rubigen 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +6 -2
- data/Rakefile +15 -14
- data/bin/rubigen +2 -0
- data/config/website.yml +2 -0
- data/features/development.feature +5 -5
- data/features/help.feature +4 -5
- data/features/rubigen_cli.feature +2 -3
- data/features/{steps/common.rb → step_definitions/common_steps.rb} +55 -77
- data/features/support/common.rb +29 -0
- data/features/support/env.rb +14 -0
- data/features/support/matchers.rb +11 -0
- data/lib/rubigen.rb +6 -6
- data/lib/rubigen/commands.rb +1 -1
- data/rubigen.gemspec +42 -0
- data/rubygems_generators/application_generator/templates/bin +1 -1
- data/test/test_helper.rb +4 -25
- data/test/test_lookup.rb +15 -15
- metadata +48 -10
- data/features/steps/env.rb +0 -6
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -14,11 +14,14 @@ app_generators/ruby_app/templates/test/test_helper.rb.erb
|
|
14
14
|
bin/install_rubigen_scripts
|
15
15
|
bin/rubigen
|
16
16
|
bin/ruby_app
|
17
|
+
config/website.yml
|
17
18
|
features/development.feature
|
18
19
|
features/help.feature
|
19
20
|
features/rubigen_cli.feature
|
20
|
-
features/
|
21
|
-
features/
|
21
|
+
features/step_definitions/common_steps.rb
|
22
|
+
features/support/common.rb
|
23
|
+
features/support/env.rb
|
24
|
+
features/support/matchers.rb
|
22
25
|
generators/install_rubigen_scripts/install_rubigen_scripts_generator.rb
|
23
26
|
generators/install_rubigen_scripts/templates/script/destroy
|
24
27
|
generators/install_rubigen_scripts/templates/script/generate
|
@@ -38,6 +41,7 @@ lib/rubigen/scripts/generate.rb
|
|
38
41
|
lib/rubigen/scripts/update.rb
|
39
42
|
lib/rubigen/simple_logger.rb
|
40
43
|
lib/rubigen/spec.rb
|
44
|
+
rubigen.gemspec
|
41
45
|
rubygems_generators/application_generator/USAGE
|
42
46
|
rubygems_generators/application_generator/application_generator_generator.rb
|
43
47
|
rubygems_generators/application_generator/templates/bin
|
data/Rakefile
CHANGED
@@ -1,20 +1,21 @@
|
|
1
|
-
|
2
|
-
require '
|
3
|
-
require
|
1
|
+
require 'rubygems'
|
2
|
+
require 'hoe'
|
3
|
+
require './lib/rubigen'
|
4
|
+
|
5
|
+
Hoe.plugin :newgem
|
6
|
+
Hoe.plugin :website
|
7
|
+
Hoe.plugin :cucumberfeatures
|
8
|
+
Hoe.plugin :git
|
4
9
|
|
5
10
|
# Generate all the Rake tasks
|
6
11
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
15
|
-
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
16
|
-
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
17
|
-
p.rsync_args = '-av --delete --ignore-errors'
|
12
|
+
Hoe.spec 'rubigen' do
|
13
|
+
developer 'Dr Nic Williams', 'drnicwilliams@gmail.com'
|
14
|
+
developer 'Jeremy Kemper', 'jeremy@bitsweat.net'
|
15
|
+
extra_deps << ['activesupport','2.3.5']
|
16
|
+
extra_deps << ['mocha','>= 0.9.7']
|
17
|
+
extra_deps << ['cucumber','>= 0.3.6']
|
18
|
+
extra_deps << ['thoughtbot-shoulda','>= 2.10.2']
|
18
19
|
end
|
19
20
|
|
20
21
|
require 'newgem/tasks' rescue nil # load /tasks/*.rake
|
data/bin/rubigen
CHANGED
data/config/website.yml
ADDED
@@ -6,8 +6,8 @@ Feature: Development processes of newgem itself (rake tasks)
|
|
6
6
|
|
7
7
|
Scenario: Generate RubyGem
|
8
8
|
Given this project is active project folder
|
9
|
-
And
|
10
|
-
When task
|
11
|
-
Then folder
|
12
|
-
And file with name matching
|
13
|
-
And gem spec key
|
9
|
+
And "pkg" folder is deleted
|
10
|
+
When I invoke task "rake gem"
|
11
|
+
Then folder "pkg" is created
|
12
|
+
And file with name matching "pkg/*.gem" is created else you should run "rake manifest" to fix this
|
13
|
+
And gem spec key "rdoc_options" contains /(--mainREADME.rdoc|\[\"--main\", \"README.rdoc\"\])/
|
data/features/help.feature
CHANGED
@@ -4,11 +4,10 @@ Feature: Generators offer help/usage details
|
|
4
4
|
I want help/usage details about generators
|
5
5
|
|
6
6
|
Scenario: List of visible generators for rubygems
|
7
|
-
|
8
|
-
|
9
|
-
Then
|
10
|
-
|
11
|
-
And output does not match /migration/ # from rails scope
|
7
|
+
When I run local executable "rubigen rubygems" with arguments ""
|
8
|
+
Then I should see "application_generator"
|
9
|
+
Then I should see "component_generator"
|
10
|
+
Then I should not see "migration" # from rails scope
|
12
11
|
|
13
12
|
|
14
13
|
|
@@ -4,7 +4,6 @@ Feature: rubigen command-line interface to access generators anywhere
|
|
4
4
|
I want to execute generators anywhere without a script/generate helper script
|
5
5
|
|
6
6
|
Scenario: Run a component generator
|
7
|
-
|
8
|
-
|
9
|
-
Then file 'bar_generators/foo/foo_generator.rb' is created
|
7
|
+
When I run local executable "rubigen" with arguments "rubygems component_generator foo bar"
|
8
|
+
Then file "bar_generators/foo/foo_generator.rb" is created
|
10
9
|
|
@@ -1,51 +1,18 @@
|
|
1
|
-
|
2
|
-
project_folder = @active_project_folder || @tmp_root
|
3
|
-
FileUtils.chdir(project_folder, &block)
|
4
|
-
end
|
5
|
-
|
6
|
-
def in_home_folder(&block)
|
7
|
-
FileUtils.chdir(@home_path, &block)
|
8
|
-
end
|
9
|
-
|
10
|
-
Given %r{^a safe folder} do
|
11
|
-
FileUtils.rm_rf @tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
12
|
-
FileUtils.mkdir_p @tmp_root
|
13
|
-
FileUtils.mkdir_p @home_path = File.expand_path(File.join(@tmp_root, "home"))
|
14
|
-
@lib_path = File.expand_path(File.dirname(__FILE__) + '/../../lib')
|
15
|
-
Given "env variable $HOME set to '#{@home_path}'"
|
16
|
-
end
|
17
|
-
|
18
|
-
Given %r{^this project is active project folder} do
|
19
|
-
Given "a safe folder"
|
1
|
+
Given /^this project is active project folder/ do
|
20
2
|
@active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
21
3
|
end
|
22
4
|
|
23
|
-
Given
|
5
|
+
Given /^env variable \$([\w_]+) set to "(.*)"/ do |env_var, value|
|
24
6
|
ENV[env_var] = value
|
25
7
|
end
|
26
8
|
|
27
|
-
|
28
|
-
|
29
|
-
File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
|
30
|
-
f << "$:.unshift('#{@lib_path}')\n"
|
31
|
-
f << rakefile
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def setup_active_project_folder project_name
|
36
|
-
@active_project_folder = File.join(@tmp_root, project_name)
|
37
|
-
@project_name = project_name
|
9
|
+
Given /"(.*)" folder is deleted/ do |folder|
|
10
|
+
in_project_folder { FileUtils.rm_rf folder }
|
38
11
|
end
|
39
12
|
|
40
|
-
|
41
|
-
in_project_folder do
|
42
|
-
FileUtils.rm_rf folder
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
When %r{^'(.*)' generator is invoked with arguments '(.*)'$} do |generator, arguments|
|
13
|
+
When /^I invoke "(.*)" generator with arguments "(.*)"$/ do |generator, arguments|
|
47
14
|
@stdout = StringIO.new
|
48
|
-
|
15
|
+
in_project_folder do
|
49
16
|
if Object.const_defined?("APP_ROOT")
|
50
17
|
APP_ROOT.replace(FileUtils.pwd)
|
51
18
|
else
|
@@ -59,55 +26,63 @@ When %r{^'(.*)' generator is invoked with arguments '(.*)'$} do |generator, argu
|
|
59
26
|
end
|
60
27
|
end
|
61
28
|
|
62
|
-
When
|
29
|
+
When /^I run executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
63
30
|
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
64
31
|
in_project_folder do
|
65
32
|
system "#{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
66
33
|
end
|
67
34
|
end
|
68
35
|
|
69
|
-
When
|
36
|
+
When /^I run project executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
70
37
|
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
71
38
|
in_project_folder do
|
72
|
-
system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
39
|
+
system "ruby -rubygems #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
73
40
|
end
|
74
41
|
end
|
75
42
|
|
76
|
-
When
|
43
|
+
When /^I run local executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
77
44
|
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
78
|
-
@stderr = File.expand_path(File.join(@tmp_root, "executable.err"))
|
79
45
|
executable = File.expand_path(File.join(File.dirname(__FILE__), "/../../bin", executable))
|
80
46
|
in_project_folder do
|
81
|
-
system "ruby #{executable} #{arguments} > #{@stdout} 2> #{@
|
47
|
+
system "ruby -rubygems #{executable} #{arguments} > #{@stdout} 2> #{@stdout}"
|
82
48
|
end
|
83
49
|
end
|
84
50
|
|
85
|
-
When
|
51
|
+
When /^I invoke task "rake (.*)"/ do |task|
|
86
52
|
@stdout = File.expand_path(File.join(@tmp_root, "tests.out"))
|
87
|
-
|
53
|
+
in_project_folder do
|
88
54
|
system "rake #{task} --trace > #{@stdout} 2> #{@stdout}"
|
89
55
|
end
|
90
56
|
end
|
91
57
|
|
92
|
-
Then
|
58
|
+
Then /^folder "(.*)" (is|is not) created/ do |folder, is|
|
93
59
|
in_project_folder do
|
94
60
|
File.exists?(folder).should(is == 'is' ? be_true : be_false)
|
95
61
|
end
|
96
62
|
end
|
97
63
|
|
98
|
-
Then
|
64
|
+
Then /^file "(.*)" (is|is not) created/ do |file, is|
|
99
65
|
in_project_folder do
|
100
66
|
File.exists?(file).should(is == 'is' ? be_true : be_false)
|
101
67
|
end
|
102
68
|
end
|
103
69
|
|
104
|
-
Then
|
70
|
+
Then /^file with name matching "(.*)" is created/ do |pattern|
|
105
71
|
in_project_folder do
|
106
72
|
Dir[pattern].should_not be_empty
|
107
73
|
end
|
108
74
|
end
|
109
75
|
|
110
|
-
Then
|
76
|
+
Then /^file "(.*)" contents (does|does not) match \/(.*)\// do |file, does, regex|
|
77
|
+
in_project_folder do
|
78
|
+
actual_output = File.read(file)
|
79
|
+
(does == 'does') ?
|
80
|
+
actual_output.should(match(/#{regex}/)) :
|
81
|
+
actual_output.should_not(match(/#{regex}/))
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
Then /gem file "(.*)" and generated file "(.*)" should be the same/ do |gem_file, project_file|
|
111
86
|
File.exists?(gem_file).should be_true
|
112
87
|
File.exists?(project_file).should be_true
|
113
88
|
gem_file_contents = File.read(File.dirname(__FILE__) + "/../../#{gem_file}")
|
@@ -115,77 +90,80 @@ Then %r{gem file '(.*)' and generated file '(.*)' should be the same} do |gem_fi
|
|
115
90
|
project_file_contents.should == gem_file_contents
|
116
91
|
end
|
117
92
|
|
118
|
-
Then
|
119
|
-
expected_output = File.read(File.join(File.dirname(__FILE__) + "/../expected_outputs", file))
|
120
|
-
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@stdout}")
|
121
|
-
actual_output.should == expected_output
|
122
|
-
end
|
123
|
-
|
124
|
-
Then %r{^(does|does not) invoke generator '(.*)'$} do |does_invoke, generator|
|
93
|
+
Then /^(does|does not) invoke generator "(.*)"$/ do |does_invoke, generator|
|
125
94
|
actual_output = File.read(@stdout)
|
126
95
|
does_invoke == "does" ?
|
127
96
|
actual_output.should(match(/dependency\s+#{generator}/)) :
|
128
97
|
actual_output.should_not(match(/dependency\s+#{generator}/))
|
129
98
|
end
|
130
99
|
|
131
|
-
Then
|
100
|
+
Then /help options "(.*)" and "(.*)" are displayed/ do |opt1, opt2|
|
132
101
|
actual_output = File.read(@stdout)
|
133
102
|
actual_output.should match(/#{opt1}/)
|
134
103
|
actual_output.should match(/#{opt2}/)
|
135
104
|
end
|
136
105
|
|
137
|
-
Then
|
106
|
+
Then /^I should see "([^\"]*)"/ do |text|
|
138
107
|
actual_output = File.read(@stdout)
|
139
|
-
(
|
140
|
-
actual_output.should(match(/#{regex}/)) :
|
141
|
-
actual_output.should_not(match(/#{regex}/))
|
108
|
+
actual_output.should contain(text)
|
142
109
|
end
|
143
110
|
|
144
|
-
Then
|
145
|
-
|
146
|
-
|
147
|
-
(does == 'does') ?
|
148
|
-
actual_output.should(match(/#{regex}/)) :
|
149
|
-
actual_output.should_not(match(/#{regex}/))
|
150
|
-
end
|
111
|
+
Then /^I should not see "([^\"]*)"/ do |text|
|
112
|
+
actual_output = File.read(@stdout)
|
113
|
+
actual_output.should_not contain(text)
|
151
114
|
end
|
152
115
|
|
153
|
-
Then
|
116
|
+
Then /^I should see$/ do |text|
|
117
|
+
actual_output = File.read(@stdout)
|
118
|
+
actual_output.should contain(text)
|
119
|
+
end
|
120
|
+
|
121
|
+
Then /^I should not see$/ do |text|
|
122
|
+
actual_output = File.read(@stdout)
|
123
|
+
actual_output.should_not contain(text)
|
124
|
+
end
|
125
|
+
|
126
|
+
Then /^I should see exactly$/ do |text|
|
127
|
+
actual_output = File.read(@stdout)
|
128
|
+
actual_output.should == text
|
129
|
+
end
|
130
|
+
|
131
|
+
Then /^I should see all (\d+) tests pass/ do |expected_test_count|
|
154
132
|
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
155
133
|
actual_output = File.read(@stdout)
|
156
134
|
actual_output.should match(expected)
|
157
135
|
end
|
158
136
|
|
159
|
-
Then
|
137
|
+
Then /^I should see all (\d+) examples pass/ do |expected_test_count|
|
160
138
|
expected = %r{^#{expected_test_count} examples?, 0 failures}
|
161
139
|
actual_output = File.read(@stdout)
|
162
140
|
actual_output.should match(expected)
|
163
141
|
end
|
164
142
|
|
165
|
-
Then
|
143
|
+
Then /^yaml file "(.*)" contains (\{.*\})/ do |file, yaml|
|
166
144
|
in_project_folder do
|
167
145
|
yaml = eval yaml
|
168
146
|
YAML.load(File.read(file)).should == yaml
|
169
147
|
end
|
170
148
|
end
|
171
149
|
|
172
|
-
Then
|
150
|
+
Then /^Rakefile can display tasks successfully/ do
|
173
151
|
@stdout = File.expand_path(File.join(@tmp_root, "rakefile.out"))
|
174
|
-
|
152
|
+
in_project_folder do
|
175
153
|
system "rake -T > #{@stdout} 2> #{@stdout}"
|
176
154
|
end
|
177
155
|
actual_output = File.read(@stdout)
|
178
156
|
actual_output.should match(/^rake\s+\w+\s+#\s.*/)
|
179
157
|
end
|
180
158
|
|
181
|
-
Then
|
159
|
+
Then /^task "rake (.*)" is executed successfully/ do |task|
|
182
160
|
@stdout.should_not be_nil
|
183
161
|
actual_output = File.read(@stdout)
|
184
162
|
actual_output.should_not match(/^Don't know how to build task '#{task}'/)
|
185
163
|
actual_output.should_not match(/Error/i)
|
186
164
|
end
|
187
165
|
|
188
|
-
Then
|
166
|
+
Then /^gem spec key "(.*)" contains \/(.*)\// do |key, regex|
|
189
167
|
in_project_folder do
|
190
168
|
gem_file = Dir["pkg/*.gem"].first
|
191
169
|
gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module CommonHelpers
|
2
|
+
def in_tmp_folder(&block)
|
3
|
+
FileUtils.chdir(@tmp_root, &block)
|
4
|
+
end
|
5
|
+
|
6
|
+
def in_project_folder(&block)
|
7
|
+
project_folder = @active_project_folder || @tmp_root
|
8
|
+
FileUtils.chdir(project_folder, &block)
|
9
|
+
end
|
10
|
+
|
11
|
+
def in_home_folder(&block)
|
12
|
+
FileUtils.chdir(@home_path, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def force_local_lib_override(project_name = @project_name)
|
16
|
+
rakefile = File.read(File.join(project_name, 'Rakefile'))
|
17
|
+
File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
|
18
|
+
f << "$:.unshift('#{@lib_path}')\n"
|
19
|
+
f << rakefile
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def setup_active_project_folder project_name
|
24
|
+
@active_project_folder = File.join(@tmp_root, project_name)
|
25
|
+
@project_name = project_name
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
World(CommonHelpers)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
gem 'cucumber'
|
2
|
+
require 'cucumber'
|
3
|
+
gem 'rspec'
|
4
|
+
require 'spec'
|
5
|
+
|
6
|
+
require File.dirname(__FILE__) + "/../../lib/rubigen"
|
7
|
+
|
8
|
+
Before do
|
9
|
+
@tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
10
|
+
@home_path = File.expand_path(File.join(@tmp_root, "home"))
|
11
|
+
FileUtils.rm_rf @tmp_root
|
12
|
+
FileUtils.mkdir_p @home_path
|
13
|
+
ENV['HOME'] = @home_path
|
14
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Matchers
|
2
|
+
def contain(expected)
|
3
|
+
simple_matcher("contain #{expected.inspect}") do |given, matcher|
|
4
|
+
matcher.failure_message = "expected #{given.inspect} to contain #{expected.inspect}"
|
5
|
+
matcher.negative_failure_message = "expected #{given.inspect} not to contain #{expected.inspect}"
|
6
|
+
given.index expected
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
World(Matchers)
|
data/lib/rubigen.rb
CHANGED
@@ -2,15 +2,15 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
4
|
begin
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
gem 'activesupport'
|
9
|
-
require 'active_support'
|
5
|
+
# if you are using rubygems, fix to 2.3.5
|
6
|
+
gem 'activesupport', '2.3.5'
|
7
|
+
rescue
|
10
8
|
end
|
11
9
|
|
10
|
+
require 'active_support'
|
11
|
+
|
12
12
|
module RubiGen
|
13
|
-
VERSION = '1.5.
|
13
|
+
VERSION = '1.5.3'
|
14
14
|
end
|
15
15
|
|
16
16
|
require 'rubigen/base'
|
data/lib/rubigen/commands.rb
CHANGED
@@ -124,7 +124,7 @@ module RubiGen
|
|
124
124
|
when /\An\z/i then :skip
|
125
125
|
when /\Ay\z/i then :force
|
126
126
|
else
|
127
|
-
|
127
|
+
stdout.puts <<-HELP.gsub(/^ /, '')
|
128
128
|
Y - yes, overwrite
|
129
129
|
n - no, do not overwrite
|
130
130
|
a - all, overwrite this and all others
|
data/rubigen.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{rubigen}
|
5
|
+
s.version = "1.5.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Dr Nic Williams", "Jeremy Kemper"]
|
9
|
+
s.date = %q{2009-01-12}
|
10
|
+
s.description = %q{A framework to allow Ruby applications to generate file/folder stubs (like the `rails` command does for Ruby on Rails, and the 'script/generate' command within a Rails application during development).}
|
11
|
+
s.email = ["drnicwilliams@gmail.com", "jeremy@bitsweat.net"]
|
12
|
+
s.executables = ["install_rubigen_scripts", "rubigen", "ruby_app"]
|
13
|
+
s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "README.rdoc", "Todo.txt", "app_generators/ruby_app/templates/README.txt", "website/index.txt", "website/version-raw.txt", "website/version.txt"]
|
14
|
+
s.files = [".autotest", "History.txt", "License.txt", "Manifest.txt", "README.rdoc", "Rakefile", "Todo.txt", "app_generators/ruby_app/USAGE", "app_generators/ruby_app/ruby_app_generator.rb", "app_generators/ruby_app/templates/README.txt", "app_generators/ruby_app/templates/Rakefile", "app_generators/ruby_app/templates/lib/module.rb", "app_generators/ruby_app/templates/test/test_helper.rb.erb", "bin/install_rubigen_scripts", "bin/rubigen", "bin/ruby_app", "features/development.feature", "features/help.feature", "features/rubigen_cli.feature", "features/steps/common.rb", "features/steps/env.rb", "generators/install_rubigen_scripts/install_rubigen_scripts_generator.rb", "generators/install_rubigen_scripts/templates/script/destroy", "generators/install_rubigen_scripts/templates/script/generate", "generators/install_rubigen_scripts/templates/script/win_script.cmd", "lib/rubigen.rb", "lib/rubigen/base.rb", "lib/rubigen/cli.rb", "lib/rubigen/commands.rb", "lib/rubigen/generated_attribute.rb", "lib/rubigen/helpers/generator_test_helper.rb", "lib/rubigen/lookup.rb", "lib/rubigen/manifest.rb", "lib/rubigen/options.rb", "lib/rubigen/scripts.rb", "lib/rubigen/scripts/destroy.rb", "lib/rubigen/scripts/generate.rb", "lib/rubigen/scripts/update.rb", "lib/rubigen/simple_logger.rb", "lib/rubigen/spec.rb", "rubygems_generators/application_generator/USAGE", "rubygems_generators/application_generator/application_generator_generator.rb", "rubygems_generators/application_generator/templates/bin", "rubygems_generators/application_generator/templates/generator.rb", "rubygems_generators/application_generator/templates/readme", "rubygems_generators/application_generator/templates/test.rb", "rubygems_generators/application_generator/templates/test_generator_helper.rb", "rubygems_generators/application_generator/templates/usage", "rubygems_generators/component_generator/USAGE", "rubygems_generators/component_generator/component_generator_generator.rb", "rubygems_generators/component_generator/templates/generator.rb", "rubygems_generators/component_generator/templates/rails_generator.rb", "rubygems_generators/component_generator/templates/readme", "rubygems_generators/component_generator/templates/test.rb", "rubygems_generators/component_generator/templates/test_generator_helper.rb", "rubygems_generators/component_generator/templates/usage", "script/console", "script/destroy", "script/generate", "script/txt2html", "test/test_application_generator_generator.rb", "test/test_component_generator_generator.rb", "test/test_generate_builtin_application.rb", "test/test_generate_builtin_test_unit.rb", "test/test_generator_helper.rb", "test/test_helper.rb", "test/test_install_rubigen_scripts_generator.rb", "test/test_lookup.rb", "test/test_rubigen_cli.rb", "test_unit_generators/test_unit/USAGE", "test_unit_generators/test_unit/templates/test.rb", "test_unit_generators/test_unit/test_unit_generator.rb", "website/index.html", "website/index.txt", "website/javascripts/rounded_corners_lite.inc.js", "website/stylesheets/screen.css", "website/template.js", "website/template.rhtml", "website/version-raw.js", "website/version-raw.txt", "website/version.js", "website/version.txt"]
|
15
|
+
s.has_rdoc = true
|
16
|
+
s.homepage = %q{http://drnic.github.com/rubigen}
|
17
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{rubigen}
|
20
|
+
s.rubygems_version = %q{1.3.1}
|
21
|
+
s.summary = %q{A framework to allow Ruby applications to generate file/folder stubs (like the `rails` command does for Ruby on Rails, and the 'script/generate' command within a Rails application during development).}
|
22
|
+
s.test_files = ["test/test_application_generator_generator.rb", "test/test_component_generator_generator.rb", "test/test_generate_builtin_application.rb", "test/test_generate_builtin_test_unit.rb", "test/test_generator_helper.rb", "test/test_helper.rb", "test/test_install_rubigen_scripts_generator.rb", "test/test_lookup.rb", "test/test_rubigen_cli.rb"]
|
23
|
+
|
24
|
+
if s.respond_to? :specification_version then
|
25
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
26
|
+
s.specification_version = 2
|
27
|
+
|
28
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
29
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 2.2.2"])
|
30
|
+
s.add_development_dependency(%q<newgem>, [">= 1.2.3"])
|
31
|
+
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<activesupport>, [">= 2.2.2"])
|
34
|
+
s.add_dependency(%q<newgem>, [">= 1.2.3"])
|
35
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
36
|
+
end
|
37
|
+
else
|
38
|
+
s.add_dependency(%q<activesupport>, [">= 2.2.2"])
|
39
|
+
s.add_dependency(%q<newgem>, [">= 1.2.3"])
|
40
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
41
|
+
end
|
42
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,29 +1,8 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'test/unit'
|
2
3
|
require File.dirname(__FILE__) + '/../lib/rubigen'
|
3
4
|
require 'rubigen/helpers/generator_test_helper'
|
4
5
|
include RubiGen
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
begin
|
9
|
-
gem 'mocha'
|
10
|
-
rescue LoadError
|
11
|
-
puts <<-EOS
|
12
|
-
#{$!}
|
13
|
-
|
14
|
-
This RubyGem is required to run the tests.
|
15
|
-
|
16
|
-
Install: gem install mocha
|
17
|
-
EOS
|
18
|
-
end
|
19
|
-
require 'mocha'
|
20
|
-
end
|
21
|
-
begin
|
22
|
-
gem 'mocha'
|
23
|
-
rescue LoadError
|
24
|
-
load_mocha
|
25
|
-
rescue NoMethodError
|
26
|
-
load_mocha
|
27
|
-
end
|
28
|
-
|
29
|
-
require "shoulda"
|
6
|
+
require "shoulda"
|
7
|
+
require "shoulda/test_unit"
|
8
|
+
require 'mocha'
|
data/test/test_lookup.rb
CHANGED
@@ -4,15 +4,15 @@ class TestLookup < Test::Unit::TestCase
|
|
4
4
|
include RubiGen
|
5
5
|
|
6
6
|
def setup
|
7
|
-
Base.reset_sources
|
7
|
+
RubiGen::Base.reset_sources
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_lookup_component
|
11
|
-
assert_nothing_raised(GeneratorError, "Could not find install_rubigen_scripts generator") { Base.lookup('install_rubigen_scripts') }
|
11
|
+
assert_nothing_raised(GeneratorError, "Could not find install_rubigen_scripts generator") { RubiGen::Base.lookup('install_rubigen_scripts') }
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_lookup_unknown_component
|
15
|
-
assert_raise(GeneratorError, "Should not find generator") { Base.lookup('dummy') }
|
15
|
+
assert_raise(GeneratorError, "Should not find generator") { RubiGen::Base.lookup('dummy') }
|
16
16
|
end
|
17
17
|
|
18
18
|
# There are 5 sources of generators
|
@@ -25,7 +25,7 @@ class TestLookup < Test::Unit::TestCase
|
|
25
25
|
# Note, this differs from Rails generator:
|
26
26
|
# * RubyGems whose name is suffixed with _generator are not loaded (e.g. ajax_scaffold_generator)
|
27
27
|
def test_sources
|
28
|
-
sources = Base.sources
|
28
|
+
sources = RubiGen::Base.sources
|
29
29
|
assert(sources.find do |source|
|
30
30
|
source.path =~ /\.rubigen\/generators$/ if source.respond_to? :path
|
31
31
|
end, "One source should be HOME/.rubigen/generators")
|
@@ -69,38 +69,38 @@ class TestLookup < Test::Unit::TestCase
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def test_use_component_sources_without_scope
|
72
|
-
Base.use_component_sources!
|
73
|
-
gem_path_source = Base.sources.find { |source| source.is_a?(GemPathSource) }
|
72
|
+
RubiGen::Base.use_component_sources!
|
73
|
+
gem_path_source = RubiGen::Base.sources.find { |source| source.is_a?(GemPathSource) }
|
74
74
|
assert_not_nil(gem_path_source, "Where is the GemPathSource?")
|
75
75
|
assert_equal("", gem_path_source.send(:filter_str))
|
76
76
|
end
|
77
77
|
|
78
78
|
def test_use_component_sources_with_scope
|
79
|
-
Base.use_component_sources! :rubygems, :ruby
|
80
|
-
gem_path_source = Base.sources.find { |source| source.is_a?(GemPathSource) }
|
79
|
+
RubiGen::Base.use_component_sources! :rubygems, :ruby
|
80
|
+
gem_path_source = RubiGen::Base.sources.find { |source| source.is_a?(GemPathSource) }
|
81
81
|
assert_not_nil(gem_path_source, "Where is the GemPathSource?")
|
82
82
|
assert_equal("{rubygems_,ruby_,}", gem_path_source.send(:filter_str))
|
83
|
-
user_path_source = Base.sources.find { |source| source.is_a?(PathFilteredSource) }
|
83
|
+
user_path_source = RubiGen::Base.sources.find { |source| source.is_a?(PathFilteredSource) }
|
84
84
|
assert_not_nil(user_path_source, "Where is the PathFilteredSource?")
|
85
85
|
assert_match(/\.rubigen\/\{rubygems_,ruby_,\}generators/, user_path_source.path)
|
86
86
|
end
|
87
87
|
|
88
88
|
def test_use_application_sources
|
89
|
-
Base.use_application_sources!
|
89
|
+
RubiGen::Base.use_application_sources!
|
90
90
|
expected_path = File.expand_path(File.join(File.dirname(__FILE__), %w[.. app_generators]))
|
91
|
-
builtin_source = Base.sources.find { |s| s.path == expected_path if s.respond_to?(:path) }
|
91
|
+
builtin_source = RubiGen::Base.sources.find { |s| s.path == expected_path if s.respond_to?(:path) }
|
92
92
|
assert_not_nil(builtin_source, "Cannot find builtin generators")
|
93
93
|
assert_nothing_raised(GeneratorError) do
|
94
|
-
generator = Base.lookup('ruby_app')
|
94
|
+
generator = RubiGen::Base.lookup('ruby_app')
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
98
98
|
def test_use_application_sources_with_scope
|
99
|
-
Base.use_application_sources! :rubygems, :newgem
|
100
|
-
gem_path_source = Base.sources.find { |source| source.is_a?(GemPathSource) }
|
99
|
+
RubiGen::Base.use_application_sources! :rubygems, :newgem
|
100
|
+
gem_path_source = RubiGen::Base.sources.find { |source| source.is_a?(GemPathSource) }
|
101
101
|
assert_not_nil(gem_path_source, "Where is the GemPathSource?")
|
102
102
|
assert_equal("{app_,rubygems_,newgem_,}", gem_path_source.send(:filter_str))
|
103
|
-
user_path_source = Base.sources.find { |source| source.is_a?(PathFilteredSource) }
|
103
|
+
user_path_source = RubiGen::Base.sources.find { |source| source.is_a?(PathFilteredSource) }
|
104
104
|
assert_not_nil(user_path_source, "Where is the PathFilteredSource?")
|
105
105
|
assert_match(/\.rubigen\/\{app_,rubygems_,newgem_,\}generators/, user_path_source.path)
|
106
106
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubigen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
@@ -10,18 +10,48 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2010-02-11 00:00:00 +10:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: activesupport
|
18
18
|
type: :runtime
|
19
19
|
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - "="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 2.3.5
|
25
|
+
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: mocha
|
28
|
+
type: :runtime
|
29
|
+
version_requirement:
|
20
30
|
version_requirements: !ruby/object:Gem::Requirement
|
21
31
|
requirements:
|
22
32
|
- - ">="
|
23
33
|
- !ruby/object:Gem::Version
|
24
|
-
version:
|
34
|
+
version: 0.9.7
|
35
|
+
version:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: cucumber
|
38
|
+
type: :runtime
|
39
|
+
version_requirement:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.3.6
|
45
|
+
version:
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: thoughtbot-shoulda
|
48
|
+
type: :runtime
|
49
|
+
version_requirement:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.10.2
|
25
55
|
version:
|
26
56
|
- !ruby/object:Gem::Dependency
|
27
57
|
name: hoe
|
@@ -31,9 +61,12 @@ dependencies:
|
|
31
61
|
requirements:
|
32
62
|
- - ">="
|
33
63
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
64
|
+
version: 2.4.0
|
35
65
|
version:
|
36
|
-
description:
|
66
|
+
description: |-
|
67
|
+
A framework to allow Ruby applications to generate file/folder stubs
|
68
|
+
(like the `rails` command does for Ruby on Rails, and the 'script/generate'
|
69
|
+
command within a Rails application during development).
|
37
70
|
email:
|
38
71
|
- drnicwilliams@gmail.com
|
39
72
|
- jeremy@bitsweat.net
|
@@ -47,7 +80,6 @@ extra_rdoc_files:
|
|
47
80
|
- History.txt
|
48
81
|
- License.txt
|
49
82
|
- Manifest.txt
|
50
|
-
- README.rdoc
|
51
83
|
- Todo.txt
|
52
84
|
- app_generators/ruby_app/templates/README.txt
|
53
85
|
- website/index.txt
|
@@ -70,11 +102,14 @@ files:
|
|
70
102
|
- bin/install_rubigen_scripts
|
71
103
|
- bin/rubigen
|
72
104
|
- bin/ruby_app
|
105
|
+
- config/website.yml
|
73
106
|
- features/development.feature
|
74
107
|
- features/help.feature
|
75
108
|
- features/rubigen_cli.feature
|
76
|
-
- features/
|
77
|
-
- features/
|
109
|
+
- features/step_definitions/common_steps.rb
|
110
|
+
- features/support/common.rb
|
111
|
+
- features/support/env.rb
|
112
|
+
- features/support/matchers.rb
|
78
113
|
- generators/install_rubigen_scripts/install_rubigen_scripts_generator.rb
|
79
114
|
- generators/install_rubigen_scripts/templates/script/destroy
|
80
115
|
- generators/install_rubigen_scripts/templates/script/generate
|
@@ -94,6 +129,7 @@ files:
|
|
94
129
|
- lib/rubigen/scripts/update.rb
|
95
130
|
- lib/rubigen/simple_logger.rb
|
96
131
|
- lib/rubigen/spec.rb
|
132
|
+
- rubigen.gemspec
|
97
133
|
- rubygems_generators/application_generator/USAGE
|
98
134
|
- rubygems_generators/application_generator/application_generator_generator.rb
|
99
135
|
- rubygems_generators/application_generator/templates/bin
|
@@ -138,6 +174,8 @@ files:
|
|
138
174
|
- website/version.txt
|
139
175
|
has_rdoc: true
|
140
176
|
homepage: http://drnic.github.com/rubigen
|
177
|
+
licenses: []
|
178
|
+
|
141
179
|
post_install_message:
|
142
180
|
rdoc_options:
|
143
181
|
- --main
|
@@ -159,9 +197,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
197
|
requirements: []
|
160
198
|
|
161
199
|
rubyforge_project: rubigen
|
162
|
-
rubygems_version: 1.3.
|
200
|
+
rubygems_version: 1.3.5
|
163
201
|
signing_key:
|
164
|
-
specification_version:
|
202
|
+
specification_version: 3
|
165
203
|
summary: A framework to allow Ruby applications to generate file/folder stubs (like the `rails` command does for Ruby on Rails, and the 'script/generate' command within a Rails application during development).
|
166
204
|
test_files:
|
167
205
|
- test/test_application_generator_generator.rb
|