ronin-gen 1.0.0.rc2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +1 -1
- data/gemspec.yml +2 -2
- data/lib/ronin/gen/gen.rb +15 -8
- data/lib/ronin/gen/generator.rb +1 -1
- data/lib/ronin/gen/generators/library.rb +9 -0
- data/lib/ronin/gen/version.rb +1 -1
- data/lib/ronin/ui/cli/commands/gen.rb +2 -2
- metadata +10 -10
data/ChangeLog.md
CHANGED
data/gemspec.yml
CHANGED
data/lib/ronin/gen/gen.rb
CHANGED
@@ -21,8 +21,13 @@ require 'ronin/gen/exceptions/unknown_generator'
|
|
21
21
|
require 'ronin/gen/generators'
|
22
22
|
require 'ronin/installation'
|
23
23
|
|
24
|
+
require 'set'
|
25
|
+
|
24
26
|
module Ronin
|
25
27
|
module Gen
|
28
|
+
# The loaded generator names
|
29
|
+
@generators = SortedSet[]
|
30
|
+
|
26
31
|
#
|
27
32
|
# Loads the generator with the given name.
|
28
33
|
#
|
@@ -48,9 +53,8 @@ module Ronin
|
|
48
53
|
#
|
49
54
|
def Gen.generator(name)
|
50
55
|
name = name.to_s
|
51
|
-
path = name.gsub(/[_-]+/,'_').gsub(/:+/,File::SEPARATOR)
|
52
56
|
|
53
|
-
unless (generator = Generators.require_const(
|
57
|
+
unless (generator = Generators.require_const(name))
|
54
58
|
raise(UnknownGenerator,"unknown generator #{name.dump}")
|
55
59
|
end
|
56
60
|
|
@@ -66,19 +70,22 @@ module Ronin
|
|
66
70
|
# @since 0.3.0
|
67
71
|
#
|
68
72
|
def Gen.generators
|
69
|
-
|
73
|
+
if @generators.empty?
|
70
74
|
directory = File.join('lib',Generators.namespace_root)
|
71
75
|
|
72
|
-
|
76
|
+
Installation.each_file_in(directory,:rb) do |path|
|
77
|
+
# strip the tailing '.rb' file extension
|
78
|
+
name = path.chomp('.rb')
|
73
79
|
|
74
|
-
|
75
|
-
|
80
|
+
# replace any file separators with a ':', to mimic the
|
81
|
+
# naming convention of Rake/Thor.
|
82
|
+
name.tr!(File::SEPARATOR,':')
|
76
83
|
|
77
|
-
|
84
|
+
@generators << name
|
78
85
|
end
|
79
86
|
end
|
80
87
|
|
81
|
-
return
|
88
|
+
return @generators
|
82
89
|
end
|
83
90
|
end
|
84
91
|
end
|
data/lib/ronin/gen/generator.rb
CHANGED
@@ -103,7 +103,7 @@ module Ronin
|
|
103
103
|
#
|
104
104
|
def self.inherited(super_class)
|
105
105
|
class_name = super_class.name.sub('Ronin::Gen::Generators::','')
|
106
|
-
gen_name = class_name.
|
106
|
+
gen_name = Support::Inflector.underscore(class_name.gsub('::',':'))
|
107
107
|
|
108
108
|
super_class.namespace(gen_name)
|
109
109
|
end
|
data/lib/ronin/gen/version.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ronin-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
version: 1.0.0
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Postmodern
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-25 00:00:00 -04:00
|
14
14
|
default_executable: ronin-gen
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -29,12 +29,12 @@ dependencies:
|
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: "0.2"
|
35
32
|
- - ">="
|
36
33
|
- !ruby/object:Gem::Version
|
37
34
|
version: 0.2.1
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: "0.2"
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: *id002
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - ~>
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.1.0
|
59
|
+
version: 0.1.0
|
60
60
|
type: :runtime
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: *id004
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
requirements:
|
68
68
|
- - ~>
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version: 1.0.0
|
70
|
+
version: 1.0.0
|
71
71
|
type: :runtime
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: *id005
|
@@ -193,12 +193,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
requirements:
|
194
194
|
- git >= 1.6.0.0, for the library generator
|
195
195
|
rubyforge_project: ronin-gen
|
196
|
-
rubygems_version: 1.
|
196
|
+
rubygems_version: 1.6.2
|
197
197
|
signing_key:
|
198
198
|
specification_version: 3
|
199
199
|
summary: A Ruby library for Ronin that provides various generators.
|
200
200
|
test_files:
|
201
|
+
- spec/gen/generator_spec.rb
|
201
202
|
- spec/gen/gen_spec.rb
|
202
203
|
- spec/gen/generators/library_spec.rb
|
203
204
|
- spec/gen/generators/repository_spec.rb
|
204
|
-
- spec/gen/generator_spec.rb
|