ronin-gen 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data.tar.gz.sig +0 -0
  2. data/History.txt +14 -0
  3. data/Manifest.txt +4 -4
  4. data/README.txt +32 -30
  5. data/Rakefile +11 -1
  6. data/bin/ronin-gen +2 -2
  7. data/bin/ronin-gen-extension +1 -1
  8. data/bin/ronin-gen-overlay +1 -1
  9. data/lib/ronin/generators.rb +0 -2
  10. data/lib/ronin/generators/dir_generator.rb +38 -7
  11. data/lib/ronin/generators/generator.rb +93 -88
  12. data/lib/ronin/generators/platform/extension.rb +7 -11
  13. data/lib/ronin/generators/platform/overlay.rb +91 -106
  14. data/lib/ronin/generators/platform/static.rb +0 -2
  15. data/lib/ronin/generators/version.rb +1 -3
  16. data/lib/ronin/ui/command_line/commands/gen.rb +8 -19
  17. data/lib/ronin/ui/command_line/commands/gen_extension.rb +1 -24
  18. data/lib/ronin/ui/command_line/commands/gen_overlay.rb +1 -65
  19. data/spec/generated_overlay_examples.rb +6 -0
  20. data/spec/generators/classes/dir_generator.rb +2 -4
  21. data/spec/generators/classes/file_generator.rb +4 -4
  22. data/spec/generators/classes/templated_generator.rb +3 -7
  23. data/spec/generators/classes/touch_generator.rb +1 -3
  24. data/spec/generators/generator_spec.rb +8 -10
  25. data/spec/generators/helpers/static/generators/templated.txt.erb +1 -1
  26. data/spec/generators/platform/extension_spec.rb +1 -4
  27. data/spec/generators/platform/overlay_spec.rb +2 -4
  28. data/spec/spec_helper.rb +1 -1
  29. data/spec/ui/command_line/commands/gen_extension_spec.rb +1 -1
  30. data/spec/ui/command_line/commands/gen_overlay_spec.rb +4 -4
  31. data/static/ronin/generators/platform/Rakefile.erb +5 -0
  32. data/static/ronin/{platform/generators → generators/platform}/extension.rb +0 -0
  33. data/static/ronin/{platform/generators → generators/platform}/spec/spec_helper.rb +1 -1
  34. data/tasks/spec.rb +1 -0
  35. data/tasks/yard.rb +13 -0
  36. metadata +33 -14
  37. metadata.gz.sig +0 -0
  38. data/TODO.txt +0 -3
  39. data/lib/ronin/generators/platform/spec.rb +0 -46
@@ -9,6 +9,12 @@ shared_examples_for "Generated Overlay" do
9
9
  File.directory?(@path).should == true
10
10
  end
11
11
 
12
+ it "should create a static directory" do
13
+ static_dir = File.join(@path,'static')
14
+
15
+ File.directory?(static_dir).should == true
16
+ end
17
+
12
18
  it "should create a lib directory" do
13
19
  lib_dir = File.join(@path,Ronin::Platform::Overlay::LIB_DIR)
14
20
 
@@ -2,10 +2,8 @@ require 'ronin/generators/generator'
2
2
 
3
3
  class DirGenerator < Generators::Generator
4
4
 
5
- protected
6
-
7
- def generate!
8
- directory 'test'
5
+ def generate
6
+ mkdir 'test'
9
7
  end
10
8
 
11
9
  end
@@ -2,10 +2,10 @@ require 'ronin/generators/generator'
2
2
 
3
3
  class FileGenerator < Generators::Generator
4
4
 
5
- protected
6
-
7
- def generate!
8
- file('test.txt') { |test| test.puts("hello") }
5
+ def generate
6
+ create_file('test.txt') do
7
+ "hello"
8
+ end
9
9
  end
10
10
 
11
11
  end
@@ -4,14 +4,10 @@ class TemplatedGenerator < Generators::Generator
4
4
 
5
5
  TEMPLATE_FILE = File.join('generators','templated.txt.erb')
6
6
 
7
- def initialize(message)
8
- @message = message
9
- end
10
-
11
- protected
7
+ class_option :message, :type => :string
12
8
 
13
- def generate!
14
- render_file TEMPLATE_FILE, 'templated.txt'
9
+ def generate
10
+ template TEMPLATE_FILE, 'templated.txt'
15
11
  end
16
12
 
17
13
  end
@@ -2,9 +2,7 @@ require 'ronin/generators/generator'
2
2
 
3
3
  class TouchGenerator < Generators::Generator
4
4
 
5
- protected
6
-
7
- def generate!
5
+ def generate
8
6
  touch('test2.txt')
9
7
  end
10
8
 
@@ -7,46 +7,44 @@ require 'generators/classes/touch_generator'
7
7
  require 'generators/classes/dir_generator'
8
8
  require 'generators/classes/templated_generator'
9
9
 
10
-
11
10
  require 'tmpdir'
12
11
  require 'fileutils'
13
12
 
14
13
  describe Generators::Generator do
15
14
  before(:all) do
15
+ @previous_dir = Dir.pwd
16
16
  @dir = File.join(Dir.tmpdir,'ronin_generators')
17
17
 
18
18
  FileUtils.mkdir(@dir)
19
+ Dir.chdir(@dir)
19
20
  end
20
21
 
21
22
  it "should generate files" do
22
- generator = FileGenerator.new
23
- generator.run(@dir)
23
+ FileGenerator.generate
24
24
 
25
- File.read(File.join(@dir,'test.txt')).should == "hello\n"
25
+ File.read(File.join(@dir,'test.txt')).should == "hello"
26
26
  end
27
27
 
28
28
  it "should touch files" do
29
- generator = TouchGenerator.new
30
- generator.run(@dir)
29
+ TouchGenerator.generate
31
30
 
32
31
  File.file?(File.join(@dir,'test2.txt')).should == true
33
32
  end
34
33
 
35
34
  it "should generate directories" do
36
- generator = DirGenerator.new
37
- generator.run(@dir)
35
+ DirGenerator.generate
38
36
 
39
37
  File.directory?(File.join(@dir,'test')).should == true
40
38
  end
41
39
 
42
40
  it "should generate files using templates" do
43
- generator = TemplatedGenerator.new('hello')
44
- generator.run(@dir)
41
+ TemplatedGenerator.generate(:message => 'hello')
45
42
 
46
43
  File.read(File.join(@dir,'templated.txt')).should == "message: hello\n"
47
44
  end
48
45
 
49
46
  after(:all) do
50
47
  FileUtils.rm_r(@dir)
48
+ Dir.chdir(@previous_dir)
51
49
  end
52
50
  end
@@ -1 +1 @@
1
- message: <%= @message %>
1
+ message: <%= options[:message] %>
@@ -7,13 +7,11 @@ require 'tmpdir'
7
7
  require 'fileutils'
8
8
 
9
9
  describe Generators::Platform::Overlay do
10
-
11
10
  before(:all) do
12
11
  @name = 'ronin_generated_extension'
13
12
  @path = File.join(Dir.tmpdir,@name)
14
13
 
15
- generator = Generators::Platform::Extension.new
16
- generator.run(@path)
14
+ Generators::Platform::Extension.generate(@path)
17
15
  end
18
16
 
19
17
  it_should_behave_like "Generated Extension"
@@ -21,5 +19,4 @@ describe Generators::Platform::Overlay do
21
19
  after(:all) do
22
20
  FileUtils.rm_r(@path)
23
21
  end
24
-
25
22
  end
@@ -7,7 +7,6 @@ require 'tmpdir'
7
7
  require 'fileutils'
8
8
 
9
9
  describe Generators::Platform::Overlay do
10
-
11
10
  before(:all) do
12
11
  @name = 'ronin_generated_overlay'
13
12
  @path = File.join(Dir.tmpdir,@name)
@@ -18,7 +17,8 @@ describe Generators::Platform::Overlay do
18
17
  @license = 'GPL-2'
19
18
  @description = 'This is a test overlay'
20
19
 
21
- generator = Generators::Platform::Overlay.new(
20
+ Generators::Platform::Overlay.generate(
21
+ @path,
22
22
  :title => @title,
23
23
  :source => @source,
24
24
  :source_view => @source_view,
@@ -26,7 +26,6 @@ describe Generators::Platform::Overlay do
26
26
  :license => @license,
27
27
  :description => @description
28
28
  )
29
- generator.run(@path)
30
29
  end
31
30
 
32
31
  it_should_behave_like "Generated Overlay"
@@ -34,5 +33,4 @@ describe Generators::Platform::Overlay do
34
33
  after(:all) do
35
34
  FileUtils.rm_r(@path)
36
35
  end
37
-
38
36
  end
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- gem 'rspec', '>=1.1.12'
2
+ gem 'rspec', '>=1.2.8'
3
3
  require 'spec'
4
4
 
5
5
  require 'ronin/generators/version'
@@ -11,7 +11,7 @@ describe UI::CommandLine::Commands::GenExtension do
11
11
  @name = 'ronin_generated_extension'
12
12
  @path = File.join(Dir.tmpdir,@name)
13
13
 
14
- UI::CommandLine::Commands::GenExtension.run(@path)
14
+ UI::CommandLine::Commands::GenExtension.start [@path]
15
15
  end
16
16
 
17
17
  it_should_behave_like "Generated Extension"
@@ -18,15 +18,15 @@ describe UI::CommandLine::Commands::GenOverlay do
18
18
  @license = 'GPL-2'
19
19
  @description = 'This is a test overlay'
20
20
 
21
- UI::CommandLine::Commands::GenOverlay.run(
21
+ UI::CommandLine::Commands::GenOverlay.start [
22
+ @path,
22
23
  '--title', @title,
23
24
  '--source', @source,
24
25
  '--source-view', @source_view,
25
26
  '--website', @website,
26
27
  '--license', @license,
27
- '--description', @description,
28
- @path
29
- )
28
+ '--description', @description
29
+ ]
30
30
  end
31
31
 
32
32
  it_should_behave_like "Generated Overlay"
@@ -0,0 +1,5 @@
1
+ # -*- ruby -*-
2
+ <% @tasks.each do |task| %>
3
+ require 'ronin/platform/tasks/<%= task %>
4
+ <% end %>
5
+ # vim: syntax=Ruby
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  gem 'rspec', '>=1.1.12'
3
3
  require 'spec'
4
4
 
5
- require 'ronin/generators/version'
5
+ require 'ronin/platform'
6
6
 
7
7
  include Ronin
8
8
 
@@ -6,4 +6,5 @@ Spec::Rake::SpecTask.new(:spec) do |t|
6
6
  t.spec_opts = ['--colour', '--format', 'specdoc']
7
7
  end
8
8
 
9
+ task :test => :spec
9
10
  task :default => :spec
@@ -0,0 +1,13 @@
1
+ require 'ronin/yard/handlers'
2
+
3
+ YARD::Rake::YardocTask.new do |t|
4
+ t.files = ['lib/**/*.rb']
5
+ t.options = [
6
+ '--protected',
7
+ '--files', 'History.txt',
8
+ '--title', 'Ronin Generators',
9
+ '--quiet'
10
+ ]
11
+ end
12
+
13
+ task :docs => :yardoc
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
@@ -30,7 +30,7 @@ cert_chain:
30
30
  pDj+ws7QjtH/Qcrr1l9jfN0ehDs=
31
31
  -----END CERTIFICATE-----
32
32
 
33
- date: 2009-07-08 00:00:00 -07:00
33
+ date: 2009-09-25 00:00:00 -07:00
34
34
  default_executable:
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
@@ -41,7 +41,27 @@ dependencies:
41
41
  requirements:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 0.2.4
44
+ version: 0.3.0
45
+ version:
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ type: :development
49
+ version_requirement:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.2.8
55
+ version:
56
+ - !ruby/object:Gem::Dependency
57
+ name: yard
58
+ type: :development
59
+ version_requirement:
60
+ version_requirements: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.2.3.5
45
65
  version:
46
66
  - !ruby/object:Gem::Dependency
47
67
  name: hoe
@@ -51,14 +71,14 @@ dependencies:
51
71
  requirements:
52
72
  - - ">="
53
73
  - !ruby/object:Gem::Version
54
- version: 2.3.2
74
+ version: 2.3.3
55
75
  version:
56
76
  description: |-
57
77
  Ronin Gen is a Ruby library for Ronin that provides various generators.
58
78
 
59
- Ronin is a Ruby platform designed for information security and data
60
- exploration tasks. Ronin allows for the rapid development and distribution
61
- of code over many of the common Source-Code-Management (SCM) systems.
79
+ Ronin is a Ruby platform for exploit development and security research.
80
+ Ronin allows for the rapid development and distribution of code, exploits
81
+ or payloads over many common Source-Code-Management (SCM) systems.
62
82
  email:
63
83
  - postmodern.mod3@gmail.com
64
84
  executables:
@@ -72,14 +92,12 @@ extra_rdoc_files:
72
92
  - COPYING.txt
73
93
  - Manifest.txt
74
94
  - README.txt
75
- - TODO.txt
76
95
  files:
77
96
  - History.txt
78
97
  - COPYING.txt
79
98
  - Manifest.txt
80
99
  - README.txt
81
100
  - Rakefile
82
- - TODO.txt
83
101
  - bin/ronin-gen
84
102
  - bin/ronin-gen-overlay
85
103
  - bin/ronin-gen-extension
@@ -90,11 +108,11 @@ files:
90
108
  - lib/ronin/generators/platform/static.rb
91
109
  - lib/ronin/generators/platform/overlay.rb
92
110
  - lib/ronin/generators/platform/extension.rb
93
- - lib/ronin/generators/platform/spec.rb
94
111
  - lib/ronin/ui/command_line/commands/gen.rb
95
112
  - lib/ronin/ui/command_line/commands/gen_overlay.rb
96
113
  - lib/ronin/ui/command_line/commands/gen_extension.rb
97
114
  - tasks/spec.rb
115
+ - tasks/yard.rb
98
116
  - spec/spec_helper.rb
99
117
  - spec/generated_overlay_examples.rb
100
118
  - spec/generated_extension_examples.rb
@@ -110,9 +128,10 @@ files:
110
128
  - spec/generators/platform/extension_spec.rb
111
129
  - spec/ui/command_line/commands/gen_overlay_spec.rb
112
130
  - spec/ui/command_line/commands/gen_extension_spec.rb
113
- - static/ronin/platform/generators/extension.rb
114
- - static/ronin/platform/generators/spec/spec_helper.rb
115
- has_rdoc: true
131
+ - static/ronin/generators/platform/Rakefile.erb
132
+ - static/ronin/generators/platform/extension.rb
133
+ - static/ronin/generators/platform/spec/spec_helper.rb
134
+ has_rdoc: yard
116
135
  homepage: http://ronin.rubyforge.org/gen/
117
136
  licenses: []
118
137
 
@@ -137,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
156
  requirements: []
138
157
 
139
158
  rubyforge_project: ronin
140
- rubygems_version: 1.3.4
159
+ rubygems_version: 1.3.5
141
160
  signing_key:
142
161
  specification_version: 3
143
162
  summary: Ronin Gen is a Ruby library for Ronin that provides various generators
metadata.gz.sig CHANGED
Binary file
data/TODO.txt DELETED
@@ -1,3 +0,0 @@
1
- == TODO:
2
-
3
-
@@ -1,46 +0,0 @@
1
- #
2
- #--
3
- # Ronin Gen - A Ruby library for Ronin that provides various generators.
4
- #
5
- # Copyright (c) 2009 Hal Brodigan (postmodern.mod3 at gmail.com)
6
- #
7
- # This program is free software; you can redistribute it and/or modify
8
- # it under the terms of the GNU General Public License as published by
9
- # the Free Software Foundation; either version 2 of the License, or
10
- # (at your option) any later version.
11
- #
12
- # This program is distributed in the hope that it will be useful,
13
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- # GNU General Public License for more details.
16
- #
17
- # You should have received a copy of the GNU General Public License
18
- # along with this program; if not, write to the Free Software
19
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
- #++
21
- #
22
-
23
- require 'ronin/generators/generator'
24
-
25
- module Ronin
26
- module Generators
27
- module Platform
28
- class Spec < Generator
29
-
30
- # The default spec_helper.rb file
31
- SPEC_HELPER = File.join('ronin','platform','generators','spec','spec_helper.rb')
32
-
33
- protected
34
-
35
- #
36
- # Generates a basic Spec test directory.
37
- #
38
- def generate!
39
- directory 'spec'
40
- copy SPEC_HELPER, 'spec'
41
- end
42
-
43
- end
44
- end
45
- end
46
- end