ore 0.7.0 → 0.7.1
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 +6 -0
- data/README.md +1 -1
- data/gemspec.yml +1 -1
- data/lib/ore/generator.rb +69 -28
- metadata +2 -2
data/ChangeLog.md
CHANGED
data/README.md
CHANGED
@@ -55,7 +55,7 @@ the developer to keep all of the project information in a single YAML file.
|
|
55
55
|
The `gemspec.yml` file used to build Ore:
|
56
56
|
|
57
57
|
name: ore
|
58
|
-
version: 0.7.
|
58
|
+
version: 0.7.1
|
59
59
|
summary: Mine raw RubyGems from YAML.
|
60
60
|
description:
|
61
61
|
Ore is a simple RubyGem building solution. Ore handles the
|
data/gemspec.yml
CHANGED
data/lib/ore/generator.rb
CHANGED
@@ -153,6 +153,69 @@ module Ore
|
|
153
153
|
|
154
154
|
argument :path, :required => true
|
155
155
|
|
156
|
+
#
|
157
|
+
# Generates an empty directory.
|
158
|
+
#
|
159
|
+
# @param [String] dest
|
160
|
+
# The uninterpolated destination path.
|
161
|
+
#
|
162
|
+
# @return [String]
|
163
|
+
# The destination path of the directory.
|
164
|
+
#
|
165
|
+
# @since 0.7.1
|
166
|
+
#
|
167
|
+
def generate_dir(dest)
|
168
|
+
return if @generated_dirs.include?(dest)
|
169
|
+
|
170
|
+
path = interpolate(dest)
|
171
|
+
empty_directory path
|
172
|
+
|
173
|
+
@generated_dirs << dest
|
174
|
+
return path
|
175
|
+
end
|
176
|
+
|
177
|
+
#
|
178
|
+
# Generates a file.
|
179
|
+
#
|
180
|
+
# @param [String] dest
|
181
|
+
# The uninterpolated destination path.
|
182
|
+
#
|
183
|
+
# @param [String] file
|
184
|
+
# The source file or template.
|
185
|
+
#
|
186
|
+
# @param [Hash] options
|
187
|
+
# Additional options.
|
188
|
+
#
|
189
|
+
# @option options [Boolean] :template
|
190
|
+
# Specifies that the file is a template, and should be rendered.
|
191
|
+
#
|
192
|
+
# @return [String]
|
193
|
+
# The destination path of the file.
|
194
|
+
#
|
195
|
+
# @since 0.7.1
|
196
|
+
#
|
197
|
+
def generate_file(dest,file,options={})
|
198
|
+
return if @generated_files.include?(dest)
|
199
|
+
|
200
|
+
path = interpolate(dest)
|
201
|
+
|
202
|
+
if options[:template]
|
203
|
+
@current_template_dir = File.dirname(dest)
|
204
|
+
template file, path
|
205
|
+
@current_template_dir = nil
|
206
|
+
else
|
207
|
+
copy_file file, path
|
208
|
+
end
|
209
|
+
|
210
|
+
if File.executable?(file)
|
211
|
+
umask = File.stat(File.join(destination_root,path)).mode
|
212
|
+
chmod path, (umask | 0111)
|
213
|
+
end
|
214
|
+
|
215
|
+
@generated_files << dest
|
216
|
+
return path
|
217
|
+
end
|
218
|
+
|
156
219
|
#
|
157
220
|
# Enables a template, adding it to the generator.
|
158
221
|
#
|
@@ -280,22 +343,18 @@ module Ore
|
|
280
343
|
instance_variable_set("@#{name}",value)
|
281
344
|
end
|
282
345
|
end
|
346
|
+
|
347
|
+
@generated_dirs = Set[]
|
348
|
+
@generated_files = Set[]
|
283
349
|
end
|
284
350
|
|
285
351
|
#
|
286
352
|
# Creates directories listed in the template directories.
|
287
353
|
#
|
288
354
|
def generate_directories!
|
289
|
-
generated = Set[]
|
290
|
-
|
291
355
|
@templates.each do |template|
|
292
356
|
template.each_directory do |dir|
|
293
|
-
|
294
|
-
path = interpolate(dir)
|
295
|
-
empty_directory path
|
296
|
-
|
297
|
-
generated << dir
|
298
|
-
end
|
357
|
+
generate_dir dir
|
299
358
|
end
|
300
359
|
end
|
301
360
|
end
|
@@ -304,35 +363,17 @@ module Ore
|
|
304
363
|
# Copies static files and renders templates in the template directories.
|
305
364
|
#
|
306
365
|
def generate_files!
|
307
|
-
generated = Set[]
|
308
|
-
|
309
366
|
# iterate through the templates in reverse, so files in the templates
|
310
367
|
# loaded last override the previously templates.
|
311
368
|
@templates.reverse_each do |template|
|
312
369
|
# copy in the static files first
|
313
370
|
template.each_file(@markup) do |dest,file|
|
314
|
-
|
315
|
-
path = interpolate(dest)
|
316
|
-
|
317
|
-
copy_file file, path
|
318
|
-
chmod path, File.stat(file).mode
|
319
|
-
|
320
|
-
generated << dest
|
321
|
-
end
|
371
|
+
generate_file dest, file
|
322
372
|
end
|
323
373
|
|
324
374
|
# then render the templates
|
325
375
|
template.each_template(@markup) do |dest,file|
|
326
|
-
|
327
|
-
path = interpolate(dest)
|
328
|
-
@current_template_dir = File.dirname(dest)
|
329
|
-
|
330
|
-
template file, path
|
331
|
-
chmod path, File.stat(file).mode
|
332
|
-
|
333
|
-
@current_template_dir = nil
|
334
|
-
generated << dest
|
335
|
-
end
|
376
|
+
generate_file dest, file, :template => true
|
336
377
|
end
|
337
378
|
end
|
338
379
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: ore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Postmodern
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-02-
|
13
|
+
date: 2011-02-20 00:00:00 -08:00
|
14
14
|
default_executable: ore
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|