ore 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -5
  3. data/.gitmodules +54 -0
  4. data/ChangeLog.md +90 -21
  5. data/Gemfile +12 -0
  6. data/LICENSE.txt +1 -1
  7. data/README.md +61 -27
  8. data/Rakefile +23 -24
  9. data/data/ore/abbreviations.txt +47 -0
  10. data/data/ore/common_namespaces.yml +13 -0
  11. data/data/ore/templates/apache/LICENSE.txt +202 -0
  12. data/data/ore/templates/apache/NOTICE.txt.erb +5 -0
  13. data/data/ore/templates/apache/lib/[namespace_path]/_copyright.erb +18 -0
  14. data/data/ore/templates/apache/template.yml +3 -0
  15. data/data/ore/templates/bsd/LICENSE.txt.erb +23 -0
  16. data/data/ore/templates/bsd/template.yml +6 -0
  17. data/data/ore/templates/bundler/Gemfile.erb +1 -1
  18. data/data/ore/templates/bundler/_tasks.erb +3 -0
  19. data/data/ore/templates/bundler/template.yml +5 -4
  20. data/data/ore/templates/code_climate/_badges.erb +1 -0
  21. data/data/ore/templates/code_climate/template.yml +2 -0
  22. data/data/ore/templates/{base → gem}/ChangeLog.md.erb +0 -0
  23. data/data/ore/templates/{base → gem}/ChangeLog.rdoc.erb +0 -0
  24. data/data/ore/templates/{base → gem}/ChangeLog.tt.erb +0 -0
  25. data/data/ore/templates/{base → gem}/README.md.erb +10 -4
  26. data/data/ore/templates/{base → gem}/README.rdoc.erb +12 -2
  27. data/data/ore/templates/{base → gem}/README.tt.erb +10 -4
  28. data/data/ore/templates/gem/Rakefile.erb +15 -0
  29. data/data/ore/templates/{gemspec → gem}/[name].gemspec.erb +21 -1
  30. data/data/ore/templates/{base → gem}/lib/[namespace_path].rb.erb +0 -0
  31. data/data/ore/templates/{base → gem}/lib/[namespace_path]/version.rb.erb +4 -0
  32. data/data/ore/templates/gem/template.yml +5 -0
  33. data/data/ore/templates/gem_package_task/template.yml +3 -0
  34. data/data/ore/templates/gemspec_yml/[name].gemspec.erb +1 -1
  35. data/data/ore/templates/gpl/COPYING.txt +674 -0
  36. data/data/ore/templates/gpl/lib/[namespace_path]/_copyright.erb +20 -0
  37. data/data/ore/templates/gpl/template.yml +7 -0
  38. data/data/ore/templates/lgpl/COPYING.txt +165 -0
  39. data/data/ore/templates/lgpl/lib/[namespace_path]/_copyright.erb +20 -0
  40. data/data/ore/templates/lgpl/template.yml +6 -0
  41. data/data/ore/templates/minitest/_tasks.erb +7 -0
  42. data/data/ore/templates/minitest/template.yml +6 -0
  43. data/data/ore/templates/minitest/test/helper.rb.erb +11 -0
  44. data/data/ore/templates/{mini_test → minitest}/test/test_[name].rb.erb +1 -1
  45. data/data/ore/templates/{base → mit}/LICENSE.txt.erb +0 -0
  46. data/data/ore/templates/mit/template.yml +8 -0
  47. data/data/ore/templates/rdoc/.document.erb +6 -0
  48. data/data/ore/templates/rdoc/.rdoc_options.erb +16 -0
  49. data/data/ore/templates/rdoc/_tasks.erb +5 -9
  50. data/data/ore/templates/rdoc/template.yml +2 -5
  51. data/data/ore/templates/rspec/_tasks.erb +1 -2
  52. data/data/ore/templates/rspec/spec/[namespace_dir]_spec.rb.erb +1 -1
  53. data/data/ore/templates/rspec/spec/spec_helper.rb.erb +0 -3
  54. data/data/ore/templates/rspec/template.yml +2 -2
  55. data/data/ore/templates/rubygems_tasks/_tasks.erb +0 -1
  56. data/data/ore/templates/rubygems_tasks/template.yml +3 -0
  57. data/data/ore/templates/test_unit/template.yml +1 -1
  58. data/data/ore/templates/test_unit/test/helper.rb.erb +3 -13
  59. data/data/ore/templates/travis/.travis.yml +6 -0
  60. data/data/ore/templates/travis/_badges.erb +1 -0
  61. data/data/ore/templates/yard/.document.erb +3 -1
  62. data/data/ore/templates/yard/_tasks.erb +2 -3
  63. data/data/ore/templates/yard/template.yml +2 -1
  64. data/gemspec.yml +6 -7
  65. data/lib/ore/actions.rb +1 -1
  66. data/lib/ore/cli.rb +1 -0
  67. data/lib/ore/config.rb +33 -41
  68. data/lib/ore/generator.rb +104 -66
  69. data/lib/ore/naming.rb +12 -19
  70. data/lib/ore/options.rb +71 -40
  71. data/lib/ore/template/directory.rb +3 -9
  72. data/lib/ore/template/helpers.rb +26 -2
  73. data/lib/ore/template/helpers/markdown.rb +96 -0
  74. data/lib/ore/template/helpers/rdoc.rb +96 -0
  75. data/lib/ore/template/helpers/textile.rb +106 -0
  76. data/lib/ore/template/markup.rb +19 -0
  77. data/lib/ore/version.rb +1 -1
  78. data/ore.gemspec +11 -0
  79. data/spec/gemspec_examples.rb +8 -8
  80. data/spec/generator_spec.rb +231 -181
  81. data/spec/helpers/generator.rb +5 -1
  82. data/spec/naming_spec.rb +11 -11
  83. data/spec/spec_helper.rb +0 -1
  84. data/spec/template/helpers/markdown_spec.rb +84 -0
  85. data/spec/template/helpers/rdoc_spec.rb +84 -0
  86. data/spec/template/helpers/textile_spec.rb +92 -0
  87. metadata +84 -85
  88. data/.gemtest +0 -0
  89. data/data/ore/templates/base/Rakefile.erb +0 -25
  90. data/data/ore/templates/base/template.yml +0 -2
  91. data/data/ore/templates/bundler_tasks/_tasks.erb +0 -1
  92. data/data/ore/templates/bundler_tasks/template.yml +0 -6
  93. data/data/ore/templates/gemspec/template.yml +0 -2
  94. data/data/ore/templates/gemspec_yml/template.yml +0 -2
  95. data/data/ore/templates/mini_test/template.yml +0 -3
  96. data/data/ore/templates/mini_test/test/helper.rb.erb +0 -26
  97. data/data/ore/templates/rdoc/.document +0 -4
@@ -0,0 +1,19 @@
1
+ module Ore
2
+ module Template
3
+ module Markup
4
+ # Official file extensions for various markups
5
+ EXT = {
6
+ markdown: 'md',
7
+ textile: 'tt',
8
+ rdoc: 'rdoc'
9
+ }
10
+
11
+ # Other common file extensions for various markups
12
+ EXTS = {
13
+ markdown: %w[.md .markdown],
14
+ textile: %w[.tt .textile],
15
+ rdoc: %w[.rdoc]
16
+ }
17
+ end
18
+ end
19
+ end
@@ -1,4 +1,4 @@
1
1
  module Ore
2
2
  # ore version
3
- VERSION = '0.10.0'
3
+ VERSION = '0.11.0'
4
4
  end
@@ -24,6 +24,17 @@ Gem::Specification.new do |gem|
24
24
  glob = lambda { |patterns| gem.files & Dir[*patterns] }
25
25
 
26
26
  gem.files = `git ls-files`.split($/)
27
+
28
+ `git submodule --quiet foreach --recursive pwd`.split($/).each do |submodule|
29
+ submodule.sub!("#{Dir.pwd}/",'')
30
+
31
+ Dir.chdir(submodule) do
32
+ `git ls-files`.split($/).map do |subpath|
33
+ gem.files << File.join(submodule,subpath)
34
+ end
35
+ end
36
+ end
37
+
27
38
  gem.files = glob[gemspec['files']] if gemspec['files']
28
39
 
29
40
  gem.executables = gemspec.fetch('executables') do
@@ -1,33 +1,33 @@
1
1
  require 'rspec'
2
2
 
3
- require 'ore/options'
3
+ require 'ore/generator'
4
4
 
5
5
  shared_examples "a gemspec" do
6
6
  it "should have a name" do
7
- subject.name.should == name
7
+ expect(subject.name).to eq(@name)
8
8
  end
9
9
 
10
10
  it "should not contain a version by default" do
11
- subject.version.version.should == Ore::Options::DEFAULT_VERSION
11
+ expect(subject.version.version).to eq(Ore::Options::DEFAULT_VERSION)
12
12
  end
13
13
 
14
14
  it "should a dummy summary" do
15
- subject.summary.should == Ore::Options::DEFAULT_SUMMARY
15
+ expect(subject.summary).to eq(Ore::Options::DEFAULT_SUMMARY)
16
16
  end
17
17
 
18
18
  it "should a dummy description" do
19
- subject.description.should == Ore::Options::DEFAULT_DESCRIPTION
19
+ expect(subject.description).to eq(Ore::Options::DEFAULT_DESCRIPTION)
20
20
  end
21
21
 
22
22
  it "should have a license" do
23
- subject.license.should == Ore::Options::DEFAULT_LICENSE
23
+ expect(subject.license).to be == 'MIT'
24
24
  end
25
25
 
26
26
  it "should have authors" do
27
- subject.authors.should_not be_empty
27
+ expect(subject.authors).not_to be_empty
28
28
  end
29
29
 
30
30
  it "should have a dummy homepage" do
31
- subject.homepage.should_not be_empty
31
+ expect(subject.homepage).not_to be_empty
32
32
  end
33
33
  end
@@ -7,114 +7,135 @@ describe Generator do
7
7
  include Helpers::Generator
8
8
 
9
9
  context "default" do
10
- let(:name) { 'my-project' }
11
-
12
10
  before(:all) do
13
- generate!(name)
11
+ @name = 'my-project'
12
+
13
+ generate!(@name)
14
14
  end
15
15
 
16
16
  it "should create the project root directory" do
17
- @path.should be_directory
17
+ expect(@path).to be_directory
18
18
  end
19
19
 
20
20
  it "should create the lib/ directory" do
21
- @path.should have_directory('lib')
21
+ expect(@path).to have_directory('lib')
22
22
  end
23
23
 
24
24
  it "should create a file to load the project within lib/" do
25
- @path.should have_file('lib','my','project.rb')
25
+ expect(@path).to have_file('lib','my','project.rb')
26
26
  end
27
27
 
28
28
  it "should create a namespace directory within lib/" do
29
- @path.should have_directory('lib','my','project')
29
+ expect(@path).to have_directory('lib','my','project')
30
30
  end
31
31
 
32
32
  it "should create a version.rb file within the namespace directory" do
33
- @path.should have_file('lib','my','project','version.rb')
33
+ expect(@path).to have_file('lib','my','project','version.rb')
34
34
  end
35
35
 
36
36
  it "should not create the bin/ directory by default" do
37
- @path.should_not have_directory('bin')
37
+ expect(@path).not_to have_directory('bin')
38
38
  end
39
39
 
40
40
  it "should create a test/ directory by default" do
41
- @path.should_not have_directory('test')
41
+ expect(@path).not_to have_directory('test')
42
42
  end
43
43
 
44
44
  it "should add a *.gemspec file" do
45
- @path.join("#{name}.gemspec").should be_file
45
+ expect(@path.join("#{@name}.gemspec")).to be_file
46
46
  end
47
47
 
48
48
  it "should add a .document file" do
49
- @path.should have_file('.document')
49
+ expect(@path).to have_file('.document')
50
50
  end
51
51
 
52
52
  it "should add a Rakefile" do
53
- @path.should have_file('Rakefile')
53
+ expect(@path).to have_file('Rakefile')
54
54
  end
55
55
 
56
- it "should add a README.rdoc file" do
57
- @path.should have_file('README.rdoc')
56
+ it "should add a README.md file" do
57
+ expect(@path).to have_file('README.md')
58
58
  end
59
59
 
60
- it "should add a ChangeLog.rdoc file" do
61
- @path.should have_file('ChangeLog.rdoc')
60
+ it "should add a ChangeLog.md file" do
61
+ expect(@path).to have_file('ChangeLog.md')
62
62
  end
63
63
 
64
64
  it "should add a LICENSE.txt file" do
65
- @path.should have_file('LICENSE.txt')
65
+ expect(@path).to have_file('LICENSE.txt')
66
+ end
67
+
68
+ it "should add a Gemfile" do
69
+ expect(@path).to have_file('Gemfile')
70
+ end
71
+
72
+ it "should add 'bundler' as a development dependency" do
73
+ expect(@gemspec).to have_development_dependency('bundler')
74
+ end
75
+
76
+ it "should not have any dependencies in the Gemfile" do
77
+ gemfile = (@path + 'Gemfile').read
78
+ expect(gemfile).to eq(<<-GEMFILE)
79
+ source 'https://rubygems.org'
80
+
81
+ gemspec
82
+ GEMFILE
83
+ end
84
+
85
+ it "should add 'Gemfile.lock' to the .gitignore file" do
86
+ expect(gitignore).to include('/Gemfile.lock')
66
87
  end
67
88
  end
68
89
 
69
90
  context "gemspec_yml" do
70
- let(:name) { 'gemspec_yml_project' }
71
-
72
91
  before(:all) do
73
- generate!(name, :gemspec_yml => true)
92
+ @name = 'gemspec_yml_project'
93
+
94
+ generate!(@name, gemspec_yml: true)
74
95
  end
75
96
 
76
97
  it "should add a gemspec.yml file" do
77
- @path.should have_file('gemspec.yml')
98
+ expect(@path).to have_file('gemspec.yml')
78
99
  end
79
100
 
80
101
  describe "gemspec.yml" do
81
102
  subject { YAML.load_file(@path.join('gemspec.yml')) }
82
103
 
83
104
  it "should have a name" do
84
- subject['name'].should == name
105
+ expect(subject['name']).to eq(@name)
85
106
  end
86
107
 
87
108
  it "should not contain a version by default" do
88
- subject.should_not have_key('version')
109
+ expect(subject).not_to have_key('version')
89
110
  end
90
111
 
91
112
  it "should a dummy summary" do
92
- subject['summary'].should == Ore::Options::DEFAULT_SUMMARY
113
+ expect(subject['summary']).to eq(Ore::Options::DEFAULT_SUMMARY)
93
114
  end
94
115
 
95
116
  it "should a dummy description" do
96
- subject['description'].should == Ore::Options::DEFAULT_DESCRIPTION
117
+ expect(subject['description']).to eq(Ore::Options::DEFAULT_DESCRIPTION)
97
118
  end
98
119
 
99
120
  it "should have a license" do
100
- subject['license'].should == Ore::Options::DEFAULT_LICENSE
121
+ expect(subject['license']).to be == 'MIT'
101
122
  end
102
123
 
103
124
  it "should have authors" do
104
- subject['authors'].should_not be_empty
125
+ expect(subject['authors']).not_to be_empty
105
126
  end
106
127
 
107
128
  it "should have a dummy homepage" do
108
- subject['homepage'].should_not be_empty
129
+ expect(subject['homepage']).not_to be_empty
109
130
  end
110
131
 
111
132
  it "should have 'rubygems-tasks' as a development dependency" do
112
- subject['development_dependencies'].should have_key('rubygems-tasks')
133
+ expect(subject['development_dependencies']).to have_key('rubygems-tasks')
113
134
  end
114
135
  end
115
136
 
116
137
  it "should add a *.gemspec file" do
117
- @path.should have_file("#{name}.gemspec")
138
+ expect(@path).to have_file("#{@name}.gemspec")
118
139
  end
119
140
 
120
141
  describe "*.gemspec file" do
@@ -125,18 +146,14 @@ describe Generator do
125
146
  end
126
147
 
127
148
  context "gemspec" do
128
- let(:name) { 'gemspec_project' }
129
-
130
149
  before(:all) do
131
- generate!(name, :gemspec => true)
132
- end
150
+ @name = 'gemspec_project'
133
151
 
134
- it "should disable the gemspec_yml template" do
135
- @generator.disabled_templates.should include(:gemspec_yml)
152
+ generate!(@name, gemspec: true)
136
153
  end
137
154
 
138
155
  it "should add a *.gemspec file" do
139
- @path.should have_file("#{name}.gemspec")
156
+ expect(@path).to have_file("#{@name}.gemspec")
140
157
  end
141
158
 
142
159
  context "*.gemspec file" do
@@ -145,414 +162,447 @@ describe Generator do
145
162
  it_should_behave_like "a gemspec"
146
163
 
147
164
  it "should have 'rubygems-tasks' as a development dependency" do
148
- subject.should have_development_dependency('rubygems-tasks')
165
+ expect(subject).to have_development_dependency('rubygems-tasks')
149
166
  end
150
167
  end
151
168
  end
152
169
 
153
170
  context "git" do
154
- let(:name) { 'git-project' }
155
-
156
171
  before(:all) do
157
- generate!(name, :git => true)
172
+ @name = 'git-project'
173
+
174
+ generate!(@name, git: true)
158
175
  end
159
176
 
160
177
  it "should create a .git directory" do
161
- @path.should have_directory('.git')
178
+ expect(@path).to have_directory('.git')
162
179
  end
163
180
 
164
181
  it "should create a .gitignore file" do
165
- @path.should have_file('.gitignore')
182
+ expect(@path).to have_file('.gitignore')
166
183
  end
167
184
  end
168
185
 
169
186
  context "hg" do
170
- let(:name) { 'hg-project' }
171
-
172
187
  before(:all) do
173
- generate!(name, :hg => true)
188
+ @name = 'hg-project'
189
+
190
+ generate!(@name, hg: true)
174
191
  end
175
192
 
176
193
  it "should create a .hg directory" do
177
- @path.should have_directory('.hg')
194
+ expect(@path).to have_directory('.hg')
178
195
  end
179
196
 
180
197
  it "should create a .hgignore file" do
181
- @path.should have_file('.hgignore')
198
+ expect(@path).to have_file('.hgignore')
182
199
  end
183
200
  end
184
201
 
185
202
  context "bin" do
186
- let(:name) { 'script-project' }
187
- let(:script) { File.join('bin',name) }
188
-
189
203
  before(:all) do
190
- generate!(name, :bin => true)
204
+ @name = 'script-project'
205
+ @script = File.join('bin',@name)
206
+
207
+ generate!(@name, bin: true)
191
208
  end
192
209
 
193
210
  it "should add a 'bin/' directory" do
194
- @path.should have_directory('bin')
211
+ expect(@path).to have_directory('bin')
195
212
  end
196
213
 
197
214
  it "should add a bin/script-project file" do
198
- @path.should have_file(script)
215
+ expect(@path).to have_file(@script)
199
216
  end
200
217
 
201
218
  it "should make the bin/script-project file executable" do
202
- @path.should have_executable(script)
219
+ expect(@path).to have_executable(@script)
203
220
  end
204
221
  end
205
222
 
206
- context "bundler" do
207
- let(:name) { 'bundled_project' }
223
+ context "without bundler" do
224
+ before(:all) do
225
+ @name = 'bundled_project'
226
+
227
+ generate!(@name, bundler: false)
228
+ end
229
+
230
+ it "should not add a Gemfile" do
231
+ expect(@path).to_not have_file('Gemfile')
232
+ end
233
+
234
+ it "should not add 'bundler' as a development dependency" do
235
+ expect(@gemspec).to_not have_development_dependency('bundler')
236
+ end
237
+
238
+ it "should not add 'Gemfile.lock' to the .gitignore file" do
239
+ expect(gitignore).to_not include('/Gemfile.lock')
240
+ end
241
+ end
208
242
 
243
+ context "rdoc" do
209
244
  before(:all) do
210
- generate!(name, :bundler => true)
245
+ @name = 'rdoc-project'
246
+
247
+ generate!(@name, rdoc: true)
211
248
  end
212
249
 
213
- it "should add a Gemfile" do
214
- @path.should have_file('Gemfile')
250
+ it "should disable the yard template" do
251
+ expect(@generator.disabled_templates).to include(:yard)
215
252
  end
216
253
 
217
- it "should add 'bundler' as a development dependency" do
218
- @gemspec.should have_development_dependency('bundler')
254
+ it "should add 'rdoc' as a development dependency" do
255
+ expect(@gemspec).to have_development_dependency('rdoc')
219
256
  end
220
257
 
221
- it "should not have any dependencies in the Gemfile" do
222
- gemfile = (@path + 'Gemfile').read
223
- gemfile.should eq(<<-GEMFILE)
224
- source :rubygems
258
+ it "should default @markup to :markdown" do
259
+ expect(@generator.instance_variable_get('@markup')).to eq(:markdown)
260
+ end
225
261
 
226
- gemspec
227
- GEMFILE
262
+ it "should add 'html/' to the .gitignore file" do
263
+ expect(gitignore).to include('/html/')
228
264
  end
229
265
 
230
- it "should add 'Gemfile.lock' to the .gitignore file" do
231
- gitignore.should include('Gemfile.lock')
266
+ it "should add a '.document' file" do
267
+ expect(@path).to have_file('.document')
232
268
  end
233
- end
234
269
 
235
- context "rdoc" do
236
- let(:name) { 'rdoc-project' }
270
+ context ".document" do
271
+ it "should include 'lib/**/*.rb'" do
272
+ expect(document).to include('lib/**/*.rb')
273
+ end
274
+
275
+ it "should include 'README.rdoc'" do
276
+ expect(document).to include('README.md')
277
+ end
237
278
 
279
+ it "should include 'ChangeLog.rdoc'" do
280
+ expect(document).to include('ChangeLog.md')
281
+ end
282
+
283
+ it "should include 'LICENSE.txt'" do
284
+ expect(document).to include('LICENSE.txt')
285
+ end
286
+ end
287
+ end
288
+
289
+ context "rdoc with rdoc markup" do
238
290
  before(:all) do
239
- generate!(name, :rdoc => true)
291
+ @name = 'rdoc_rdoc-project'
292
+
293
+ generate!(@name, rdoc: true, markup: 'rdoc')
240
294
  end
241
295
 
242
296
  it "should disable the yard template" do
243
- @generator.disabled_templates.should include(:yard)
297
+ expect(@generator.disabled_templates).to include(:yard)
244
298
  end
245
299
 
246
300
  it "should add 'rdoc' as a development dependency" do
247
- @gemspec.should have_development_dependency('rdoc')
301
+ expect(@gemspec).to have_development_dependency('rdoc')
248
302
  end
249
303
 
250
304
  it "should set @markup to :rdoc" do
251
- @generator.instance_variable_get('@markup').should == :rdoc
305
+ expect(@generator.instance_variable_get('@markup')).to eq(:rdoc)
252
306
  end
253
307
 
254
308
  it "should add 'html/' to the .gitignore file" do
255
- gitignore.should include('html/')
309
+ expect(gitignore).to include('/html/')
256
310
  end
257
311
 
258
312
  it "should add a '.document' file" do
259
- @path.should have_file('.document')
313
+ expect(@path).to have_file('.document')
260
314
  end
261
315
 
262
316
  context ".document" do
263
317
  it "should include 'lib/**/*.rb'" do
264
- document.should include('lib/**/*.rb')
318
+ expect(document).to include('lib/**/*.rb')
265
319
  end
266
320
 
267
- it "should include 'README.rdoc'" do
268
- document.should include('README.rdoc')
321
+ it "should include 'README.md'" do
322
+ expect(document).to include('README.rdoc')
269
323
  end
270
324
 
271
- it "should include 'ChangeLog.rdoc'" do
272
- document.should include('ChangeLog.rdoc')
325
+ it "should include 'ChangeLog.md'" do
326
+ expect(document).to include('ChangeLog.rdoc')
273
327
  end
274
328
 
275
329
  it "should include 'LICENSE.txt'" do
276
- document.should include('LICENSE.txt')
330
+ expect(document).to include('LICENSE.txt')
277
331
  end
278
332
  end
279
333
  end
280
334
 
281
335
  context "yard" do
282
- let(:name) { 'yard-project' }
283
-
284
336
  before(:all) do
285
- generate!(name, :yard => true)
337
+ @name = 'yard-project'
338
+
339
+ generate!(@name, yard: true)
286
340
  end
287
341
 
288
342
  it "should disable the rdoc template" do
289
- @generator.disabled_templates.should include(:rdoc)
343
+ expect(@generator.disabled_templates).to include(:rdoc)
290
344
  end
291
345
 
292
346
  it "should add a .yardopts file" do
293
- @path.should have_file('.yardopts')
347
+ expect(@path).to have_file('.yardopts')
294
348
  end
295
349
 
296
350
  it "should add a '.document' file" do
297
- @path.should have_file('.document')
351
+ expect(@path).to have_file('.document')
298
352
  end
299
353
 
300
354
  it "should add 'yard' as a development dependency" do
301
- @gemspec.should have_development_dependency('yard')
355
+ expect(@gemspec).to have_development_dependency('yard')
302
356
  end
303
357
 
304
358
  context ".document" do
305
359
  it "should not include 'lib/**/*.rb'" do
306
- document.should_not include('lib/**/*.rb')
360
+ expect(document).not_to include('lib/**/*.rb')
307
361
  end
308
362
 
309
363
  it "should include a '-' separator for non-code files" do
310
- document.should include('-')
364
+ expect(document).to include('-')
311
365
  end
312
366
 
313
- it "should not include 'README.rdoc'" do
314
- document.should_not include('README.rdoc')
367
+ it "should not include 'README.md'" do
368
+ expect(document).not_to include('README.md')
315
369
  end
316
370
 
317
- it "should include 'ChangeLog.rdoc'" do
318
- document.should include('ChangeLog.rdoc')
371
+ it "should include 'ChangeLog.md'" do
372
+ expect(document).to include('ChangeLog.md')
319
373
  end
320
374
 
321
375
  it "should include 'LICENSE.txt'" do
322
- document.should include('LICENSE.txt')
376
+ expect(document).to include('LICENSE.txt')
323
377
  end
324
378
  end
325
379
  end
326
380
 
327
- context "yard with markdown" do
328
- let(:name) { 'yard_markdown-project' }
329
-
381
+ context "yard with rdoc markup" do
330
382
  before(:all) do
331
- generate!(name, :yard => true, :markdown => true)
383
+ @name = 'yard_rdoc-project'
384
+
385
+ generate!(@name, yard: true, markup: 'rdoc')
332
386
  end
333
387
 
334
- it "should add a README.md file" do
335
- @path.should have_file('README.md')
388
+ it "should add a README.rdoc file" do
389
+ expect(@path).to have_file('README.rdoc')
336
390
  end
337
391
 
338
- it "should add a ChangeLog.md file" do
339
- @path.should have_file('ChangeLog.md')
392
+ it "should add a ChangeLog.rdoc file" do
393
+ expect(@path).to have_file('ChangeLog.rdoc')
340
394
  end
341
395
 
342
- it "should set --markup to markdown in .yardopts" do
343
- yard_opts.should include('--markup markdown')
396
+ it "should set --markup to rdoc in .yardopts" do
397
+ expect(yard_opts).to include('--markup rdoc')
344
398
  end
345
399
 
346
400
  context ".document" do
347
- it "should include 'ChangeLog.md'" do
348
- document.should include('ChangeLog.md')
401
+ it "should include 'ChangeLog.rdoc'" do
402
+ expect(document).to include('ChangeLog.rdoc')
349
403
  end
350
404
  end
351
405
  end
352
406
 
353
- context "yard with textile" do
354
- let(:name) { 'yard_textile-project' }
355
-
407
+ context "yard with textile markup" do
356
408
  before(:all) do
357
- generate!(name, :yard => true, :textile => true)
409
+ @name = 'yard_textile-project'
410
+
411
+ generate!(@name, yard: true, markup: 'textile')
358
412
  end
359
413
 
360
414
  it "should add a README.tt file" do
361
- @path.should have_file('README.tt')
415
+ expect(@path).to have_file('README.tt')
362
416
  end
363
417
 
364
418
  it "should add a ChangeLog.tt file" do
365
- @path.should have_file('ChangeLog.tt')
419
+ expect(@path).to have_file('ChangeLog.tt')
366
420
  end
367
421
 
368
422
  it "should set --markup to textile in .yardopts" do
369
- yard_opts.should include('--markup textile')
423
+ expect(yard_opts).to include('--markup textile')
370
424
  end
371
425
 
372
426
  context ".document" do
373
427
  it "should include 'ChangeLog.tt'" do
374
- document.should include('ChangeLog.tt')
428
+ expect(document).to include('ChangeLog.tt')
375
429
  end
376
430
  end
377
431
  end
378
432
 
379
433
  context "yard with bundler" do
380
- let(:name) { 'bundled_yard_project' }
381
-
382
434
  before(:all) do
383
- generate!(name, :bundler => true, :yard => true)
435
+ @name = 'bundled_yard_project'
436
+
437
+ generate!(@name, bundler: true, yard: true)
384
438
  end
385
439
 
386
440
  it "should still add 'yard' as a development dependency" do
387
- @gemspec.should have_development_dependency('yard')
441
+ expect(@gemspec).to have_development_dependency('yard')
388
442
  end
389
443
  end
390
444
 
391
445
  context "test_unit" do
392
- let(:name) { 'test_unit_project' }
393
-
394
446
  before(:all) do
395
- generate!(name, :test_unit => true)
447
+ @name = 'test_unit_project'
448
+
449
+ generate!(@name, test_unit: true)
396
450
  end
397
451
 
398
- it "should disable the mini_test template" do
399
- @generator.disabled_templates.should include(:mini_test)
452
+ it "should disable the minitest template" do
453
+ expect(@generator.disabled_templates).to include(:minitest)
400
454
  end
401
455
 
402
456
  it "should disable the rspec template" do
403
- @generator.disabled_templates.should include(:rspec)
457
+ expect(@generator.disabled_templates).to include(:rspec)
404
458
  end
405
459
 
406
460
  it "should create the test/ directory" do
407
- @path.should have_directory('test')
461
+ expect(@path).to have_directory('test')
408
462
  end
409
463
 
410
464
  it "should create the test/helper.rb file" do
411
- @path.should have_file('test','helper.rb')
465
+ expect(@path).to have_file('test','helper.rb')
412
466
  end
413
467
 
414
468
  it "should add a single test_*.rb file" do
415
- @path.should have_file('test',"test_#{name}.rb")
469
+ expect(@path).to have_file('test',"test_#{@name}.rb")
416
470
  end
417
471
  end
418
472
 
419
- context "mini_test" do
420
- let(:name) { 'mini_test_project' }
421
-
473
+ context "minitest" do
422
474
  before(:all) do
423
- generate!(name, :mini_test => true)
475
+ @name = 'minitest_project'
476
+
477
+ generate!(@name, minitest: true)
424
478
  end
425
479
 
426
480
  it "should disable the test_unit template" do
427
- @generator.disabled_templates.should include(:test_unit)
481
+ expect(@generator.disabled_templates).to include(:test_unit)
428
482
  end
429
483
 
430
484
  it "should disable the rspec template" do
431
- @generator.disabled_templates.should include(:rspec)
485
+ expect(@generator.disabled_templates).to include(:rspec)
432
486
  end
433
487
 
434
488
  it "should create the test/ directory" do
435
- @path.should have_directory('test')
489
+ expect(@path).to have_directory('test')
436
490
  end
437
491
 
438
492
  it "should create the test/helper.rb file" do
439
- @path.should have_file('test','helper.rb')
493
+ expect(@path).to have_file('test','helper.rb')
440
494
  end
441
495
 
442
496
  it "should add a single test_*.rb file" do
443
- @path.should have_file('test',"test_#{name}.rb")
497
+ expect(@path).to have_file('test',"test_#{@name}.rb")
444
498
  end
445
499
  end
446
500
 
447
501
  context "rspec" do
448
- let(:name) { 'rspec_project' }
449
-
450
502
  before(:all) do
451
- generate!(name, :rspec => true)
503
+ @name = 'rspec_project'
504
+
505
+ generate!(@name, rspec: true)
452
506
  end
453
507
 
454
508
  it "should disable the test_unit template" do
455
- @generator.disabled_templates.should include(:test_unit)
509
+ expect(@generator.disabled_templates).to include(:test_unit)
456
510
  end
457
511
 
458
- it "should disable the mini_test template" do
459
- @generator.disabled_templates.should include(:mini_test)
512
+ it "should disable the minitest template" do
513
+ expect(@generator.disabled_templates).to include(:minitest)
460
514
  end
461
515
 
462
516
  it "should not create the test/ directory" do
463
- @path.should_not have_directory('test')
517
+ expect(@path).not_to have_directory('test')
464
518
  end
465
519
 
466
520
  it "should create the spec/ directory" do
467
- @path.should have_directory('spec')
521
+ expect(@path).to have_directory('spec')
468
522
  end
469
523
 
470
524
  it "should add a spec_helper.rb file" do
471
- @path.should have_file('spec','spec_helper.rb')
525
+ expect(@path).to have_file('spec','spec_helper.rb')
472
526
  end
473
527
 
474
528
  it "should add a single *_spec.rb file" do
475
- @path.should have_file('spec','rspec_project_spec.rb')
529
+ expect(@path).to have_file('spec','rspec_project_spec.rb')
476
530
  end
477
531
 
478
532
  it "should add a .rspec file" do
479
- @path.should have_file('.rspec')
533
+ expect(@path).to have_file('.rspec')
480
534
  end
481
535
 
482
536
  it "should add 'rspec' as a development dependency" do
483
- @gemspec.should have_development_dependency('rspec')
537
+ expect(@gemspec).to have_development_dependency('rspec')
484
538
  end
485
539
  end
486
540
 
487
541
  context "rspec with bundler" do
488
- let(:name) { 'bundled_rspec_project' }
489
-
490
542
  before(:all) do
491
- generate!(name, :bundler => true, :rspec => true)
543
+ @name = 'bundled_rspec_project'
544
+
545
+ generate!(@name, bundler: true, rspec: true)
492
546
  end
493
547
 
494
548
  it "should add 'rspec' as a development dependency" do
495
- @gemspec.should have_development_dependency('rspec')
549
+ expect(@gemspec).to have_development_dependency('rspec')
496
550
  end
497
551
  end
498
552
 
499
553
  context "rubygems-tasks" do
500
- let(:name) { 'rubygems_tasks_project' }
501
-
502
554
  before(:all) do
503
- generate!(name, :rubygems_tasks => true)
555
+ @name = 'rubygems_tasks_project'
556
+
557
+ generate!(@name, rubygems_tasks: true)
504
558
  end
505
559
 
506
560
  it "should disable the bundler_tasks template" do
507
- @generator.disabled_templates.should include(:bundler_tasks)
561
+ expect(@generator.disabled_templates).to include(:bundler_tasks)
508
562
  end
509
563
 
510
564
  it "should add 'rubygems-tasks' as a development dependency" do
511
- @gemspec.should have_development_dependency('rubygems-tasks')
565
+ expect(@gemspec).to have_development_dependency('rubygems-tasks')
512
566
  end
513
567
  end
514
568
 
515
569
  context "rubygems-tasks with bundler" do
516
- let(:name) { 'bundled_ore_project' }
517
-
518
570
  before(:all) do
519
- generate!(name, :bundler => true, :rubygems_tasks => true)
571
+ @name = 'bundled_ore_project'
572
+
573
+ generate!(@name, bundler: true, rubygems_tasks: true)
520
574
  end
521
575
 
522
576
  it "should add 'rubygems-tasks' as a development dependency" do
523
- @gemspec.should have_development_dependency('rubygems-tasks')
577
+ expect(@gemspec).to have_development_dependency('rubygems-tasks')
524
578
  end
525
579
  end
526
580
 
527
- context "bundler_tasks" do
528
- let(:name) { 'bundler_tasks_project' }
529
-
581
+ context "bundler without rubygems-tasks" do
530
582
  before(:all) do
531
- generate!(name, :bundler_tasks => true)
532
- end
583
+ @name = 'bundler_without_rubygems_tasks_project'
533
584
 
534
- it "should disable the rubygems_tasks template" do
535
- @generator.disabled_templates.should include(:rubygems_tasks)
585
+ generate!(@name, bundler: true, rubygems_tasks: false)
536
586
  end
537
587
 
538
- it "should enable the bundler template" do
539
- @generator.enabled_templates.should include(:bundler)
588
+ it "should add \"require 'bundler/gem_tasks'\" to the Rakefile" do
589
+ expect(rakefile).to include("require 'bundler/gem_tasks'")
540
590
  end
541
591
  end
542
592
 
543
593
  context "gem_package_task" do
544
- let(:name) { 'gem_package_task_project' }
545
-
546
594
  before(:all) do
547
- generate!(name, :gem_package_task => true)
595
+ @name = 'gem_package_task_project'
596
+
597
+ generate!(@name, gem_package_task: true)
548
598
  end
549
599
 
550
600
  it "should disable the rubygems_tasks template" do
551
- @generator.disabled_templates.should include(:rubygems_tasks)
601
+ expect(@generator.disabled_templates).to include(:rubygems_tasks)
552
602
  end
553
603
 
554
604
  it "should disable the bundler_tasks template" do
555
- @generator.disabled_templates.should include(:bundler_tasks)
605
+ expect(@generator.disabled_templates).to include(:bundler_tasks)
556
606
  end
557
607
  end
558
608