pah 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/CONTRIBUTING.md +2 -3
- data/LICENSE.txt +1 -1
- data/README.md +0 -1
- data/features/bourbon.feature +23 -0
- data/features/bullet.feature +2 -1
- data/features/canonical_host.feature +2 -1
- data/features/capybara.feature +2 -1
- data/features/database.feature +2 -1
- data/features/env.feature +2 -1
- data/features/gemfile.feature +3 -2
- data/features/generators.feature +2 -1
- data/features/git.feature +2 -1
- data/features/heroku.feature +2 -1
- data/features/jumpup.feature +2 -1
- data/features/layout.feature +2 -2
- data/features/letter_opener.feature +2 -1
- data/features/locale.feature +4 -3
- data/features/newrelic.feature +2 -1
- data/features/public.feature +2 -1
- data/features/puma.feature +2 -1
- data/features/rack_deflater.feature +2 -1
- data/features/rack_timeout.feature +2 -1
- data/features/rails_works.feature +4 -2
- data/features/readme.feature +2 -1
- data/features/remove_unused_files.feature +2 -1
- data/features/rollbar.feature +3 -2
- data/features/rspec.feature +3 -1
- data/features/run_specs.feature +2 -1
- data/features/runner.feature +42 -4
- data/features/secret_token.feature +2 -1
- data/features/secure_headers.feature +2 -1
- data/features/sendgrid.feature +2 -1
- data/features/simple_form.feature +2 -1
- data/features/step_definitions/create_simple_app.rb +19 -9
- data/features/step_definitions/file_content.rb +5 -0
- data/features/support/env.rb +3 -0
- data/lib/pah/files/Gemfile +24 -25
- data/lib/pah/files/app/views/application/_flash_messages.html.slim +3 -4
- data/lib/pah/files/app/views/layouts/application.html.slim +4 -33
- data/lib/pah/files/config/initializers/rack_timeout.rb +3 -1
- data/lib/pah/files/spec/acceptance/dummy_spec.rb +2 -2
- data/lib/pah/files/spec/rails_helper.rb +19 -0
- data/lib/pah/files/spec/spec_helper.rb +10 -43
- data/lib/pah/pah.rb +64 -0
- data/lib/pah/partials/_bourbon.rb +25 -0
- data/lib/pah/partials/_heroku.rb +16 -9
- data/lib/pah/partials/_layout.rb +1 -2
- data/lib/pah/partials/_locale.rb +2 -2
- data/lib/pah/partials/_rack_deflater.rb +1 -1
- data/lib/pah/partials/_rollbar.rb +1 -1
- data/lib/pah/partials/_rspec.rb +1 -0
- data/lib/pah/template.rb +2 -58
- data/lib/pah/version.rb +2 -2
- metadata +9 -15
- data/features/assets.feature +0 -13
- data/lib/pah/files/app/assets/javascripts/application.js +0 -33
- data/lib/pah/files/app/assets/stylesheets/_variables.scss +0 -39
- data/lib/pah/files/app/assets/stylesheets/application.scss +0 -5
- data/lib/pah/files/app/assets/stylesheets/form.scss +0 -248
- data/lib/pah/files/app/assets/stylesheets/general.scss +0 -47
- data/lib/pah/files/app/assets/stylesheets/reset.scss +0 -75
- data/lib/pah/files/app/assets/stylesheets/responsive.scss +0 -97
- data/lib/pah/files/app/views/application/_error_messages.html.slim +0 -5
- data/lib/pah/partials/_assets.rb +0 -12
@@ -1,6 +1,7 @@
|
|
1
|
+
@no-clobber
|
1
2
|
Feature: Secure Headers
|
2
3
|
Background:
|
3
|
-
Given I have created
|
4
|
+
Given I have created the app "myapp" with pah
|
4
5
|
|
5
6
|
Scenario: Have correct files
|
6
7
|
Then I have the file app/controllers/application_controller.rb and contents of this file should include:
|
data/features/sendgrid.feature
CHANGED
@@ -1,10 +1,20 @@
|
|
1
|
-
Given(/^I have created
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
""
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
Given(/^I have created the app "(.*?)" with pah$/) do |app_name|
|
2
|
+
app_exists = File.directory?("tmp/aruba/#{app_name}")
|
3
|
+
|
4
|
+
if app_exists
|
5
|
+
steps %Q{
|
6
|
+
Then a directory named "#{app_name}" should exist
|
7
|
+
}
|
8
|
+
else
|
9
|
+
steps %Q{
|
10
|
+
When I run `rm -rf #{app_name}`
|
11
|
+
Then I run `pah #{app_name}` interactively
|
12
|
+
And I type "n"
|
13
|
+
Then the output should contain:
|
14
|
+
"""
|
15
|
+
CONGRATS! INSTALLATION COMPLETE!
|
16
|
+
"""
|
17
|
+
Then a directory named "#{app_name}" should exist
|
18
|
+
}
|
19
|
+
end
|
10
20
|
end
|
@@ -8,6 +8,11 @@ Then(/^I have the file(.* )and contents of this file should include:$/) do |file
|
|
8
8
|
expect(file_content).to include(content)
|
9
9
|
end
|
10
10
|
|
11
|
+
Then(/^I have the file(.* )and contents of this file should not include:$/) do |file, content|
|
12
|
+
file_content = read_from_app(file.strip)
|
13
|
+
expect(file_content).to_not include(content)
|
14
|
+
end
|
15
|
+
|
11
16
|
Then(/^I have the file(.* )and contents of this file should match:$/) do |file, content|
|
12
17
|
file_content = read_from_app(file.strip)
|
13
18
|
expect(file_content).to match(%r{#{content}})
|
data/features/support/env.rb
CHANGED
data/lib/pah/files/Gemfile
CHANGED
@@ -1,58 +1,57 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
ruby '2.1.2'
|
3
3
|
|
4
|
-
# See: https://github.com/rails/rails/issues/13164
|
5
|
-
gem 'i18n', github: 'svenfuchs/i18n',
|
6
|
-
ref: '8fc94e7e9ec20396e974b0549cf499662238bf56'
|
7
|
-
|
8
4
|
gem 'rails', 'RAILS_VERSION'
|
9
5
|
gem 'puma', '2.8.2'
|
10
|
-
gem 'secure_headers', '1.
|
11
|
-
gem 'jquery-rails', '3.1.
|
6
|
+
gem 'secure_headers', '1.2.0'
|
7
|
+
gem 'jquery-rails', '3.1.1'
|
12
8
|
gem 'turbolinks', '2.2.2'
|
13
|
-
gem 'jbuilder', '2.
|
14
|
-
gem 'slim-rails', '2.1.
|
9
|
+
gem 'jbuilder', '2.1.1'
|
10
|
+
gem 'slim-rails', '2.1.5'
|
15
11
|
gem 'pg', '0.17.1'
|
16
12
|
gem 'sass-rails', '4.0.3'
|
17
13
|
gem 'coffee-rails', '4.0.1'
|
18
|
-
gem 'uglifier', '2.5.
|
19
|
-
gem 'rack-canonical-host', '0.1.0'
|
20
|
-
gem 'rack-timeout', github: 'kch/rack-timeout', ref: '83ca9f5141c1fdcb626820b1601c406e3a3a560a'
|
21
|
-
gem 'bourbon', '3.1.8'
|
14
|
+
gem 'uglifier', '2.5.1'
|
22
15
|
gem 'simple_form', '3.1.0.rc1'
|
23
16
|
gem 'flutie', '2.0.0'
|
24
|
-
gem '
|
17
|
+
gem 'bourbon', '3.2.3'
|
18
|
+
gem 'neat', '1.5.1'
|
19
|
+
gem 'bitters', '0.10.0'
|
20
|
+
gem 'refills', '0.0.2'
|
25
21
|
|
26
|
-
group :production do
|
22
|
+
group :production, :staging do
|
27
23
|
gem 'rails_12factor', '0.0.2'
|
28
|
-
gem '
|
24
|
+
gem 'rack-canonical-host', '0.1.0'
|
25
|
+
gem 'rack-timeout', github: 'kch/rack-timeout', ref: '83ca9f5141c1fdcb626820b1601c406e3a3a560a'
|
26
|
+
gem 'newrelic_rpm', '3.9.0.229'
|
27
|
+
gem 'rollbar', '0.13.1'
|
29
28
|
end
|
30
29
|
|
31
30
|
group :development do
|
32
31
|
gem 'spring', '1.1.3'
|
33
|
-
gem 'foreman', '0.
|
32
|
+
gem 'foreman', '0.74.0'
|
34
33
|
gem 'jumpup', '0.0.5'
|
35
34
|
gem 'jumpup-heroku', '0.0.5'
|
36
35
|
gem 'better_errors', '1.1.0'
|
37
36
|
gem 'binding_of_caller', '0.7.2'
|
38
37
|
gem 'letter_opener', '1.2.0'
|
39
|
-
gem 'bullet', '4.
|
40
|
-
gem 'quiet_assets', '1.0.
|
38
|
+
gem 'bullet', '4.11.3'
|
39
|
+
gem 'quiet_assets', '1.0.3'
|
41
40
|
end
|
42
41
|
|
43
42
|
group :test do
|
44
43
|
gem 'shoulda-matchers', '2.6.1', require: false
|
45
44
|
gem 'simplecov', '0.8.2', require: false
|
46
|
-
gem 'email_spec',
|
47
|
-
gem 'capybara', '2.
|
48
|
-
gem 'poltergeist', '1.5.
|
49
|
-
gem 'vcr', '2.9.
|
50
|
-
gem 'webmock', '
|
51
|
-
gem 'database_cleaner', '1.
|
45
|
+
gem 'email_spec', '1.6.0'
|
46
|
+
gem 'capybara', '2.4.1'
|
47
|
+
gem 'poltergeist', '1.5.1'
|
48
|
+
gem 'vcr', '2.9.2'
|
49
|
+
gem 'webmock', '1.18.0'
|
50
|
+
gem 'database_cleaner', '1.3.0'
|
52
51
|
end
|
53
52
|
|
54
53
|
group :development, :test do
|
55
|
-
gem 'rspec-rails', '3.0.
|
54
|
+
gem 'rspec-rails', '3.0.1'
|
56
55
|
gem 'factory_girl_rails', '4.4.1'
|
57
56
|
gem 'pry-rails', '0.3.2'
|
58
57
|
gem 'dotenv-rails', '0.11.1'
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
= value
|
1
|
+
- flash.each do |key, value|
|
2
|
+
div id="flash_#{key}"
|
3
|
+
= value
|
@@ -9,43 +9,14 @@ html lang="pt"
|
|
9
9
|
= page_title(app_name: 'example')
|
10
10
|
|
11
11
|
link href="/favicon.ico" rel=("shortcut icon")
|
12
|
-
= yield(:header_tags)
|
13
12
|
|
14
|
-
= stylesheet_link_tag
|
15
|
-
= javascript_include_tag
|
13
|
+
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
14
|
+
= javascript_include_tag 'application', 'data-turbolinks-track' => true
|
16
15
|
= csrf_meta_tags
|
17
16
|
|
18
17
|
/![if lt IE 9]
|
19
18
|
script src="http://html5shim.googlecode.com/svn/trunk/html5.js"
|
20
19
|
|
21
|
-
javascript:
|
22
|
-
var _gaq = _gaq || [];
|
23
|
-
_gaq.push(['_setAccount', 'XXXXX-XXXX']);
|
24
|
-
_gaq.push(['_trackPageview']);
|
25
|
-
|
26
|
-
(function() {
|
27
|
-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
28
|
-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
29
|
-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
30
|
-
})();
|
31
|
-
|
32
20
|
body class=body_class
|
33
|
-
|
34
|
-
|
35
|
-
.holder
|
36
|
-
#logo
|
37
|
-
= link_to "Logo", "/"
|
38
|
-
= render 'flash_messages'
|
39
|
-
|
40
|
-
#main-content
|
41
|
-
.holder
|
42
|
-
section role="main"
|
43
|
-
= yield
|
44
|
-
|
45
|
-
- if content_for?(:sidebar)
|
46
|
-
aside
|
47
|
-
= yield(:sidebar)
|
48
|
-
|
49
|
-
footer
|
50
|
-
.holder
|
51
|
-
= "Copyright © #{Time.zone.now.year} App".html_safe
|
21
|
+
= render 'flash_messages'
|
22
|
+
= yield
|
@@ -0,0 +1,19 @@
|
|
1
|
+
ENV["RAILS_ENV"] ||= 'test'
|
2
|
+
require 'spec_helper'
|
3
|
+
require File.expand_path("../../config/environment", __FILE__)
|
4
|
+
require 'rspec/rails'
|
5
|
+
require 'shoulda/matchers'
|
6
|
+
require "email_spec"
|
7
|
+
|
8
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
9
|
+
|
10
|
+
ActiveRecord::Migration.maintain_test_schema!
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.use_transactional_fixtures = true
|
14
|
+
config.infer_spec_type_from_file_location!
|
15
|
+
config.render_views
|
16
|
+
config.include FactoryGirl::Syntax::Methods
|
17
|
+
config.include EmailSpec::Helpers
|
18
|
+
config.include EmailSpec::Matchers
|
19
|
+
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
-
|
3
1
|
if ENV['coverage'] == 'on'
|
4
2
|
require 'simplecov'
|
5
3
|
SimpleCov.start 'rails' do
|
@@ -7,51 +5,20 @@ if ENV['coverage'] == 'on'
|
|
7
5
|
end
|
8
6
|
end
|
9
7
|
|
10
|
-
ENV["RAILS_ENV"] ||= 'test'
|
11
|
-
require File.expand_path("../../config/environment", __FILE__)
|
12
|
-
require 'rspec/rails'
|
13
|
-
require 'shoulda/matchers'
|
14
|
-
require "email_spec"
|
15
|
-
|
16
|
-
# Checks for pending migrations before tests are run.
|
17
|
-
# If you are not using ActiveRecord, you can remove this line.
|
18
|
-
ActiveRecord::Migration.maintain_test_schema!
|
19
|
-
|
20
|
-
# Requires supporting ruby files with custom matchers and macros, etc,
|
21
|
-
# in spec/support/ and its subdirectories.
|
22
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
23
|
-
|
24
8
|
RSpec.configure do |config|
|
25
|
-
|
26
|
-
config.
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
# Use the new rspec expect syntax
|
34
|
-
config.expect_with :rspec do |c|
|
35
|
-
c.syntax = :expect
|
9
|
+
config.disable_monkey_patching!
|
10
|
+
config.order = :random
|
11
|
+
Kernel.srand config.seed
|
12
|
+
config.filter_run focus: true
|
13
|
+
config.run_all_when_everything_filtered = true
|
14
|
+
config.expect_with :rspec do |expectations|
|
15
|
+
expectations.syntax = :expect
|
36
16
|
end
|
37
|
-
|
38
17
|
config.mock_with :rspec do |mocks|
|
39
18
|
mocks.syntax = :expect
|
40
19
|
mocks.verify_partial_doubles = true
|
41
20
|
end
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
config.render_views
|
46
|
-
config.include FactoryGirl::Syntax::Methods
|
47
|
-
config.include EmailSpec::Helpers
|
48
|
-
config.include EmailSpec::Matchers
|
49
|
-
|
50
|
-
config.filter_run focus: true
|
51
|
-
config.run_all_when_everything_filtered = true
|
52
|
-
|
53
|
-
# If true, the base class of anonymous controllers will be inferred
|
54
|
-
# automatically. This will be the default behavior in future versions of
|
55
|
-
# rspec-rails.
|
56
|
-
config.infer_base_class_for_anonymous_controllers = false
|
21
|
+
if config.files_to_run.one?
|
22
|
+
config.default_formatter = 'doc'
|
23
|
+
end
|
57
24
|
end
|
data/lib/pah/pah.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.expand_path(File.join('..', 'pah', 'version.rb'), File.dirname(__FILE__))
|
2
|
+
|
3
|
+
%w{colored}.each do |component|
|
4
|
+
if Gem::Specification.find_all_by_name(component).empty?
|
5
|
+
run "gem install #{component}"
|
6
|
+
Gem.refresh
|
7
|
+
Gem::Specification.find_by_name(component).activate
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
require "rails"
|
12
|
+
require "colored"
|
13
|
+
require "bundler"
|
14
|
+
|
15
|
+
def template_root
|
16
|
+
File.expand_path(File.join('..', 'pah'), File.dirname(__FILE__))
|
17
|
+
end
|
18
|
+
|
19
|
+
def partials
|
20
|
+
File.join(template_root, 'partials')
|
21
|
+
end
|
22
|
+
|
23
|
+
def static_files
|
24
|
+
File.join(template_root, 'files')
|
25
|
+
end
|
26
|
+
|
27
|
+
# Copy a static file from the template into the new application
|
28
|
+
def copy_static_file(path)
|
29
|
+
remove_file path
|
30
|
+
file path, File.read(File.join(static_files, path))
|
31
|
+
end
|
32
|
+
|
33
|
+
def apply_n(partial_name, message='')
|
34
|
+
puts message.magenta
|
35
|
+
|
36
|
+
in_root do
|
37
|
+
Bundler.with_clean_env do
|
38
|
+
apply "#{partials}/_#{partial_name}.rb"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
puts "\n"
|
43
|
+
end
|
44
|
+
|
45
|
+
def will_you_like_to?(question)
|
46
|
+
answer = ask("Will you like to #{question} [y,n]".red)
|
47
|
+
case answer.downcase
|
48
|
+
when "yes", "y"
|
49
|
+
true
|
50
|
+
when "no", "n"
|
51
|
+
false
|
52
|
+
else
|
53
|
+
will_you_like_to?(question)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def ask_unless_test(*params)
|
58
|
+
ask(*params)
|
59
|
+
end
|
60
|
+
|
61
|
+
def git_commit(message)
|
62
|
+
message = "#{message}\n\nGenerated by pah version #{Pah::VERSION}"
|
63
|
+
git commit: "-qm '#{message}'"
|
64
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
css_path = 'app/assets/stylesheets/'
|
2
|
+
application_css_path = "#{css_path}application.css"
|
3
|
+
|
4
|
+
prepend_to_file application_css_path do
|
5
|
+
<<IMPORTS
|
6
|
+
@import 'bourbon';
|
7
|
+
@import 'base/base';
|
8
|
+
@import 'neat';
|
9
|
+
IMPORTS
|
10
|
+
end
|
11
|
+
|
12
|
+
gsub_file application_css_path, /\*= require_tree \./, '*'
|
13
|
+
|
14
|
+
inside(css_path) do
|
15
|
+
system 'bundle exec bitters install'
|
16
|
+
end
|
17
|
+
|
18
|
+
gsub_file "#{css_path}base/_base.scss", %r{// @import 'grid-settings';}, "@import 'grid-settings';"
|
19
|
+
|
20
|
+
system "mv #{application_css_path} #{css_path}application.css.scss"
|
21
|
+
|
22
|
+
git rm: application_css_path
|
23
|
+
git add: css_path
|
24
|
+
git_commit 'Install bourbon.'
|
25
|
+
|
data/lib/pah/partials/_heroku.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class HerokuApp < Rails::Generators::AppGenerator
|
2
|
-
DEFAULT_ADDONS = %w(heroku-postgresql:dev pgbackups:auto-month loggly:mole
|
2
|
+
DEFAULT_ADDONS = %w(heroku-postgresql:dev pgbackups:auto-month loggly:mole
|
3
|
+
sendgrid:starter rollbar newrelic:stark)
|
3
4
|
|
4
5
|
attr_reader :name, :description, :config
|
5
6
|
|
@@ -22,41 +23,47 @@ class HerokuApp < Rails::Generators::AppGenerator
|
|
22
23
|
|
23
24
|
def add_secret_token
|
24
25
|
say "Creating SECRET_KEY_BASE for Heroku '#{name}.herokuapp.com'".magenta
|
25
|
-
|
26
|
+
run "heroku config:set SECRET_KEY_BASE=#{SecureRandom::hex(60)} --app #{name}"
|
26
27
|
end
|
27
28
|
|
28
29
|
def add_heroku_git_remote
|
29
30
|
say "Adding Heroku git remote for deploy to '#{name}'.".magenta
|
30
|
-
|
31
|
+
run "git remote add heroku git@heroku.com:#{name}.git"
|
31
32
|
end
|
32
33
|
|
33
34
|
def add_heroku_addon(addon)
|
34
35
|
say "Adding heroku addon [#{addon}] to '#{name}'.".magenta
|
35
|
-
|
36
|
+
run "heroku addons:add #{addon} --app #{name}"
|
36
37
|
end
|
37
38
|
|
38
39
|
def add_canonical_domain(domain)
|
39
|
-
|
40
|
+
run "heroku domains:add #{domain} --app #{name}"
|
40
41
|
end
|
41
42
|
|
42
43
|
def add_collaborator(email)
|
43
|
-
|
44
|
+
run "heroku sharing:add #{email} --app #{name}"
|
44
45
|
end
|
45
46
|
|
46
47
|
def add_timezone_config
|
47
48
|
say "Adding timezone config on Heroku".magenta
|
48
|
-
|
49
|
+
run "heroku config:set TZ=America/Sao_Paulo --app #{name}"
|
49
50
|
end
|
50
51
|
|
51
52
|
def open
|
52
53
|
say "Pushing application to heroku...".magenta
|
53
54
|
|
54
|
-
|
55
|
+
run "git push heroku master"
|
55
56
|
|
56
|
-
|
57
|
+
run "heroku open --app #{name}"
|
57
58
|
end
|
58
59
|
|
59
60
|
private
|
61
|
+
def run(command)
|
62
|
+
unless system(command)
|
63
|
+
raise "Error while running #{command}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
60
67
|
def check_canonical_domain
|
61
68
|
domain = @config[:heroku][:domain]
|
62
69
|
add_canonical_domain(domain) unless domain.blank?
|