Top Level Namespace

Defined Under Namespace

Modules: Enumerable, Origen Classes: Array, Bignum, Fixnum, Hash, Integer, Module, Numeric, Object, OptionParser, OrigenBootError, OrigenGlobalApplication, Range, Regexp, String, Symbol

Constant Summary collapse

ORIGEN_COMMAND_ALIASES =
{
  'g'         => 'generate',
  'p'         => 'program',
  't'         => 'target',
  '-t'        => 'target', # For legacy reasons
  'e'         => 'environment',
  '-e'        => 'environment',
  'l'         => 'lsf',
  'i'         => 'interactive',
  'c'         => 'compile',
  'pl'        => 'plugin',
  '-v'        => 'version',
  '--version' => 'version',
  '-version'  => 'version',
  'm'         => 'mode'
}
QUIET_ATTRS =
%w(
  files test_files signing_key licenses rdoc_options
  autorequire cert_chain post_install_message
)
PatSeq =
Origen::Generator::PatternSequencer

Constants included from Origen::GlobalMethods

Origen::GlobalMethods::Flow, Origen::GlobalMethods::Pattern, Origen::GlobalMethods::Resources, Origen::GlobalMethods::User

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Origen::Utility::InputCapture

#find_space, #get_text, #split_long_line

Methods included from Origen::GlobalMethods

#annotate, #c1, #c2, #dut, #global_binding, #options, #pp, #render, #snip, #ss, #tester, #undefined

Class Method Details

._application_gemfileObject

[View source]

71
72
73
# File 'lib/origen/commands/plugin.rb', line 71

def self._application_gemfile
  "#{Origen.app.root}/Gemfile"
end

._gem_basename(gem) ⇒ Object

[View source]

79
80
81
# File 'lib/origen/commands/plugin.rb', line 79

def self._gem_basename(gem)
  "#{Pathname(gem[:location]).basename}"
end

._gem_rc_version(gem) ⇒ Object

[View source]

83
84
85
# File 'lib/origen/commands/plugin.rb', line 83

def self._gem_rc_version(gem)
  gem[:version]
end

._local_gemsObject

[View source]

50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/origen/commands/plugin.rb', line 50

def self._local_gems
  gems = {}
  Gem::Specification.sort_by { |g| [g.name.downcase, g.version] }.group_by(&:name).map do |name, specs|
    gems[name.to_sym] = {
      name:     name,
      version:  specs.map(&:version).join(','),
      location: specs.map(&:full_gem_path).join(','),
      authors:  specs.map(&:authors).join(',')
    }
  end
  gems
end

._local_gems_origObject

[View source]

63
64
65
# File 'lib/origen/commands/plugin.rb', line 63

def self._local_gems_orig
  Gem::Specification.sort_by { |g| [g.name.downcase, g.version] }.group_by(&:name)
end

._local_path_to_gem(gem) ⇒ Object

[View source]

75
76
77
# File 'lib/origen/commands/plugin.rb', line 75

def self._local_path_to_gem(gem)
  "#{_session_gem_path}/#{Pathname(gem[:location]).basename}"
end

._session_gem_pathObject

[View source]

67
68
69
# File 'lib/origen/commands/plugin.rb', line 67

def self._session_gem_path
  "#{Origen.app.root}/tmp/gems"
end

._update_gemfileObject

[View source]

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/origen/commands/plugin.rb', line 87

def self._update_gemfile
  content = File.read(_application_gemfile)

  search_regexp = "# ORIGEN PLUGIN AUTO-GENERATED.*# /ORIGEN PLUGIN AUTO-GENERATED.*?\n"

  if Origen.app.session.gems.keys.empty?
    new_contents = content.gsub(/#{search_regexp}/m, '')
  else
    replacement_string = "# ORIGEN PLUGIN AUTO-GENERATED---------------DO NOT REMOVE THIS LINE-------------\n"
    replacement_string += "# -- DO NOT CHECK IN WITH THIS SECTION!\n"
    replacement_string += "# -- DO NOT HAND MODIFY!\n"
    replacement_string += "# -- USE 'origen pl clean all' to reset\n"
    replacement_string += "\n"

    Origen.app.session.gems.keys.sort.each do |g|
      replacement_string += "gem '#{g}', path: '#{Origen.app.session.gems[g.to_sym]}'\n"
      replacement_string += "puts \"\\e[1;93;40mWARNING: Using session gem for '#{g}'\\e[0m\"\n"
    end

    replacement_string += "def gem(*args)\n"
    replacement_string += "  return if [#{Origen.app.session.gems.keys.sort.map { |e| "'" + e.to_s + "'" }.join(',')}].include? args[0]\n"
    replacement_string += "  super(*args)\n"
    replacement_string += "end\n"
    replacement_string += "#\n"
    replacement_string += "# /ORIGEN PLUGIN AUTO-GENERATED---------------DO NOT REMOVE THIS LINE------------\n"

    if content =~ /#{search_regexp}/m
      new_contents = content.gsub(/#{search_regexp}/m, replacement_string)
    else
      new_contents = replacement_string + content
    end
  end
  File.open(_application_gemfile, 'w') { |file| file.puts new_contents }
end

._with_doc_tester(options) ⇒ Object

[View source]

44
45
46
47
48
49
50
51
52
# File 'lib/origen/commands/program.rb', line 44

def self._with_doc_tester(options)
  if options[:doc]
    Origen.app.with_doc_tester do
      yield
    end
  else
    yield
  end
end

Instance Method Details

#_unmanaged_dirsObject

[View source]

22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/origen/commands/rc.rb', line 22

def _unmanaged_dirs
  # List of unmanaged files and directories for an Origen workspace
  unmanaged_dirs = Origen::RevisionControl::IGNORE_DIRS
  unmanaged_dirs += config.unmanaged_dirs || []

  # If the given dirs are not full paths then prefix with Origen.root
  unmanaged_dirs.map do |d|
    if Pathname.new(d).absolute?
      d
    else
      "#{Origen.root}/#{d}"
    end
  end
end

#_unmanaged_filesObject

[View source]

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/origen/commands/rc.rb', line 6

def _unmanaged_files
  unmanaged_files = Origen::RevisionControl::IGNORE_FILES
  unmanaged_files += config.unmanaged_files || []
  # unmanaged_files += Origen.import_manager.all_symlinks || []

  # If the given files are not full paths then prefix with Origen.root, unless they
  # are wildcards
  unmanaged_files.map do |f|
    if f =~ /\*/ || Pathname.new(f).absolute?
      f
    else
      "#{Origen.root}/#{f}"
    end
  end
end

#debuggerObject

[View source]

135
136
137
138
# File 'lib/origen/commands.rb', line 135

def debugger
  caller[0] =~ /.*\/(\w+\.rb):(\d+).*/
  puts "#{Regexp.last_match[1]}:#{Regexp.last_match[2]} - debugger statement ignored, run again with '-d' to enable it"
end

#min_ruby_versionObject

[View source]

7
8
9
10
11
12
13
# File 'lib/origen/ruby_version_check.rb', line 7

def min_ruby_version
  if Origen.os.windows?
    '1.9.3'
  else
    '2.1.0'
  end
end

#require_type_or_id(options) ⇒ Object

[View source]

6
7
8
9
10
11
# File 'lib/origen/commands/lsf.rb', line 6

def require_type_or_id(options)
  unless options[:id] || options[:type]
    puts 'You must supply a job type or ID'
    exit 1
  end
end

#ruby_acceptable_to_run?Boolean

Returns:

  • (Boolean)
[View source]

3
4
5
# File 'lib/origen/ruby_version_check.rb', line 3

def ruby_acceptable_to_run?
  RUBY_VERSION >= min_ruby_version
end

#use_packaged_generatorsObject

[View source]

67
68
69
70
71
# File 'lib/origen/commands/new.rb', line 67

def use_packaged_generators
  puts "Using origen_app_generators that was packaged with Origen #{Origen.version}"
  FileUtils.cp_r Origen.top.join('origen_app_generators').to_s, '.'
  FileUtils.mv 'origen_app_generators', '0'
end

#workspace_dirsObject

[View source]

37
38
39
# File 'lib/origen/commands/rc.rb', line 37

def workspace_dirs
  "#{Origen.root} " + Origen.app.config.external_app_dirs.join(' ')
end