happy_seed 0.0.16 → 0.0.17
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.
- checksums.yaml +4 -4
- data/Rakefile +45 -0
- data/happy_seed.rb +36 -117
- data/happy_seed.txt +55 -0
- data/lib/generators/happy_seed/admin/admin_generator.rb +13 -9
- data/lib/generators/happy_seed/angular_install/angular_install_generator.rb +9 -1
- data/lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb +9 -9
- data/lib/generators/happy_seed/angular_view/templates/app/assets/javascripts/controllers/controller.js.coffee +1 -1
- data/lib/generators/happy_seed/api/api_generator.rb +9 -9
- data/lib/generators/happy_seed/base/base_generator.rb +65 -14
- data/lib/generators/happy_seed/base/templates/.bowerrc +3 -0
- data/lib/generators/happy_seed/base/templates/Procfile +1 -1
- data/lib/generators/happy_seed/base/templates/app/views/setup/index.html.haml +0 -2
- data/lib/generators/happy_seed/base/templates/config/puma.rb +15 -0
- data/lib/generators/happy_seed/base/templates/docs/README.00.base.rdoc +1 -1
- data/lib/generators/happy_seed/base/templates/spec/requests/setup_spec.rb +11 -0
- data/lib/generators/happy_seed/bootstrap/bootstrap_generator.rb +13 -1
- data/lib/generators/happy_seed/devise/devise_generator.rb +35 -12
- data/lib/generators/happy_seed/devise_invitable/devise_invitable_generator.rb +10 -10
- data/lib/generators/happy_seed/facebook/facebook_generator.rb +8 -1
- data/lib/generators/happy_seed/github/github_generator.rb +8 -2
- data/lib/generators/happy_seed/googleoauth/googleoauth_generator.rb +8 -2
- data/lib/generators/happy_seed/happy_seed_generator.rb +28 -16
- data/lib/generators/happy_seed/instagram/instagram_generator.rb +8 -2
- data/lib/generators/happy_seed/jazz_hands/jazz_hands_generator.rb +8 -1
- data/lib/generators/happy_seed/omniauth/omniauth_generator.rb +11 -24
- data/lib/generators/happy_seed/splash/splash_generator.rb +8 -19
- data/lib/generators/happy_seed/static/templates/source/stylesheets/application.css.scss +10 -13
- data/lib/generators/happy_seed/static_blog/templates/Gemfile.lock +45 -49
- data/lib/generators/happy_seed/static_blog/templates/source/stylesheets/application.css.scss +13 -8
- data/lib/generators/happy_seed/twitter/templates/add_secret_token_to_identity.rb +5 -0
- data/lib/generators/happy_seed/twitter/twitter_generator.rb +26 -2
- data/lib/happy_seed/cli.rb +2 -2
- data/lib/happy_seed/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +15 -0
- metadata +12 -5
- data/lib/generators/happy_seed/base/templates/config/unicorn.rb +0 -33
- data/lib/generators/happy_seed/static/templates/Gemfile.lock +0 -158
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23afa00644d4205c8819205ef62f471279e72554
|
4
|
+
data.tar.gz: c2d994f8a78a75f0cafb04f0cd391aa5121e87ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f1e69f11cda779b832b1dccce701a9e042bd2defcb8bda50d9addb1725c74cc24733ab4172f2a8bb5f50f1024f97121313d94d4110e7b4a25372bedae680a57
|
7
|
+
data.tar.gz: 39b4a11ac30fa9fb48c4ec38e85da04fbbfb521bceda56d60ab667f8851b015050758713812513e91158468349987d43b2752728da62e406b737b874e87ce517
|
data/Rakefile
CHANGED
@@ -41,3 +41,48 @@ task :sync_docs do
|
|
41
41
|
system( "cp #{file} website/source/docs/#{out}" )
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
desc "Generate dependancy graph"
|
46
|
+
task :generator_dependancies do
|
47
|
+
require 'active_support/inflector'
|
48
|
+
|
49
|
+
Dir.glob( 'lib/generators/**/*_generator.rb' ).each do |f|
|
50
|
+
data = File.read f
|
51
|
+
# name = data.lines.select { |x| x =~ /class/ }.first.gsub( /.*class (.*?)Generator.*/m, '\1' ).underscore
|
52
|
+
name = data.grep( /class/ ).first.gsub( /.*class (.*?)Generator.*/m, '\1' ).underscore
|
53
|
+
|
54
|
+
if name != 'happy_seed'
|
55
|
+
print = false
|
56
|
+
|
57
|
+
if data.grep( /require_omniauth/ ).size > 0
|
58
|
+
puts "[#{name}] -> [omniauth]"
|
59
|
+
print = true
|
60
|
+
end
|
61
|
+
|
62
|
+
data.grep( /generate .happy_seed/ ).each do |line|
|
63
|
+
dep = line.gsub( /.*happy_seed:([^"' ]*).*/m, '\1' )
|
64
|
+
puts "[#{name}] -> [#{dep}]"
|
65
|
+
print = true
|
66
|
+
end
|
67
|
+
|
68
|
+
if name == 'base'
|
69
|
+
puts "[base]"
|
70
|
+
print = true
|
71
|
+
end
|
72
|
+
|
73
|
+
if ['plugin', 'static', 'static_blog'].index( name )
|
74
|
+
# puts "Skipping #{name}"
|
75
|
+
print = true
|
76
|
+
end
|
77
|
+
|
78
|
+
puts "[#{name}] -> [base]" unless print
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class String
|
85
|
+
def grep( regex )
|
86
|
+
lines.select { |x| x =~ regex }
|
87
|
+
end
|
88
|
+
end
|
data/happy_seed.rb
CHANGED
@@ -3,141 +3,60 @@ require 'bundler'
|
|
3
3
|
puts "Setting up basic template"
|
4
4
|
puts
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
gem
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
gem "rspec"
|
13
|
-
gem "rspec-rails"
|
14
|
-
gem "factory_girl_rails"
|
15
|
-
gem "capybara"
|
16
|
-
gem "cucumber-rails", :require => false
|
17
|
-
gem "guard-rspec"
|
18
|
-
gem "guard-cucumber"
|
19
|
-
gem "database_cleaner"
|
20
|
-
gem "spring-commands-rspec"
|
21
|
-
gem 'spring-commands-cucumber'
|
22
|
-
gem "quiet_assets"
|
23
|
-
gem "launchy"
|
24
|
-
gem "vcr"
|
25
|
-
gem "faker"
|
6
|
+
gem_group :development do
|
7
|
+
if ENV['SEED_DEVELOPMENT']
|
8
|
+
gem 'happy_seed', :path => ENV['SEED_DEVELOPMENT'] # File.dirname(__FILE__)
|
9
|
+
else
|
10
|
+
gem 'happy_seed'
|
11
|
+
end
|
26
12
|
end
|
27
13
|
|
28
|
-
|
29
|
-
gem "webmock"
|
30
|
-
end
|
14
|
+
@packages = [ 'base' ]
|
31
15
|
|
32
|
-
|
33
|
-
|
34
|
-
|
16
|
+
def run_graph graph
|
17
|
+
graph.each do |node|
|
18
|
+
if yes?( "Install #{node[:name]}, #{node[:desc]}?" )
|
19
|
+
generate "happy_seed:#{node[:name]}"
|
20
|
+
@packages << node[:name]
|
35
21
|
|
36
|
-
if
|
37
|
-
|
38
|
-
|
39
|
-
gem 'happy_seed'
|
22
|
+
run_graph node[:subtree] if node[:subtree]
|
23
|
+
end
|
24
|
+
end
|
40
25
|
end
|
41
26
|
|
42
|
-
packages = []
|
43
|
-
|
44
27
|
Bundler.with_clean_env do
|
45
28
|
run "bundle install --without production"
|
46
29
|
|
47
|
-
gsub_file "app/assets/javascripts/application.js", /= require turbolinks/, "require turbolinks"
|
48
|
-
|
49
|
-
# Install rspec
|
50
|
-
generate "rspec:install"
|
51
|
-
gsub_file ".rspec", "--warnings\n", ""
|
52
|
-
append_to_file ".rspec", "--format documentation\n"
|
53
|
-
|
54
|
-
# Install cucumber
|
55
|
-
generate "cucumber:install"
|
56
|
-
|
57
|
-
append_to_file "features/support/env.rb", "
|
58
|
-
World(FactoryGirl::Syntax::Methods)
|
59
|
-
Warden.test_mode!
|
60
|
-
World(Warden::Test::Helpers)
|
61
|
-
After{ Warden.test_reset! }"
|
62
|
-
|
63
|
-
# Install Guard
|
64
|
-
run "guard init"
|
65
|
-
|
66
|
-
# Use the spring version and also run everything on startup
|
67
|
-
gsub_file "Guardfile", 'cmd: "bundle exec rspec"', 'cmd: "bin/rspec", all_on_start: true'
|
68
|
-
gsub_file "Guardfile", 'guard "cucumber"', 'guard "cucumber", cli: "--color --strict"'
|
69
|
-
|
70
30
|
# Run the base generator
|
71
31
|
generate "happy_seed:base"
|
72
32
|
|
73
|
-
|
74
|
-
all_in = true if yes? "Would you like to install everything?"
|
75
|
-
|
76
|
-
if all_in || yes?( "Would you like to install jazz hands?" )
|
77
|
-
generate "happy_seed:jazz_hands"
|
78
|
-
packages << "jazz_hands"
|
79
|
-
end
|
80
|
-
|
81
|
-
if all_in || yes?( "Would you like to install bootstrap?" )
|
82
|
-
generate "happy_seed:bootstrap"
|
83
|
-
packages << "bootstrap"
|
84
|
-
|
85
|
-
if all_in || yes?( "Would you like to install splash page?" )
|
86
|
-
generate "happy_seed:splash"
|
87
|
-
packages << "splash"
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
if all_in || yes?( "Would you like to install devise?" )
|
92
|
-
generate "happy_seed:devise"
|
93
|
-
packages << "devise"
|
94
|
-
|
95
|
-
if all_in || yes?( "Would you like to install devise_invitable?")
|
96
|
-
generate "happy_seed:devise_invitable"
|
97
|
-
packages << "devise_invitable"
|
98
|
-
end
|
99
|
-
|
100
|
-
|
101
|
-
all_connectors = yes?( "Would you like to install all of the oauth connectors?" )
|
102
|
-
|
103
|
-
if all_connectors || yes?( "Would you like to install facebook connect?" )
|
104
|
-
generate "happy_seed:facebook"
|
105
|
-
packages << "facebook"
|
106
|
-
end
|
107
|
-
|
108
|
-
if all_connectors || yes?( "Would you like to install github?" )
|
109
|
-
generate "happy_seed:github"
|
110
|
-
packages << "github"
|
111
|
-
end
|
33
|
+
puts "Base generator installed."
|
112
34
|
|
113
|
-
|
114
|
-
generate "happy_seed:googleoauth"
|
115
|
-
packages << "googleoauth"
|
116
|
-
end
|
35
|
+
puts File.read( File.expand_path( "happy_seed.txt", File.dirname( __FILE__ ) ) )
|
117
36
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
37
|
+
GRAPH = [
|
38
|
+
{name: 'splash', desc: 'Basic splash page' },
|
39
|
+
{name: 'devise', desc: 'User profiles', subtree: [
|
40
|
+
{name: 'devise_invitable', desc: 'Invitable users'},
|
41
|
+
{name: 'facebook', desc: 'OAuth: Connect with facebook' },
|
42
|
+
{name: 'github', desc: 'OAuth: Connect with github' },
|
43
|
+
{name: 'googleoauth', desc: 'OAuth: Connect wuth google' },
|
44
|
+
{name: 'instagram', desc: 'OAuth: Instagram' },
|
45
|
+
{name: 'twitter', desc: 'OAuth: twitter' },
|
46
|
+
]},
|
47
|
+
{name: 'admin', desc: 'Active Admin for back office adminstration' },
|
48
|
+
{name: 'api', desc: 'Provide API for mobile device (Beta)' },
|
49
|
+
{name: 'angular', desc: 'Setup an angular application' },
|
50
|
+
{name: 'jazz_hands', desc: 'Better Rails Console tools' }
|
51
|
+
]
|
122
52
|
|
123
|
-
|
124
|
-
generate "happy_seed:twitter"
|
125
|
-
packages << "twitter"
|
126
|
-
end
|
127
|
-
end
|
53
|
+
run_graph GRAPH
|
128
54
|
|
129
|
-
|
130
|
-
generate "happy_seed:admin"
|
131
|
-
packages << "admin"
|
132
|
-
end
|
133
|
-
|
134
|
-
if yes?( "(BETA) Would you like to install angular?" )
|
135
|
-
generate "happy_seed:angular_install"
|
136
|
-
packages << "angular"
|
137
|
-
end
|
55
|
+
run "bundle exec spring binstub --all"
|
138
56
|
|
139
57
|
puts "Setting up git"
|
140
58
|
git :init
|
141
59
|
git add: "."
|
142
|
-
git commit: "-a -m 'Based off of happy_seed: #{packages.join( ', ')} included'"
|
60
|
+
git commit: "-a -m 'Based off of happy_seed: #{@packages.join( ', ')} included'"
|
143
61
|
end
|
62
|
+
|
data/happy_seed.txt
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
```````
|
2
|
+
``.-:::::::::::::-.`` ```.`
|
3
|
+
`:///::---------------::::.+/o:/ -:
|
4
|
+
`-/+/::---------------------:///+/o/o
|
5
|
+
`//:------------:-----------------://:/ `
|
6
|
+
/o:---------/--//-.-/:-/:------------+/:.
|
7
|
+
-/----------.-::+//+s///-...----------/o++-
|
8
|
+
:/--------.......+ssosss-......---------+.
|
9
|
+
-/-----//+-......:soooooso......:///------+`
|
10
|
+
+------/-:-......sooooooos/.....:-./------:/
|
11
|
+
-/-------........-yysoooosso.........-------o
|
12
|
+
+--------.........oysooooyy:.........-------/.
|
13
|
+
+--------........../ossso+-..........-------/-
|
14
|
+
+--------..:......................-..-------+.
|
15
|
+
-/-------..o.....................-+..-------o
|
16
|
+
+--------./:....................+-.-------:/
|
17
|
+
-/---------+:.................-/:.--------+`
|
18
|
+
:/---------:/:.............-:/-.--------+.
|
19
|
+
-/----------:/::--....--://:----------/.
|
20
|
+
./:------------://///::------------/:`
|
21
|
+
`-/:----------------------------:/.
|
22
|
+
`-::-----------------------:::.
|
23
|
+
`-::::--------------::::.`
|
24
|
+
`.-:::::::::::::-.``
|
25
|
+
```````
|
26
|
+
|
27
|
+
┌───────┐ ┌────────────────┐
|
28
|
+
│ api │ ┌──│devise_invitable│
|
29
|
+
┌────────────┐ └───────┘ │ └────────────────┘
|
30
|
+
┌───│ jazz_hands │ │ │ ┌────────┐
|
31
|
+
│ └────────────┘ ▼ │ ┌──│facebook│
|
32
|
+
│ ┌────────────┐ ┌────────┐ │ ┌────────┐ │ └────────┘
|
33
|
+
├───│ admin │ ┌──│ devise │◀─┴──│omniauth│◀─┤ ┌───────┐
|
34
|
+
│ └────────────┘ │ └────────┘ └────────┘ ├──│github │
|
35
|
+
┌──────┐ │ ┌────────────┐ │ ┌────────┐ │ └───────┘
|
36
|
+
│ base │◀─┼───│ bootstrap │◀─┴──│ splash │ │ ┌──────────┐
|
37
|
+
└──────┘ │ └────────────┘ └────────┘ ├──│googleauth│
|
38
|
+
│ ┌────────────┐ ┌───────────────┐ │ └──────────┘
|
39
|
+
└───│angular_view│◀────│angular_install│ │ ┌─────────┐
|
40
|
+
└────────────┘ └───────────────┘ ├──│instagram│
|
41
|
+
│ └─────────┘
|
42
|
+
│ ┌───────┐
|
43
|
+
└──│twitter│
|
44
|
+
└───────┘
|
45
|
+
|
46
|
+
Welcome to Seed. Above is the list of generators and how they interact
|
47
|
+
with each other.
|
48
|
+
|
49
|
+
You've installed the base generator. All of the other generators can
|
50
|
+
be run now, or at anytime after the project is started. For example,
|
51
|
+
you could run "rails generate happy_seed:twitter" and all over the
|
52
|
+
dependancies would also be run if needed.
|
53
|
+
|
54
|
+
For more documentation, please go to:
|
55
|
+
http://seed.happyfuncorp.com/docs/rails.html
|
@@ -1,9 +1,17 @@
|
|
1
|
+
require 'generators/happy_seed/happy_seed_generator'
|
2
|
+
|
1
3
|
module HappySeed
|
2
4
|
module Generators
|
3
|
-
class AdminGenerator <
|
5
|
+
class AdminGenerator < HappySeedGenerator
|
4
6
|
source_root File.expand_path('../templates', __FILE__)
|
5
7
|
|
6
|
-
def
|
8
|
+
def self.fingerprint
|
9
|
+
gem_available? 'activeadmin'
|
10
|
+
end
|
11
|
+
|
12
|
+
def install_active_admin
|
13
|
+
return if already_installed
|
14
|
+
|
7
15
|
gem 'devise'
|
8
16
|
gem 'activeadmin', github: 'activeadmin', branch: 'master'
|
9
17
|
gem 'inherited_resources' # , github: 'josevalim/inherited_resources', branch: 'rails-4-2'
|
@@ -43,13 +51,9 @@ ROUTE
|
|
43
51
|
|
44
52
|
end
|
45
53
|
|
46
|
-
|
47
|
-
def
|
48
|
-
|
49
|
-
rescue Gem::LoadError
|
50
|
-
false
|
51
|
-
rescue
|
52
|
-
Gem.available?(name)
|
54
|
+
protected
|
55
|
+
def fingerprint
|
56
|
+
gem_available?( 'activeadmin' )
|
53
57
|
end
|
54
58
|
end
|
55
59
|
end
|
@@ -1,9 +1,17 @@
|
|
1
|
+
require 'generators/happy_seed/happy_seed_generator'
|
2
|
+
|
1
3
|
module HappySeed
|
2
4
|
module Generators
|
3
|
-
class AngularInstallGenerator <
|
5
|
+
class AngularInstallGenerator < HappySeedGenerator
|
4
6
|
source_root File.expand_path('../templates', __FILE__)
|
5
7
|
|
8
|
+
def self.fingerprint
|
9
|
+
File.exists? 'app/controllers/angular_controller.rb'
|
10
|
+
end
|
11
|
+
|
6
12
|
def install_angular
|
13
|
+
return if already_installed
|
14
|
+
|
7
15
|
gem 'angularjs-rails'
|
8
16
|
|
9
17
|
Bundler.with_clean_env do
|
@@ -1,37 +1,37 @@
|
|
1
|
-
|
2
|
-
app = angular.module( "HappySeed", ["ngResource", "ngRoute"])
|
1
|
+
@app = angular.module( "HappySeed", ["ngResource", "ngRoute"])
|
3
2
|
|
4
|
-
app.config(["$httpProvider", (p) ->
|
3
|
+
@app.config(["$httpProvider", (p) ->
|
5
4
|
m = document.getElementsByTagName('meta')
|
6
5
|
for i in m
|
7
6
|
p.defaults.headers.common['X-CSRF-Token'] = i.content if i.name == 'csrf-token'
|
8
7
|
])
|
9
8
|
|
10
|
-
app.config(['$routeProvider', ($routeProvider) ->
|
11
|
-
$routeProvider.
|
9
|
+
@app.config(['$routeProvider', ($routeProvider) ->
|
10
|
+
$routeProvider. when('/landing', {templateUrl: '<%= asset_path('landing.html' )%>', controller: 'LandingCtrl'}).
|
11
|
+
|
12
|
+
|
12
13
|
otherwise({redirectTo: '/landing'});
|
13
14
|
])
|
14
15
|
|
15
|
-
|
16
16
|
safeApply = (scope, fn) ->
|
17
17
|
if( scope.$$phase || scope.$root.$$phase )
|
18
18
|
fn()
|
19
19
|
else
|
20
20
|
scope.$apply(fn)
|
21
21
|
|
22
|
-
app.directive 'onEsc', ->
|
22
|
+
@app.directive 'onEsc', ->
|
23
23
|
link: (scope, elm, attr) ->
|
24
24
|
elm.bind 'keydown', (e)->
|
25
25
|
if( e.keyCode == 27 )
|
26
26
|
scope.$apply attr.onEsc
|
27
27
|
|
28
|
-
app.directive 'onEnter', ->
|
28
|
+
@app.directive 'onEnter', ->
|
29
29
|
link: (scope, elm, attr) ->
|
30
30
|
elm.bind 'keydown', (e) ->
|
31
31
|
if( e.keyCode == 13 )
|
32
32
|
scope.$apply attr.onEnter
|
33
33
|
|
34
|
-
app.directive 'onTab', ->
|
34
|
+
@app.directive 'onTab', ->
|
35
35
|
link: (scope, elm, attr) ->
|
36
36
|
elm.bind 'keydown', (e) ->
|
37
37
|
if( e.keyCode == 9 )
|
@@ -1,18 +1,18 @@
|
|
1
|
+
require 'generators/happy_seed/devise/devise_generator'
|
2
|
+
|
1
3
|
module HappySeed
|
2
4
|
module Generators
|
3
|
-
class ApiGenerator <
|
5
|
+
class ApiGenerator < HappySeedGenerator
|
4
6
|
source_root File.expand_path('../templates', __FILE__)
|
5
7
|
|
8
|
+
def self.fingerprint
|
9
|
+
gem_available? 'apitome'
|
10
|
+
end
|
11
|
+
|
6
12
|
def install_device_invitable
|
7
|
-
|
8
|
-
puts "The api generator requires devise"
|
13
|
+
return if already_installed
|
9
14
|
|
10
|
-
|
11
|
-
generate "happy_seed:devise"
|
12
|
-
else
|
13
|
-
exit
|
14
|
-
end
|
15
|
-
end
|
15
|
+
require_generator DeviseGenerator
|
16
16
|
|
17
17
|
gem 'apitome'
|
18
18
|
gem 'rspec_api_documentation', :groups => [:development, :test]
|
@@ -1,34 +1,85 @@
|
|
1
|
+
require 'generators/happy_seed/happy_seed_generator'
|
2
|
+
|
1
3
|
module HappySeed
|
2
4
|
module Generators
|
3
|
-
class BaseGenerator <
|
5
|
+
class BaseGenerator < HappySeedGenerator
|
4
6
|
source_root File.expand_path('../templates', __FILE__)
|
5
7
|
|
6
|
-
def
|
8
|
+
def self.fingerprint
|
9
|
+
File.exists?( "docs/README.00.base.rdoc" )
|
10
|
+
end
|
11
|
+
|
12
|
+
def install_seed_base
|
13
|
+
return if already_installed
|
14
|
+
|
7
15
|
puts "Installing happy_seed:base environment"
|
8
|
-
|
9
|
-
|
10
|
-
|
16
|
+
|
17
|
+
# We only want SQLITE in development not everywhere
|
18
|
+
gsub_file 'Gemfile', /.*sqlite3.*/, ""
|
19
|
+
|
20
|
+
gem 'puma'
|
11
21
|
gem 'rails_12factor'
|
22
|
+
gem 'haml-rails'
|
23
|
+
|
24
|
+
gem_group :development, :test do
|
25
|
+
gem "sqlite3"
|
26
|
+
gem "rspec"
|
27
|
+
gem "rspec-rails"
|
28
|
+
gem "factory_girl_rails"
|
29
|
+
gem "capybara"
|
30
|
+
gem "cucumber-rails", :require => false
|
31
|
+
gem "guard-rspec"
|
32
|
+
gem "guard-cucumber"
|
33
|
+
gem "database_cleaner"
|
34
|
+
gem "spring-commands-rspec"
|
35
|
+
gem 'spring-commands-cucumber'
|
36
|
+
gem "quiet_assets"
|
37
|
+
gem "launchy"
|
38
|
+
gem "vcr"
|
39
|
+
gem "faker"
|
40
|
+
gem 'dotenv-rails'
|
41
|
+
gem 'rdiscount'
|
42
|
+
end
|
43
|
+
|
44
|
+
gem_group :test do
|
45
|
+
gem "webmock"
|
46
|
+
end
|
47
|
+
|
48
|
+
gem_group :production do
|
49
|
+
gem 'pg'
|
50
|
+
end
|
12
51
|
|
13
52
|
Bundler.with_clean_env do
|
14
53
|
run "bundle install --without production"
|
15
54
|
end
|
16
55
|
|
56
|
+
gsub_file "app/assets/javascripts/application.js", /= require turbolinks/, "require turbolinks"
|
57
|
+
|
58
|
+
# Install rspec
|
59
|
+
generate "rspec:install"
|
60
|
+
gsub_file ".rspec", "--warnings\n", ""
|
61
|
+
append_to_file ".rspec", "--format documentation\n"
|
62
|
+
|
63
|
+
# Install cucumber
|
64
|
+
generate "cucumber:install"
|
65
|
+
|
66
|
+
append_to_file "features/support/env.rb", "\nWorld(FactoryGirl::Syntax::Methods)\n"
|
67
|
+
|
68
|
+
# Install Guard
|
69
|
+
run "guard init"
|
70
|
+
|
71
|
+
# Use the spring version and also run everything on startup
|
72
|
+
gsub_file "Guardfile", 'cmd: "bundle exec rspec"', 'cmd: "bin/rspec", all_on_start: true'
|
73
|
+
gsub_file "Guardfile", 'guard "cucumber"', 'guard "cucumber", cli: "--color --strict"'
|
74
|
+
|
17
75
|
directory '.'
|
18
76
|
|
19
77
|
remove_file "application_controller.rb"
|
20
78
|
|
21
79
|
inject_into_file 'app/controllers/application_controller.rb', File.read( find_in_source_paths('application_controller.rb') ), :after=>/protect_from_forgery.*\n/
|
80
|
+
inject_into_class 'config/application.rb', :Application, " config.assets.paths << Rails.root.join('vendor', 'assets', 'bower_components')"
|
22
81
|
inject_into_file 'config/environments/test.rb', " config.log_level = :error\n", before: "end\n"
|
23
82
|
|
24
|
-
begin
|
25
|
-
inject_into_file 'spec/spec_helper.rb', "\n config.include Warden::Test::Helpers, type: :feature\n config.include ControllerHelpers, type: :controller\n Warden.test_mode!\n", :before => "\nend\n"
|
26
|
-
prepend_to_file 'spec/spec_helper.rb', "require_relative 'support/controller_helpers'\n"
|
27
|
-
rescue
|
28
|
-
say_status :spec, "Unable to add login helpers to spec_helper.rb"
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
83
|
begin
|
33
84
|
inject_into_file 'spec/rails_helper.rb', "require 'webmock/rspec'\n", after: "'rspec/rails'\n"
|
34
85
|
rescue
|
@@ -36,7 +87,7 @@ module HappySeed
|
|
36
87
|
end
|
37
88
|
|
38
89
|
begin
|
39
|
-
inject_into_file 'spec/rails_helper.rb', "\n config.include
|
90
|
+
inject_into_file 'spec/rails_helper.rb', "\n config.include FactoryGirl::Syntax::Methods\n", :before => "\nend\n"
|
40
91
|
append_to_file 'spec/rails_helper.rb', "\nVCR.configure do |c|\n c.cassette_library_dir = Rails.root.join('spec', 'vcr')\n c.hook_into :webmock\nend\n"
|
41
92
|
rescue
|
42
93
|
say_status :spec, "Unable to add factory girl and VCR to rails_helper.rb", :red
|