rubigen 1.0.3 → 1.0.4
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/History.txt +7 -0
- data/Manifest.txt +3 -4
- data/Rakefile +1 -1
- data/app_generators/ruby_app/ruby_app_generator.rb +5 -4
- data/app_generators/ruby_app/templates/{fresh_rakefile → Rakefile} +0 -0
- data/app_generators/ruby_app/templates/{module.rb → lib/module.rb} +0 -0
- data/app_generators/ruby_app/templates/{test_helper.rb → test/test_helper.rb} +0 -0
- data/lib/rubigen/base.rb +14 -0
- data/lib/rubigen/commands.rb +9 -0
- data/lib/rubigen/helpers/generator_test_helper.rb +3 -1
- data/lib/rubigen/version.rb +1 -1
- data/website/index.html +1 -1
- metadata +5 -6
- data/app_generators/ruby_app/templates/script/generate +0 -13
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 1.0.4 2007-09-07
|
2
|
+
|
3
|
+
* New manifest actions:
|
4
|
+
* m.folder - copies over all files in folder into target path
|
5
|
+
* helper run_generator returns generator instance (so you can assert instance variables/methods etc)
|
6
|
+
* base_name method for generators - returns basename of destination_root, unless its trunk/tags/branches
|
7
|
+
|
1
8
|
== 1.0.3 2007-08-22
|
2
9
|
|
3
10
|
* /generators folder is automatically picked up by all component/app generators [bug fix]
|
data/Manifest.txt
CHANGED
@@ -7,11 +7,10 @@ Todo.txt
|
|
7
7
|
app_generators/ruby_app/USAGE
|
8
8
|
app_generators/ruby_app/ruby_app_generator.rb
|
9
9
|
app_generators/ruby_app/templates/README.txt
|
10
|
+
app_generators/ruby_app/templates/Rakefile
|
10
11
|
app_generators/ruby_app/templates/configs/empty.log
|
11
|
-
app_generators/ruby_app/templates/
|
12
|
-
app_generators/ruby_app/templates/
|
13
|
-
app_generators/ruby_app/templates/script/generate
|
14
|
-
app_generators/ruby_app/templates/test_helper.rb
|
12
|
+
app_generators/ruby_app/templates/lib/module.rb
|
13
|
+
app_generators/ruby_app/templates/test/test_helper.rb
|
15
14
|
bin/install_rubigen_scripts
|
16
15
|
bin/ruby_app
|
17
16
|
examples/rails_generators/applications/app/USAGE
|
data/Rakefile
CHANGED
@@ -93,7 +93,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
93
93
|
|
94
94
|
end
|
95
95
|
|
96
|
-
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("
|
96
|
+
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
|
97
97
|
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
98
98
|
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
99
99
|
|
@@ -28,14 +28,15 @@ class RubyAppGenerator < RubiGen::Base
|
|
28
28
|
BASEDIRS.each { |path| m.directory path }
|
29
29
|
|
30
30
|
# Root
|
31
|
-
m.file "fresh_rakefile", "Rakefile"
|
32
|
-
m.file "README.txt", "README.txt"
|
31
|
+
# m.file "fresh_rakefile", "Rakefile"
|
32
|
+
# m.file "README.txt", "README.txt"
|
33
|
+
m.folder ""
|
33
34
|
|
34
35
|
# Default module for app
|
35
|
-
m.template "module.rb", "lib/#{app_name}.rb"
|
36
|
+
m.template "lib/module.rb", "lib/#{app_name}.rb"
|
36
37
|
|
37
38
|
# Test helper
|
38
|
-
m.
|
39
|
+
m.template_copy_each %w(test_helper.rb), "test"
|
39
40
|
|
40
41
|
%w(debug).each { |file|
|
41
42
|
m.file "configs/empty.log", "log/#{file}.log", :chmod => 0666
|
File without changes
|
File without changes
|
File without changes
|
data/lib/rubigen/base.rb
CHANGED
@@ -147,6 +147,20 @@ module RubiGen
|
|
147
147
|
def destination_path(relative_destination)
|
148
148
|
File.join(destination_root, relative_destination)
|
149
149
|
end
|
150
|
+
|
151
|
+
# Return the basename of the destination_root,
|
152
|
+
# BUT, if it is trunk, tags, or branches, it continues to the
|
153
|
+
# parent path for the name
|
154
|
+
def base_name
|
155
|
+
name = File.basename(destination_root)
|
156
|
+
root = destination_root
|
157
|
+
while %w[trunk branches tags].include? name
|
158
|
+
root = File.expand_path(File.join(root, ".."))
|
159
|
+
name = File.basename(root)
|
160
|
+
end
|
161
|
+
name
|
162
|
+
end
|
163
|
+
|
150
164
|
|
151
165
|
protected
|
152
166
|
# Convenience method for generator subclasses to record a manifest.
|
data/lib/rubigen/commands.rb
CHANGED
@@ -255,6 +255,15 @@ module RubiGen
|
|
255
255
|
end
|
256
256
|
end
|
257
257
|
|
258
|
+
def folder(template_path, path=nil, options = {})
|
259
|
+
template_path = "/" if template_path.blank?
|
260
|
+
source = source_path(template_path)
|
261
|
+
files = Dir[source + '/*'].select { |file| File.file? file }.map { |file| file.sub(/^#{source}/,"") }
|
262
|
+
files.each do |file_name|
|
263
|
+
file "#{template_path}#{file_name}", "#{path}#{file_name}", options
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
258
267
|
# Checks if the source and the destination file are identical. If
|
259
268
|
# passed a block then the source file is a template that needs to first
|
260
269
|
# be evaluated before being compared to the destination.
|
@@ -2,9 +2,11 @@ module RubiGen
|
|
2
2
|
module GeneratorTestHelper
|
3
3
|
# Runs the create command (like the command line does)
|
4
4
|
def run_generator(name, params, sources, options = {})
|
5
|
+
generator = build_generator(name, params, sources, options)
|
5
6
|
silence_generator do
|
6
|
-
|
7
|
+
generator.command(:create).invoke!
|
7
8
|
end
|
9
|
+
generator
|
8
10
|
end
|
9
11
|
|
10
12
|
# Instatiates the Generator
|
data/lib/rubigen/version.rb
CHANGED
data/website/index.html
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
<h1>rubigen</h1>
|
32
32
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rubigen"; return false'>
|
33
33
|
<p>Get Version</p>
|
34
|
-
<a href="http://rubyforge.org/projects/rubigen" class="numbers">1.0.
|
34
|
+
<a href="http://rubyforge.org/projects/rubigen" class="numbers">1.0.4</a>
|
35
35
|
</div>
|
36
36
|
<h1>Ruby Generator Framework</h1>
|
37
37
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4.3
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rubigen
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.0.4
|
7
|
+
date: 2007-09-07 00:00:00 +02:00
|
8
8
|
summary: "A framework to allow Ruby applications to generate file/folder stubs (like the rails command does for Ruby on Rails, and the \xE2\x80\x98script/generate\xE2\x80\x99 command within a Rails application during development)."
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -38,11 +38,10 @@ files:
|
|
38
38
|
- app_generators/ruby_app/USAGE
|
39
39
|
- app_generators/ruby_app/ruby_app_generator.rb
|
40
40
|
- app_generators/ruby_app/templates/README.txt
|
41
|
+
- app_generators/ruby_app/templates/Rakefile
|
41
42
|
- app_generators/ruby_app/templates/configs/empty.log
|
42
|
-
- app_generators/ruby_app/templates/
|
43
|
-
- app_generators/ruby_app/templates/
|
44
|
-
- app_generators/ruby_app/templates/script/generate
|
45
|
-
- app_generators/ruby_app/templates/test_helper.rb
|
43
|
+
- app_generators/ruby_app/templates/lib/module.rb
|
44
|
+
- app_generators/ruby_app/templates/test/test_helper.rb
|
46
45
|
- bin/install_rubigen_scripts
|
47
46
|
- bin/ruby_app
|
48
47
|
- examples/rails_generators/applications/app/USAGE
|
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.join(File.dirname(__FILE__), '..')
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|