hashrocket-terraformation 0.1.0 → 0.1.2
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/Rakefile +2 -2
- data/bin/terrarails +7 -6
- data/rails_generators/terraformation/templates/cucumber +3 -2
- data/rails_generators/terraformation/templates/cucumber.rake +29 -8
- data/rails_generators/terraformation/templates/cucumber_environment.rb +1 -0
- data/rails_generators/terraformation/templates/gitignore +0 -1
- data/rails_generators/terraformation/terraformation_generator.rb +10 -1
- data/rails_generators/terrascaffold/templates/controller_spec.rb.erb +23 -23
- data/rails_generators/terrascaffold/terrascaffold_generator.rb +31 -0
- data/rails_generators/terraview/terraview_generator.rb +38 -0
- metadata +7 -6
- data/rails_generators/terraformation/templates/rspec.rake +0 -149
data/Rakefile
CHANGED
|
@@ -4,12 +4,12 @@ require 'fileutils'
|
|
|
4
4
|
|
|
5
5
|
spec = Gem::Specification.new do |s|
|
|
6
6
|
s.name = "terraformation"
|
|
7
|
-
s.version = "0.1.
|
|
7
|
+
s.version = "0.1.2"
|
|
8
8
|
s.summary = "Terraform your app with style"
|
|
9
9
|
s.email = "info@hashrocket.com"
|
|
10
10
|
s.homepage = "http://github.com/hashrocket/terraformation"
|
|
11
11
|
s.has_rdoc = false
|
|
12
|
-
s.authors = ["
|
|
12
|
+
s.authors = ["Hashrocket"]
|
|
13
13
|
s.files = %w( LICENSE README.rdoc Rakefile ) + Dir["{bin,rails_generators}/**/*"].sort
|
|
14
14
|
s.extra_rdoc_files = ["README.rdoc", "LICENSE"]
|
|
15
15
|
s.executables = ["terrarails"]
|
data/bin/terrarails
CHANGED
|
@@ -68,20 +68,21 @@ if File.size('doc/README_FOR_APP') == 211
|
|
|
68
68
|
file 'doc/README_FOR_APP', "= #{application_name}\n"
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
+
added_cucumber = !File.directory?('features')
|
|
72
|
+
generate 'terraformation', '--skip', '--full'
|
|
73
|
+
|
|
71
74
|
gsub_file 'app/helpers/application_helper.rb', /\A# Methods added to this .*\n/, ''
|
|
72
75
|
gsub_file 'config/environment.rb', /(?:^\s*# config\.gem .*\n)+/, <<-EOS
|
|
73
|
-
config.gem "haml", :version => ">= 2.
|
|
74
|
-
config.gem "rspec-rails", :version => ">= 1.2.1",
|
|
75
|
-
config.gem "cucumber", :version => ">= 0.
|
|
76
|
-
config.gem "webrat", :version => ">= 0.
|
|
76
|
+
config.gem "haml", :version => ">= 2.2.3"
|
|
77
|
+
config.gem "rspec-rails", :version => ">= 1.2.7.1", :lib => false
|
|
78
|
+
config.gem "cucumber", :version => ">= 0.3.99", :lib => false
|
|
79
|
+
config.gem "webrat", :version => ">= 0.5.3", :lib => false
|
|
77
80
|
EOS
|
|
78
81
|
gsub_file 'config/routes.rb', /^(ActionController::Routing::Routes\.draw do \|map\|\n)(?:^\s*\n|^\s*#.*\n)*/, '\\1'
|
|
79
82
|
|
|
80
83
|
reformat *Dir.glob('config/environments/*.rb')
|
|
81
84
|
reformat 'config/environment.rb', 'config/routes.rb', 'config/boot.rb', 'config/initializers/session_store.rb', 'script/about'
|
|
82
85
|
|
|
83
|
-
added_cucumber = !File.directory?('features')
|
|
84
|
-
generate 'terraformation', '--skip', '--full'
|
|
85
86
|
if added_cucumber
|
|
86
87
|
reformat 'features/support/env.rb', 'features/step_definitions/webrat_steps.rb'
|
|
87
88
|
end
|
|
@@ -3,6 +3,7 @@ begin
|
|
|
3
3
|
load File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/cucumber/bin/cucumber")
|
|
4
4
|
rescue LoadError => e
|
|
5
5
|
raise unless e.to_s =~ /cucumber/
|
|
6
|
-
require
|
|
7
|
-
|
|
6
|
+
require 'rubygems'
|
|
7
|
+
require 'cucumber'
|
|
8
|
+
load Cucumber::BINARY
|
|
8
9
|
end
|
|
@@ -1,15 +1,36 @@
|
|
|
1
|
+
$LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
|
|
2
|
+
|
|
3
|
+
unless ARGV.any? {|a| a =~ /^gems/}
|
|
4
|
+
|
|
1
5
|
begin
|
|
2
|
-
$:.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
|
|
3
6
|
require 'cucumber/rake/task'
|
|
7
|
+
namespace :cucumber do
|
|
8
|
+
Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
|
|
9
|
+
t.fork = true # You may get faster startup if you set this to false
|
|
10
|
+
t.cucumber_opts = "--tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
|
11
|
+
end
|
|
4
12
|
|
|
5
|
-
|
|
6
|
-
|
|
13
|
+
Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
|
|
14
|
+
t.fork = true # You may get faster startup if you set this to false
|
|
15
|
+
t.cucumber_opts = "--tags @wip:2 --wip --format #{ENV['CUCUMBER_FORMAT'] || 'pretty'}"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
desc 'Run all features'
|
|
19
|
+
task :all => [:ok, :wip]
|
|
7
20
|
end
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
21
|
+
desc 'Alias for cucumber:ok'
|
|
22
|
+
task :cucumber => 'cucumber:ok'
|
|
23
|
+
|
|
24
|
+
task :default => :cucumber
|
|
25
|
+
|
|
26
|
+
task :features => :cucumber do
|
|
27
|
+
STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
|
|
28
|
+
end
|
|
29
|
+
rescue LoadError
|
|
30
|
+
desc 'cucumber rake task not available (cucumber not installed)'
|
|
31
|
+
task :cucumber do
|
|
32
|
+
abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
|
|
12
33
|
end
|
|
13
34
|
end
|
|
14
35
|
|
|
15
|
-
|
|
36
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
eval File.read(File.join(File.dirname(__FILE__),'test.rb'))
|
|
@@ -39,7 +39,7 @@ class TerraformationGenerator < Rails::Generator::Base
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
if option?(:rspec)
|
|
42
|
-
m.file 'rspec.rake',
|
|
42
|
+
m.file 'rspec:rspec.rake', 'lib/tasks/rspec.rake'
|
|
43
43
|
|
|
44
44
|
m.file 'rspec:script/autospec', 'script/autospec', script_options
|
|
45
45
|
m.file 'rspec:script/spec', 'script/spec', script_options
|
|
@@ -54,6 +54,7 @@ class TerraformationGenerator < Rails::Generator::Base
|
|
|
54
54
|
if option?(:cucumber)
|
|
55
55
|
m.file 'cucumber.rake', 'lib/tasks/cucumber.rake'
|
|
56
56
|
m.file 'cucumber', 'script/cucumber', script_options
|
|
57
|
+
m.file 'cucumber_environment.rb', 'config/environments/cucumber.rb'
|
|
57
58
|
|
|
58
59
|
m.directory 'features'
|
|
59
60
|
m.directory 'features/support'
|
|
@@ -62,6 +63,14 @@ class TerraformationGenerator < Rails::Generator::Base
|
|
|
62
63
|
m.template 'cucumber:env.rb', 'features/support/env.rb'
|
|
63
64
|
m.file 'paths.rb', 'features/support/paths.rb'
|
|
64
65
|
m.template 'cucumber:webrat_steps.rb', 'features/step_definitions/webrat_steps.rb'
|
|
66
|
+
|
|
67
|
+
%w(config/database.yml config/database.example.yml config/database.yml.example).each do |file|
|
|
68
|
+
path = destination_path(file)
|
|
69
|
+
if File.exist?(path) && !File.read(path).include?("\ncucumber:")
|
|
70
|
+
m.gsub_file file, /test:.*\n/, "test: &TEST\n"
|
|
71
|
+
m.gsub_file file, /\z/, "\ncucumber:\n <<: *TEST\n"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
65
74
|
end
|
|
66
75
|
|
|
67
76
|
if option?(:gitignore)
|
|
@@ -9,7 +9,7 @@ describe <%= controller_class_name %>Controller do
|
|
|
9
9
|
describe "responding to GET index" do
|
|
10
10
|
|
|
11
11
|
it "should expose all <%= plural_name %> as @<%= plural_name %>" do
|
|
12
|
-
<%= class_name
|
|
12
|
+
<%= class_name %>.<%= should_receive %>(:all).<%= and_return %>([mock_<%= file_name %>])
|
|
13
13
|
get :index
|
|
14
14
|
assigns[:<%= plural_name %>].should == [mock_<%= file_name %>]
|
|
15
15
|
end
|
|
@@ -18,8 +18,8 @@ describe <%= controller_class_name %>Controller do
|
|
|
18
18
|
|
|
19
19
|
it "should render all <%= plural_name %> as xml" do
|
|
20
20
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
|
21
|
-
<%= class_name
|
|
22
|
-
<%= file_name.pluralize
|
|
21
|
+
<%= class_name %>.<%= should_receive %>(:all).<%= and_return %>(<%= file_name.pluralize %> = mock("Array of <%= class_name.pluralize %>"))
|
|
22
|
+
<%= file_name.pluralize %>.<%= should_receive %>(:to_xml).<%= and_return %>("generated XML")
|
|
23
23
|
get :index
|
|
24
24
|
response.body.should == "generated XML"
|
|
25
25
|
end
|
|
@@ -31,7 +31,7 @@ describe <%= controller_class_name %>Controller do
|
|
|
31
31
|
describe "responding to GET show" do
|
|
32
32
|
|
|
33
33
|
it "should expose the requested <%= file_name %> as @<%= file_name %>" do
|
|
34
|
-
<%= class_name
|
|
34
|
+
<%= class_name %>.<%= should_receive %>(:find).with("37").<%= and_return %>(mock_<%= file_name %>)
|
|
35
35
|
get :show, :id => "37"
|
|
36
36
|
assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
|
|
37
37
|
end
|
|
@@ -40,8 +40,8 @@ describe <%= controller_class_name %>Controller do
|
|
|
40
40
|
|
|
41
41
|
it "should render the requested <%= file_name %> as xml" do
|
|
42
42
|
request.env["HTTP_ACCEPT"] = "application/xml"
|
|
43
|
-
<%= class_name
|
|
44
|
-
mock_<%= file_name
|
|
43
|
+
<%= class_name %>.<%= should_receive %>(:find).with("37").<%= and_return %>(mock_<%= file_name %>)
|
|
44
|
+
mock_<%= file_name %>.<%= should_receive %>(:to_xml).<%= and_return %>("generated XML")
|
|
45
45
|
get :show, :id => "37"
|
|
46
46
|
response.body.should == "generated XML"
|
|
47
47
|
end
|
|
@@ -53,7 +53,7 @@ describe <%= controller_class_name %>Controller do
|
|
|
53
53
|
describe "responding to GET new" do
|
|
54
54
|
|
|
55
55
|
it "should expose a new <%= file_name %> as @<%= file_name %>" do
|
|
56
|
-
<%= class_name
|
|
56
|
+
<%= class_name %>.<%= should_receive %>(:new).<%= and_return %>(mock_<%= file_name %>)
|
|
57
57
|
get :new
|
|
58
58
|
assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
|
|
59
59
|
end
|
|
@@ -63,7 +63,7 @@ describe <%= controller_class_name %>Controller do
|
|
|
63
63
|
describe "responding to GET edit" do
|
|
64
64
|
|
|
65
65
|
it "should expose the requested <%= file_name %> as @<%= file_name %>" do
|
|
66
|
-
<%= class_name
|
|
66
|
+
<%= class_name %>.<%= should_receive %>(:find).with("37").<%= and_return %>(mock_<%= file_name %>)
|
|
67
67
|
get :edit, :id => "37"
|
|
68
68
|
assigns[:<%= file_name %>].should equal(mock_<%= file_name %>)
|
|
69
69
|
end
|
|
@@ -75,13 +75,13 @@ describe <%= controller_class_name %>Controller do
|
|
|
75
75
|
describe "with valid params" do
|
|
76
76
|
|
|
77
77
|
it "should expose a newly created <%= file_name %> as @<%= file_name %>" do
|
|
78
|
-
<%= class_name
|
|
78
|
+
<%= class_name %>.<%= should_receive %>(:new).with({'these' => 'params'}).<%= and_return %>(mock_<%= file_name %>(:save => true))
|
|
79
79
|
post :create, :<%= file_name %> => {:these => 'params'}
|
|
80
80
|
assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
it "should redirect to the created <%= file_name %>" do
|
|
84
|
-
<%= class_name
|
|
84
|
+
<%= class_name %>.<%= stub %>(:new).<%= and_return %>(mock_<%= file_name %>(:save => true))
|
|
85
85
|
post :create, :<%= file_name %> => {}
|
|
86
86
|
response.should redirect_to(<%= singular_name %>_url(mock_<%= file_name %>))
|
|
87
87
|
end
|
|
@@ -91,13 +91,13 @@ describe <%= controller_class_name %>Controller do
|
|
|
91
91
|
describe "with invalid params" do
|
|
92
92
|
|
|
93
93
|
it "should expose a newly created but unsaved <%= file_name %> as @<%= file_name %>" do
|
|
94
|
-
<%= class_name
|
|
94
|
+
<%= class_name %>.<%= stub %>(:new).with({'these' => 'params'}).<%= and_return %>(mock_<%= file_name %>(:save => false))
|
|
95
95
|
post :create, :<%= file_name %> => {:these => 'params'}
|
|
96
96
|
assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
it "should re-render the 'new' template" do
|
|
100
|
-
<%= class_name
|
|
100
|
+
<%= class_name %>.<%= stub %>(:new).<%= and_return %>(mock_<%= file_name %>(:save => false))
|
|
101
101
|
post :create, :<%= file_name %> => {}
|
|
102
102
|
response.should render_template('new')
|
|
103
103
|
end
|
|
@@ -111,19 +111,19 @@ describe <%= controller_class_name %>Controller do
|
|
|
111
111
|
describe "with valid params" do
|
|
112
112
|
|
|
113
113
|
it "should update the requested <%= file_name %>" do
|
|
114
|
-
<%= class_name
|
|
115
|
-
mock_<%= file_name
|
|
114
|
+
<%= class_name %>.<%= should_receive %>(:find).with("37").<%= and_return %>(mock_<%= file_name %>)
|
|
115
|
+
mock_<%= file_name %>.<%= should_receive %>(:update_attributes).with({'these' => 'params'})
|
|
116
116
|
put :update, :id => "37", :<%= file_name %> => {:these => 'params'}
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
it "should expose the requested <%= file_name %> as @<%= file_name %>" do
|
|
120
|
-
<%= class_name
|
|
120
|
+
<%= class_name %>.<%= stub %>(:find).<%= and_return %>(mock_<%= file_name %>(:update_attributes => true))
|
|
121
121
|
put :update, :id => "1"
|
|
122
122
|
assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
it "should redirect to the <%= file_name %>" do
|
|
126
|
-
<%= class_name
|
|
126
|
+
<%= class_name %>.<%= stub %>(:find).<%= and_return %>(mock_<%= file_name %>(:update_attributes => true))
|
|
127
127
|
put :update, :id => "1"
|
|
128
128
|
response.should redirect_to(<%= singular_name %>_url(mock_<%= file_name %>))
|
|
129
129
|
end
|
|
@@ -133,19 +133,19 @@ describe <%= controller_class_name %>Controller do
|
|
|
133
133
|
describe "with invalid params" do
|
|
134
134
|
|
|
135
135
|
it "should update the requested <%= file_name %>" do
|
|
136
|
-
<%= class_name
|
|
137
|
-
mock_<%= file_name
|
|
136
|
+
<%= class_name %>.<%= should_receive %>(:find).with("37").<%= and_return %>(mock_<%= file_name %>)
|
|
137
|
+
mock_<%= file_name %>.<%= should_receive %>(:update_attributes).with({'these' => 'params'})
|
|
138
138
|
put :update, :id => "37", :<%= file_name %> => {:these => 'params'}
|
|
139
139
|
end
|
|
140
140
|
|
|
141
141
|
it "should expose the <%= file_name %> as @<%= file_name %>" do
|
|
142
|
-
<%= class_name
|
|
142
|
+
<%= class_name %>.<%= stub %>(:find).<%= and_return %>(mock_<%= file_name %>(:update_attributes => false))
|
|
143
143
|
put :update, :id => "1"
|
|
144
144
|
assigns(:<%= file_name %>).should equal(mock_<%= file_name %>)
|
|
145
145
|
end
|
|
146
146
|
|
|
147
147
|
it "should re-render the 'edit' template" do
|
|
148
|
-
<%= class_name
|
|
148
|
+
<%= class_name %>.<%= stub %>(:find).<%= and_return %>(mock_<%= file_name %>(:update_attributes => false))
|
|
149
149
|
put :update, :id => "1"
|
|
150
150
|
response.should render_template('edit')
|
|
151
151
|
end
|
|
@@ -157,13 +157,13 @@ describe <%= controller_class_name %>Controller do
|
|
|
157
157
|
describe "responding to DELETE destroy" do
|
|
158
158
|
|
|
159
159
|
it "should destroy the requested <%= file_name %>" do
|
|
160
|
-
<%= class_name
|
|
161
|
-
mock_<%= file_name
|
|
160
|
+
<%= class_name %>.<%= should_receive %>(:find).with("37").<%= and_return %>(mock_<%= file_name %>)
|
|
161
|
+
mock_<%= file_name %>.<%= should_receive %>(:destroy)
|
|
162
162
|
delete :destroy, :id => "37"
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
it "should redirect to the <%= plural_name %> list" do
|
|
166
|
-
<%= class_name
|
|
166
|
+
<%= class_name %>.<%= stub %>(:find).<%= and_return %>(mock_<%= file_name %>(:destroy => true))
|
|
167
167
|
delete :destroy, :id => "1"
|
|
168
168
|
response.should redirect_to(<%= plural_name %>_path)
|
|
169
169
|
end
|
|
@@ -9,6 +9,37 @@ class TerrascaffoldGenerator < Rails::Generator::NamedBase
|
|
|
9
9
|
:controller_class_name,
|
|
10
10
|
:controller_file_name
|
|
11
11
|
|
|
12
|
+
def mocha?
|
|
13
|
+
if @mocha.nil?
|
|
14
|
+
@mocha = Rails.configuration.gems.any? {|g| g.name == "mocha"}
|
|
15
|
+
end
|
|
16
|
+
@mocha
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def stub
|
|
20
|
+
if mocha?
|
|
21
|
+
"stubs"
|
|
22
|
+
else
|
|
23
|
+
"stub!"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def should_receive
|
|
28
|
+
if mocha?
|
|
29
|
+
"expects"
|
|
30
|
+
else
|
|
31
|
+
"should_receive"
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def and_return
|
|
36
|
+
if mocha?
|
|
37
|
+
"returns"
|
|
38
|
+
else
|
|
39
|
+
"and_return"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
12
43
|
def initialize(runtime_args, runtime_options = {})
|
|
13
44
|
super
|
|
14
45
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../terraforming'
|
|
2
|
+
|
|
3
|
+
class TerraviewGenerator < Rails::Generator::Base
|
|
4
|
+
include Terraforming
|
|
5
|
+
|
|
6
|
+
def manifest
|
|
7
|
+
record do |m|
|
|
8
|
+
views
|
|
9
|
+
usage unless args.empty?
|
|
10
|
+
usage unless views.all? {|view| view.include?("/") ? true : p(view)}
|
|
11
|
+
|
|
12
|
+
views.map {|view| File.dirname(view)}.each do |dir|
|
|
13
|
+
m.directory File.join('app/views', dir)
|
|
14
|
+
m.directory File.join('spec/views', dir)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
views.each do |view|
|
|
18
|
+
full_name, format, engine = view.split('.')
|
|
19
|
+
class_name, name = File.dirname(full_name).camelize, File.basename(full_name)
|
|
20
|
+
m.template 'terracontroller:view_spec.rb.erb',
|
|
21
|
+
File.join('spec/views', "#{full_name}.#{format}_spec.rb"),
|
|
22
|
+
:assigns => { :class_name => class_name, :name => name, :format => format, :engine => engine }
|
|
23
|
+
path = File.join('app/views', view)
|
|
24
|
+
template = ["terracontroller:view.#{format}.#{engine}.erb", "terracontroller:view.#{engine}.erb", "terracontroller:view.erb"].detect {|f| File.exist?(source_path(f))}
|
|
25
|
+
m.template template,
|
|
26
|
+
path,
|
|
27
|
+
:assigns => { :class_name => class_name, :action => "#{name}.#{format}", :path => path }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
protected
|
|
33
|
+
|
|
34
|
+
def banner
|
|
35
|
+
"Usage: #{$0} terraview [controller/action[.format[.engine]]] ..."
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hashrocket-terraformation
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Hashrocket
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-
|
|
12
|
+
date: 2009-09-12 00:00:00 -07:00
|
|
13
13
|
default_executable: terrarails
|
|
14
14
|
dependencies: []
|
|
15
15
|
|
|
@@ -49,12 +49,12 @@ files:
|
|
|
49
49
|
- rails_generators/terraformation/templates/clear_test_default.rake
|
|
50
50
|
- rails_generators/terraformation/templates/cucumber
|
|
51
51
|
- rails_generators/terraformation/templates/cucumber.rake
|
|
52
|
+
- rails_generators/terraformation/templates/cucumber_environment.rb
|
|
52
53
|
- rails_generators/terraformation/templates/gitignore
|
|
53
54
|
- rails_generators/terraformation/templates/jquery.js
|
|
54
55
|
- rails_generators/terraformation/templates/null_gitignore
|
|
55
56
|
- rails_generators/terraformation/templates/paths.rb
|
|
56
57
|
- rails_generators/terraformation/templates/rcov.opts
|
|
57
|
-
- rails_generators/terraformation/templates/rspec.rake
|
|
58
58
|
- rails_generators/terraformation/templates/spec.opts
|
|
59
59
|
- rails_generators/terraformation/templates/spec_helper.rb
|
|
60
60
|
- rails_generators/terraformation/terraformation_generator.rb
|
|
@@ -74,7 +74,6 @@ files:
|
|
|
74
74
|
- rails_generators/terramodel/terramodel_generator.rb
|
|
75
75
|
- rails_generators/terraresource
|
|
76
76
|
- rails_generators/terraresource/USAGE
|
|
77
|
-
- rails_generators/terraresource/templates
|
|
78
77
|
- rails_generators/terraresource/terraresource_generator.rb
|
|
79
78
|
- rails_generators/terrascaffold
|
|
80
79
|
- rails_generators/terrascaffold/USAGE
|
|
@@ -91,6 +90,8 @@ files:
|
|
|
91
90
|
- rails_generators/terrascaffold/templates/view_show.html.haml.erb
|
|
92
91
|
- rails_generators/terrascaffold/templates/view_show.html_spec.rb.erb
|
|
93
92
|
- rails_generators/terrascaffold/terrascaffold_generator.rb
|
|
93
|
+
- rails_generators/terraview
|
|
94
|
+
- rails_generators/terraview/terraview_generator.rb
|
|
94
95
|
has_rdoc: false
|
|
95
96
|
homepage: http://github.com/hashrocket/terraformation
|
|
96
97
|
post_install_message:
|
|
@@ -115,7 +116,7 @@ requirements: []
|
|
|
115
116
|
rubyforge_project:
|
|
116
117
|
rubygems_version: 1.2.0
|
|
117
118
|
signing_key:
|
|
118
|
-
specification_version:
|
|
119
|
+
specification_version: 3
|
|
119
120
|
summary: Terraform your app with style
|
|
120
121
|
test_files: []
|
|
121
122
|
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
rspec_gem_dir = nil
|
|
2
|
-
Dir["#{RAILS_ROOT}/vendor/gems/*"].each do |subdir|
|
|
3
|
-
rspec_gem_dir = subdir if subdir.gsub("#{RAILS_ROOT}/vendor/gems/","") =~ /^(\w+-)?rspec-(\d+)/ && File.exist?("#{subdir}/lib/spec/rake/spectask.rb")
|
|
4
|
-
end
|
|
5
|
-
rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
|
|
6
|
-
|
|
7
|
-
if rspec_gem_dir && (test ?d, rspec_plugin_dir)
|
|
8
|
-
raise "\n#{'*'*50}\nYou have rspec installed in both vendor/gems and vendor/plugins\nPlease pick one and dispose of the other.\n#{'*'*50}\n\n"
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
if rspec_gem_dir
|
|
12
|
-
$LOAD_PATH.unshift("#{rspec_gem_dir}/lib")
|
|
13
|
-
elsif File.exist?(rspec_plugin_dir)
|
|
14
|
-
$LOAD_PATH.unshift("#{rspec_plugin_dir}/lib")
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
begin
|
|
18
|
-
require 'spec/rake/spectask'
|
|
19
|
-
|
|
20
|
-
spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : []
|
|
21
|
-
spec_opts = ["--options", "\"#{RAILS_ROOT}/spec/spec.opts\""]
|
|
22
|
-
spec_opts.clear unless File.exist?(spec_opts.last[1..-2])
|
|
23
|
-
|
|
24
|
-
task :stats => "spec:statsetup"
|
|
25
|
-
|
|
26
|
-
desc "Run all specs in spec directory (excluding plugin specs)"
|
|
27
|
-
Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
|
|
28
|
-
t.spec_opts = spec_opts
|
|
29
|
-
t.spec_files = FileList['spec/**/*/*_spec.rb']
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
namespace :spec do
|
|
33
|
-
desc "Run all specs in spec directory with RCov (excluding plugin specs)"
|
|
34
|
-
Spec::Rake::SpecTask.new(:rcov) do |t|
|
|
35
|
-
t.spec_opts = spec_opts
|
|
36
|
-
t.spec_files = FileList['spec/**/*/*_spec.rb']
|
|
37
|
-
t.rcov = true
|
|
38
|
-
t.rcov_opts = lambda do
|
|
39
|
-
IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
desc "Print Specdoc for all specs (excluding plugin specs)"
|
|
44
|
-
Spec::Rake::SpecTask.new(:doc) do |t|
|
|
45
|
-
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
|
46
|
-
t.spec_files = FileList['spec/**/*/*_spec.rb']
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
desc "Print Specdoc for all plugin examples"
|
|
50
|
-
Spec::Rake::SpecTask.new(:plugin_doc) do |t|
|
|
51
|
-
t.spec_opts = ["--format", "specdoc", "--dry-run"]
|
|
52
|
-
t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*')
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
[:models, :controllers, :views, :helpers, :lib].each do |sub|
|
|
56
|
-
desc "Run the code examples in spec/#{sub}"
|
|
57
|
-
Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
|
|
58
|
-
t.spec_opts = spec_opts
|
|
59
|
-
t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
desc "Run the code examples in vendor/plugins (except RSpec's own)"
|
|
64
|
-
Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
|
|
65
|
-
t.spec_opts = spec_opts
|
|
66
|
-
t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
namespace :plugins do
|
|
70
|
-
desc "Runs the examples for rspec_on_rails"
|
|
71
|
-
Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
|
|
72
|
-
t.spec_opts = spec_opts
|
|
73
|
-
t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
# Setup specs for stats
|
|
78
|
-
task :statsetup do
|
|
79
|
-
require 'code_statistics'
|
|
80
|
-
::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
|
|
81
|
-
::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
|
|
82
|
-
::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
|
|
83
|
-
::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
|
|
84
|
-
::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
|
|
85
|
-
::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
|
|
86
|
-
::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
|
|
87
|
-
::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
|
|
88
|
-
::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
|
|
89
|
-
::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
|
|
90
|
-
::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
namespace :db do
|
|
94
|
-
namespace :fixtures do
|
|
95
|
-
desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
|
|
96
|
-
task :load => :environment do
|
|
97
|
-
ActiveRecord::Base.establish_connection(Rails.env)
|
|
98
|
-
base_dir = File.join(Rails.root, 'spec', 'fixtures')
|
|
99
|
-
fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
|
|
100
|
-
|
|
101
|
-
(ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
|
|
102
|
-
Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
namespace :server do
|
|
109
|
-
daemonized_server_pid = File.expand_path("spec_server.pid", RAILS_ROOT + "/tmp")
|
|
110
|
-
|
|
111
|
-
desc "start spec_server."
|
|
112
|
-
task :start do
|
|
113
|
-
if File.exist?(daemonized_server_pid)
|
|
114
|
-
$stderr.puts "spec_server is already running."
|
|
115
|
-
else
|
|
116
|
-
$stderr.puts "Starting up spec server."
|
|
117
|
-
system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
desc "stop spec_server."
|
|
122
|
-
task :stop do
|
|
123
|
-
unless File.exist?(daemonized_server_pid)
|
|
124
|
-
$stderr.puts "No server running."
|
|
125
|
-
else
|
|
126
|
-
$stderr.puts "Shutting down spec_server."
|
|
127
|
-
system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
|
|
128
|
-
File.delete(daemonized_server_pid)
|
|
129
|
-
end
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
desc "reload spec_server."
|
|
133
|
-
task :restart do
|
|
134
|
-
unless File.exist?(daemonized_server_pid)
|
|
135
|
-
$stderr.puts "No server running."
|
|
136
|
-
else
|
|
137
|
-
$stderr.puts "Reloading down spec_server."
|
|
138
|
-
system("kill", "-s", "USR2", File.read(daemonized_server_pid).strip)
|
|
139
|
-
end
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
rescue MissingSourceFile => e
|
|
144
|
-
task :spec do
|
|
145
|
-
raise e
|
|
146
|
-
end
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
task :default => :spec
|