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.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -18
  3. data/.rspec +1 -1
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +4 -11
  6. data/CHANGELOG.md +15 -1
  7. data/CONTRIBUTING +1 -0
  8. data/Gemfile +1 -1
  9. data/Guardfile +7 -0
  10. data/LICENSE +17 -4
  11. data/README.md +32 -14
  12. data/Rakefile +11 -10
  13. data/bin/shoestrap +2 -10
  14. data/features/features_helper.rb +91 -0
  15. data/features/shoestrap/commands/new_command_feature.rb +191 -0
  16. data/features/shoestrap/generators/bdd_generator_feature.rb +43 -0
  17. data/features/shoestrap/generators/bootstrap_generator_feature.rb +11 -0
  18. data/features/shoestrap/generators/coffee_files_generator_feature.rb +32 -0
  19. data/features/shoestrap/generators/foundation_generator_feature.rb +34 -0
  20. data/features/shoestrap/generators/kuhsaft_generator_feature.rb +38 -0
  21. data/features/shoestrap/generators/smacss_files_generator_feature.rb +45 -0
  22. data/lib/generators/shoestrap/bdd_generator.rb +34 -0
  23. data/lib/generators/shoestrap/bootstrap_generator.rb +6 -0
  24. data/lib/generators/shoestrap/coffee_files_generator.rb +19 -0
  25. data/lib/generators/shoestrap/database_generator.rb +9 -0
  26. data/lib/generators/shoestrap/foundation_generator.rb +24 -0
  27. data/lib/generators/shoestrap/gem_install_generator.rb +12 -0
  28. data/lib/generators/shoestrap/kuhsaft_generator.rb +34 -0
  29. data/lib/generators/shoestrap/mailcatcher_generator.rb +14 -0
  30. data/lib/generators/shoestrap/smacss_file_generator.rb +33 -0
  31. data/lib/shoestrap.rb +2 -6
  32. data/lib/shoestrap/application_generator.rb +96 -0
  33. data/lib/shoestrap/cli.rb +35 -0
  34. data/lib/shoestrap/railtie.rb +7 -0
  35. data/lib/shoestrap/shell.rb +9 -0
  36. data/lib/shoestrap/version.rb +3 -0
  37. data/shoestrap.gemspec +28 -21
  38. data/spec/shoestrap/application_generator_spec.rb +170 -0
  39. data/spec/shoestrap/cli_spec.rb +28 -0
  40. data/spec/spec_helper.rb +34 -0
  41. data/templates/application_generator/application.html.haml +51 -0
  42. data/templates/application_generator/application_helper.rb +6 -0
  43. data/templates/application_generator/application_template.rb +72 -0
  44. data/templates/application_generator/favicons/favicon-sc-129x129.png +0 -0
  45. data/templates/application_generator/favicons/favicon-sc-16x16.ico +0 -0
  46. data/templates/application_generator/favicons/favicon-sc-32x32.png +0 -0
  47. data/templates/bdd_generator/active_record_spec_helper.rb +19 -0
  48. data/templates/bdd_generator/dotrspec +2 -0
  49. data/templates/bdd_generator/fast_spec_helper.rb +6 -0
  50. data/templates/bdd_generator/spec_helper.rb +12 -0
  51. data/templates/coffee_generator/application.js.coffee +3 -0
  52. data/templates/foundation_generator/_ie8_grid.css +85 -0
  53. data/templates/foundation_generator/_settings.css.sass +171 -0
  54. data/templates/kuhsaft_generator/kuhsaft.rb +5 -0
  55. data/templates/smacss_generator/application.css.sass +18 -0
  56. metadata +165 -74
  57. data/.rvmrc +0 -34
  58. data/lib/generators/shoestrap/app_generator.rb +0 -35
  59. data/lib/generators/shoestrap/cms_generator.rb +0 -57
  60. data/lib/generators/shoestrap/deployment_generator.rb +0 -62
  61. data/lib/generators/shoestrap/templates/cms/migration.rb +0 -15
  62. data/lib/generators/shoestrap/templates/cms/model.rb +0 -10
  63. data/lib/generators/shoestrap/templates/cms/model.yml.erb +0 -9
  64. data/lib/generators/shoestrap/templates/cms/view.yml.erb +0 -10
  65. data/lib/generators/shoestrap/templates/deployment/airbrake.rb +0 -10
  66. data/lib/generators/shoestrap/templates/deployment/database.yml.erb +0 -30
  67. data/lib/generators/shoestrap/templates/deployment/deployment.rake.erb +0 -23
  68. data/lib/generators/shoestrap/templates/deployment/unicorn.rb +0 -38
  69. data/lib/shoestrap/app_builder.rb +0 -132
  70. data/lib/shoestrap/tasks/middleman.rb +0 -21
  71. data/lib/shoestrap/tasks/radiant.rb +0 -41
  72. data/lib/shoestrap/tasks/rails.rb +0 -81
  73. data/templates/Gemfile.erb +0 -43
  74. data/templates/Guardfile +0 -33
  75. data/templates/README.md.erb +0 -30
  76. data/templates/_main_navigation.html.haml.erb +0 -5
  77. data/templates/application.html.haml +0 -24
  78. data/templates/bootstrap_and_overrides.css.sass +0 -7
  79. data/templates/cms_navigation.rb +0 -9
  80. data/templates/development_mail_interceptor.rb +0 -7
  81. data/templates/haml/scaffold/_form.html.haml +0 -10
  82. data/templates/haml/scaffold/edit.html.haml +0 -8
  83. data/templates/haml/scaffold/index.html.haml +0 -29
  84. data/templates/haml/scaffold/new.html.haml +0 -5
  85. data/templates/haml/scaffold/show.html.haml +0 -11
  86. data/templates/index.html.haml +0 -27
  87. data/templates/kuhsaft.css.sass +0 -2
  88. data/templates/rails/scaffold_controller/controller.rb +0 -89
  89. data/templates/setup_mail.rb +0 -1
  90. data/templates/shoestrap.yml +0 -41
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9791492dd8bd44bbc69b59cee2871160915eccee
4
+ data.tar.gz: 1f8a4e2e50a56425a0fc55cd561455fb0e944214
5
+ SHA512:
6
+ metadata.gz: 4d9896bbaff16d24ac9525b9894bdc7f579eb91f8a36f409c3336dd3abe4bdf276ed571937320c44dad34b0e6b453faf3dd8ad7026905736a8f6d6089f342047
7
+ data.tar.gz: c0e40359529e4552bdf63fa84f4fcdfb4e0a64e726cfd3143fc0f9254087f6f048dfee0cf291a5590452a8a74c025a9edeaac18d8efd1e45534d1a170ed3cb95
data/.gitignore CHANGED
@@ -1,19 +1,18 @@
1
- .bundle/
2
- log/*.log
3
- pkg/
4
- spec/dummy/db/*.sqlite3
5
- spec/dummy/log/*.log
6
- spec/dummy/tmp/
7
- spec/dummy/db/migrate/*.rb
8
- spec/dummy/db/schema.rb
9
- spec/dummy/public/stylesheets/*
10
- spec/dummy/public/uploads/tmp/*
11
- spec/dummy/public/uploads/kuhsaft/*
12
- spec/dummy/public/uploads/*
13
- spec/dummy/public/images/**/*
14
- spec/dummy/public/javascripts/**/*
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
15
6
  Gemfile.lock
16
- .DS_Store
17
- .sass-cache
18
- tags
19
- .idea
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ project-notes.txt
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
1
  --color
2
- --format nested
2
+ --format d
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p247
data/.travis.yml CHANGED
@@ -1,13 +1,6 @@
1
- language: ruby
1
+ ---
2
2
  rvm:
3
- - "1.8.7"
4
- - "1.9.2"
5
- - "1.9.3"
6
- - jruby-18mode # JRuby in 1.8 mode
7
- - jruby-19mode # JRuby in 1.9 mode
8
- - rbx-18mode
9
- - rbx-19mode
3
+ - 2.0.0
10
4
  notifications:
11
- campfire: "AylPbg/2kJ8sHjuLGfc0rcDFO5LDSNa+kuH5trCYiLzGD+4hkpftqkvRWyWN\nW3GSOIU32elrb3wqo2jU22c5dhQoYtEgV0Cpv25X4kY2aTlMqSAkCc2Uywxb\n8bmIM3VThTolQUw9F5nhM9aw7wzVXDufSsOwQqUftEmJ2yjrTh4="
12
- # uncomment this line if your project needs to run something other than `rake`:
13
- # script: bundle exec rspec spec
5
+ hipchat:
6
+ secure: "RfG5xaMJ9Lgrusw9G34fqBd+AkHXWIEMFtwc4KRNUR4nfwLnuJi/Ekpkd2rc\n09CL19vm+uyHSL90PStSYZ7KLvYH7OGq/M1I0lLNZFTkCMnpNKyxwCr+Pk6l\nughm/FT0ablL7dE/isoDttRb6o//tpiv9sREib2DvIgzleciA0g="
data/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
- #Changelog
1
+ # CHANGELOG
2
+
3
+ ## 1.0.0.pre1 - 2013-07-17
4
+
5
+ Started from scratch for a clean, test driven implementation.
6
+ A few notable changes:
7
+
8
+ - the application generator is now implemented as a standard
9
+ rails application template instead of hooking into Rails.
10
+
11
+ - Everything deployment related has been extracted into
12
+ another gem.
13
+
14
+ - For now, only app generation works, the CMS Scaffolding generators
15
+ still have to be ported/implemented.
2
16
 
3
17
  ## 0.4.1 - 2013-06-03
4
18
 
data/CONTRIBUTING ADDED
@@ -0,0 +1 @@
1
+ # Contributing Guideline
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
data/Guardfile ADDED
@@ -0,0 +1,7 @@
1
+ guard :rspec, :cli => "--color --format nested --fail-fast" do
2
+ # with Minitest::Spec
3
+ watch(%r|^lib/shoestrap.rb|) { "spec" }
4
+ watch(%r|^spec/(.*)_spec\.rb|)
5
+ watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
6
+ watch(%r|^spec/spec_helper\.rb|) { "spec" }
7
+ end
data/LICENSE CHANGED
@@ -1,7 +1,20 @@
1
- Copyright (c) 2011 Screen Concept©
1
+ Copyright (c) 2013 Screen Concept
2
2
 
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
4
10
 
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
6
13
 
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,28 +1,46 @@
1
- [![Build Status](https://api.travis-ci.org/screenconcept/shoestrap.png)](http://travis-ci.org/screenconcept/shoestrap)
1
+ [![Build Status](https://travis-ci.org/screenconcept/shoestrap.png)](https://travis-ci.org/screenconcept/shoestrap)
2
+ [![Code Climate](https://codeclimate.com/github/screenconcept/shoestrap.png)](https://codeclimate.com/github/screenconcept/shoestrap)
3
+ [![Gem Version](https://badge.fury.io/rb/shoestrap.png)](http://badge.fury.io/rb/shoestrap)
2
4
 
3
- # Shoestrap
5
+ # shoestrap
4
6
 
5
- Shoestrap is Screen Concept's Rails App bootstrapper, very similar and
6
- heavily inspired by https://github.com/thoughtbot/suspenders.
7
+ Shoestrap is used @ Screen Concept for generating new Rails Apps and creating admin
8
+ backends. Shoestrap is pretty opinionated and tailored to the way we
9
+ work. Your mileage may vary!
7
10
 
8
- It is currently under heavy development.
11
+ # Features
9
12
 
10
- # Installation
13
+ * generate new rails apps with a sc flavored setup
14
+ * generate admin backens similar to rails_admin and ative_admin, with
15
+ some notable differences:
11
16
 
12
- `gem install shoestrap`
17
+ TBD: elaborate on differences between rails_admin/active_admin, i.e
18
+ why whe built it
13
19
 
14
- # Using Shoestrap
20
+ ## Test shoestrap "compliance"
15
21
 
16
- ## Create a shoestrapped Rails Application
22
+ You can check how much your existing Applicaiton complies with the
23
+ current shoestrap featureset by running the integration tests against
24
+ your application. You can do this via the `TARGET_APP` environment
25
+ variable:
17
26
 
18
- `shoestrap <app_name>`
27
+ `TARGET_APP=../some_rails_project rake features`
19
28
 
20
- ## Using shoestrap generators
29
+ # Development & Contributing
21
30
 
22
- Add shoestrap to your Gemfile.
31
+ See the CONTRIBUTING file for project specific guidelines.
23
32
 
24
- Run `rails generate shoestrap:cms cms/ModelName` to generate CMS Backend
25
- views. The cms/ prefix is necessary!
33
+ ## Run specs in DEBUG mode
34
+
35
+ You can run the integration tests in debug mode. The test helpers that
36
+ generate the dummy apps will then be more verbose:
37
+
38
+ `DEBUG=true rake features`
39
+
40
+ If you don't want debug mode anymore, remember to unset the DEBUG
41
+ variable:
42
+
43
+ `unset DEBUG`
26
44
 
27
45
  # License
28
46
 
data/Rakefile CHANGED
@@ -1,17 +1,18 @@
1
- require 'bundler'
2
- require 'rake/clean'
3
- #require 'rdoc/task'
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
4
3
  require 'rspec/core/rake_task'
5
4
 
6
- include Rake::DSL
7
-
8
- Bundler::GemHelper.install_tasks
9
-
10
5
  desc "Run specs"
11
6
  RSpec::Core::RakeTask.new do |t|
12
- # t.rspec_opts = %w(--colour --fail-fast --format nested)
13
- t.rspec_opts = %w(--colour --format nested)
7
+ t.rspec_opts = %w(--color --format nested)
8
+ t.ruby_opts = %w(-w)
9
+ end
10
+
11
+ RSpec::Core::RakeTask.new(:features) do |t|
12
+ t.rspec_opts = %w(--color --format nested)
14
13
  t.ruby_opts = %w(-w)
14
+ t.pattern = 'features/**/*_feature.rb'
15
+ t.verbose = true
15
16
  end
16
17
 
17
- task :default => [:spec]
18
+ task :default => [:spec, :features]
data/bin/shoestrap CHANGED
@@ -1,12 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require File.expand_path(File.join('..', 'lib', 'generators', 'shoestrap', 'app_generator'), File.dirname(__FILE__))
4
- require File.expand_path(File.join('..', 'lib', 'shoestrap', 'app_builder'), File.dirname(__FILE__))
5
-
6
- templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
7
-
8
- Shoestrap::AppGenerator.source_root templates_root
9
- Shoestrap::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
10
-
11
- Shoestrap::AppGenerator.start
12
-
3
+ require_relative '../lib/shoestrap/cli'
4
+ Shoestrap::CLI.start(ARGV)
@@ -0,0 +1,91 @@
1
+ require 'rspec'
2
+ require 'fileutils'
3
+ require 'digest'
4
+ require 'pry'
5
+
6
+ RSpec.configure do |c|
7
+ c.after(:suite) do
8
+ clean_up
9
+ end
10
+ end
11
+
12
+ # TODO: spec these helpers!
13
+
14
+ def generate_test_app_with_shoestrap(options=nil)
15
+ `createuser -s #{test_app_key(options)}`
16
+ unless ENV['TARGET_APP'] || File.exists?(test_app_path(options))
17
+ if ENV['DEBUG']
18
+ puts "generating test app in #{test_app_path(options)}"
19
+ puts "#{File.join(File.dirname(__FILE__), '../bin/shoestrap')} new #{test_app_path(options)} #{options}"
20
+ system "#{File.join(File.dirname(__FILE__), '../bin/shoestrap')} new #{test_app_path(options)} #{options}"
21
+ else
22
+ `#{File.join(File.dirname(__FILE__), '../bin/shoestrap')} new #{test_app_path(options)} #{options}`
23
+ end
24
+ end
25
+ end
26
+
27
+ def reload_application_gemfile(options=nil)
28
+ ENV['BUNDLE_GEMFILE'] = File.join(application_path(options), 'Gemfile')
29
+ require 'bundler'
30
+ Bundler.require(:default)
31
+ end
32
+
33
+ def clean_up
34
+ puts
35
+ puts 'cleaning up...'
36
+ remove_test_dbs
37
+ remove_test_apps
38
+ puts
39
+ puts
40
+ end
41
+
42
+ def test_apps
43
+ Dir.entries(File.join(File.dirname(__FILE__))).select do |entry|
44
+ entry.include? 'test_app'
45
+ end.map { |e| "features/#{e}" }
46
+ end
47
+
48
+ def remove_test_apps
49
+ test_apps.each do |app|
50
+ puts "removing test app #{File.expand_path(app)}"
51
+ FileUtils.rm_rf(app)
52
+ end
53
+ end
54
+
55
+ def remove_test_dbs
56
+ test_apps.each do |app|
57
+ Dir.chdir app do
58
+ puts "dropping test db for #{app}" if ENV['DEBUG']
59
+ ENV['BUNDLE_GEMFILE'] = File.join(Dir.pwd, 'Gemfile')
60
+ require 'bundler'
61
+ Bundler.require(:default)
62
+ `bundle exec rake db:drop`
63
+ end
64
+ end
65
+ end
66
+
67
+ def application_path(options = nil)
68
+ target_app_path || test_app_path(options)
69
+ end
70
+
71
+ def target_app_path
72
+ ENV['TARGET_APP']
73
+ end
74
+
75
+ def test_app_path(options = nil)
76
+ File.join(File.dirname(__FILE__), test_app_key(options))
77
+ end
78
+
79
+ def application_file(file, options = nil)
80
+ File.read(File.join(application_path(options), file))
81
+ end
82
+
83
+ def test_app_key(options)
84
+ "test_app#{options.to_s.digest}"
85
+ end
86
+
87
+ class String
88
+ def digest
89
+ "_#{Digest::MD5.hexdigest(self)}" unless self.empty?
90
+ end
91
+ end
@@ -0,0 +1,191 @@
1
+ require_relative '../../features_helper'
2
+
3
+ describe 'application generated with shoestrap new <application_name>' do
4
+ before :all do
5
+ generate_test_app_with_shoestrap
6
+ end
7
+
8
+ it 'has timezone set for switzerland' do
9
+ expect(application_file('config/application.rb')).to match(/config.time_zone = 'Bern'/)
10
+ end
11
+
12
+ it 'has :de as default locale' do
13
+ expect(application_file('config/application.rb')).to match(/config.i18n.default_locale = :de/)
14
+ end
15
+
16
+ it 'has :de as only available locale for a satrt' do
17
+ expect(application_file('config/application.rb')).to match(/config.i18n.available_locales = \[:de\]/)
18
+ end
19
+
20
+ it 'has translation files load path' do
21
+ expect(application_file('config/application.rb')).to match(/config.i18n.load_path \+= Dir\[Rails.root.join\('config', 'locales', '\*\*', '\*.{rb,yml}'\).to_s\]/)
22
+ end
23
+
24
+ it 'has rspec-rails in the Gemfile' do
25
+ expect(application_file('Gemfile')).to match(/gem "rspec-rails"/)
26
+ end
27
+
28
+ it 'has guard-rspec in the Gemfile' do
29
+ expect(application_file('Gemfile')).to match(/gem "guard-rspec"/)
30
+ end
31
+
32
+ # TODO: fix this in rails. Gems added with gem method of app template have double quotes!
33
+
34
+ %w[
35
+ simple_form
36
+ haml
37
+ haml-rails
38
+ simple-navigation
39
+ mail
40
+ fabrication
41
+ shoestrap
42
+ kuhsaft
43
+ pry
44
+ ruby_gntp
45
+ database_cleaner
46
+ selectivizr-rails
47
+ modernizr-rails
48
+ bourbon
49
+ ].each do |gem_name|
50
+ it "has #{gem_name} in the Gemfile" do
51
+ expect(application_file('Gemfile')).to match "gem \"#{gem_name}\""
52
+ end
53
+ end
54
+
55
+ it 'has pg in the Gemfile' do
56
+ expect(application_file('Gemfile')).to match "gem 'pg'"
57
+ end
58
+
59
+ context 'application layout' do
60
+ it 'has no application layout written in erb' do
61
+ expect { application_file('app/views/layouts/application.html.erb') }.to raise_error(Errno::ENOENT)
62
+ end
63
+
64
+ it 'has an application layout written in haml' do
65
+ expect(application_file('app/views/layouts/application.html.haml')).not_to be_nil
66
+ end
67
+
68
+ it 'sets the html lang' do
69
+ expect(application_file('app/views/layouts/application.html.haml')).to match "%html.no-js{ lang: I18n.locale }"
70
+ end
71
+
72
+ it 'sets a page title' do
73
+ expect(application_file('app/views/layouts/application.html.haml')).to match(/%title=\ content_for\?\(:title\)\ \?\ yield\(:title\)\ :\ 'Untitled'/)
74
+ end
75
+
76
+ it 'has meta tags' do
77
+ expect(application_file('app/views/layouts/application.html.haml')).to match "%meta{ charset: 'utf-8' }"
78
+ expect(application_file('app/views/layouts/application.html.haml')).to match "%meta{ 'http-equiv' => 'X-UA-Compatible', content: 'IE=edge,chrome=1' }"
79
+ expect(application_file('app/views/layouts/application.html.haml')).to match "%meta{ name: 'keywords', content: '' }"
80
+ expect(application_file('app/views/layouts/application.html.haml')).to match "%meta{ name: 'description', content: '' }"
81
+ expect(application_file('app/views/layouts/application.html.haml')).to match "%meta{ name: 'viewport', content: 'width=device-width, initial-scale=1.0' }"
82
+ expect(application_file('app/views/layouts/application.html.haml')).to match "= csrf_meta_tags"
83
+ end
84
+
85
+ it 'has favicons' do
86
+ expect(application_file('app/views/layouts/application.html.haml')).to match(/favicon_link_tag\('favicons\/favicon\-sc\-129x129\.png',\ rel:\ 'apple\-touch\-icon',\ type:\ 'image\/png'\)/)
87
+ expect(application_file('app/views/layouts/application.html.haml')).to match(/favicon_link_tag\('favicons\/favicon\-sc\-32x32\.png',\ rel:\ 'icon',\ type:\ 'image\/png'\)/)
88
+ expect(application_file('app/views/layouts/application.html.haml')).to match(/favicon_link_tag\('favicons\/favicon\-sc\-16x16\.ico'\)/)
89
+ end
90
+
91
+ it 'has typekit integration' do
92
+ expect(application_file('app/views/layouts/application.html.haml')).to match(/javascript_include_tag\ '\/\/use\.typekit\.net\/XXXX\.js',\ :media\ =>\ 'all'/)
93
+ expect(application_file('app/views/layouts/application.html.haml')).to match(/try\{Typekit\.load\(\);\}catch\(e\)\{\}/)
94
+ end
95
+
96
+ it 'has an application stylehseet link' do
97
+ expect(application_file('app/views/layouts/application.html.haml')).to match "= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true"
98
+ end
99
+
100
+ it 'has javascript links' do
101
+ expect(application_file('app/views/layouts/application.html.haml')).to match "= javascript_include_tag 'modernizr', 'data-turbolinks-track' => true"
102
+ expect(application_file('app/views/layouts/application.html.haml')).to match "= javascript_include_tag 'application', 'data-turbolinks-track' => true"
103
+ expect(application_file('app/views/layouts/application.html.haml')).to match "= javascript_include_tag 'selectivizr'"
104
+ end
105
+
106
+ it 'has a body class helper included' do
107
+ expect(application_file('app/views/layouts/application.html.haml')).to match "%body{ class: body_class }"
108
+ end
109
+
110
+ it 'renders the navigation' do
111
+ expect(application_file('app/views/layouts/application.html.haml')).to match "= render_navigation"
112
+ end
113
+
114
+ it 'renders the content' do
115
+ expect(application_file('app/views/layouts/application.html.haml')).to match "= yield"
116
+ end
117
+
118
+ it 'has google analytics integrated' do
119
+ expect(application_file('app/views/layouts/application.html.haml')).to match(/var\ _gaq=\[\['_setAccount','UA\-XXXXX\-X'\],\['_trackPageview'\],\['_trackPageLoadTime'\]\];/)
120
+ expect(application_file('app/views/layouts/application.html.haml')).to match(/\(function\(d,t\)\{var\ g=d\.createElement\(t\),s=d\.getElementsByTagName\(t\)\[0\];g\.async=1;/)
121
+ expect(application_file('app/views/layouts/application.html.haml')).to match(/g\.src=\('https:'==location\.protocol\?'\/\/ssl':'\/\/www'\)\+'\.google\-analytics\.com\/ga\.js';/)
122
+ expect(application_file('app/views/layouts/application.html.haml')).to match(/s\.parentNode\.insertBefore\(g,s\)\}\(document,'script'\)\);/)
123
+ end
124
+ end
125
+
126
+ context 'favicons' do
127
+ it 'has a favicon' do
128
+ expect(application_file('app/assets/images/favicons/favicon-sc-32x32.png')).not_to be_nil
129
+ end
130
+
131
+ it 'has a favicon for iDevices' do
132
+ expect(application_file('app/assets/images/favicons/favicon-sc-129x129.png')).not_to be_nil
133
+ end
134
+
135
+ it 'has a favicton for IE' do
136
+ expect(application_file('app/assets/images/favicons/favicon-sc-16x16.ico')).not_to be_nil
137
+ end
138
+ end
139
+
140
+ context 'application helper' do
141
+ it 'has an application layout written in haml' do
142
+ expect(application_file('app/helpers/application_helper.rb')).not_to be_nil
143
+ end
144
+
145
+ it 'has a body_class method' do
146
+ expect(application_file('app/helpers/application_helper.rb')).to match "def body_class"
147
+ end
148
+ end
149
+
150
+ context 'generators' do
151
+ it 'use haml as a template engine' do
152
+ expect(application_file('config/application.rb')).to match "g.template_engine :haml"
153
+ end
154
+
155
+ it 'use rspec as test framework' do
156
+ expect(application_file('config/application.rb')).to match "test_framework :rspec"
157
+ end
158
+
159
+ it 'do not generate stylesheets' do
160
+ expect(application_file('config/application.rb')).to match "g.stylesheets false"
161
+ end
162
+
163
+ it 'do not generate javascripts' do
164
+ expect(application_file('config/application.rb')).to match "g.javascripts false"
165
+ end
166
+
167
+ it 'do not generate assets' do
168
+ expect(application_file('config/application.rb')).to match "g.assets false"
169
+ end
170
+
171
+ it 'does not generate helpers' do
172
+ expect(application_file('config/application.rb')).to match "g.helper false"
173
+ end
174
+
175
+ it 'uses simple_form as form builder' do
176
+ expect(application_file('config/application.rb')).to match(/form_builder :simple_form/)
177
+ end
178
+
179
+ context 'mailcatcher' do
180
+ it 'is configured for development environment' do
181
+ expect(application_file('config/environments/development.rb')).to match(/config\.action_mailer\.delivery_method = :smtp/)
182
+ expect(application_file('config/environments/development.rb')).to match(/config\.action_mailer\.smtp_settings = { address: 'localhost', port: 1025 }/)
183
+ end
184
+
185
+ it 'is documented in the readme' do
186
+ pending "implement proper readme template"
187
+ expect(application_file('README.md')).to match(/This Application uses Mailcatcher/)
188
+ end
189
+ end
190
+ end
191
+ end