ore 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog.md +13 -0
- data/data/ore/templates/base/{:name:.gemspec.erb → [name].gemspec.erb} +0 -0
- data/data/ore/templates/base/lib/{:namespace_dir:.rb.erb → [namespace_dir].rb.erb} +0 -0
- data/data/ore/templates/base/lib/{:namespace_dir: → [namespace_dir]}/version.rb.erb +0 -0
- data/data/ore/templates/ore_tasks/_dependencies.erb +2 -0
- data/data/ore/templates/rspec/spec/{:namespace_dir:_spec.rb.erb → [namespace_dir]_spec.rb.erb} +0 -0
- data/data/ore/templates/test_unit/test/{test_:name:.rb.erb → test_[name].rb.erb} +0 -0
- data/gemspec.yml +1 -1
- data/lib/ore/template/interpolations.rb +6 -6
- data/spec/generator_spec.rb +287 -0
- data/spec/helpers/generator.rb +34 -0
- data/spec/helpers/projects/{dm-plugin → dm-is-plugin}/Gemfile +0 -0
- data/spec/helpers/projects/{dm-plugin → dm-is-plugin}/VERSION +0 -0
- data/spec/helpers/projects/{dm-plugin/dm-plugin.gemspec → dm-is-plugin/dm-is-plugin.gemspec} +1 -1
- data/spec/helpers/projects/{dm-plugin → dm-is-plugin}/gemspec.yml +1 -1
- data/spec/helpers/projects/dm-is-plugin/lib/dm-is-plugin.rb +4 -0
- data/spec/helpers/projects/dm-is-plugin/lib/dm-is-plugin/is/plugin.rb +6 -0
- data/spec/projects/dm_plugin_project_spec.rb +3 -3
- metadata +17 -13
- data/spec/helpers/projects/dm-plugin/lib/dm-plugin.rb +0 -1
data/ChangeLog.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
### 0.2.3 / 2010-11-01
|
2
|
+
|
3
|
+
* Fixed path interpolation on Windows:
|
4
|
+
* Windows does not allow the `:` character in paths, so path interpolation
|
5
|
+
keywords are now wrapped in `[` and `]` characters.
|
6
|
+
|
7
|
+
interpolate("[name].gemspec")
|
8
|
+
# => "my-project.gemspec"
|
9
|
+
|
10
|
+
* Do not include `ore-tasks` as a developmnet dependency in generated
|
11
|
+
projects that also use Bundler.
|
12
|
+
* Added more specs to {Ore::Generator} and the builtin templates.
|
13
|
+
|
1
14
|
### 0.2.2 / 2010-10-30
|
2
15
|
|
3
16
|
* Added {Ore::Project#root}.
|
File without changes
|
File without changes
|
File without changes
|
data/data/ore/templates/rspec/spec/{:namespace_dir:_spec.rb.erb → [namespace_dir]_spec.rb.erb}
RENAMED
File without changes
|
File without changes
|
data/gemspec.yml
CHANGED
@@ -4,10 +4,10 @@ module Ore
|
|
4
4
|
# Handles the expansion of paths and substitution of path keywords.
|
5
5
|
# The following keywords are supported:
|
6
6
|
#
|
7
|
-
# *
|
8
|
-
# *
|
7
|
+
# * `[name]` - The name of the project.
|
8
|
+
# * `[project_dir]` - The directory base-name derived from the project
|
9
9
|
# name.
|
10
|
-
# *
|
10
|
+
# * `[namespace_dir]` - The full directory path derived from the
|
11
11
|
# project name.
|
12
12
|
#
|
13
13
|
module Interpolations
|
@@ -31,18 +31,18 @@ module Ore
|
|
31
31
|
# The expanded path.
|
32
32
|
#
|
33
33
|
# @example Assuming `@project_dir` contains `my_project`.
|
34
|
-
# interpolate
|
34
|
+
# interpolate("lib/[project_dir].rb")
|
35
35
|
# # => "lib/my_project.rb"
|
36
36
|
#
|
37
37
|
# @example Assuming `@namespace_dir` contains `my/project`.
|
38
|
-
# interpolate
|
38
|
+
# interpolate("spec/[namespace_dir]_spec.rb")
|
39
39
|
# # => "spec/my/project_spec.rb"
|
40
40
|
#
|
41
41
|
def interpolate(path)
|
42
42
|
dirs = path.split(File::SEPARATOR)
|
43
43
|
|
44
44
|
dirs.each do |dir|
|
45
|
-
dir.gsub!(/(
|
45
|
+
dir.gsub!(/(\[[a-z_]+\])/) do |capture|
|
46
46
|
keyword = capture[1..-2]
|
47
47
|
|
48
48
|
if @@keywords.include?(keyword)
|
@@ -0,0 +1,287 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'helpers/generator'
|
3
|
+
require 'ore/generator'
|
4
|
+
|
5
|
+
describe Generator do
|
6
|
+
include Helpers::Generator
|
7
|
+
|
8
|
+
context "default" do
|
9
|
+
let(:name) { 'my-project' }
|
10
|
+
|
11
|
+
before(:all) do
|
12
|
+
generate!(name)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should create the project root directory" do
|
16
|
+
@path.should be_directory
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should create the lib/ directory" do
|
20
|
+
@path.join('lib').should be_directory
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should create a file to load the project within lib/" do
|
24
|
+
@path.join('lib','my','project.rb').should be_file
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should create a namespace directory within lib/" do
|
28
|
+
@path.join('lib','my','project').should be_directory
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should create a version.rb file within the namespace directory" do
|
32
|
+
@path.join('lib','my','project','version.rb').should be_file
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should not create the bin/ directory by default" do
|
36
|
+
@path.join('bin').should_not be_directory
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should create a test/ directory by default" do
|
40
|
+
@path.join('test').should_not be_directory
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should create a gemspec.yml file" do
|
44
|
+
@path.join('gemspec.yml').should be_file
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "gemspec.yml" do
|
48
|
+
subject { @gemspec }
|
49
|
+
|
50
|
+
it "should have a name" do
|
51
|
+
subject['name'].should == 'my-project'
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should not contain a version by default" do
|
55
|
+
subject.should_not have_key('version')
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should a dummy summary" do
|
59
|
+
subject['summary'].should_not be_empty
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should a description summary" do
|
63
|
+
subject['description'].should_not be_empty
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should have a license" do
|
67
|
+
subject['license'].should == 'MIT'
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should have authors" do
|
71
|
+
subject['authors'].should_not be_empty
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should have a dummy homepage" do
|
75
|
+
subject['homepage'].should_not be_empty
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should have 'ore' as a development dependency" do
|
79
|
+
subject['development_dependencies'].should have_key('ore')
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should add a *.gemspec file" do
|
84
|
+
@path.join('my-project.gemspec').should be_file
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should add a .document file" do
|
88
|
+
@path.join('.document').should be_file
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should add a Rakefile" do
|
92
|
+
@path.join('Rakefile').should be_file
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should add a README.rdoc file" do
|
96
|
+
@path.join('README.rdoc').should be_file
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should add a ChangeLog.rdoc file" do
|
100
|
+
@path.join('ChangeLog.rdoc').should be_file
|
101
|
+
end
|
102
|
+
|
103
|
+
it "should add a LICENSE.txt file" do
|
104
|
+
@path.join('LICENSE.txt').should be_file
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
context "bundler" do
|
109
|
+
let(:name) { 'bundled_project' }
|
110
|
+
|
111
|
+
before(:all) do
|
112
|
+
generate!(name, :bundler => true)
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should add a Gemfile" do
|
116
|
+
@path.join('Gemfile').should be_file
|
117
|
+
end
|
118
|
+
|
119
|
+
it "should add 'bundler' as a development dependency" do
|
120
|
+
@gemspec['development_dependencies'].should have_key('bundler')
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context "yard" do
|
125
|
+
let(:name) { 'yard-project' }
|
126
|
+
|
127
|
+
before(:all) do
|
128
|
+
generate!(name, :yard => true)
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should add a .yardopts file" do
|
132
|
+
@path.join('.yardopts').should be_file
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should set 'has_yard' to 'true' in the gemspec.yml file" do
|
136
|
+
@gemspec['has_yard'].should == true
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
context "yard with markdown" do
|
141
|
+
let(:name) { 'yard_markdown-project' }
|
142
|
+
|
143
|
+
before(:all) do
|
144
|
+
generate!(name, :yard => true, :markdown => true)
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should add a README.md file" do
|
148
|
+
@path.join('README.md').should be_file
|
149
|
+
end
|
150
|
+
|
151
|
+
it "should add a ChangeLog.md file" do
|
152
|
+
@path.join('ChangeLog.md').should be_file
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should set --markup to markdown in .yardopts" do
|
156
|
+
yard_opts.should include('--markup markdown')
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
context "yard with textile" do
|
161
|
+
let(:name) { 'yard_textile-project' }
|
162
|
+
|
163
|
+
before(:all) do
|
164
|
+
generate!(name, :yard => true, :textile => true)
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should add a README.tt file" do
|
168
|
+
@path.join('README.tt').should be_file
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should add a ChangeLog.tt file" do
|
172
|
+
@path.join('ChangeLog.tt').should be_file
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should set --markup to textile in .yardopts" do
|
176
|
+
yard_opts.should include('--markup textile')
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
context "yard with bundler" do
|
181
|
+
let(:name) { 'bundled_yard_project' }
|
182
|
+
|
183
|
+
before(:all) do
|
184
|
+
generate!(name, :bundler => true, :yard => true)
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should still add 'yard' as a development dependency" do
|
188
|
+
@gemspec['development_dependencies'].should have_key('yard')
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
context "rspec" do
|
193
|
+
let(:name) { 'rspec_project' }
|
194
|
+
|
195
|
+
before(:all) do
|
196
|
+
generate!(name, :rspec => true)
|
197
|
+
end
|
198
|
+
|
199
|
+
it "should not create the test/ directory" do
|
200
|
+
@path.join('test').should_not be_directory
|
201
|
+
end
|
202
|
+
|
203
|
+
it "should create the spec/ directory" do
|
204
|
+
@path.join('spec').should be_directory
|
205
|
+
end
|
206
|
+
|
207
|
+
it "should add a spec_helper.rb file" do
|
208
|
+
@path.join('spec','spec_helper.rb').should be_file
|
209
|
+
end
|
210
|
+
|
211
|
+
it "should add a single *_spec.rb file" do
|
212
|
+
@path.join('spec','rspec_project_spec.rb').should be_file
|
213
|
+
end
|
214
|
+
|
215
|
+
it "should add a .rspec file" do
|
216
|
+
@path.join('.rspec').should be_file
|
217
|
+
end
|
218
|
+
|
219
|
+
it "should add 'rspec' as a development dependency" do
|
220
|
+
@gemspec['development_dependencies'].should have_key('rspec')
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
context "rspec with bundler" do
|
225
|
+
let(:name) { 'bundled_rspec_project' }
|
226
|
+
|
227
|
+
before(:all) do
|
228
|
+
generate!(name, :bundler => true, :rspec => true)
|
229
|
+
end
|
230
|
+
|
231
|
+
it "should not add 'rspec' as a development dependency" do
|
232
|
+
@gemspec['development_dependencies'].should_not have_key('rspec')
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
context "jeweler tasks" do
|
237
|
+
let(:name) { 'jewelery_project' }
|
238
|
+
|
239
|
+
before(:all) do
|
240
|
+
generate!(name, :jeweler_tasks => true)
|
241
|
+
end
|
242
|
+
|
243
|
+
it "should add 'jeweler' as a development dependency" do
|
244
|
+
@gemspec['development_dependencies'].should have_key('jeweler')
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
context "jeweler tasks with bundler" do
|
249
|
+
let(:name) { 'bundled_jewelery_project' }
|
250
|
+
|
251
|
+
before(:all) do
|
252
|
+
generate!(name, :bundler => true, :jeweler_tasks => true)
|
253
|
+
end
|
254
|
+
|
255
|
+
it "should not add 'jeweler' as a development dependency" do
|
256
|
+
@gemspec['development_dependencies'].should_not have_key('jeweler')
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
context "ore tasks" do
|
261
|
+
let(:name) { 'ore_project' }
|
262
|
+
|
263
|
+
before(:all) do
|
264
|
+
generate!(name, :ore_tasks => true)
|
265
|
+
end
|
266
|
+
|
267
|
+
it "should add 'ore-tasks' as a development dependency" do
|
268
|
+
@gemspec['development_dependencies'].should have_key('ore-tasks')
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
context "ore tasks with bundler" do
|
273
|
+
let(:name) { 'bundled_ore_project' }
|
274
|
+
|
275
|
+
before(:all) do
|
276
|
+
generate!(name, :bundler => true, :ore_tasks => true)
|
277
|
+
end
|
278
|
+
|
279
|
+
it "should not add 'ore-tasks' as a development dependency" do
|
280
|
+
@gemspec['development_dependencies'].should_not have_key('ore-tasks')
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
after(:all) do
|
285
|
+
cleanup!
|
286
|
+
end
|
287
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'pathname'
|
3
|
+
require 'yaml'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module Helpers
|
7
|
+
module Generator
|
8
|
+
ROOT = File.join(Dir.tmpdir,'ore')
|
9
|
+
|
10
|
+
def generate!(path,options={})
|
11
|
+
path = File.join(ROOT,path)
|
12
|
+
|
13
|
+
Ore::Generator.new(
|
14
|
+
[path],
|
15
|
+
options.merge(:quiet => true)
|
16
|
+
).invoke_all
|
17
|
+
|
18
|
+
@path = Pathname.new(path)
|
19
|
+
@gemspec = YAML.load_file(@path.join('gemspec.yml'))
|
20
|
+
end
|
21
|
+
|
22
|
+
def rspec_opts
|
23
|
+
@path.join('.rspec').read
|
24
|
+
end
|
25
|
+
|
26
|
+
def yard_opts
|
27
|
+
@path.join('.yardopts').read
|
28
|
+
end
|
29
|
+
|
30
|
+
def cleanup!
|
31
|
+
FileUtils.rm_r(ROOT)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
File without changes
|
File without changes
|
@@ -6,17 +6,17 @@ describe "DataMapper Plugin project" do
|
|
6
6
|
include Helpers::Projects
|
7
7
|
|
8
8
|
before(:all) do
|
9
|
-
@project = project('dm-plugin')
|
9
|
+
@project = project('dm-is-plugin')
|
10
10
|
end
|
11
11
|
|
12
12
|
it_should_behave_like 'an Ore Project'
|
13
13
|
|
14
14
|
it "should correctly guess the namespace" do
|
15
|
-
@project.namespace.should == 'DataMapper::Plugin'
|
15
|
+
@project.namespace.should == 'DataMapper::Is::Plugin'
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should have a namespace directory" do
|
19
|
-
@project.namespace_dir.should == 'dm-plugin'
|
19
|
+
@project.namespace_dir.should == 'dm-is-plugin'
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should use Bundler" do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 3
|
9
|
+
version: 0.2.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Postmodern
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-11-01 00:00:00 -07:00
|
18
18
|
default_executable: ore
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -87,7 +87,6 @@ files:
|
|
87
87
|
- bin/ore
|
88
88
|
- data/ore/templates/base/.document
|
89
89
|
- data/ore/templates/base/.gitignore.erb
|
90
|
-
- data/ore/templates/base/:name:.gemspec.erb
|
91
90
|
- data/ore/templates/base/ChangeLog.md.erb
|
92
91
|
- data/ore/templates/base/ChangeLog.rdoc.erb
|
93
92
|
- data/ore/templates/base/ChangeLog.tt.erb
|
@@ -96,10 +95,11 @@ files:
|
|
96
95
|
- data/ore/templates/base/README.rdoc.erb
|
97
96
|
- data/ore/templates/base/README.tt.erb
|
98
97
|
- data/ore/templates/base/Rakefile.erb
|
98
|
+
- data/ore/templates/base/[name].gemspec.erb
|
99
99
|
- data/ore/templates/base/_gemfile.erb
|
100
100
|
- data/ore/templates/base/gemspec.yml.erb
|
101
|
-
- data/ore/templates/base/lib
|
102
|
-
- data/ore/templates/base/lib
|
101
|
+
- data/ore/templates/base/lib/[namespace_dir].rb.erb
|
102
|
+
- data/ore/templates/base/lib/[namespace_dir]/version.rb.erb
|
103
103
|
- data/ore/templates/base/template.yml
|
104
104
|
- data/ore/templates/bundler/Gemfile.erb
|
105
105
|
- data/ore/templates/bundler/_dependencies.erb
|
@@ -117,11 +117,11 @@ files:
|
|
117
117
|
- data/ore/templates/rspec/_dependencies.erb
|
118
118
|
- data/ore/templates/rspec/_gemfile.erb
|
119
119
|
- data/ore/templates/rspec/_tasks.erb
|
120
|
-
- data/ore/templates/rspec/spec
|
120
|
+
- data/ore/templates/rspec/spec/[namespace_dir]_spec.rb.erb
|
121
121
|
- data/ore/templates/rspec/spec/spec_helper.rb.erb
|
122
122
|
- data/ore/templates/rspec/template.yml
|
123
123
|
- data/ore/templates/test_unit/test/helper.rb.erb
|
124
|
-
- data/ore/templates/test_unit/test/test_
|
124
|
+
- data/ore/templates/test_unit/test/test_[name].rb.erb
|
125
125
|
- data/ore/templates/yard/.yardopts.erb
|
126
126
|
- data/ore/templates/yard/_dependencies.erb
|
127
127
|
- data/ore/templates/yard/_gemfile.erb
|
@@ -162,16 +162,19 @@ files:
|
|
162
162
|
- ore.gemspec
|
163
163
|
- spec/dependency_spec.rb
|
164
164
|
- spec/document_file_spec.rb
|
165
|
+
- spec/generator_spec.rb
|
165
166
|
- spec/helpers/files.rb
|
166
167
|
- spec/helpers/files/.document
|
167
168
|
- spec/helpers/files/VERSION
|
168
169
|
- spec/helpers/files/VERSION.yml
|
170
|
+
- spec/helpers/generator.rb
|
169
171
|
- spec/helpers/projects.rb
|
170
|
-
- spec/helpers/projects/dm-plugin/Gemfile
|
171
|
-
- spec/helpers/projects/dm-plugin/VERSION
|
172
|
-
- spec/helpers/projects/dm-plugin/dm-plugin.gemspec
|
173
|
-
- spec/helpers/projects/dm-plugin/gemspec.yml
|
174
|
-
- spec/helpers/projects/dm-plugin/lib/dm-plugin.rb
|
172
|
+
- spec/helpers/projects/dm-is-plugin/Gemfile
|
173
|
+
- spec/helpers/projects/dm-is-plugin/VERSION
|
174
|
+
- spec/helpers/projects/dm-is-plugin/dm-is-plugin.gemspec
|
175
|
+
- spec/helpers/projects/dm-is-plugin/gemspec.yml
|
176
|
+
- spec/helpers/projects/dm-is-plugin/lib/dm-is-plugin.rb
|
177
|
+
- spec/helpers/projects/dm-is-plugin/lib/dm-is-plugin/is/plugin.rb
|
175
178
|
- spec/helpers/projects/explicit/gemspec.yml
|
176
179
|
- spec/helpers/projects/explicit/lib/explicit/version.rb
|
177
180
|
- spec/helpers/projects/ffi-binding/gemspec.yml
|
@@ -230,6 +233,7 @@ test_files:
|
|
230
233
|
- spec/dependency_spec.rb
|
231
234
|
- spec/naming_spec.rb
|
232
235
|
- spec/document_file_spec.rb
|
236
|
+
- spec/generator_spec.rb
|
233
237
|
- spec/versions/version_spec.rb
|
234
238
|
- spec/versions/version_file_spec.rb
|
235
239
|
- spec/projects/jeweler_project_spec.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
require 'dm-core'
|