shoestrap 0.4.1 → 1.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -18
- data/.rspec +1 -1
- data/.ruby-version +1 -0
- data/.travis.yml +4 -11
- data/CHANGELOG.md +15 -1
- data/CONTRIBUTING +1 -0
- data/Gemfile +1 -1
- data/Guardfile +7 -0
- data/LICENSE +17 -4
- data/README.md +32 -14
- data/Rakefile +11 -10
- data/bin/shoestrap +2 -10
- data/features/features_helper.rb +91 -0
- data/features/shoestrap/commands/new_command_feature.rb +191 -0
- data/features/shoestrap/generators/bdd_generator_feature.rb +43 -0
- data/features/shoestrap/generators/bootstrap_generator_feature.rb +11 -0
- data/features/shoestrap/generators/coffee_files_generator_feature.rb +32 -0
- data/features/shoestrap/generators/foundation_generator_feature.rb +34 -0
- data/features/shoestrap/generators/kuhsaft_generator_feature.rb +38 -0
- data/features/shoestrap/generators/smacss_files_generator_feature.rb +45 -0
- data/lib/generators/shoestrap/bdd_generator.rb +34 -0
- data/lib/generators/shoestrap/bootstrap_generator.rb +6 -0
- data/lib/generators/shoestrap/coffee_files_generator.rb +19 -0
- data/lib/generators/shoestrap/database_generator.rb +9 -0
- data/lib/generators/shoestrap/foundation_generator.rb +24 -0
- data/lib/generators/shoestrap/gem_install_generator.rb +12 -0
- data/lib/generators/shoestrap/kuhsaft_generator.rb +34 -0
- data/lib/generators/shoestrap/mailcatcher_generator.rb +14 -0
- data/lib/generators/shoestrap/smacss_file_generator.rb +33 -0
- data/lib/shoestrap.rb +2 -6
- data/lib/shoestrap/application_generator.rb +96 -0
- data/lib/shoestrap/cli.rb +35 -0
- data/lib/shoestrap/railtie.rb +7 -0
- data/lib/shoestrap/shell.rb +9 -0
- data/lib/shoestrap/version.rb +3 -0
- data/shoestrap.gemspec +28 -21
- data/spec/shoestrap/application_generator_spec.rb +170 -0
- data/spec/shoestrap/cli_spec.rb +28 -0
- data/spec/spec_helper.rb +34 -0
- data/templates/application_generator/application.html.haml +51 -0
- data/templates/application_generator/application_helper.rb +6 -0
- data/templates/application_generator/application_template.rb +72 -0
- data/templates/application_generator/favicons/favicon-sc-129x129.png +0 -0
- data/templates/application_generator/favicons/favicon-sc-16x16.ico +0 -0
- data/templates/application_generator/favicons/favicon-sc-32x32.png +0 -0
- data/templates/bdd_generator/active_record_spec_helper.rb +19 -0
- data/templates/bdd_generator/dotrspec +2 -0
- data/templates/bdd_generator/fast_spec_helper.rb +6 -0
- data/templates/bdd_generator/spec_helper.rb +12 -0
- data/templates/coffee_generator/application.js.coffee +3 -0
- data/templates/foundation_generator/_ie8_grid.css +85 -0
- data/templates/foundation_generator/_settings.css.sass +171 -0
- data/templates/kuhsaft_generator/kuhsaft.rb +5 -0
- data/templates/smacss_generator/application.css.sass +18 -0
- metadata +165 -74
- data/.rvmrc +0 -34
- data/lib/generators/shoestrap/app_generator.rb +0 -35
- data/lib/generators/shoestrap/cms_generator.rb +0 -57
- data/lib/generators/shoestrap/deployment_generator.rb +0 -62
- data/lib/generators/shoestrap/templates/cms/migration.rb +0 -15
- data/lib/generators/shoestrap/templates/cms/model.rb +0 -10
- data/lib/generators/shoestrap/templates/cms/model.yml.erb +0 -9
- data/lib/generators/shoestrap/templates/cms/view.yml.erb +0 -10
- data/lib/generators/shoestrap/templates/deployment/airbrake.rb +0 -10
- data/lib/generators/shoestrap/templates/deployment/database.yml.erb +0 -30
- data/lib/generators/shoestrap/templates/deployment/deployment.rake.erb +0 -23
- data/lib/generators/shoestrap/templates/deployment/unicorn.rb +0 -38
- data/lib/shoestrap/app_builder.rb +0 -132
- data/lib/shoestrap/tasks/middleman.rb +0 -21
- data/lib/shoestrap/tasks/radiant.rb +0 -41
- data/lib/shoestrap/tasks/rails.rb +0 -81
- data/templates/Gemfile.erb +0 -43
- data/templates/Guardfile +0 -33
- data/templates/README.md.erb +0 -30
- data/templates/_main_navigation.html.haml.erb +0 -5
- data/templates/application.html.haml +0 -24
- data/templates/bootstrap_and_overrides.css.sass +0 -7
- data/templates/cms_navigation.rb +0 -9
- data/templates/development_mail_interceptor.rb +0 -7
- data/templates/haml/scaffold/_form.html.haml +0 -10
- data/templates/haml/scaffold/edit.html.haml +0 -8
- data/templates/haml/scaffold/index.html.haml +0 -29
- data/templates/haml/scaffold/new.html.haml +0 -5
- data/templates/haml/scaffold/show.html.haml +0 -11
- data/templates/index.html.haml +0 -27
- data/templates/kuhsaft.css.sass +0 -2
- data/templates/rails/scaffold_controller/controller.rb +0 -89
- data/templates/setup_mail.rb +0 -1
- data/templates/shoestrap.yml +0 -41
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative '../../features_helper'
|
2
|
+
|
3
|
+
describe 'application generated with shoestrap new <name>' do
|
4
|
+
before :all do
|
5
|
+
generate_test_app_with_shoestrap
|
6
|
+
end
|
7
|
+
|
8
|
+
context '.rspec file' do
|
9
|
+
it 'sets up rspec to use colored output' do
|
10
|
+
expect(application_file('.rspec')).to match /--color/
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'sets up rspec to use the documentation format' do
|
14
|
+
expect(application_file('.rspec')).to match /--format d/
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'has a spec_helper' do
|
19
|
+
expect(application_file('spec/spec_helper.rb')).not_to be_nil
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'has a fast_spec_helper' do
|
23
|
+
expect(application_file('spec/fast_spec_helper.rb')).not_to be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'has a active_record_spec_helper' do
|
27
|
+
expect(application_file('spec/active_record_spec_helper.rb')).not_to be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'Guardfile' do
|
31
|
+
it 'has a Guardfile' do
|
32
|
+
expect(application_file('Guardfile')).not_to be_nil
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'has the rspec config in it' do
|
36
|
+
expect(application_file('Guardfile')).to match /guard\ :rspec\ do/
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'has the spring config in it' do
|
40
|
+
expect(application_file('Guardfile')).to match /guard\ 'spring'\ do/
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative '../../features_helper'
|
2
|
+
|
3
|
+
describe 'application generated with shoestrap new <name> --css=bootstrap' do
|
4
|
+
before :all do
|
5
|
+
generate_test_app_with_shoestrap('--css=bootstrap')
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'has bootstrap-sass in the Gemfile' do
|
9
|
+
expect(application_file('Gemfile')).to match /gem "bootstrap-sass"/
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative '../../features_helper'
|
2
|
+
|
3
|
+
describe 'application generated with shoestrap new <name>' do
|
4
|
+
before :all do
|
5
|
+
generate_test_app_with_shoestrap
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'has coffee-rails in the Gemfile' do
|
9
|
+
expect(application_file('Gemfile')).to match /gem\ 'coffee\-rails'/
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has uglifier in the Gemfile' do
|
13
|
+
expect(application_file('Gemfile')).to match /gem\ 'uglifier'/
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'application.js.coffee' do
|
17
|
+
it 'has the application javascript' do
|
18
|
+
expect(application_file('app/assets/javascripts/application.js.coffee')).not_to be_nil
|
19
|
+
end
|
20
|
+
|
21
|
+
%w[
|
22
|
+
jquery
|
23
|
+
jquery_ujs
|
24
|
+
turbolinks
|
25
|
+
].each do |js_requirement|
|
26
|
+
it "has #{js_requirement} required in the application.js.coffee" do
|
27
|
+
expect(application_file('app/assets/javascripts/application.js.coffee')).to match "#= require #{js_requirement}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative '../../features_helper'
|
2
|
+
|
3
|
+
describe 'application generated with shoestrap new <name> --css=foundation' do
|
4
|
+
|
5
|
+
options = '--css=foundation'
|
6
|
+
|
7
|
+
before :all do
|
8
|
+
generate_test_app_with_shoestrap(options)
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'has the foundation gem in the Gemfile' do
|
12
|
+
expect(application_file('Gemfile', options)).to match /gem "zurb-foundation"/
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'has the foundation requirement in the application.js.coffee' do
|
16
|
+
expect(application_file('app/assets/javascripts/application.js.coffee', options)).to match /\#=\ require\ foundation/
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'has the foundation requirement in the application.css.sass' do
|
20
|
+
expect(application_file('app/assets/stylesheets/application.css.sass', options)).to match /@import\ foundation/
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'has the ie8 grid requirement in the application.css.sass' do
|
24
|
+
expect(application_file('app/assets/stylesheets/application.css.sass', options)).to match /@import\ ie8_grid/
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'has the ie8 grid support' do
|
28
|
+
expect(application_file('app/assets/stylesheets/_ie8_grid.css', options)).not_to be_nil
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'has the foundation settings file' do
|
32
|
+
expect(application_file('app/assets/stylesheets/_settings.css.sass', options)).not_to be_nil
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require_relative '../../features_helper'
|
2
|
+
|
3
|
+
describe 'application generated with shoestrap new <name> --kuhsaft true' do
|
4
|
+
|
5
|
+
let(:migrations_count) { Dir.glob(File.join(application_path,'db/migrate/*kuhsaft*.rb')).size }
|
6
|
+
|
7
|
+
before :all do
|
8
|
+
generate_test_app_with_shoestrap
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'has the kuhsaft migrations installed' do
|
12
|
+
expect(migrations_count).to be 12
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'has db migrated with kuhsaft migrations' do
|
16
|
+
reload_application_gemfile
|
17
|
+
migration_status = Dir.chdir(application_path) { `bundle exec rake db:migrate:status` }
|
18
|
+
expect(migration_status.split("\n").select { |x| x.include? 'kuhsaft' }.size).to be 12
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'has the db with kuhsaft seeds' do
|
22
|
+
expect(Dir.chdir(application_path) { `bundle exec rails runner "puts Kuhsaft::BrickType.all.size"` }.to_i).to be 11
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'has the kuhsaft assets installed' do
|
26
|
+
expect(application_file('app/assets/stylesheets/kuhsaft/cms/customizations.css.sass')).not_to be_nil
|
27
|
+
expect(application_file('app/assets/javascripts/kuhsaft/cms/customizations.js.coffee')).not_to be_nil
|
28
|
+
expect(application_file('app/assets/javascripts/kuhsaft/cms/ck-config.js.coffee')).not_to be_nil
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'has kuhsaft mounted as an engine on /' do
|
32
|
+
expect(application_file('config/routes.rb')).to match("mount Kuhsaft::Engine => '/'")
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'has the default image size initializer' do
|
36
|
+
expect(application_file('config/initializers/kuhsaft.rb')).not_to be_nil
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative '../../features_helper'
|
2
|
+
|
3
|
+
describe 'application generated with shoestrap new <name>' do
|
4
|
+
before :all do
|
5
|
+
generate_test_app_with_shoestrap
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'has bourbon in the Gemfile' do
|
9
|
+
expect(application_file('Gemfile')).to match /gem "bourbon"/
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has the modules directory and at least one module stylesheet' do
|
13
|
+
expect(File.directory?('app/assets/stylesheets/modules/')).not_to be_nil
|
14
|
+
expect(application_file('app/assets/stylesheets/modules/_main_nav.css.sass')).not_to be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'has the initial stylesheet partials' do
|
18
|
+
expect(application_file('app/assets/stylesheets/_base.css.sass')).not_to be_nil
|
19
|
+
expect(application_file('app/assets/stylesheets/_fonts.css.sass')).not_to be_nil
|
20
|
+
expect(application_file('app/assets/stylesheets/_layout.css.sass')).not_to be_nil
|
21
|
+
expect(application_file('app/assets/stylesheets/_mixins.css.sass')).not_to be_nil
|
22
|
+
expect(application_file('app/assets/stylesheets/_settings.css.sass')).not_to be_nil
|
23
|
+
expect(application_file('app/assets/stylesheets/_states.css.sass')).not_to be_nil
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'application.css.sass' do
|
27
|
+
it 'has the application stylesheet' do
|
28
|
+
expect(application_file('app/assets/stylesheets/application.css.sass')).not_to be_nil
|
29
|
+
end
|
30
|
+
|
31
|
+
%w[
|
32
|
+
settings
|
33
|
+
bourbon
|
34
|
+
mixins
|
35
|
+
base
|
36
|
+
layout
|
37
|
+
states
|
38
|
+
modules/*
|
39
|
+
].each do |stylesheet_import|
|
40
|
+
it "has #{stylesheet_import} in the application.css.sass" do
|
41
|
+
expect(application_file('app/assets/stylesheets/application.css.sass')).to match "@import #{stylesheet_import}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require_relative '../../shoestrap/shell'
|
3
|
+
|
4
|
+
module Shoestrap
|
5
|
+
class BddGenerator < Rails::Generators::Base
|
6
|
+
|
7
|
+
def source_paths
|
8
|
+
[File.join(File.dirname(__FILE__), '../../../templates/bdd_generator')]
|
9
|
+
end
|
10
|
+
|
11
|
+
def install_rspec
|
12
|
+
generate("rspec:install")
|
13
|
+
end
|
14
|
+
|
15
|
+
# TODO: make force optional and make it an option of cli method?
|
16
|
+
def copy_dotrspec
|
17
|
+
copy_file "dotrspec", ".rspec", force: true
|
18
|
+
end
|
19
|
+
|
20
|
+
def copy_spec_helpers
|
21
|
+
copy_file "spec_helper.rb", "spec/spec_helper.rb", force: true
|
22
|
+
copy_file "fast_spec_helper.rb", "spec/fast_spec_helper.rb", force: true
|
23
|
+
copy_file "active_record_spec_helper.rb", "spec/active_record_spec_helper.rb", force: true
|
24
|
+
end
|
25
|
+
|
26
|
+
def init_guard_rspec
|
27
|
+
Shell.exec('guard init rspec')
|
28
|
+
end
|
29
|
+
|
30
|
+
def init_guard_spring
|
31
|
+
Shell.exec('guard init spring')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require_relative '../../shoestrap/shell'
|
3
|
+
|
4
|
+
module Shoestrap
|
5
|
+
class CoffeeFilesGenerator < Rails::Generators::Base
|
6
|
+
|
7
|
+
def source_paths
|
8
|
+
[File.join(File.dirname(__FILE__), '../../../templates/coffee_generator')]
|
9
|
+
end
|
10
|
+
|
11
|
+
def remove_application_js
|
12
|
+
remove_file 'app/assets/javascripts/application.js'
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy_application_js_coffee
|
16
|
+
copy_file 'application.js.coffee', 'app/assets/javascripts/application.js.coffee'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Shoestrap
|
4
|
+
class FoundationGenerator < Rails::Generators::Base
|
5
|
+
|
6
|
+
def source_paths
|
7
|
+
[File.join(File.dirname(__FILE__), '../../../templates/foundation_generator')]
|
8
|
+
end
|
9
|
+
|
10
|
+
def copy_application_sass
|
11
|
+
copy_file '_settings.css.sass', 'app/assets/stylesheets/_settings.css.sass', force: true
|
12
|
+
end
|
13
|
+
|
14
|
+
def copy_ie8_css
|
15
|
+
copy_file '_ie8_grid.css', 'app/assets/stylesheets/_ie8_grid.css'
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_foundation_requirements
|
19
|
+
inject_into_file 'app/assets/javascripts/application.js.coffee', "#= require foundation", after: "#= require turbolinks\n"
|
20
|
+
inject_into_file 'app/assets/stylesheets/application.css.sass', "// Foundation\n@import foundation\n\n", after: "@import settings\n\n"
|
21
|
+
inject_into_file 'app/assets/stylesheets/application.css.sass', "// IE8 Foundation Grid Fix\n@import ie8_grid\n\n", after: "@import foundation\n\n"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Shoestrap
|
4
|
+
class KuhsaftGenerator < Rails::Generators::Base
|
5
|
+
|
6
|
+
def source_paths
|
7
|
+
[File.join(File.dirname(__FILE__), '../../../templates/kuhsaft_generator')]
|
8
|
+
end
|
9
|
+
|
10
|
+
def install_migrations
|
11
|
+
rake 'kuhsaft:install:migrations'
|
12
|
+
end
|
13
|
+
|
14
|
+
def migrate_db
|
15
|
+
rake 'db:migrate'
|
16
|
+
end
|
17
|
+
|
18
|
+
def seed_db
|
19
|
+
rake 'db:seed'
|
20
|
+
end
|
21
|
+
|
22
|
+
def install_assets
|
23
|
+
generate 'kuhsaft:assets:install'
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_kuhsaft_routing
|
27
|
+
route "mount Kuhsaft::Engine => '/'"
|
28
|
+
end
|
29
|
+
|
30
|
+
def add_default_image_size
|
31
|
+
copy_file 'kuhsaft.rb', 'config/initializers/kuhsaft.rb'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Shoestrap
|
4
|
+
class MailcatcherGenerator < Rails::Generators::Base
|
5
|
+
def add_mailcatcher_config
|
6
|
+
application(nil, env: "development") do
|
7
|
+
"config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }"
|
8
|
+
end
|
9
|
+
application(nil, env: "development") do
|
10
|
+
"config.action_mailer.delivery_method = :smtp"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require_relative '../../shoestrap/shell'
|
3
|
+
|
4
|
+
module Shoestrap
|
5
|
+
class SmacssFilesGenerator < Rails::Generators::Base
|
6
|
+
|
7
|
+
def source_paths
|
8
|
+
[File.join(File.dirname(__FILE__), '../../../templates/smacss_generator')]
|
9
|
+
end
|
10
|
+
|
11
|
+
def remove_application_css
|
12
|
+
remove_file 'app/assets/stylesheets/application.css'
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy_application_sass
|
16
|
+
copy_file 'application.css.sass', 'app/assets/stylesheets/application.css.sass'
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_initial_stylesheets
|
20
|
+
create_file 'app/assets/stylesheets/_base.css.sass'
|
21
|
+
create_file 'app/assets/stylesheets/_fonts.css.sass'
|
22
|
+
create_file 'app/assets/stylesheets/_layout.css.sass'
|
23
|
+
create_file 'app/assets/stylesheets/_mixins.css.sass'
|
24
|
+
create_file 'app/assets/stylesheets/_settings.css.sass'
|
25
|
+
create_file 'app/assets/stylesheets/_states.css.sass'
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_modules_directory
|
29
|
+
empty_directory 'app/assets/stylesheets/modules/'
|
30
|
+
create_file 'app/assets/stylesheets/modules/_main_nav.css.sass'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/shoestrap.rb
CHANGED
@@ -0,0 +1,96 @@
|
|
1
|
+
require 'active_support/inflector'
|
2
|
+
require_relative 'shell'
|
3
|
+
Dir[File.join(File.dirname(__FILE__), '../generators/shoestrap/*_generator.rb')].each{ |f| require f }
|
4
|
+
|
5
|
+
module Shoestrap
|
6
|
+
module ApplicationGenerator
|
7
|
+
extend self
|
8
|
+
|
9
|
+
APPLICATION_TEMPLATE = File.join(File.dirname(__FILE__), '../../templates/application_generator/application_template.rb')
|
10
|
+
|
11
|
+
def start(application_name, options)
|
12
|
+
puts "[shoestrap] Generating new Rails Application #{application_name}"
|
13
|
+
rails_new_with_template(application_name, options[:database])
|
14
|
+
shoestrap_generators(application_name, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def shoestrap_generators(application_name, options)
|
18
|
+
Dir.chdir(application_name) do
|
19
|
+
# Sorry guys, a tiny little bit of setup that is very SC specific is added
|
20
|
+
# by an additional gem we maintain privately.
|
21
|
+
# This ugly hack allows us to run it here while not messing
|
22
|
+
# with your setup.
|
23
|
+
#
|
24
|
+
if ENV['GIVE_ME_SPECIAL_SAUCE']
|
25
|
+
apply_special_sauce(application_name)
|
26
|
+
end
|
27
|
+
|
28
|
+
install_gems(required_gems(options))
|
29
|
+
setup_database
|
30
|
+
setup_smacss_files
|
31
|
+
setup_coffee_files
|
32
|
+
setup_css_framework(options[:css])
|
33
|
+
setup_bdd_environment
|
34
|
+
setup_mailcatcher
|
35
|
+
setup_kuhsaft
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def install_gems(gemlist)
|
40
|
+
Shoestrap::GemInstallGenerator.start(gemlist)
|
41
|
+
Shell.exec('bundle')
|
42
|
+
reload_gemfile_for_application
|
43
|
+
end
|
44
|
+
|
45
|
+
def setup_database
|
46
|
+
Shoestrap::DatabaseGenerator.start
|
47
|
+
end
|
48
|
+
|
49
|
+
def setup_smacss_files
|
50
|
+
Shoestrap::SmacssFilesGenerator.start
|
51
|
+
end
|
52
|
+
|
53
|
+
def setup_coffee_files
|
54
|
+
Shoestrap::CoffeeFilesGenerator.start
|
55
|
+
end
|
56
|
+
|
57
|
+
def setup_css_framework(framework)
|
58
|
+
"Shoestrap::#{"#{framework}_generator".camelcase}".constantize.start
|
59
|
+
end
|
60
|
+
|
61
|
+
def setup_bdd_environment
|
62
|
+
Shoestrap::BddGenerator.start
|
63
|
+
end
|
64
|
+
|
65
|
+
def setup_kuhsaft
|
66
|
+
Shoestrap::KuhsaftGenerator.start
|
67
|
+
end
|
68
|
+
|
69
|
+
def setup_mailcatcher
|
70
|
+
Shoestrap::MailcatcherGenerator.start
|
71
|
+
end
|
72
|
+
|
73
|
+
def required_gems(options)
|
74
|
+
gems = []
|
75
|
+
gems << 'kuhsaft' if options[:kuhsaft]
|
76
|
+
gems << 'bootstrap-sass' if options[:css] == 'bootstrap'
|
77
|
+
gems << 'zurb-foundation' if options[:css] == 'foundation'
|
78
|
+
gems
|
79
|
+
end
|
80
|
+
|
81
|
+
def apply_special_sauce(application_name)
|
82
|
+
Shell.exec "sauce apply . --appname=#{application_name.split('/').last}"
|
83
|
+
end
|
84
|
+
|
85
|
+
private
|
86
|
+
def rails_new_with_template(application_name, database)
|
87
|
+
Shell.exec "rails new #{application_name} -m #{APPLICATION_TEMPLATE} -d #{database}"
|
88
|
+
end
|
89
|
+
|
90
|
+
def reload_gemfile_for_application
|
91
|
+
ENV['BUNDLE_GEMFILE'] = File.join(Dir.pwd, 'Gemfile')
|
92
|
+
require 'bundler'
|
93
|
+
Bundler.require(:default)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|