rubigen 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/app_generators/ruby_app/ruby_app_generator.rb +1 -1
- data/lib/rubigen/base.rb +4 -3
- data/lib/rubigen/commands.rb +7 -7
- data/lib/rubigen/helpers/generator_test_helper.rb +10 -7
- data/lib/rubigen/lookup.rb +1 -1
- data/lib/rubigen/spec.rb +1 -1
- data/lib/rubigen.rb +3 -2
- data/test/test_generate_builtin_application.rb +2 -1
- data/test/test_install_rubigen_scripts_generator.rb +2 -1
- data/test/test_lookup.rb +1 -1
- data/website/index.html +1 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 1.4.0 2008-12-11 NOT RELEASED
|
2
|
+
|
3
|
+
* rubigen tests now pass against ruby 1.9.0 and ruby 1.9.1(prerelease 2)
|
4
|
+
* puts are sent to an explicit #stdout which can be STDOUT or a StringIO passed from tests; test output is now clean!
|
5
|
+
|
1
6
|
== 1.3.4 2008-11-12
|
2
7
|
|
3
8
|
* ruby_app: fixed reference to non-existent version.rb [jperkins]
|
@@ -56,7 +56,7 @@ class RubyAppGenerator < RubiGen::Base
|
|
56
56
|
opts.separator 'Options:'
|
57
57
|
opts.on("-r", "--ruby=path", String,
|
58
58
|
"Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
|
59
|
-
"Default: #{DEFAULT_SHEBANG}") { |options[:shebang]
|
59
|
+
"Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v }
|
60
60
|
end
|
61
61
|
|
62
62
|
|
data/lib/rubigen/base.rb
CHANGED
@@ -81,7 +81,7 @@ module RubiGen
|
|
81
81
|
|
82
82
|
# Declare default options for the generator. These options
|
83
83
|
# are inherited to subclasses.
|
84
|
-
default_options :collision => :ask, :quiet => false
|
84
|
+
default_options :collision => :ask, :quiet => false, :stdout => STDOUT
|
85
85
|
|
86
86
|
# A logger instance available everywhere in the generator.
|
87
87
|
cattr_accessor :logger
|
@@ -90,7 +90,7 @@ module RubiGen
|
|
90
90
|
# Spec describing where it was found.
|
91
91
|
class_inheritable_accessor :spec
|
92
92
|
|
93
|
-
attr_reader :source_root, :destination_root, :args
|
93
|
+
attr_reader :source_root, :destination_root, :args, :stdout
|
94
94
|
|
95
95
|
def initialize(runtime_args, runtime_options = {})
|
96
96
|
@args = runtime_args
|
@@ -106,6 +106,8 @@ module RubiGen
|
|
106
106
|
|
107
107
|
# Silence the logger if requested.
|
108
108
|
logger.quiet = options[:quiet]
|
109
|
+
|
110
|
+
@stdout = options[:stdout]
|
109
111
|
|
110
112
|
# Raise usage error if help is requested.
|
111
113
|
usage if options[:help]
|
@@ -161,7 +163,6 @@ module RubiGen
|
|
161
163
|
name
|
162
164
|
end
|
163
165
|
|
164
|
-
|
165
166
|
protected
|
166
167
|
# Convenience method for generator subclasses to record a manifest.
|
167
168
|
def record
|
data/lib/rubigen/commands.rb
CHANGED
@@ -99,18 +99,18 @@ module RubiGen
|
|
99
99
|
Tempfile.open(File.basename(destination), File.dirname(dst)) do |temp|
|
100
100
|
temp.write render_file(src, file_options, &block)
|
101
101
|
temp.rewind
|
102
|
-
$stdout.puts `#{diff_cmd} #{dst} #{temp.path}`
|
102
|
+
$stdout.stdout.puts `#{diff_cmd} #{dst} #{temp.path}`
|
103
103
|
end
|
104
|
-
puts "retrying"
|
104
|
+
stdout.puts "retrying"
|
105
105
|
raise 'retry diff'
|
106
106
|
when /a/i
|
107
|
-
$stdout.puts "forcing #{spec.name}"
|
107
|
+
$stdout.stdout.puts "forcing #{spec.name}"
|
108
108
|
options[:collision] = :force
|
109
109
|
when /i/i
|
110
|
-
$stdout.puts "ignoring #{spec.name}"
|
110
|
+
$stdout.stdout.puts "ignoring #{spec.name}"
|
111
111
|
options[:collision] = :skip
|
112
112
|
when /q/i
|
113
|
-
$stdout.puts "aborting #{spec.name}"
|
113
|
+
$stdout.stdout.puts "aborting #{spec.name}"
|
114
114
|
raise SystemExit
|
115
115
|
when /n/i then :skip
|
116
116
|
when /y/i then :force
|
@@ -352,7 +352,7 @@ module RubiGen
|
|
352
352
|
def readme(*relative_sources)
|
353
353
|
relative_sources.flatten.each do |relative_source|
|
354
354
|
logger.readme relative_source
|
355
|
-
puts File.read(source_path(relative_source)) unless options[:pretend]
|
355
|
+
stdout.puts File.read(source_path(relative_source)) unless options[:pretend]
|
356
356
|
end
|
357
357
|
end
|
358
358
|
|
@@ -545,7 +545,7 @@ end_message
|
|
545
545
|
|
546
546
|
migration_file_name = template_options[:migration_file_name] || file_name
|
547
547
|
unless migration_exists?(migration_file_name)
|
548
|
-
puts "There is no migration named #{migration_file_name}"
|
548
|
+
stdout.puts "There is no migration named #{migration_file_name}"
|
549
549
|
return
|
550
550
|
end
|
551
551
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
|
1
3
|
module RubiGen
|
2
4
|
module GeneratorTestHelper
|
3
5
|
# Runs the create command (like the command line does)
|
@@ -11,7 +13,9 @@ module RubiGen
|
|
11
13
|
|
12
14
|
# Instatiates the Generator
|
13
15
|
def build_generator(name, params, sources, options)
|
16
|
+
@stdout ||= StringIO.new
|
14
17
|
options.merge!(:collision => :force) # so no questions are prompted
|
18
|
+
options.merge!(:stdout => @stdout) # so stdout is piped to a StringIO
|
15
19
|
if sources.is_a?(Symbol)
|
16
20
|
if sources == :app
|
17
21
|
RubiGen::Base.use_application_sources!
|
@@ -27,13 +31,11 @@ module RubiGen
|
|
27
31
|
|
28
32
|
# Silences the logger temporarily and returns the output as a String
|
29
33
|
def silence_generator
|
30
|
-
logger_original=RubiGen::Base.logger
|
31
|
-
myout=StringIO.new
|
32
|
-
RubiGen::Base.logger=RubiGen::SimpleLogger.new(myout)
|
33
|
-
# TODO redirect $stdout to myout
|
34
|
+
logger_original = RubiGen::Base.logger
|
35
|
+
myout = StringIO.new
|
36
|
+
RubiGen::Base.logger = RubiGen::SimpleLogger.new(myout)
|
34
37
|
yield if block_given?
|
35
|
-
RubiGen::Base.logger=logger_original
|
36
|
-
# TODO fix $stdout again
|
38
|
+
RubiGen::Base.logger = logger_original
|
37
39
|
myout.string
|
38
40
|
end
|
39
41
|
|
@@ -120,6 +122,7 @@ module RubiGen
|
|
120
122
|
|
121
123
|
def bare_setup
|
122
124
|
FileUtils.mkdir_p(APP_ROOT)
|
125
|
+
@stdout = StringIO.new
|
123
126
|
end
|
124
127
|
|
125
128
|
def bare_teardown
|
@@ -127,4 +130,4 @@ module RubiGen
|
|
127
130
|
end
|
128
131
|
|
129
132
|
end
|
130
|
-
end
|
133
|
+
end
|
data/lib/rubigen/lookup.rb
CHANGED
@@ -168,7 +168,7 @@ module RubiGen
|
|
168
168
|
private
|
169
169
|
# Lookup and cache every generator from the source list.
|
170
170
|
def cache
|
171
|
-
@cache ||= sources.inject([]) { |cache, source| cache + source.
|
171
|
+
@cache ||= sources.inject([]) { |cache, source| cache + source.to_a }
|
172
172
|
end
|
173
173
|
|
174
174
|
# Clear the cache whenever the source list changes.
|
data/lib/rubigen/spec.rb
CHANGED
@@ -6,7 +6,7 @@ module RubiGen
|
|
6
6
|
attr_reader :name, :path, :source
|
7
7
|
|
8
8
|
def initialize(name, path, source)
|
9
|
-
@name, @path, @source = name, path, source
|
9
|
+
@name, @path, @source, @klass = name, path, source, nil
|
10
10
|
end
|
11
11
|
|
12
12
|
# Look up the generator class. Require its class file, find the class
|
data/lib/rubigen.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
$:.unshift(File.dirname(__FILE__))
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
2
3
|
|
3
4
|
begin
|
4
5
|
require 'active_support'
|
@@ -9,7 +10,7 @@ rescue LoadError
|
|
9
10
|
end
|
10
11
|
|
11
12
|
module RubiGen
|
12
|
-
VERSION = '1.
|
13
|
+
VERSION = '1.4.0'
|
13
14
|
end
|
14
15
|
|
15
16
|
require 'rubigen/base'
|
@@ -25,7 +25,8 @@ class TestGenerateBuiltinApplication < Test::Unit::TestCase
|
|
25
25
|
|
26
26
|
private
|
27
27
|
def sources
|
28
|
-
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
28
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path)),
|
29
|
+
RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", "generators"))
|
29
30
|
]
|
30
31
|
end
|
31
32
|
|
@@ -34,7 +34,8 @@ class TestInstallRubigenScriptsGenerator < Test::Unit::TestCase
|
|
34
34
|
|
35
35
|
private
|
36
36
|
def sources
|
37
|
-
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
37
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path)),
|
38
|
+
RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", "generators"))
|
38
39
|
]
|
39
40
|
end
|
40
41
|
|
data/test/test_lookup.rb
CHANGED
@@ -8,7 +8,7 @@ class TestLookup < Test::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_lookup_component
|
11
|
-
assert_nothing_raised(GeneratorError, "Could not find
|
11
|
+
assert_nothing_raised(GeneratorError, "Could not find install_rubigen_scripts generator") { Base.lookup('install_rubigen_scripts') }
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_lookup_unknown_component
|
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.
|
38
|
+
<a href="http://rubyforge.org/projects/rubigen" class="numbers">1.4.0</a>
|
39
39
|
</div>
|
40
40
|
|
41
41
|
<div id="twitter_search">
|
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.
|
4
|
+
version: 1.4.0
|
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-11
|
13
|
+
date: 2008-12-11 00:00:00 +10:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|