padrino-gen 0.1.5 → 0.2.0
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/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -17,12 +17,12 @@ module Padrino
|
|
17
17
|
end
|
18
18
|
|
19
19
|
# Inserts a required gem into the Gemfile to add the bundler dependency
|
20
|
-
#
|
21
|
-
#
|
20
|
+
# insert_into_gemfile(name)
|
21
|
+
# insert_into_gemfile(name, :env => :testing, :require_as => 'foo')
|
22
22
|
def insert_into_gemfile(name, options={})
|
23
|
-
after_pattern = "# Component requirements\n"
|
24
|
-
|
25
|
-
include_text = "gem '#{name}'" << (
|
23
|
+
after_pattern = options[:env] ? "#{options[:env].to_s.capitalize} requirements\n" : "Component requirements\n"
|
24
|
+
gem_options = options.slice(:env, :require_as).collect { |k, v| "#{k.inspect} => #{v.inspect}" }.join(", ")
|
25
|
+
include_text = "gem '#{name}'" << (gem_options.present? ? ", #{gem_options}" : "") << "\n"
|
26
26
|
options.merge!(:content => include_text, :after => after_pattern)
|
27
27
|
inject_into_file('Gemfile', options[:content], :after => options[:after])
|
28
28
|
end
|
@@ -16,7 +16,7 @@ module Padrino
|
|
16
16
|
|
17
17
|
# TODO move to spec directory to follow convention
|
18
18
|
def setup_test
|
19
|
-
require_dependencies '
|
19
|
+
require_dependencies 'rspec', :env => :testing, :require_as => 'spec'
|
20
20
|
insert_test_suite_setup RSPEC_SETUP
|
21
21
|
end
|
22
22
|
|
data/padrino-gen.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{padrino-gen}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
@@ -187,7 +187,7 @@ class TestSkeletonGenerator < Test::Unit::TestCase
|
|
187
187
|
should "properly generate for rspec" do
|
188
188
|
buffer = silence_logger { @skeleton.start(['sample_app', '/tmp', '--test=rspec', '--script=none']) }
|
189
189
|
assert_match /Applying.*?rspec.*?test/, buffer
|
190
|
-
assert_match_in_file(/gem 'spec
|
190
|
+
assert_match_in_file(/gem 'rspec'.*?:require_as => "spec"/, '/tmp/sample_app/Gemfile')
|
191
191
|
assert_match_in_file(/Bundler.require_env\(:testing\)/, '/tmp/sample_app/test/test_config.rb')
|
192
192
|
assert_match_in_file(/Spec::Runner/, '/tmp/sample_app/test/test_config.rb')
|
193
193
|
end
|