ronin-gen 1.1.1 → 1.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,7 +53,7 @@ module Ronin
53
53
  :default => 'Author'
54
54
 
55
55
  parameter :email, :type => String,
56
- :default => 'name@host.com'
56
+ :default => 'name@example.com'
57
57
 
58
58
  parameter :homepage, :type => String,
59
59
  :default => 'http://ronin-ruby.github.com/'
@@ -50,7 +50,7 @@ module Ronin
50
50
  parameter :website, :type => String
51
51
 
52
52
  parameter :license, :type => String,
53
- :default => 'CC-by'
53
+ :default => 'MIT'
54
54
 
55
55
  parameter :description, :type => String,
56
56
  :default => 'This is a Ronin Repository'
@@ -74,6 +74,8 @@ module Ronin
74
74
  # Sets up the repository generator.
75
75
  #
76
76
  def setup
77
+ super
78
+
77
79
  @title ||= File.basename(@path).gsub(/[_\s]+/,' ').capitalize
78
80
  @website ||= @source
79
81
 
@@ -20,6 +20,6 @@
20
20
  module Ronin
21
21
  module Gen
22
22
  # Ronin Gen version
23
- VERSION = '1.1.1'
23
+ VERSION = '1.2.0.rc1'
24
24
  end
25
25
  end
@@ -0,0 +1,2 @@
1
+ require 'ronin/spec/ui/output'
2
+ require 'ronin/spec/gen/source_code_generator'
@@ -0,0 +1,22 @@
1
+ #
2
+ # Copyright (c) 2009-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
3
+ #
4
+ # This file is part of Ronin Gen.
5
+ #
6
+ # Ronin Gen is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Ronin Gen is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Ronin Gen. If not, see <http://www.gnu.org/licenses/>.
18
+ #
19
+
20
+ require 'ronin/gen/source_code_generator'
21
+
22
+ Ronin::Gen::SourceCodeGenerator.edit = false
@@ -18,6 +18,8 @@
18
18
  #
19
19
 
20
20
  require 'ronin/ui/cli/command'
21
+ require 'ronin/gen/file_generator'
22
+ require 'ronin/gen/dir_generator'
21
23
  require 'ronin/gen/gen'
22
24
  require 'ronin/gen/version'
23
25
 
@@ -28,18 +30,41 @@ module Ronin
28
30
  module CLI
29
31
  module Commands
30
32
  #
31
- # The `ronin-gen` command.
33
+ # Runs or lists available generators.
34
+ #
35
+ # ## Usage
36
+ #
37
+ # ronin-gen [[options] | GENERATOR [generator-options]]
38
+ #
39
+ # ## Options
40
+ #
41
+ # -v, --[no-]verbose Enable verbose output.
42
+ # -q, --[no-]quiet Disable verbose output.
43
+ # --[no-]silent Silence all output.
44
+ # --[no-]color Enables color output.
45
+ # Default: true
46
+ # -V, --[no-]version Prints the ronin-gen version.
47
+ #
48
+ # ## Examples
49
+ #
50
+ # ronin-gen repository myrepo --git
51
+ # ronin-gen library ronin-pwn
32
52
  #
33
53
  class Gen < Command
34
54
 
35
- summary "Prints the list of available generators"
55
+ summary "Runs or lists available generators"
36
56
 
37
- usage '[options] | GENERATOR [generator-options]'
57
+ usage '[[options] | GENERATOR [generator-options]]'
38
58
 
39
59
  option :version, :type => true,
40
60
  :flag => '-V',
41
61
  :description => 'Prints the ronin-gen version'
42
62
 
63
+ examples [
64
+ "ronin-gen repository myrepo --git",
65
+ "ronin-gen library ronin-pwn"
66
+ ]
67
+
43
68
  #
44
69
  # Starts the `ronin-gen` command.
45
70
  #
@@ -51,17 +76,41 @@ module Ronin
51
76
  return super(argv)
52
77
  end
53
78
 
54
- generator_name = argv.shift
55
- generator = Ronin::Gen.generator(generator_name).new
79
+ generator_name = argv.shift
80
+ generator = Ronin::Gen.generator(generator_name).new
56
81
 
57
- opts = Parameters::Options.parser(generator) do |opts|
58
- opts.banner = "ronin-gen #{generator_name} PATH [options]"
59
- end
82
+ case generator
83
+ when Ronin::Gen::FileGenerator, Ronin::Gen::DirGenerator
84
+ opts = Parameters::Options.parser(generator) do |opts|
85
+ opts.banner = "ronin-gen #{generator_name} PATH [options]"
86
+ end
87
+
88
+ args = opts.parse(argv)
89
+
90
+ if args.empty?
91
+ print_error "Must specify a PATH argument"
92
+ exit -1
93
+ end
60
94
 
61
- args = opts.parse(argv)
95
+ generator.path = args.first
96
+ else
97
+ opts = Parameters::Options.parser(generator) do |opts|
98
+ opts.banner = "ronin-gen #{generator_name} [options]"
99
+ end
62
100
 
63
- generator.path = args.first
64
- generator.generate!
101
+ args = opts.parse(argv)
102
+ end
103
+
104
+ begin
105
+ generator.generate!
106
+ rescue Parameters::MissingParam => error
107
+ print_error error
108
+ print_error "Please see `ronin-gen #{generator_name} --help`"
109
+ exit -1
110
+ rescue => error
111
+ print_exception error
112
+ exit -1
113
+ end
65
114
  end
66
115
 
67
116
  #
@@ -0,0 +1,40 @@
1
+ # ronin-gen 1 "April 2012" Ronin "User Manuals"
2
+
3
+ ## SYNOPSIS
4
+
5
+ `ronin-gen` [[*options*] | *GENERATOR* [*generator-options*]]
6
+
7
+ ## DESCRIPTION
8
+
9
+ Either runs the Ronin *GENERATOR* with the given *generator-options*, or lists
10
+ available Generators.
11
+
12
+ ## ARGUMENTS
13
+
14
+ *GENERATOR*
15
+ The Ronin Generator to run.
16
+
17
+ ## OPTIONS
18
+
19
+ `-v`, `--[no-]verbose`
20
+ Enable verbose output.
21
+
22
+ `-q`, `--[no-]quiet`
23
+ Disable verbose output.
24
+
25
+ `--[no-]silent`
26
+ Silence all output.
27
+
28
+ `--[no-]color`
29
+ Enables color output.
30
+
31
+ `-V`, `--[no-]version`
32
+ Prints the ronin-gen version.
33
+
34
+ *generator-options*
35
+ Additional options for the *GENERATOR*.
36
+
37
+ ## AUTHOR
38
+
39
+ Postmodern <postmodern.mod3@gmail.com>
40
+
@@ -2,130 +2,59 @@
2
2
 
3
3
  require 'yaml'
4
4
 
5
- Gem::Specification.new do |gemspec|
6
- root = File.dirname(__FILE__)
7
- lib_dir = File.join(root,'lib')
8
- files = if File.directory?('.git')
9
- `git ls-files`.split($/)
10
- elsif File.directory?('.hg')
11
- `hg manifest`.split($/)
12
- elsif File.directory?('.svn')
13
- `svn ls -R`.split($/).select { |path| File.file?(path) }
14
- else
15
- Dir['{**/}{.*,*}'].select { |path| File.file?(path) }
16
- end
5
+ Gem::Specification.new do |gem|
6
+ gemspec = YAML.load_file('gemspec.yml')
17
7
 
18
- filter_files = lambda { |paths|
19
- case paths
20
- when Array
21
- (files & paths)
22
- when String
23
- (files & Dir[paths])
24
- end
25
- }
26
-
27
- version = {
28
- :file => 'ronin/gen/version',
29
- :constant => 'Ronin::Gen::VERSION'
30
- }
31
-
32
- defaults = {
33
- 'name' => File.basename(root),
34
- 'files' => files,
35
- 'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
36
- 'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
37
- 'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}'],
38
- }
8
+ gem.name = gemspec.fetch('name')
9
+ gem.version = gemspec.fetch('version') do
10
+ lib_dir = File.join(File.dirname(__FILE__),'lib')
11
+ $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
39
12
 
40
- metadata = defaults.merge(YAML.load_file('gemspec.yml'))
13
+ require 'ronin/gen/version'
14
+ Ronin::Gen::VERSION
15
+ end
41
16
 
42
- gemspec.name = metadata.fetch('name',defaults[:name])
43
- gemspec.version = if metadata['version']
44
- metadata['version']
45
- else
46
- $LOAD_PATH << lib_dir unless $LOAD_PATH.include?(lib_dir)
17
+ gem.summary = gemspec['summary']
18
+ gem.description = gemspec['description']
19
+ gem.licenses = Array(gemspec['license'])
20
+ gem.authors = Array(gemspec['authors'])
21
+ gem.email = gemspec['email']
22
+ gem.homepage = gemspec['homepage']
47
23
 
48
- require version[:file]
49
- eval(version[:constant])
50
- end
24
+ glob = lambda { |patterns| gem.files & Dir[*patterns] }
51
25
 
52
- gemspec.summary = metadata.fetch('summary',metadata['description'])
53
- gemspec.description = metadata.fetch('description',metadata['summary'])
26
+ gem.files = `git ls-files`.split($/)
27
+ gem.files = glob[gemspec['files']] if gemspec['files']
54
28
 
55
- case metadata['license']
56
- when Array
57
- gemspec.licenses = metadata['license']
58
- when String
59
- gemspec.license = metadata['license']
29
+ gem.executables = gemspec.fetch('executables') do
30
+ glob['bin/*'].map { |path| File.basename(path) }
60
31
  end
32
+ gem.default_executable = gem.executables.first if Gem::VERSION < '1.7.'
61
33
 
62
- case metadata['authors']
63
- when Array
64
- gemspec.authors = metadata['authors']
65
- when String
66
- gemspec.author = metadata['authors']
67
- end
68
-
69
- gemspec.email = metadata['email']
70
- gemspec.homepage = metadata['homepage']
34
+ gem.extensions = glob[gemspec['extensions'] || 'ext/**/extconf.rb']
35
+ gem.test_files = glob[gemspec['test_files'] || '{test/{**/}*_test.rb']
36
+ gem.extra_rdoc_files = glob[gemspec['extra_doc_files'] || '*.{txt,md}']
71
37
 
72
- case metadata['require_paths']
73
- when Array
74
- gemspec.require_paths = metadata['require_paths']
75
- when String
76
- gemspec.require_path = metadata['require_paths']
77
- end
38
+ gem.require_paths = Array(gemspec.fetch('require_paths') {
39
+ %w[ext lib].select { |dir| File.directory?(dir) }
40
+ })
78
41
 
79
- gemspec.files = filter_files[metadata['files']]
42
+ gem.requirements = gemspec['requirements']
43
+ gem.required_ruby_version = gemspec['required_ruby_version']
44
+ gem.required_rubygems_version = gemspec['required_rubygems_version']
45
+ gem.post_install_message = gemspec['post_install_message']
80
46
 
81
- gemspec.executables = metadata['executables']
82
- gemspec.extensions = metadata['extensions']
83
-
84
- if Gem::VERSION < '1.7.'
85
- gemspec.default_executable = gemspec.executables.first
86
- end
87
-
88
- gemspec.test_files = filter_files[metadata['test_files']]
89
-
90
- unless gemspec.files.include?('.document')
91
- gemspec.extra_rdoc_files = metadata['extra_doc_files']
92
- end
93
-
94
- gemspec.post_install_message = metadata['post_install_message']
95
- gemspec.requirements = metadata['requirements']
96
-
97
- if gemspec.respond_to?(:required_ruby_version=)
98
- gemspec.required_ruby_version = metadata['required_ruby_version']
99
- end
100
-
101
- if gemspec.respond_to?(:required_rubygems_version=)
102
- gemspec.required_rubygems_version = metadata['required_rubygems_version']
103
- end
104
-
105
- parse_versions = lambda { |versions|
106
- case versions
107
- when Array
108
- versions.map { |v| v.to_s }
109
- when String
110
- versions.split(/,\s*/)
111
- end
112
- }
113
-
114
- if metadata['dependencies']
115
- metadata['dependencies'].each do |name,versions|
116
- gemspec.add_dependency(name,parse_versions[versions])
117
- end
118
- end
47
+ split = lambda { |string| string.split(/,\s*/) }
119
48
 
120
- if metadata['runtime_dependencies']
121
- metadata['runtime_dependencies'].each do |name,versions|
122
- gemspec.add_runtime_dependency(name,parse_versions[versions])
49
+ if gemspec['dependencies']
50
+ gemspec['dependencies'].each do |name,versions|
51
+ gem.add_dependency(name,split[versions])
123
52
  end
124
53
  end
125
54
 
126
- if metadata['development_dependencies']
127
- metadata['development_dependencies'].each do |name,versions|
128
- gemspec.add_development_dependency(name,parse_versions[versions])
55
+ if gemspec['development_dependencies']
56
+ gemspec['development_dependencies'].each do |name,versions|
57
+ gem.add_development_dependency(name,split[versions])
129
58
  end
130
59
  end
131
60
  end
@@ -1,5 +1,5 @@
1
1
  require 'rspec'
2
- require 'ronin/spec/ui/output'
2
+ require 'ronin/spec/gen'
3
3
  require 'ronin/gen/version'
4
4
 
5
5
  include Ronin
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
5
- prerelease:
4
+ version: 1.2.0.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Postmodern
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-04 00:00:00.000000000 Z
12
+ date: 2012-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: open_namespace
16
- requirement: &21483340 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0.3'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *21483340
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '0.3'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: data_paths
27
- requirement: &21482600 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '0.3'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *21482600
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '0.3'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: parameters
38
- requirement: &21481860 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,32 +53,47 @@ dependencies:
43
53
  version: '0.4'
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *21481860
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0.4'
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: ronin-support
49
- requirement: &21481160 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
67
  - - ~>
53
68
  - !ruby/object:Gem::Version
54
- version: '0.4'
69
+ version: 0.5.0.rc1
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *21481160
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.5.0.rc1
58
78
  - !ruby/object:Gem::Dependency
59
79
  name: ronin
60
- requirement: &21480420 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
61
81
  none: false
62
82
  requirements:
63
83
  - - ~>
64
84
  - !ruby/object:Gem::Version
65
- version: '1.4'
85
+ version: 1.5.0.rc1
66
86
  type: :runtime
67
87
  prerelease: false
68
- version_requirements: *21480420
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 1.5.0.rc1
69
94
  - !ruby/object:Gem::Dependency
70
95
  name: bundler
71
- requirement: &21479620 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
72
97
  none: false
73
98
  requirements:
74
99
  - - ~>
@@ -76,35 +101,53 @@ dependencies:
76
101
  version: '1.0'
77
102
  type: :development
78
103
  prerelease: false
79
- version_requirements: *21479620
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.0'
80
110
  - !ruby/object:Gem::Dependency
81
111
  name: yard
82
- requirement: &21479140 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
83
113
  none: false
84
114
  requirements:
85
115
  - - ~>
86
116
  - !ruby/object:Gem::Version
87
- version: 0.7.0
117
+ version: '0.8'
88
118
  type: :development
89
119
  prerelease: false
90
- version_requirements: *21479140
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '0.8'
91
126
  - !ruby/object:Gem::Dependency
92
127
  name: yard-parameters
93
- requirement: &21478660 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
94
129
  none: false
95
130
  requirements:
96
131
  - - ~>
97
132
  - !ruby/object:Gem::Version
98
- version: 0.1.0
133
+ version: '0.1'
99
134
  type: :development
100
135
  prerelease: false
101
- version_requirements: *21478660
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: '0.1'
102
142
  description: Ronin Gen is a Ruby library for Ronin that provides various generators.
103
143
  email: postmodern.mod3@gmail.com
104
144
  executables:
105
145
  - ronin-gen
106
146
  extensions: []
107
- extra_rdoc_files: []
147
+ extra_rdoc_files:
148
+ - COPYING.txt
149
+ - ChangeLog.md
150
+ - README.md
108
151
  files:
109
152
  - .document
110
153
  - .gemtest
@@ -144,6 +187,7 @@ files:
144
187
  - data/ronin/gen/repository/spec/spec_helper.rb
145
188
  - gemspec.yml
146
189
  - lib/ronin/gen.rb
190
+ - lib/ronin/gen/actions.rb
147
191
  - lib/ronin/gen/config.rb
148
192
  - lib/ronin/gen/dir_generator.rb
149
193
  - lib/ronin/gen/exceptions.rb
@@ -157,7 +201,10 @@ files:
157
201
  - lib/ronin/gen/ruby_generator.rb
158
202
  - lib/ronin/gen/source_code_generator.rb
159
203
  - lib/ronin/gen/version.rb
204
+ - lib/ronin/spec/gen.rb
205
+ - lib/ronin/spec/gen/source_code_generator.rb
160
206
  - lib/ronin/ui/cli/commands/gen.rb
207
+ - man/ronin-gen.1.md
161
208
  - ronin-gen.gemspec
162
209
  - spec/gen/classes/basic_generator.rb
163
210
  - spec/gen/classes/dir_generator.rb
@@ -193,13 +240,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
240
  requirements:
194
241
  - git >= 1.6.0.0, for the library generator
195
242
  rubyforge_project:
196
- rubygems_version: 1.8.15
243
+ rubygems_version: 1.8.24
197
244
  signing_key:
198
245
  specification_version: 3
199
246
  summary: A Ruby library for Ronin that provides various generators.
200
- test_files:
201
- - spec/gen/gen_spec.rb
202
- - spec/gen/generator_spec.rb
203
- - spec/gen/generators/library_spec.rb
204
- - spec/gen/generators/repository_spec.rb
205
- has_rdoc:
247
+ test_files: []