ore 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/ChangeLog.md +70 -7
- data/LICENSE.txt +1 -1
- data/README.md +93 -88
- data/Rakefile +5 -5
- data/data/ore/templates/base/README.md.erb +3 -0
- data/data/ore/templates/base/README.rdoc.erb +3 -0
- data/data/ore/templates/base/README.tt.erb +3 -0
- data/data/ore/templates/base/template.yml +2 -2
- data/data/ore/templates/bin/bin/[name].erb +1 -1
- data/data/ore/templates/bundler/Gemfile.erb +14 -3
- data/data/ore/templates/bundler/template.yml +7 -2
- data/data/ore/templates/bundler_tasks/_tasks.erb +1 -0
- data/data/ore/templates/bundler_tasks/template.yml +6 -0
- data/data/ore/templates/gem_package_task/_tasks.erb +5 -0
- data/data/ore/templates/gem_package_task/template.yml +4 -0
- data/data/ore/templates/gemspec/[name].gemspec.erb +45 -0
- data/data/ore/templates/gemspec/template.yml +2 -0
- data/data/ore/templates/{base → gemspec_yml}/[name].gemspec.erb +36 -55
- data/data/ore/templates/gemspec_yml/gemspec.yml.erb +41 -0
- data/data/ore/templates/gemspec_yml/template.yml +2 -0
- data/data/ore/templates/git/.gitignore.erb +3 -0
- data/data/ore/templates/git/template.yml +2 -0
- data/data/ore/templates/hg/.hgignore.erb +3 -0
- data/data/ore/templates/hg/template.yml +2 -0
- data/data/ore/templates/jeweler_tasks/_tasks.erb +3 -12
- data/data/ore/templates/jeweler_tasks/template.yml +4 -3
- data/data/ore/templates/rdoc/_tasks.erb +1 -1
- data/data/ore/templates/rdoc/template.yml +3 -0
- data/data/ore/templates/rspec/_tasks.erb +1 -1
- data/data/ore/templates/rspec/spec/spec_helper.rb.erb +1 -1
- data/data/ore/templates/rspec/template.yml +2 -2
- data/data/ore/templates/rubygems_tasks/_tasks.erb +14 -0
- data/data/ore/templates/rubygems_tasks/template.yml +7 -0
- data/data/ore/templates/rvmrc/.rvmrc.erb +9 -15
- data/data/ore/templates/yard/_gemfile_development.erb +0 -1
- data/data/ore/templates/yard/_tasks.erb +1 -1
- data/data/ore/templates/yard/template.yml +5 -2
- data/gemspec.yml +5 -7
- data/lib/ore.rb +0 -2
- data/lib/ore/actions.rb +85 -0
- data/lib/ore/cli.rb +2 -32
- data/lib/ore/config.rb +20 -20
- data/lib/ore/generator.rb +101 -203
- data/lib/ore/naming.rb +160 -0
- data/lib/ore/options.rb +67 -0
- data/lib/ore/template.rb +8 -0
- data/lib/ore/template/directory.rb +60 -41
- data/lib/ore/template/helpers.rb +55 -7
- data/lib/ore/template/template.rb +61 -0
- data/ore.gemspec +35 -55
- data/spec/gemspec_examples.rb +33 -0
- data/spec/generator_spec.rb +188 -70
- data/spec/helpers/generator.rb +4 -2
- data/spec/helpers/matchers.rb +33 -0
- data/spec/naming_spec.rb +56 -0
- data/spec/spec_helper.rb +1 -1
- metadata +104 -117
- data/data/ore/templates/base/.gitignore.erb +0 -3
- data/data/ore/templates/base/_gemfile_development.erb +0 -3
- data/data/ore/templates/base/gemspec.yml.erb +0 -30
- data/data/ore/templates/bundler/_development_dependencies.erb +0 -1
- data/data/ore/templates/bundler/_gitignore.erb +0 -2
- data/data/ore/templates/bundler/_tasks.erb +0 -3
- data/data/ore/templates/jeweler_tasks/_development_dependencies.erb +0 -3
- data/data/ore/templates/jeweler_tasks/_gemfile_development.erb +0 -1
- data/data/ore/templates/ore_tasks/_development_dependencies.erb +0 -3
- data/data/ore/templates/ore_tasks/_gemfile_development.erb +0 -1
- data/data/ore/templates/ore_tasks/_tasks.erb +0 -14
- data/data/ore/templates/ore_tasks/template.yml +0 -5
- data/data/ore/templates/rdoc/_gitignore.erb +0 -1
- data/data/ore/templates/rspec/_development_dependencies.erb +0 -3
- data/data/ore/templates/rspec/_gemfile_development.erb +0 -1
- data/data/ore/templates/yard/_development_dependencies.erb +0 -1
@@ -0,0 +1,61 @@
|
|
1
|
+
module Ore
|
2
|
+
module Template
|
3
|
+
#
|
4
|
+
# The templates registered with the generator.
|
5
|
+
#
|
6
|
+
# @return [Hash{Symbol => String}]
|
7
|
+
# The template names and paths.
|
8
|
+
#
|
9
|
+
# @api semipublic
|
10
|
+
#
|
11
|
+
# @since 0.9.0
|
12
|
+
#
|
13
|
+
def self.templates
|
14
|
+
@@templates ||= {}
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# Determines whether a template was registered.
|
19
|
+
#
|
20
|
+
# @param [Symbol, String] name
|
21
|
+
# The name of the template.
|
22
|
+
#
|
23
|
+
# @return [Boolean]
|
24
|
+
# Specifies whether the template was registered.
|
25
|
+
#
|
26
|
+
# @api semipublic
|
27
|
+
#
|
28
|
+
# @since 0.9.0
|
29
|
+
#
|
30
|
+
def self.template?(name)
|
31
|
+
self.templates.has_key?(name.to_sym)
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# Registers a template with the generator.
|
36
|
+
#
|
37
|
+
# @param [String] path
|
38
|
+
# The path to the template.
|
39
|
+
#
|
40
|
+
# @return [Symbol]
|
41
|
+
# The name of the registered template.
|
42
|
+
#
|
43
|
+
# @raise [StandardError]
|
44
|
+
# The given path was not a directory.
|
45
|
+
#
|
46
|
+
# @api semipublic
|
47
|
+
#
|
48
|
+
# @since 0.9.0
|
49
|
+
#
|
50
|
+
def self.register(path)
|
51
|
+
unless File.directory?(path)
|
52
|
+
raise(StandardError,"#{path.dump} is must be a directory")
|
53
|
+
end
|
54
|
+
|
55
|
+
name = File.basename(path).to_sym
|
56
|
+
|
57
|
+
self.templates[name] = path
|
58
|
+
return name
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/ore.gemspec
CHANGED
@@ -3,43 +3,44 @@
|
|
3
3
|
require 'yaml'
|
4
4
|
|
5
5
|
Gem::Specification.new do |gemspec|
|
6
|
-
root
|
6
|
+
root = File.dirname(__FILE__)
|
7
7
|
lib_dir = File.join(root,'lib')
|
8
|
-
files
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
17
17
|
|
18
18
|
filter_files = lambda { |paths|
|
19
|
-
case paths
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
files & case paths
|
20
|
+
when Array
|
21
|
+
paths
|
22
|
+
when String
|
23
|
+
Dir[paths]
|
24
|
+
end
|
25
25
|
}
|
26
26
|
|
27
27
|
version = {
|
28
|
-
:file
|
28
|
+
:file => 'ore/version.rb',
|
29
29
|
:constant => 'Ore::VERSION'
|
30
30
|
}
|
31
31
|
|
32
32
|
defaults = {
|
33
|
-
'name'
|
34
|
-
'files'
|
35
|
-
'
|
36
|
-
'
|
37
|
-
'
|
33
|
+
'name' => File.basename(File.dirname(__FILE__)),
|
34
|
+
'files' => files,
|
35
|
+
'require_paths' => ['ext', 'lib'].select { |dir| File.directory?(dir) },
|
36
|
+
'executables' => filter_files['bin/*'].map { |path| File.basename(path) },
|
37
|
+
'test_files' => filter_files['{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'],
|
38
|
+
'extra_doc_files' => filter_files['*.{txt,rdoc,md,markdown,tt,textile}']
|
38
39
|
}
|
39
40
|
|
40
41
|
metadata = defaults.merge(YAML.load_file('gemspec.yml'))
|
41
42
|
|
42
|
-
gemspec.name
|
43
|
+
gemspec.name = metadata['name']
|
43
44
|
gemspec.version = if metadata['version']
|
44
45
|
metadata['version']
|
45
46
|
else
|
@@ -49,50 +50,29 @@ Gem::Specification.new do |gemspec|
|
|
49
50
|
eval(version[:constant])
|
50
51
|
end
|
51
52
|
|
52
|
-
gemspec.summary
|
53
|
+
gemspec.summary = metadata.fetch('summary',metadata['description'])
|
53
54
|
gemspec.description = metadata.fetch('description',metadata['summary'])
|
54
55
|
|
55
|
-
|
56
|
-
|
57
|
-
gemspec.licenses = metadata['license']
|
58
|
-
when String
|
59
|
-
gemspec.license = metadata['license']
|
60
|
-
end
|
61
|
-
|
62
|
-
case metadata['authors']
|
63
|
-
when Array
|
64
|
-
gemspec.authors = metadata['authors']
|
65
|
-
when String
|
66
|
-
gemspec.author = metadata['authors']
|
67
|
-
end
|
56
|
+
gemspec.licenses = Array(metadata['license'])
|
57
|
+
gemspec.authors = Array(metadata['authors'])
|
68
58
|
|
69
|
-
gemspec.email
|
59
|
+
gemspec.email = metadata['email']
|
70
60
|
gemspec.homepage = metadata['homepage']
|
71
61
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
gemspec.require_path = metadata['require_paths']
|
77
|
-
end
|
78
|
-
|
79
|
-
gemspec.files = filter_files[metadata['files']]
|
80
|
-
|
81
|
-
gemspec.executables = metadata['executables']
|
82
|
-
gemspec.extensions = metadata['extensions']
|
62
|
+
gemspec.require_paths = Array(metadata['require_paths'])
|
63
|
+
gemspec.files = filter_files[metadata['files']]
|
64
|
+
gemspec.executables = metadata['executables']
|
65
|
+
gemspec.extensions = metadata['extensions']
|
83
66
|
|
84
67
|
if Gem::VERSION < '1.7.'
|
85
68
|
gemspec.default_executable = gemspec.executables.first
|
86
69
|
end
|
87
70
|
|
88
|
-
gemspec.test_files
|
89
|
-
|
90
|
-
unless gemspec.files.include?('.document')
|
91
|
-
gemspec.extra_rdoc_files = metadata['extra_doc_files']
|
92
|
-
end
|
71
|
+
gemspec.test_files = filter_files[metadata['test_files']]
|
72
|
+
gemspec.extra_rdoc_files = Array(metadata['extra_doc_files'])
|
93
73
|
|
94
74
|
gemspec.post_install_message = metadata['post_install_message']
|
95
|
-
gemspec.requirements
|
75
|
+
gemspec.requirements = metadata['requirements']
|
96
76
|
|
97
77
|
if gemspec.respond_to?(:required_ruby_version=)
|
98
78
|
gemspec.required_ruby_version = metadata['required_ruby_version']
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
|
3
|
+
require 'ore/options'
|
4
|
+
|
5
|
+
shared_examples "a gemspec" do
|
6
|
+
it "should have a name" do
|
7
|
+
subject.name.should == name
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should not contain a version by default" do
|
11
|
+
subject.version.version.should == Ore::Options::DEFAULT_VERSION
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should a dummy summary" do
|
15
|
+
subject.summary.should == Ore::Options::DEFAULT_SUMMARY
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should a dummy description" do
|
19
|
+
subject.description.should == Ore::Options::DEFAULT_DESCRIPTION
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should have a license" do
|
23
|
+
subject.license.should == Ore::Options::DEFAULT_LICENSE
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should have authors" do
|
27
|
+
subject.authors.should == Ore::Options::DEFAULT_AUTHORS
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have a dummy homepage" do
|
31
|
+
subject.homepage.should_not be_empty
|
32
|
+
end
|
33
|
+
end
|
data/spec/generator_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'gemspec_examples'
|
2
3
|
require 'helpers/generator'
|
3
4
|
require 'ore/generator'
|
4
5
|
|
@@ -17,38 +18,70 @@ describe Generator do
|
|
17
18
|
end
|
18
19
|
|
19
20
|
it "should create the lib/ directory" do
|
20
|
-
@path.
|
21
|
+
@path.should have_directory('lib')
|
21
22
|
end
|
22
23
|
|
23
24
|
it "should create a file to load the project within lib/" do
|
24
|
-
@path.
|
25
|
+
@path.should have_file('lib','my','project.rb')
|
25
26
|
end
|
26
27
|
|
27
28
|
it "should create a namespace directory within lib/" do
|
28
|
-
@path.
|
29
|
+
@path.should have_directory('lib','my','project')
|
29
30
|
end
|
30
31
|
|
31
32
|
it "should create a version.rb file within the namespace directory" do
|
32
|
-
@path.
|
33
|
+
@path.should have_file('lib','my','project','version.rb')
|
33
34
|
end
|
34
35
|
|
35
36
|
it "should not create the bin/ directory by default" do
|
36
|
-
@path.
|
37
|
+
@path.should_not have_directory('bin')
|
37
38
|
end
|
38
39
|
|
39
40
|
it "should create a test/ directory by default" do
|
40
|
-
@path.
|
41
|
+
@path.should_not have_directory('test')
|
41
42
|
end
|
42
43
|
|
43
|
-
it "should
|
44
|
-
@path.join(
|
44
|
+
it "should add a *.gemspec file" do
|
45
|
+
@path.join("#{name}.gemspec").should be_file
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should add a .document file" do
|
49
|
+
@path.should have_file('.document')
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should add a Rakefile" do
|
53
|
+
@path.should have_file('Rakefile')
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should add a README.rdoc file" do
|
57
|
+
@path.should have_file('README.rdoc')
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should add a ChangeLog.rdoc file" do
|
61
|
+
@path.should have_file('ChangeLog.rdoc')
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should add a LICENSE.txt file" do
|
65
|
+
@path.should have_file('LICENSE.txt')
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context "gemspec_yml" do
|
70
|
+
let(:name) { 'gemspec_yml_project' }
|
71
|
+
|
72
|
+
before(:all) do
|
73
|
+
generate!(name, :gemspec_yml => true)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should add a gemspec.yml file" do
|
77
|
+
@path.should have_file('gemspec.yml')
|
45
78
|
end
|
46
79
|
|
47
80
|
describe "gemspec.yml" do
|
48
|
-
subject { @gemspec }
|
81
|
+
subject { YAML.load_file(@path.join('gemspec.yml')) }
|
49
82
|
|
50
83
|
it "should have a name" do
|
51
|
-
subject['name'].should ==
|
84
|
+
subject['name'].should == name
|
52
85
|
end
|
53
86
|
|
54
87
|
it "should not contain a version by default" do
|
@@ -56,72 +89,117 @@ describe Generator do
|
|
56
89
|
end
|
57
90
|
|
58
91
|
it "should a dummy summary" do
|
59
|
-
subject['summary'].
|
92
|
+
subject['summary'].should == Ore::Options::DEFAULT_SUMMARY
|
60
93
|
end
|
61
94
|
|
62
|
-
it "should a description
|
63
|
-
subject['description'].
|
95
|
+
it "should a dummy description" do
|
96
|
+
subject['description'].should == Ore::Options::DEFAULT_DESCRIPTION
|
64
97
|
end
|
65
98
|
|
66
99
|
it "should have a license" do
|
67
|
-
subject['license'].should ==
|
100
|
+
subject['license'].should == Ore::Options::DEFAULT_LICENSE
|
68
101
|
end
|
69
102
|
|
70
103
|
it "should have authors" do
|
71
|
-
subject['authors'].
|
104
|
+
subject['authors'].should == Ore::Options::DEFAULT_AUTHORS[0]
|
72
105
|
end
|
73
106
|
|
74
107
|
it "should have a dummy homepage" do
|
75
108
|
subject['homepage'].should_not be_empty
|
76
109
|
end
|
77
110
|
|
78
|
-
it "should have '
|
79
|
-
subject['development_dependencies'].should have_key('
|
111
|
+
it "should have 'rubygems-tasks' as a development dependency" do
|
112
|
+
subject['development_dependencies'].should have_key('rubygems-tasks')
|
80
113
|
end
|
81
114
|
end
|
82
115
|
|
83
116
|
it "should add a *.gemspec file" do
|
84
|
-
@path.
|
117
|
+
@path.should have_file("#{name}.gemspec")
|
85
118
|
end
|
86
119
|
|
87
|
-
|
88
|
-
@
|
120
|
+
describe "*.gemspec file" do
|
121
|
+
subject { @gemspec }
|
122
|
+
|
123
|
+
it_should_behave_like "a gemspec"
|
89
124
|
end
|
125
|
+
end
|
90
126
|
|
91
|
-
|
92
|
-
|
127
|
+
context "gemspec" do
|
128
|
+
let(:name) { 'gemspec_project' }
|
129
|
+
|
130
|
+
before(:all) do
|
131
|
+
generate!(name, :gemspec => true)
|
93
132
|
end
|
94
133
|
|
95
|
-
it "should
|
96
|
-
@
|
134
|
+
it "should disable the gemspec_yml template" do
|
135
|
+
@generator.disabled_templates.should include(:gemspec_yml)
|
97
136
|
end
|
98
137
|
|
99
|
-
it "should add a
|
100
|
-
@path.
|
138
|
+
it "should add a *.gemspec file" do
|
139
|
+
@path.should have_file("#{name}.gemspec")
|
101
140
|
end
|
102
141
|
|
103
|
-
|
104
|
-
@
|
142
|
+
context "*.gemspec file" do
|
143
|
+
subject { @gemspec }
|
144
|
+
|
145
|
+
it_should_behave_like "a gemspec"
|
146
|
+
|
147
|
+
it "should have 'rubygems-tasks' as a development dependency" do
|
148
|
+
subject.should have_development_dependency('rubygems-tasks')
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
context "git" do
|
154
|
+
let(:name) { 'git-project' }
|
155
|
+
|
156
|
+
before(:all) do
|
157
|
+
generate!(name, :git => true)
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should create a .git directory" do
|
161
|
+
@path.should have_directory('.git')
|
162
|
+
end
|
163
|
+
|
164
|
+
it "should create a .gitignore file" do
|
165
|
+
@path.should have_file('.gitignore')
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
context "hg" do
|
170
|
+
let(:name) { 'hg-project' }
|
171
|
+
|
172
|
+
before(:all) do
|
173
|
+
generate!(name, :hg => true)
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should create a .hg directory" do
|
177
|
+
@path.should have_directory('.hg')
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should create a .hgignore file" do
|
181
|
+
@path.should have_file('.hgignore')
|
105
182
|
end
|
106
183
|
end
|
107
184
|
|
108
185
|
context "bin" do
|
109
|
-
let(:name)
|
186
|
+
let(:name) { 'script-project' }
|
187
|
+
let(:script) { File.join('bin',name) }
|
110
188
|
|
111
189
|
before(:all) do
|
112
190
|
generate!(name, :bin => true)
|
113
191
|
end
|
114
192
|
|
115
193
|
it "should add a 'bin/' directory" do
|
116
|
-
@path.
|
194
|
+
@path.should have_directory('bin')
|
117
195
|
end
|
118
196
|
|
119
197
|
it "should add a bin/script-project file" do
|
120
|
-
@path.
|
198
|
+
@path.should have_file(script)
|
121
199
|
end
|
122
200
|
|
123
201
|
it "should make the bin/script-project file executable" do
|
124
|
-
@path.
|
202
|
+
@path.should have_executable(script)
|
125
203
|
end
|
126
204
|
end
|
127
205
|
|
@@ -133,7 +211,7 @@ describe Generator do
|
|
133
211
|
end
|
134
212
|
|
135
213
|
it "should add a .gemtest file" do
|
136
|
-
@path.
|
214
|
+
@path.should have_file('.gemtest')
|
137
215
|
end
|
138
216
|
end
|
139
217
|
|
@@ -145,11 +223,11 @@ describe Generator do
|
|
145
223
|
end
|
146
224
|
|
147
225
|
it "should add a Gemfile" do
|
148
|
-
@path.
|
226
|
+
@path.should have_file('Gemfile')
|
149
227
|
end
|
150
228
|
|
151
229
|
it "should add 'bundler' as a development dependency" do
|
152
|
-
@gemspec
|
230
|
+
@gemspec.should have_development_dependency('bundler')
|
153
231
|
end
|
154
232
|
|
155
233
|
it "should add 'Gemfile.lock' to the .gitignore file" do
|
@@ -177,7 +255,7 @@ describe Generator do
|
|
177
255
|
end
|
178
256
|
|
179
257
|
it "should add a '.document' file" do
|
180
|
-
@path.
|
258
|
+
@path.should have_file('.document')
|
181
259
|
end
|
182
260
|
|
183
261
|
context ".document" do
|
@@ -211,11 +289,11 @@ describe Generator do
|
|
211
289
|
end
|
212
290
|
|
213
291
|
it "should add a .yardopts file" do
|
214
|
-
@path.
|
292
|
+
@path.should have_file('.yardopts')
|
215
293
|
end
|
216
294
|
|
217
295
|
it "should add a '.document' file" do
|
218
|
-
@path.
|
296
|
+
@path.should have_file('.document')
|
219
297
|
end
|
220
298
|
|
221
299
|
context ".document" do
|
@@ -249,11 +327,11 @@ describe Generator do
|
|
249
327
|
end
|
250
328
|
|
251
329
|
it "should add a README.md file" do
|
252
|
-
@path.
|
330
|
+
@path.should have_file('README.md')
|
253
331
|
end
|
254
332
|
|
255
333
|
it "should add a ChangeLog.md file" do
|
256
|
-
@path.
|
334
|
+
@path.should have_file('ChangeLog.md')
|
257
335
|
end
|
258
336
|
|
259
337
|
it "should set --markup to markdown in .yardopts" do
|
@@ -269,11 +347,11 @@ describe Generator do
|
|
269
347
|
end
|
270
348
|
|
271
349
|
it "should add a README.tt file" do
|
272
|
-
@path.
|
350
|
+
@path.should have_file('README.tt')
|
273
351
|
end
|
274
352
|
|
275
353
|
it "should add a ChangeLog.tt file" do
|
276
|
-
@path.
|
354
|
+
@path.should have_file('ChangeLog.tt')
|
277
355
|
end
|
278
356
|
|
279
357
|
it "should set --markup to textile in .yardopts" do
|
@@ -289,7 +367,7 @@ describe Generator do
|
|
289
367
|
end
|
290
368
|
|
291
369
|
it "should still add 'yard' as a development dependency" do
|
292
|
-
@gemspec
|
370
|
+
@gemspec.should have_development_dependency('yard')
|
293
371
|
end
|
294
372
|
end
|
295
373
|
|
@@ -305,15 +383,15 @@ describe Generator do
|
|
305
383
|
end
|
306
384
|
|
307
385
|
it "should create the test/ directory" do
|
308
|
-
@path.
|
386
|
+
@path.should have_directory('test')
|
309
387
|
end
|
310
388
|
|
311
389
|
it "should create the test/helper.rb file" do
|
312
|
-
@path.
|
390
|
+
@path.should have_file('test','helper.rb')
|
313
391
|
end
|
314
392
|
|
315
393
|
it "should add a single test_*.rb file" do
|
316
|
-
@path.
|
394
|
+
@path.should have_file('test','test_test_unit_project.rb')
|
317
395
|
end
|
318
396
|
end
|
319
397
|
|
@@ -329,27 +407,27 @@ describe Generator do
|
|
329
407
|
end
|
330
408
|
|
331
409
|
it "should not create the test/ directory" do
|
332
|
-
@path.
|
410
|
+
@path.should_not have_directory('test')
|
333
411
|
end
|
334
412
|
|
335
413
|
it "should create the spec/ directory" do
|
336
|
-
@path.
|
414
|
+
@path.should have_directory('spec')
|
337
415
|
end
|
338
416
|
|
339
417
|
it "should add a spec_helper.rb file" do
|
340
|
-
@path.
|
418
|
+
@path.should have_file('spec','spec_helper.rb')
|
341
419
|
end
|
342
420
|
|
343
421
|
it "should add a single *_spec.rb file" do
|
344
|
-
@path.
|
422
|
+
@path.should have_file('spec','rspec_project_spec.rb')
|
345
423
|
end
|
346
424
|
|
347
425
|
it "should add a .rspec file" do
|
348
|
-
@path.
|
426
|
+
@path.should have_file('.rspec')
|
349
427
|
end
|
350
428
|
|
351
429
|
it "should add 'rspec' as a development dependency" do
|
352
|
-
@gemspec
|
430
|
+
@gemspec.should have_development_dependency('rspec')
|
353
431
|
end
|
354
432
|
end
|
355
433
|
|
@@ -361,7 +439,7 @@ describe Generator do
|
|
361
439
|
end
|
362
440
|
|
363
441
|
it "should not add 'rspec' as a development dependency" do
|
364
|
-
@gemspec
|
442
|
+
@gemspec.should_not have_development_dependency('rspec')
|
365
443
|
end
|
366
444
|
end
|
367
445
|
|
@@ -372,12 +450,16 @@ describe Generator do
|
|
372
450
|
generate!(name, :jeweler_tasks => true)
|
373
451
|
end
|
374
452
|
|
375
|
-
it "should disable the
|
376
|
-
@generator.disabled_templates.should include(:
|
453
|
+
it "should disable the rubygems_tasks template" do
|
454
|
+
@generator.disabled_templates.should include(:rubygems_tasks)
|
455
|
+
end
|
456
|
+
|
457
|
+
it "should disable the bundler_tasks template" do
|
458
|
+
@generator.disabled_templates.should include(:bundler_tasks)
|
377
459
|
end
|
378
460
|
|
379
461
|
it "should add 'jeweler' as a development dependency" do
|
380
|
-
@gemspec
|
462
|
+
@gemspec.should have_development_dependency('jeweler')
|
381
463
|
end
|
382
464
|
end
|
383
465
|
|
@@ -389,43 +471,79 @@ describe Generator do
|
|
389
471
|
end
|
390
472
|
|
391
473
|
it "should not add 'jeweler' as a development dependency" do
|
392
|
-
@gemspec
|
474
|
+
@gemspec.should_not have_development_dependency('jeweler')
|
393
475
|
end
|
394
476
|
end
|
395
477
|
|
396
|
-
context "
|
397
|
-
let(:name) { '
|
478
|
+
context "rubygems-tasks" do
|
479
|
+
let(:name) { 'rubygems_tasks_project' }
|
398
480
|
|
399
481
|
before(:all) do
|
400
|
-
generate!(name, :
|
482
|
+
generate!(name, :rubygems_tasks => true)
|
401
483
|
end
|
402
484
|
|
403
485
|
it "should disable the jeweler_tasks template" do
|
404
486
|
@generator.disabled_templates.should include(:jeweler_tasks)
|
405
487
|
end
|
406
488
|
|
407
|
-
it "should
|
408
|
-
@
|
489
|
+
it "should disable the bundler_tasks template" do
|
490
|
+
@generator.disabled_templates.should include(:bundler_tasks)
|
409
491
|
end
|
410
492
|
|
411
|
-
it "should add '
|
412
|
-
@gemspec
|
493
|
+
it "should add 'rubygems-tasks' as a development dependency" do
|
494
|
+
@gemspec.should have_development_dependency('rubygems-tasks')
|
413
495
|
end
|
414
496
|
end
|
415
497
|
|
416
|
-
context "
|
498
|
+
context "rubygems-tasks with bundler" do
|
417
499
|
let(:name) { 'bundled_ore_project' }
|
418
500
|
|
419
501
|
before(:all) do
|
420
|
-
generate!(name, :bundler => true, :
|
502
|
+
generate!(name, :bundler => true, :rubygems_tasks => true)
|
503
|
+
end
|
504
|
+
|
505
|
+
it "should not add 'rubygems-tasks' as a development dependency" do
|
506
|
+
@gemspec.should_not have_development_dependency('rubygems-tasks')
|
421
507
|
end
|
508
|
+
end
|
509
|
+
|
510
|
+
context "bundler_tasks" do
|
511
|
+
let(:name) { 'bundler_tasks_project' }
|
422
512
|
|
423
|
-
|
424
|
-
|
513
|
+
before(:all) do
|
514
|
+
generate!(name, :bundler_tasks => true)
|
515
|
+
end
|
516
|
+
|
517
|
+
it "should disable the jeweler_tasks template" do
|
518
|
+
@generator.disabled_templates.should include(:jeweler_tasks)
|
519
|
+
end
|
520
|
+
|
521
|
+
it "should disable the rubygems_tasks template" do
|
522
|
+
@generator.disabled_templates.should include(:rubygems_tasks)
|
523
|
+
end
|
524
|
+
|
525
|
+
it "should enable the bundler template" do
|
526
|
+
@generator.enabled_templates.should include(:bundler)
|
527
|
+
end
|
528
|
+
end
|
529
|
+
|
530
|
+
context "gem_package_task" do
|
531
|
+
let(:name) { 'gem_package_task_project' }
|
532
|
+
|
533
|
+
before(:all) do
|
534
|
+
generate!(name, :gem_package_task => true)
|
535
|
+
end
|
536
|
+
|
537
|
+
it "should disable the rubygems_tasks template" do
|
538
|
+
@generator.disabled_templates.should include(:rubygems_tasks)
|
539
|
+
end
|
540
|
+
|
541
|
+
it "should disable the jeweler_tasks template" do
|
542
|
+
@generator.disabled_templates.should include(:jeweler_tasks)
|
425
543
|
end
|
426
544
|
|
427
|
-
it "should
|
428
|
-
@
|
545
|
+
it "should disable the bundler_tasks template" do
|
546
|
+
@generator.disabled_templates.should include(:bundler_tasks)
|
429
547
|
end
|
430
548
|
end
|
431
549
|
|