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 +4 -4
- data/bin/origen +6 -2
- data/config/version.rb +1 -1
- data/lib/origen/commands/new.rb +69 -52
- data/lib/origen/site_config.rb +3 -3
- data/origen_site_config.yml +14 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c220c4b98134c25059399a9c5f8f9719ad39a6d0
|
4
|
+
data.tar.gz: 1faed96ffe8651f6d49f8e3932a3ab17b0d28e38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
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
data/lib/origen/commands/new.rb
CHANGED
@@ -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('-
|
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
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
version ||= '0.0.0'
|
49
|
+
generators_dir = "#{Origen.home}/app_generators"
|
50
|
+
update_required = false
|
53
51
|
|
54
|
-
|
55
|
-
|
56
|
-
|
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
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
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
|
-
|
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
|
-
|
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
|
data/lib/origen/site_config.rb
CHANGED
@@ -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
|
-
|
53
|
+
val = ENV[env]
|
54
54
|
if TRUE_VALUES.include?(val)
|
55
|
-
|
55
|
+
return true
|
56
56
|
elsif FALSE_VALUES.include?(val)
|
57
|
-
|
57
|
+
return false
|
58
58
|
end
|
59
59
|
config
|
60
60
|
else
|
data/origen_site_config.yml
CHANGED
@@ -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.
|
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-
|
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.
|
606
|
+
rubygems_version: 2.5.2
|
607
607
|
signing_key:
|
608
608
|
specification_version: 4
|
609
609
|
summary: The Semiconductor Developer's Kit
|