rspec-engine-generator 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -1
- data/TODO +3 -0
- data/bin/rspec_engine +37 -4
- data/lib/rspec-engine-generator/version.rb +1 -1
- metadata +11 -5
data/README.md
CHANGED
@@ -12,7 +12,15 @@ and elsewhere and tried to make this simple and easy.
|
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
15
|
-
|
15
|
+
Usage:
|
16
|
+
rspec\_engine new NAME
|
17
|
+
|
18
|
+
Options:
|
19
|
+
[--mountable] # choose whether to make the engine mountable or not
|
20
|
+
(if false, engine is --full)
|
21
|
+
# Default: true
|
22
|
+
|
23
|
+
Build a new rspec-ready engine named NAME
|
16
24
|
|
17
25
|
## Notes
|
18
26
|
|
data/TODO
ADDED
data/bin/rspec_engine
CHANGED
@@ -5,11 +5,11 @@ require 'thor'
|
|
5
5
|
class RspecEngine < Thor
|
6
6
|
include Thor::Actions
|
7
7
|
|
8
|
-
option :mountable, type: :boolean, default: true
|
8
|
+
option :mountable, type: :boolean, default: true, desc: "choose whether to make the engine mountable or not (if false, engine is --full)"
|
9
9
|
desc "new NAME", "Build a new rspec-ready engine named NAME"
|
10
10
|
def new(name)
|
11
|
-
command = %{rails plugin new #{name} #{options[:mountable] ? '--mountable
|
12
|
-
|
11
|
+
command = %{rails plugin new #{name} #{options[:mountable] ? '--mountable' : '--full'} --skip-test-unit --skip-bundle --dummy-path=spec/dummy}
|
12
|
+
run command
|
13
13
|
inside name do
|
14
14
|
run 'git init && git add . && git commit -m"Base engine"'
|
15
15
|
insert_into_file "#{name}.gemspec", :after => 's.add_development_dependency "sqlite3"' do
|
@@ -18,7 +18,7 @@ class RspecEngine < Thor
|
|
18
18
|
run "bundle install"
|
19
19
|
run "rails g rspec:install"
|
20
20
|
gsub_file 'spec/spec_helper.rb', /..\/config\/environment/, 'dummy/config/environment'
|
21
|
-
insert_into_file "Rakefile", :
|
21
|
+
insert_into_file "Rakefile", after: "load 'rails/tasks/engine.rake'" do
|
22
22
|
%{\n\nrequire 'rspec/core/rake_task'\nRSpec::Core::RakeTask.new(:spec)\ntask :default => :spec}
|
23
23
|
end
|
24
24
|
run 'git add . && git commit -m"added rspec"'
|
@@ -43,6 +43,39 @@ class RspecEngine < Thor
|
|
43
43
|
end
|
44
44
|
SPEC
|
45
45
|
run 'git add . && git ci -am"installed capybara"'
|
46
|
+
|
47
|
+
insert_into_file 'spec/dummy/config/routes.rb', " root to: 'home#index'\n", after: '.draw do'
|
48
|
+
# generate a home controller and place to link off to engine from
|
49
|
+
inside 'spec/dummy' do
|
50
|
+
run "rails g controller Home index"
|
51
|
+
create_file 'app/views/home/index.html.erb', force: true do
|
52
|
+
content = "<h1>Welcome to the Dummy app for #{name}</h1>"
|
53
|
+
# if generating a mountable engine, add a link to the dashboard we'll setup below
|
54
|
+
if options[:mountable]
|
55
|
+
content += <<-INDEX.gsub(/^ {12}/, '')
|
56
|
+
<ul>
|
57
|
+
<li><%= link_to "View #{name} dashboard", #{name}_path %></li>
|
58
|
+
</ul>
|
59
|
+
INDEX
|
60
|
+
end
|
61
|
+
content
|
62
|
+
end
|
63
|
+
run 'git add . && git ci -am"created Home controller for easy start to engine development"'
|
64
|
+
end
|
65
|
+
|
66
|
+
# if we're generating a mountable engine, then generate a simple dashboard controller
|
67
|
+
# if it's a full engine, then there's no real dashboard, as it's integrated fully into the host app, not alongside
|
68
|
+
if options[:mountable]
|
69
|
+
run "rails g controller Dashboard index"
|
70
|
+
insert_into_file 'config/routes.rb', " root to: 'dashboard#index'\n", after: '.draw do'
|
71
|
+
create_file "app/views/#{name}/dashboard/index.html.erb", force: true do
|
72
|
+
content = <<-INDEX.gsub(/^ {10}/, '')
|
73
|
+
<h1>Welcome to an example Dashboard for #{name}</h1>
|
74
|
+
INDEX
|
75
|
+
end
|
76
|
+
run 'git add . && git ci -am"created Dashboardcontroller for easy starting place to link off to subcomponents of mounted engine."'
|
77
|
+
end
|
78
|
+
|
46
79
|
end
|
47
80
|
end
|
48
81
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-engine-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: 0.15.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.15.2
|
25
30
|
description: Thor based gem that generates an RSpec ready Rails 3 engine
|
26
31
|
email:
|
27
32
|
- jack.dempsey@gmail.com
|
@@ -35,6 +40,7 @@ files:
|
|
35
40
|
- LICENSE
|
36
41
|
- README.md
|
37
42
|
- Rakefile
|
43
|
+
- TODO
|
38
44
|
- bin/rspec_engine
|
39
45
|
- lib/rspec-engine-generator.rb
|
40
46
|
- lib/rspec-engine-generator/version.rb
|
@@ -59,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
65
|
version: '0'
|
60
66
|
requirements: []
|
61
67
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.8.
|
68
|
+
rubygems_version: 1.8.24
|
63
69
|
signing_key:
|
64
70
|
specification_version: 3
|
65
71
|
summary: Thor based gem that generates an RSpec ready Rails 3 engine
|