origen_app_generators 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/version.rb +2 -2
- data/lib/origen_app_generators/base.rb +29 -8
- data/lib/origen_app_generators/new.rb +1 -1
- data/lib/origen_app_generators/origen_infrastructure/app_generator_plugin.rb +7 -1
- data/templates/app_generators/application/dot_keep +0 -0
- data/templates/app_generators/new/generator.rb +2 -0
- data/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/application.rb +4 -0
- data/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/base.rb +53 -0
- data/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/module.rb +1 -0
- data/templates/app_generators/origen_infrastructure/app_generator_plugin/lib/plugin.rb +5 -1
- data/templates/app_generators/plugin/Gemfile +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52ed0cc091ddc22553ff9ef23b89d32a583f5dad
|
4
|
+
data.tar.gz: 15d517d2d9057b35ce8b10ced794abc241de6332
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30fb76df25db734b690c4669a79b6bd124e454d97b909daf48fa6811cc7d90800971b4310a8bed202d3d060ffc145eec5bf311c052926815e287c15c8a19814f
|
7
|
+
data.tar.gz: 35c4fed01e48500f0823a62c29387cdd429b0f9261a68c24829c16f0566853c601a39203580d19b7220a21e7c0a1a36cd04168b7e259e3a921aebf2c213b1a15
|
data/config/version.rb
CHANGED
@@ -14,15 +14,22 @@ module OrigenAppGenerators
|
|
14
14
|
klass = self.class
|
15
15
|
|
16
16
|
until klass == OrigenAppGenerators::Base
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
if template_dir = OrigenAppGenerators.template_dirs[klass]
|
18
|
+
dir = []
|
19
|
+
last_class = nil
|
20
|
+
until klass.to_s =~ /^OrigenAppGenerators/
|
21
|
+
dir << "#{template_dir}/#{class_dir(klass)}"
|
22
|
+
last_class = klass
|
23
|
+
klass = klass.superclass
|
24
|
+
end
|
25
|
+
dir << "#{template_dir}/base"
|
26
|
+
klass = last_class
|
22
27
|
else
|
23
|
-
dir =
|
28
|
+
dir = "#{Origen.root!}/templates/app_generators/#{class_dir(klass)}"
|
29
|
+
end
|
30
|
+
Array(dir).each do |dir|
|
31
|
+
self.class.source_paths << dir if File.exist?(dir) && !self.class.source_paths.include?(dir)
|
24
32
|
end
|
25
|
-
self.class.source_paths << dir if File.exist?(dir) && !self.class.source_paths.include?(dir)
|
26
33
|
klass = klass.superclass
|
27
34
|
end
|
28
35
|
end
|
@@ -42,6 +49,16 @@ module OrigenAppGenerators
|
|
42
49
|
|
43
50
|
protected
|
44
51
|
|
52
|
+
def class_dir(klass)
|
53
|
+
names = klass.to_s.split('::')
|
54
|
+
names.shift
|
55
|
+
names.map(&:underscore).join('/')
|
56
|
+
end
|
57
|
+
|
58
|
+
# def application_class?(klass)
|
59
|
+
# until klass == OrigenAppGenerators::Base
|
60
|
+
# end
|
61
|
+
|
45
62
|
def debugger
|
46
63
|
require 'byebug'
|
47
64
|
byebug # rubocop:disable Lint/Debugger
|
@@ -74,7 +91,11 @@ module OrigenAppGenerators
|
|
74
91
|
create_link file[:dest], file[:source]
|
75
92
|
end
|
76
93
|
elsif file[:type] == :dir || file[:type] == :directory
|
77
|
-
|
94
|
+
if file[:nokeep]
|
95
|
+
empty_directory(file[:dest] || file[:source])
|
96
|
+
else
|
97
|
+
copy_file('dot_keep', "#{file[:dest]}/.keep")
|
98
|
+
end
|
78
99
|
else
|
79
100
|
dest = file[:dest] || file[:source]
|
80
101
|
if file[:copy] || dest =~ /.erb$/
|
@@ -62,7 +62,7 @@ module OrigenAppGenerators
|
|
62
62
|
inputs += " ['#{first}', '#{second}', :default, :default, :default]"
|
63
63
|
end
|
64
64
|
inputs = ",#{inputs}" unless test_inputs.empty?
|
65
|
-
end_of_test_inputs = /\n\s
|
65
|
+
end_of_test_inputs = /\n\s*\]\s*#\s*END_OF_TEST_INPUTS/
|
66
66
|
inject_into_file "lib/#{Origen.app.name}.rb", inputs, before: end_of_test_inputs
|
67
67
|
end
|
68
68
|
|
@@ -79,17 +79,23 @@ module OrigenAppGenerators
|
|
79
79
|
# list.delete(:web_doc_layout)
|
80
80
|
list.delete(:lib_readme)
|
81
81
|
list.delete(:lib_readme_dev)
|
82
|
+
list.delete(:templates_shared)
|
82
83
|
# Example of how to add a file, in this case the file will be compiled and copied to
|
83
84
|
# the same location in the new app
|
84
85
|
# list[:config_shared_commands] = { source: 'config/shared_commands.rb' }
|
85
86
|
list[:config_load_generators] = { source: 'config/load_generators.rb' }
|
87
|
+
list[:lib_base] = { source: 'lib/base.rb', dest: "lib/#{@name}/base.rb" }
|
86
88
|
list[:lib_plugin] = { source: 'lib/plugin.rb', dest: "lib/#{@name}/plugin.rb" }
|
87
89
|
list[:lib_application] = { source: 'lib/application.rb', dest: "lib/#{@name}/application.rb" }
|
88
90
|
# Alternatively specifying a different destination, typically you would do this when
|
89
91
|
# the final location is dynamic
|
90
92
|
# list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
|
91
93
|
# Example of how to create a directory
|
92
|
-
|
94
|
+
list[:templates_app] = { dest: 'templates/app_generators/application', type: :directory }
|
95
|
+
list[:templates_plugin] = { dest: 'templates/app_generators/plugin', type: :directory }
|
96
|
+
list[:templates_base] = { dest: 'templates/app_generators/base', type: :directory }
|
97
|
+
# By default, directories created in this way will contain a .keep file, to inhibit this:
|
98
|
+
# list[:pattern_dir] = { dest: "pattern", type: :directory, nokeep: true }
|
93
99
|
# Example of how to create a symlink
|
94
100
|
# list[:target_default] = { source: 'debug.rb', # Relative to the file being linked to
|
95
101
|
# dest: 'target/default.rb', # Relative to destination_root
|
File without changes
|
@@ -86,6 +86,8 @@ module <%= @namespace %>
|
|
86
86
|
# list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
|
87
87
|
# Example of how to create a directory
|
88
88
|
# list[:pattern_dir] = { dest: "pattern", type: :directory }
|
89
|
+
# By default, directories created in this way will contain a .keep file, to inhibit this:
|
90
|
+
# list[:pattern_dir] = { dest: "pattern", type: :directory, nokeep: true }
|
89
91
|
# Example of how to create a symlink
|
90
92
|
# list[:target_default] = { source: 'debug.rb', # Relative to the file being linked to
|
91
93
|
# dest: 'target/default.rb', # Relative to destination_root
|
@@ -2,6 +2,8 @@ module <%= @namespace %>
|
|
2
2
|
# This will be the parent class of all of your application generators, it provides a place
|
3
3
|
# to add anything that you want to be added to all of your applications
|
4
4
|
class Application < OrigenAppGenerators::Application
|
5
|
+
include Base
|
6
|
+
|
5
7
|
# Any methods added above the protected line will get automatically invoked
|
6
8
|
# at the start of *all* of your application generators.
|
7
9
|
|
@@ -36,6 +38,8 @@ module <%= @namespace %>
|
|
36
38
|
# list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
|
37
39
|
# Example of how to create a directory
|
38
40
|
# list[:pattern_dir] = { dest: "pattern", type: :directory }
|
41
|
+
# By default, directories created in this way will contain a .keep file, to inhibit this:
|
42
|
+
# list[:pattern_dir] = { dest: "pattern", type: :directory, nokeep: true }
|
39
43
|
# Example of how to create a symlink
|
40
44
|
# list[:target_default] = { source: 'debug.rb', # Relative to the file being linked to
|
41
45
|
# dest: 'target/default.rb', # Relative to destination_root
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module <%= @namespace %>
|
2
|
+
# This is a mixin that is included in both the application and plugin
|
3
|
+
# generators, it provides a place to add things that should apply to
|
4
|
+
# all of your applications and plugins
|
5
|
+
module Base
|
6
|
+
# Any helper methods added to this base module will not be automatically invoked,
|
7
|
+
# you must call them from either the top-level application or plugin generators,
|
8
|
+
# or from a child generator.
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
# Here you can modify the default list of files that are included in all of your
|
13
|
+
# applications AND plugins.
|
14
|
+
#
|
15
|
+
# See here for the default list of files:
|
16
|
+
# https://github.com/Origen-SDK/origen_app_generators/blob/master/lib/origen_app_generators/application.rb
|
17
|
+
# If the child generator is a plugin, then this list is then modified by the base plugin generator which
|
18
|
+
# you can see here:
|
19
|
+
# https://github.com/Origen-SDK/origen_app_generators/blob/master/lib/origen_app_generators/plugin.rb
|
20
|
+
#
|
21
|
+
# The filelist can contain references to generate files, directories or symlinks in the
|
22
|
+
# new application.
|
23
|
+
#
|
24
|
+
# To make your generators more maintainable, try and re-use as much as possible
|
25
|
+
# from the parent generators, this means that your generator will automatically stay up
|
26
|
+
# to date with the latest conventions.
|
27
|
+
#
|
28
|
+
# Additional files can be added or removed from the filelist as shown below.
|
29
|
+
def filelist
|
30
|
+
@filelist ||= begin
|
31
|
+
list = super # Always pick up the parent list
|
32
|
+
# Example of how to remove a file from the parent list
|
33
|
+
# list.delete(:web_doc_layout)
|
34
|
+
# Example of how to add a file, in this case the file will be compiled and copied to
|
35
|
+
# the same location in the new app
|
36
|
+
# list[:config_shared_commands] = { source: 'config/shared_commands.rb' }
|
37
|
+
# Alternatively specifying a different destination, typically you would do this when
|
38
|
+
# the final location is dynamic
|
39
|
+
# list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
|
40
|
+
# Example of how to create a directory
|
41
|
+
# list[:pattern_dir] = { dest: "pattern", type: :directory }
|
42
|
+
# By default, directories created in this way will contain a .keep file, to inhibit this:
|
43
|
+
# list[:pattern_dir] = { dest: "pattern", type: :directory, nokeep: true }
|
44
|
+
# Example of how to create a symlink
|
45
|
+
# list[:target_default] = { source: 'debug.rb', # Relative to the file being linked to
|
46
|
+
# dest: 'target/default.rb', # Relative to destination_root
|
47
|
+
# type: :symlink }
|
48
|
+
# Remember to return the final list
|
49
|
+
list
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -2,6 +2,8 @@ module <%= @namespace %>
|
|
2
2
|
# This will be the parent class of all of your plugin generators, it provides a place
|
3
3
|
# to add anything that you want to be added to all of your plugins
|
4
4
|
class Plugin < OrigenAppGenerators::Plugin
|
5
|
+
include Base
|
6
|
+
|
5
7
|
def initialize(*args)
|
6
8
|
# This makes all of your plugins be configured for internal distribution, i.e. rather
|
7
9
|
# than via rubygems.org
|
@@ -19,7 +21,7 @@ module <%= @namespace %>
|
|
19
21
|
|
20
22
|
# Here you can modify the default list of files that are included in all of your plugins.
|
21
23
|
#
|
22
|
-
# Since this is a plugin
|
24
|
+
# Since this is a plugin generator, the default list of files comprises the application list,
|
23
25
|
# which you can see here:
|
24
26
|
# https://github.com/Origen-SDK/origen_app_generators/blob/master/lib/origen_app_generators/application.rb
|
25
27
|
# And this is then modified by the base plugin generator which you can see here:
|
@@ -46,6 +48,8 @@ module <%= @namespace %>
|
|
46
48
|
# list[:gemspec] = { source: 'gemspec.rb', dest: "#{@name}.gemspec" }
|
47
49
|
# Example of how to create a directory
|
48
50
|
# list[:pattern_dir] = { dest: "pattern", type: :directory }
|
51
|
+
# By default, directories created in this way will contain a .keep file, to inhibit this:
|
52
|
+
# list[:pattern_dir] = { dest: "pattern", type: :directory, nokeep: true }
|
49
53
|
# Example of how to create a symlink
|
50
54
|
# list[:target_default] = { source: 'debug.rb', # Relative to the file being linked to
|
51
55
|
# dest: 'target/default.rb', # Relative to destination_root
|
@@ -10,7 +10,7 @@ source '<%= Origen.site_config.gem_server %>'
|
|
10
10
|
# your application's test coverage
|
11
11
|
gem 'coveralls', require: false
|
12
12
|
<% end -%>
|
13
|
-
gem 'byebug'
|
13
|
+
gem 'byebug', '<9.1.0' # This version restriction required if you need Ruby < 2.2, otherwise you can remove it
|
14
14
|
gem 'ripper-tags'
|
15
15
|
gem 'origen_doc_helpers'
|
16
16
|
gem 'origen_updater'
|
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
|
4
|
+
version: 1.1.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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: origen
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.23.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.23.0
|
27
27
|
description:
|
28
28
|
email:
|
29
29
|
- stephen.f.mcginty@gmail.com
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- templates/app_generators/application/config/maillist_prod.txt
|
65
65
|
- templates/app_generators/application/config/version.rb
|
66
66
|
- templates/app_generators/application/doc/history
|
67
|
+
- templates/app_generators/application/dot_keep
|
67
68
|
- templates/app_generators/application/lib/app.rake
|
68
69
|
- templates/app_generators/application/lib/module.rb
|
69
70
|
- templates/app_generators/application/lib/top_level.rb
|
@@ -80,6 +81,7 @@ files:
|
|
80
81
|
- templates/app_generators/new/info.md.erb
|
81
82
|
- templates/app_generators/origen_infrastructure/app_generator_plugin/config/load_generators.rb
|
82
83
|
- templates/app_generators/origen_infrastructure/app_generator_plugin/lib/application.rb
|
84
|
+
- templates/app_generators/origen_infrastructure/app_generator_plugin/lib/base.rb
|
83
85
|
- templates/app_generators/origen_infrastructure/app_generator_plugin/lib/module.rb
|
84
86
|
- templates/app_generators/origen_infrastructure/app_generator_plugin/lib/plugin.rb
|
85
87
|
- templates/app_generators/plugin/Gemfile
|
@@ -133,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
135
|
version: 1.8.11
|
134
136
|
requirements: []
|
135
137
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.
|
138
|
+
rubygems_version: 2.6.7
|
137
139
|
signing_key:
|
138
140
|
specification_version: 4
|
139
141
|
summary: Origen application generators
|