origen_app_generators 1.0.0 → 1.0.1

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: 6bd751932ba648a39c5f1b2d8cd61d1cc224d739
4
- data.tar.gz: a71ffc595f1da44df412126be1bcaf68e5f369e7
3
+ metadata.gz: efe3f54f85b5eb4fbf72aa62d4735d1b3eb91a0d
4
+ data.tar.gz: a7ac8e0632d178b7549e39fdb1c2b7da8c9a0bd5
5
5
  SHA512:
6
- metadata.gz: 3990cdbb27929fb3fe39665776ddd6ad2d559ff8ba65c158e9761fe47aa8f004b1bd9ba8142a8721d4103c4e4e6c0f492ed23671a3cd105e5ae03d479160699b
7
- data.tar.gz: 442e825f3e580a2edb99c5c32584f69c6665fc5db5015812ed5ece72bf7353ce7a10576554ecb6fef7c8f6f5440ac4402ce0d36b3f46024d07cf018b4b9db3e5
6
+ metadata.gz: b5234f29caa0c4f6611ec22b79cfa3cca7714104b6487ae22f0fa8dc222349c992238df591856d630c1d984e5f80d7e2579d1dd59900c830720dd974be0929ae
7
+ data.tar.gz: f26c931c0aec81bdc5f8125db023736e105e37eb5f21d70352b2022aa30a58ea23f36b302d938a1f15d8f22d231e85c58764e22fce31c8303dde9286d4e53f20
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module OrigenAppGenerators
2
2
  MAJOR = 1
3
3
  MINOR = 0
4
- BUGFIX = 0
4
+ BUGFIX = 1
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -43,8 +43,9 @@ module OrigenAppGenerators
43
43
  }
44
44
 
45
45
  # @api private
46
- def self.add_generators(new_generators)
46
+ def self.add_generators(new_generators, options = {})
47
47
  new_generators.each do |domain, gens|
48
+ gens.each { |gen| template_dirs[gen] ||= options[:template_dir] if options[:template_dir] }
48
49
  if generators[domain]
49
50
  gens.each { |g| generators[domain].unshift(g) }
50
51
  new_generators.delete(domain)
@@ -63,6 +64,11 @@ module OrigenAppGenerators
63
64
  @generators ||= AVAILABLE
64
65
  end
65
66
 
67
+ # @api private
68
+ def self.template_dirs
69
+ @template_dirs ||= {}
70
+ end
71
+
66
72
  # @api private
67
73
  def self.invoke(path)
68
74
  puts
@@ -12,10 +12,17 @@ module OrigenAppGenerators
12
12
  # So to keep things sane remove any inherited source paths.
13
13
  self.class.source_paths.pop until self.class.source_paths.empty?
14
14
  klass = self.class
15
+
15
16
  until klass == OrigenAppGenerators::Base
16
- dir = klass.to_s.sub('OrigenAppGenerators::', '').split('::').map(&:underscore).join('/')
17
- dir = File.expand_path("../../../templates/app_generators/#{dir}", __FILE__)
18
- self.class.source_paths << dir if File.exist?(dir)
17
+ names = klass.to_s.split('::')
18
+ names.shift
19
+ dir = names.map(&:underscore).join('/')
20
+ if OrigenAppGenerators.template_dirs[klass]
21
+ dir = File.expand_path("#{OrigenAppGenerators.template_dirs[klass]}/#{dir}", __FILE__)
22
+ else
23
+ dir = File.expand_path("#{Origen.root!}/templates/app_generators/#{dir}", __FILE__)
24
+ end
25
+ self.class.source_paths << dir if File.exist?(dir) && !self.class.source_paths.include?(dir)
19
26
  klass = klass.superclass
20
27
  end
21
28
  end
@@ -136,7 +136,14 @@ module OrigenAppGenerators
136
136
  puts "Enter something like 'Test Engineering', 'Design', etc."
137
137
  puts
138
138
  domain = get_text(single: true)
139
- domain = domain.titleize
139
+ domain = domain.split(' ').map do |word|
140
+ # Ensure all first letters capitalized, but make sure something like
141
+ # 'NVM' remains 'NVM' and not 'Nvm'
142
+ letters = word.split('')
143
+ letters.first.upcase!
144
+ letters.join
145
+ end.join(' ')
146
+
140
147
  @domain_summary = domain
141
148
  @domain_namespace = @domain_summary.gsub(' ', '')
142
149
  end
@@ -1,7 +1,6 @@
1
1
  # This file is used to hook the generators defined in this plugin into the
2
2
  # 'origen new' command, it must not be removed or modified
3
-
4
3
  require 'origen_app_generators'
5
4
  require "<%= @name %>"
6
-
7
- OrigenAppGenerators.add_generators(<%= @namespace %>::AVAILABLE)
5
+ template_dir = File.expand_path('../../templates/app_generators', __FILE__)
6
+ OrigenAppGenerators.add_generators(<%= @namespace %>::AVAILABLE, template_dir: template_dir)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_app_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
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-17 00:00:00.000000000 Z
11
+ date: 2017-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen