rubigen 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/lib/rubigen/commands.rb +41 -0
- data/lib/rubigen.rb +1 -1
- data/test/test_generator_helper.rb +2 -0
- data/website/index.html +3 -3
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 1.5.1 2008-12-29
|
2
|
+
|
3
|
+
* Return #write_manifest which was accidently removed
|
4
|
+
* Moved website into gh-pages branch; thus moving homepage from http://rubigen.rubforge.org ->
|
5
|
+
http://drnic.github.com/rubigen
|
6
|
+
|
1
7
|
== 1.5.0 2008-12-27
|
2
8
|
|
3
9
|
* Preparation for integration back into Rails
|
data/lib/rubigen/commands.rb
CHANGED
@@ -56,6 +56,10 @@ module RubiGen
|
|
56
56
|
def readme(*args)
|
57
57
|
end
|
58
58
|
|
59
|
+
# Does nothing for all commands except Create.
|
60
|
+
def write_manifest
|
61
|
+
end
|
62
|
+
|
59
63
|
protected
|
60
64
|
def current_migration_number
|
61
65
|
Dir.glob("#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb").inject(0) do |max, file_path|
|
@@ -374,6 +378,43 @@ module RubiGen
|
|
374
378
|
end
|
375
379
|
end
|
376
380
|
|
381
|
+
def write_manifest(relative_destination)
|
382
|
+
files = ([relative_destination] + Dir["#{destination_root}/**/*"])
|
383
|
+
files.reject! { |file| File.directory?(file) }
|
384
|
+
files.map! { |path| path.sub("#{destination_root}/","") }
|
385
|
+
files = files.uniq.sort
|
386
|
+
|
387
|
+
|
388
|
+
destination = destination_path(relative_destination)
|
389
|
+
destination_exists = File.exists?(destination)
|
390
|
+
|
391
|
+
# Check for and resolve file collisions.
|
392
|
+
if destination_exists
|
393
|
+
# Always recreate the Manifest (perhaps we need to give the option... like normal files)
|
394
|
+
choice = :force
|
395
|
+
logger.force(relative_destination)
|
396
|
+
|
397
|
+
# File doesn't exist so log its unbesmirched creation.
|
398
|
+
else
|
399
|
+
logger.create relative_destination
|
400
|
+
end
|
401
|
+
|
402
|
+
# If we're pretending, back off now.
|
403
|
+
return if options[:pretend]
|
404
|
+
|
405
|
+
# Write destination file with optional shebang. Yield for content
|
406
|
+
# if block given so templaters may render the source file. If a
|
407
|
+
# shebang is requested, replace the existing shebang or insert a
|
408
|
+
# new one.
|
409
|
+
File.open(destination, 'wb') do |dest|
|
410
|
+
dest.write files.join("\n")
|
411
|
+
dest.write "\n"
|
412
|
+
end
|
413
|
+
|
414
|
+
# Optionally add file to subversion
|
415
|
+
system("svn add #{destination}") if options[:svn]
|
416
|
+
end
|
417
|
+
|
377
418
|
# When creating a migration, it knows to find the first available file in db/migrate and use the migration.rb template.
|
378
419
|
def migration_template(relative_source, relative_destination, template_options = {})
|
379
420
|
migration_directory relative_destination
|
data/lib/rubigen.rb
CHANGED
data/website/index.html
CHANGED
@@ -35,7 +35,7 @@
|
|
35
35
|
<div class="sidebar">
|
36
36
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rubigen"; return false'>
|
37
37
|
<p>Get Version</p>
|
38
|
-
<a href="http://rubyforge.org/projects/rubigen" class="numbers">1.5.
|
38
|
+
<a href="http://rubyforge.org/projects/rubigen" class="numbers">1.5.1</a>
|
39
39
|
</div>
|
40
40
|
|
41
41
|
<div id="twitter_search">
|
@@ -68,7 +68,7 @@ If you are developing a RubyGem, then you will want a different set of generator
|
|
68
68
|
<p>On your development machine:</p>
|
69
69
|
<p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">rubigen</span></pre></p>
|
70
70
|
<h2>Usage</h2>
|
71
|
-
<p>RubiGen will be normally integrated into another RubyGem, such as <code>newgem</code> or <code>
|
71
|
+
<p>RubiGen will be normally integrated into another RubyGem, such as <code>newgem</code> or <code>rails</code> or <code>camping</code>, rather than be used on its own.</p>
|
72
72
|
<p>These frameworks might use RubiGen for two reasons:</p>
|
73
73
|
<ol>
|
74
74
|
<li>To generate an initial stub for developers, e.g. <code>rails</code> generated a stub to write a Rails application. <code>newgem</code> generates a stub to write a RubyGem. <br/><br />
|
@@ -86,7 +86,7 @@ If you are developing a RubyGem, then you will want a different set of generator
|
|
86
86
|
RubyGem development environment (as generated by <code>newgem</code>), the <code>script/generator</code><br />
|
87
87
|
only shows <code>rubygem</code>-related generators. Rails could restrict <code>script/generator</code><br />
|
88
88
|
to only show Rails related generators</li>
|
89
|
-
<li>Your framework RubyGem (e.g. <code>newgem</code> or <code>
|
89
|
+
<li>Your framework RubyGem (e.g. <code>newgem</code> or <code>rails</code> RubyGems) needs to add <code>rubigen</code> as a <br />
|
90
90
|
dependency, so that users of your RubyGem can access the generator framework.</li>
|
91
91
|
</ol>
|
92
92
|
<h1>Creating generators</h1>
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2008-12-
|
13
|
+
date: 2008-12-29 00:00:00 +10:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|