origen 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 386c5e434e711ec01dd643a04282d2662f7ff312
4
- data.tar.gz: fd0058e5748471a646a0e05fa582e7212fc50613
3
+ metadata.gz: c220c4b98134c25059399a9c5f8f9719ad39a6d0
4
+ data.tar.gz: 1faed96ffe8651f6d49f8e3932a3ab17b0d28e38
5
5
  SHA512:
6
- metadata.gz: 3d43b3346743a82f2144c9d6bc9b29f4aaab1c5af84d75e2d08fea74035680fabf7e851b1a6fb91c71cdb9dbaa32ee077c3cf3f0772f9ac408d62c1e7d979ec3
7
- data.tar.gz: 399ad3393b90080cf5607d599e302de982edf1ce52340b8af4fb3f426eedca47ff45b82446bf7d1c6216cab797421254b4debda0690360d5cc09e41786d7b437
6
+ metadata.gz: '01218847dde5ecd45712e55138007b7d2157e6390445f308759be1a0d53d2adbec7167394cbd4cc34efabcf674d42c43e08695140b91b582436fe2a557a1525b'
7
+ data.tar.gz: 93747cc9c2559141f4c4d8cf3378a715a0874db7928093973eeb070c1a1354b62ddd6f15b7e91a5828794d03a1953ae8c47ea5426ef293176265040e0bcd9d8d
data/bin/origen CHANGED
@@ -61,7 +61,7 @@ if origen_root
61
61
  elsif Origen.site_config.gem_manage_bundler && (Origen.site_config.user_install_enable || Origen.site_config.tool_repo_install_dir)
62
62
  # Force everyone to have a consistent way of installing gems with bundler.
63
63
  # In this case, we aren't running from an Origen application, so build everything at Origen.home instead
64
- # Have two options here: if user_install_enable is tru, use user_install_dir. Otherwise, use the tool_repo_install_dir
64
+ # Have two options here: if user_install_enable is true, use user_install_dir. Otherwise, use the tool_repo_install_dir
65
65
  Origen.site_config.user_install_enable ? origen_root = File.expand_path(Origen.site_config.user_install_dir) : origen_root = File.expand_path(Origen.site_config.tool_repo_install_dir)
66
66
  unless Dir.exists?(origen_root)
67
67
  load File.expand_path('../../lib/origen/utility/input_capture.rb', __FILE__)
@@ -174,7 +174,11 @@ begin
174
174
  require 'origen/commands_global'
175
175
  end
176
176
  rescue Exception => e
177
- unless e.is_a?(SystemExit) && e.status == 0
177
+ # A formatted stack dump will not be printed if the application ends via 'exit 0' or 'exit 1'. In that
178
+ # case the application code is responsible for printing a helpful error message.
179
+ # This will intercept all other exits, e.g. via 'fail "Something has done wrong"', and split the stack
180
+ # dump to separate all in-application references from Origen core/plugin references.
181
+ unless e.is_a?(SystemExit)
178
182
  puts
179
183
  if Origen.app_loaded?
180
184
  puts 'COMPLETE CALL STACK'
data/config/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Origen
2
2
  MAJOR = 0
3
- MINOR = 21
3
+ MINOR = 22
4
4
  BUGFIX = 0
5
5
  DEV = nil
6
6
 
@@ -3,6 +3,7 @@ require 'fileutils'
3
3
  require 'httparty'
4
4
  require 'digest'
5
5
  require 'gems'
6
+ require 'time'
6
7
 
7
8
  include Origen::Utility::InputCapture
8
9
 
@@ -25,7 +26,7 @@ http://origen-sdk.org/origen_app_generators
25
26
  Usage: origen new [APP_NAME] [options]
26
27
  END
27
28
  opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
28
- opts.on('-v', '--version TAG', String, 'Use a specific version of Origen App Generators') { |f| options[:version] = f }
29
+ opts.on('-f', '--fetch', 'Fetch the latest versions of the app generators, otherwise happens every 24hrs') { options[:fetch] = true }
29
30
  opts.separator ''
30
31
  opts.on('-h', '--help', 'Show this message') { puts opts; exit }
31
32
  end
@@ -45,69 +46,85 @@ unless Dir["#{dir}/*"].empty?
45
46
  exit 1
46
47
  end
47
48
 
48
- version = options[:version] || begin
49
- (Gems.info 'origen_app_generators')['version']
50
- end
51
-
52
- version ||= '0.0.0'
49
+ generators_dir = "#{Origen.home}/app_generators"
50
+ update_required = false
53
51
 
54
- version.sub!(/^v/, '')
55
-
56
- if Origen.running_on_windows?
57
- tmp = 'C:/tmp/origen_app_generators'
52
+ # Update the generators every 24hrs unless specifically requested
53
+ if options[:fetch] || !File.exist?(generators_dir)
54
+ update_required = true
58
55
  else
59
- tmp = '/tmp/origen_app_generators'
60
- end
61
-
62
- tmp_dir = "#{tmp}/app_gen#{version}"
63
- lib = "#{tmp_dir}/lib"
64
- md5 = "#{tmp}/md5#{version}"
65
-
66
- # If the app generators already exists in /tmp, check that all files are still there.
67
- # This deals with the problem of some files being swept up by the tmp cleaner while
68
- # leaving the top-level folder there.
69
- if File.exist?(tmp_dir) && File.exist?(md5)
70
- old_sig = File.read(md5)
71
- hash = Digest::MD5.new
72
- Dir["#{tmp_dir}/**/{*,.*}"].each do |f|
73
- hash << File.read(f) unless File.directory?(f)
56
+ if Origen.session.app_generators[generators_dir]
57
+ if Time.now - Origen.session.app_generators[generators_dir] > 60 * 60 * 24
58
+ update_required = true
59
+ end
60
+ else
61
+ update_required = true
74
62
  end
75
- new_sig = hash.hexdigest
76
- all_present = old_sig == new_sig
77
- else
78
- all_present = false
79
63
  end
80
64
 
81
- unless all_present
82
-
83
- FileUtils.rm_rf(tmp_dir) if File.exist?(tmp_dir)
84
- FileUtils.mkdir_p(tmp) unless File.exist?(tmp)
85
-
86
- File.open("#{tmp}/app_gen#{version}.gem", 'wb') do |f|
87
- response = HTTParty.get("http://rubygems.org/downloads/origen_app_generators-#{version}.gem")
88
- if response.success?
89
- f.write response.parsed_response
90
- else
91
- puts "Sorry, could not find app generators version #{version}"
92
- exit 1
65
+ generators = [['http://rubygems.org', 'origen_app_generators']] + Array(Origen.site_config.app_generators)
66
+
67
+ if update_required
68
+ puts 'Fetching the latest app generators...'
69
+ FileUtils.rm_rf(generators_dir) if File.exist?(generators_dir)
70
+ FileUtils.mkdir(generators_dir)
71
+
72
+ Dir.chdir generators_dir do
73
+ generators.each_with_index do |gen, i|
74
+ # If a reference to a gem from a gem server
75
+ if gen.is_a?(Array)
76
+ response = HTTParty.get("#{gen[0]}/api/v1/dependencies.json?gems=#{gen[1]}")
77
+
78
+ if response.success?
79
+ latest_version = JSON.parse(response.body).map { |v| v['number'] }.max
80
+
81
+ response = HTTParty.get("#{gen[0]}/gems/#{gen[1]}-#{latest_version}.gem")
82
+ if response.success?
83
+ File.open("#{gen[1]}-#{latest_version}.gem", 'wb') do |f|
84
+ f.write response.parsed_response
85
+ end
86
+ else
87
+ puts "Sorry, could not find generator #{gen[1]} version #{latest_version}"
88
+ end
89
+
90
+ `gem unpack #{gen[1]}-#{latest_version}.gem`
91
+ FileUtils.rm_rf("#{gen[1]}-#{latest_version}.gem")
92
+ FileUtils.mv("#{gen[1]}-#{latest_version}", i.to_s)
93
+
94
+ else
95
+ puts "Failed to get generator #{gen[1]}, the response from the server was:"
96
+ puts response.body
97
+ end
98
+
99
+ # If a reference to a git repo
100
+ elsif gen.to_s =~ /\.git$/
101
+ Origen::RevisionControl.new(remote: gen, local: i.to_s).checkout(version: 'master', force: true)
102
+
103
+ # Assume a reference to a folder
104
+ else
105
+ if File.exist?(gen)
106
+ FileUtils.cp_r(gen, i.to_s)
107
+ else
108
+ puts "Failed to find generator at #{gen}"
109
+ end
110
+
111
+ end
93
112
  end
94
- end
95
113
 
96
- Dir.chdir tmp do
97
- `gem unpack app_gen#{version}.gem`
98
- `rm -f app_gen#{version}.gem`
114
+ Origen.session.app_generators[generators_dir] = Time.now
99
115
  end
100
-
101
- hash = Digest::MD5.new
102
- Dir["#{tmp_dir}/**/{*,.*}"].each do |f|
103
- hash << File.read(f) unless File.directory?(f)
104
- end
105
- File.open(md5, 'w') { |f| f.write(hash.hexdigest) }
106
116
  end
107
117
 
108
- $LOAD_PATH.unshift(lib)
118
+ generators.each_with_index do |gen, i|
119
+ lib = "#{generators_dir}/#{i}/lib"
120
+ $LOAD_PATH.unshift(lib)
121
+ end
109
122
 
110
123
  Origen.with_boot_environment do
111
124
  require 'origen_app_generators'
125
+ generators.each_with_index do |gen, i|
126
+ loader = "#{generators_dir}/#{i}/config/load_generators.rb"
127
+ require loader if File.exist?(loader)
128
+ end
112
129
  OrigenAppGenerators.invoke(dir)
113
130
  end
@@ -50,11 +50,11 @@ module Origen
50
50
  def find_val(val, options = {})
51
51
  env = "ORIGEN_#{val.upcase}"
52
52
  if ENV.key?(env)
53
- config = ENV[env]
53
+ val = ENV[env]
54
54
  if TRUE_VALUES.include?(val)
55
- config = true
55
+ return true
56
56
  elsif FALSE_VALUES.include?(val)
57
- config = false
57
+ return false
58
58
  end
59
59
  config
60
60
  else
@@ -1,3 +1,17 @@
1
+ # GENERAL SETUP
2
+
3
+ # Application generator plugins can be used to extend the available new application templates
4
+ # that are offered via the 'origen new' command.
5
+ # This allows you to offer application shells that are unique to your company or to specific
6
+ # domains within your company.
7
+ #app_generators:
8
+ # # Example of how to reference a plugin from an internal gem server (recommended)
9
+ # - ["http://gems.mycompany.net:9292", my_app_generators]
10
+ # # Alternatively a file system path to a central copy of a plugin can be used
11
+ # - "/path/to/some/central/location/my_app_generators"
12
+ # # Or a reference to a plugin's Git repository can be used
13
+ # - "http://bitbucket.mycompany.net/origen/my_app_generators.git"
14
+
1
15
  # GEM SETUP
2
16
 
3
17
  # If your company has an internal gem server enter it here
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-14 00:00:00.000000000 Z
11
+ date: 2017-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -603,7 +603,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
603
603
  version: 1.8.11
604
604
  requirements: []
605
605
  rubyforge_project:
606
- rubygems_version: 2.6.7
606
+ rubygems_version: 2.5.2
607
607
  signing_key:
608
608
  specification_version: 4
609
609
  summary: The Semiconductor Developer's Kit