pah 0.0.3 → 0.0.4
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.
- data/.rvmrc +1 -1
- data/CHANGELOG.md +20 -0
- data/README.md +5 -9
- data/lib/pah/files/.rvmrc +2 -0
- data/lib/pah/files/Gemfile +19 -11
- data/lib/pah/files/lib/tasks/integration.rake +4 -4
- data/lib/pah/files/lib/tasks/tasks.rake +4 -4
- data/lib/pah/files/spec/spec_helper.rb +5 -0
- data/lib/pah/files/spec/support/deferred_garbage_collection.rb +1 -6
- data/lib/pah/partials/_cleanup.rb +2 -4
- data/lib/pah/partials/_default.rb +0 -1
- data/lib/pah/partials/_heroku.rb +13 -6
- data/lib/pah/partials/_integration.rb +0 -2
- data/lib/pah/partials/_secure_headers.rb +2 -2
- data/lib/pah/template.rb +1 -10
- data/lib/pah/version.rb +1 -1
- data/pah.gemspec +1 -1
- metadata +4 -4
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm use
|
1
|
+
rvm use 2.0.0@pah --create
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.0.4 (July 19, 2013)
|
4
|
+
|
5
|
+
### features
|
6
|
+
|
7
|
+
### improvements
|
8
|
+
|
9
|
+
- Use the new rspec expect syntax
|
10
|
+
- Halt if Heroku app already exists.
|
11
|
+
- Do not say "Pushing application to Heroku" if there is no deploy
|
12
|
+
- Do not install Sendgrid unless user explicitely says so
|
13
|
+
- Using user input for Heroku app name
|
14
|
+
- Changed readme
|
15
|
+
- Heroku tasks now run out of Bundler environment
|
16
|
+
- Cleaning old stuffs
|
17
|
+
- Show suggestion of heroku app
|
18
|
+
- Export APP on .rvmrc
|
19
|
+
- Updated to Rails 4.0 and Ruby 2.0
|
20
|
+
|
21
|
+
### bug fixes
|
22
|
+
|
3
23
|
## 0.0.3 (July 05, 2013)
|
4
24
|
|
5
25
|
### features
|
data/README.md
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
[![Code Climate][code_climate_badge]][code_climate]
|
4
4
|
[![Gemnasium][gemnasium_badge]][gemnasium]
|
5
5
|
|
6
|
-
A rails application template which born from [Startup DEV][startupdev] and now is used to start most projects at [HE:labs][helabs].
|
6
|
+
A rails application template which was born from [Startup DEV][startupdev] and now is used to start most projects at [HE:labs][helabs].
|
7
7
|
|
8
8
|
## Instalation
|
9
9
|
|
10
|
-
|
10
|
+
Install Pah at the command prompt:
|
11
11
|
|
12
12
|
gem install pah
|
13
13
|
|
@@ -17,7 +17,7 @@ Run:
|
|
17
17
|
|
18
18
|
pah projectname
|
19
19
|
|
20
|
-
This will create a Rails
|
20
|
+
This will create a Rails 4.0 app in `projectname` with ruby 2.0.0. This script creates a new git repository. It is not meant to be used against an existing repo.
|
21
21
|
|
22
22
|
Be sure to set your canonical domain on Heroku:
|
23
23
|
```shell
|
@@ -28,15 +28,11 @@ heroku config:add CANONICAL_HOST=yourdomain.com #or www.yourdomain.com
|
|
28
28
|
|
29
29
|
### heroku toolbelt
|
30
30
|
|
31
|
-
|
31
|
+
Install from: https://toolbelt.heroku.com/
|
32
32
|
|
33
33
|
### phantomjs
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
```shell
|
38
|
-
brew install phantomjs
|
39
|
-
```
|
35
|
+
Install from: http://phantomjs.org/download.html
|
40
36
|
|
41
37
|
## Versioning
|
42
38
|
|
data/lib/pah/files/.rvmrc
CHANGED
data/lib/pah/files/Gemfile
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
|
-
ruby "
|
2
|
+
ruby "2.0.0"
|
3
3
|
|
4
|
-
gem 'rails', '
|
4
|
+
gem 'rails', '4.0.0'
|
5
5
|
gem 'unicorn', '4.6.2'
|
6
6
|
gem 'unicorn-worker-killer', '0.4.1'
|
7
7
|
gem 'secure_headers', '1.0.0'
|
8
|
-
gem 'jquery-rails', '3.0.
|
8
|
+
gem 'jquery-rails', '3.0.4'
|
9
|
+
gem 'turbolinks'
|
10
|
+
gem 'jbuilder', '~> 1.2'
|
9
11
|
gem 'haml-rails', '0.4'
|
10
12
|
gem 'pg', '0.15.1'
|
13
|
+
gem 'sass-rails', '~> 4.0.0'
|
14
|
+
gem 'coffee-rails', '~> 4.0.0'
|
15
|
+
gem 'uglifier', '>= 1.3.0'
|
11
16
|
gem 'rack-canonical-host', '0.0.8'
|
12
17
|
gem 'bourbon', '3.1.8'
|
13
18
|
# gem 'paperclip', '3.4.2'
|
@@ -18,14 +23,10 @@ gem 'bourbon', '3.1.8'
|
|
18
23
|
# gem 'kaminari', '0.14.1'
|
19
24
|
# gem 'acts_as_hashed', '1.0.0'
|
20
25
|
|
21
|
-
group :assets do
|
22
|
-
gem 'sass-rails', '3.2.6'
|
23
|
-
gem 'coffee-rails', '3.2.2'
|
24
|
-
gem 'uglifier', '2.1.1'
|
25
|
-
end
|
26
|
-
|
27
26
|
group :development do
|
28
|
-
gem
|
27
|
+
gem "letter_opener", '1.1.1'
|
28
|
+
gem 'foreman', '0.63.0'
|
29
|
+
gem 'integration', github: 'mergulhao/integration'
|
29
30
|
gem 'better_errors', '0.9.0'
|
30
31
|
gem 'binding_of_caller', '0.7.2'
|
31
32
|
gem "letter_opener", '1.1.1'
|
@@ -34,7 +35,8 @@ group :development do
|
|
34
35
|
end
|
35
36
|
|
36
37
|
group :test do
|
37
|
-
|
38
|
+
# See https://github.com/thoughtbot/shoulda-matchers/issues/270
|
39
|
+
gem "shoulda-matchers", github: "thoughtbot/shoulda-matchers" , branch: 'dp-rails-four'
|
38
40
|
gem 'simplecov', '0.7.1', require: false
|
39
41
|
gem 'valid_attribute', '1.3.1'
|
40
42
|
gem 'email_spec', '1.4.0'
|
@@ -51,3 +53,9 @@ group :development, :test do
|
|
51
53
|
gem 'dotenv-rails', '0.8.0'
|
52
54
|
gem 'awesome_print', '1.1.0'
|
53
55
|
end
|
56
|
+
|
57
|
+
group :doc do
|
58
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
59
|
+
gem 'sdoc', require: false
|
60
|
+
end
|
61
|
+
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
namespace :integration do
|
3
|
-
APP = '
|
3
|
+
APP = ENV['APP']
|
4
4
|
|
5
5
|
namespace :heroku do
|
6
6
|
task :add_remote do
|
@@ -9,7 +9,7 @@ namespace :integration do
|
|
9
9
|
end
|
10
10
|
|
11
11
|
task :check do
|
12
|
-
var = `heroku config -s --app #{APP}|grep INTEGRATING_BY`
|
12
|
+
var = Bundler.with_clean_env { `heroku config -s --app #{APP}|grep INTEGRATING_BY` }
|
13
13
|
integrating_by = var.split('=')[1] # Eu sei que é tosco, mas foda-se
|
14
14
|
user = `whoami`
|
15
15
|
if !integrating_by.blank? and integrating_by != user
|
@@ -19,10 +19,10 @@ namespace :integration do
|
|
19
19
|
end
|
20
20
|
task :lock do
|
21
21
|
user = `whoami`
|
22
|
-
sh "heroku config:add INTEGRATING_BY=#{user}"
|
22
|
+
Bundler.with_clean_env { sh "heroku config:add INTEGRATING_BY=#{user}" }
|
23
23
|
end
|
24
24
|
task :unlock do
|
25
|
-
|
25
|
+
Bundler.with_clean_env { sh "heroku config:remove INTEGRATING_BY" }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
namespace :heroku do
|
2
|
-
APP = '
|
2
|
+
APP = ENV['APP']
|
3
3
|
|
4
4
|
def run(*cmd)
|
5
5
|
system(*cmd)
|
@@ -17,12 +17,12 @@ namespace :heroku do
|
|
17
17
|
run "git push git@heroku.com:#{APP}.git HEAD:master -f"
|
18
18
|
|
19
19
|
puts "-----> Migrating..."
|
20
|
-
run "heroku run rake db:migrate --app #{APP}"
|
20
|
+
Bundler.with_clean_env { run "heroku run rake db:migrate --app #{APP}" }
|
21
21
|
|
22
22
|
puts "-----> Seeding..."
|
23
|
-
run "heroku run rake db:seed --app #{APP}"
|
23
|
+
Bundler.with_clean_env { run "heroku run rake db:seed --app #{APP}" }
|
24
24
|
|
25
25
|
puts "-----> Restarting..."
|
26
|
-
run "heroku restart --app #{APP}"
|
26
|
+
Bundler.with_clean_env { run "heroku restart --app #{APP}" }
|
27
27
|
end
|
28
28
|
end
|
@@ -33,6 +33,11 @@ RSpec.configure do |config|
|
|
33
33
|
# instead of true.
|
34
34
|
config.use_transactional_fixtures = true
|
35
35
|
|
36
|
+
# Use the new rspec expect syntax
|
37
|
+
config.expect_with :rspec do |c|
|
38
|
+
c.syntax = :expect
|
39
|
+
end
|
40
|
+
|
36
41
|
config.order = "random"
|
37
42
|
config.render_views
|
38
43
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
@@ -4,7 +4,6 @@
|
|
4
4
|
# https://makandracards.com/makandra/950-speed-up-rspec-by-deferring-garbage-collection
|
5
5
|
|
6
6
|
class DeferredGarbageCollection
|
7
|
-
RESERVED_IVARS = %w(@loaded_fixtures)
|
8
7
|
DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || 10.0).to_f
|
9
8
|
@@last_gc_run = Time.now
|
10
9
|
def self.start
|
@@ -24,11 +23,7 @@ RSpec.configure do |config|
|
|
24
23
|
config.before(:all) do
|
25
24
|
DeferredGarbageCollection.start
|
26
25
|
end
|
27
|
-
|
28
|
-
(instance_variables - DeferredGarbageCollection::RESERVED_IVARS).each do |ivar|
|
29
|
-
instance_variable_set(ivar, nil)
|
30
|
-
end
|
31
|
-
end
|
26
|
+
|
32
27
|
config.after(:all) do
|
33
28
|
DeferredGarbageCollection.reconsider
|
34
29
|
end
|
@@ -5,16 +5,14 @@ git :commit => "-aqm 'Commit new rails app.'"
|
|
5
5
|
|
6
6
|
puts "Removing unnecessary files ... ".magenta
|
7
7
|
|
8
|
-
remove_file "README"
|
8
|
+
remove_file "README.rdoc"
|
9
9
|
remove_file "app/views/layouts/application.html.erb"
|
10
|
-
remove_file "app/assets/images/rails.png"
|
11
10
|
|
12
11
|
inside "public" do
|
13
|
-
remove_file "index.html"
|
14
12
|
remove_file "favicon.ico"
|
15
13
|
remove_file "robots.txt"
|
16
14
|
end
|
17
15
|
|
18
16
|
git :add => '.'
|
19
17
|
git :commit => "-aqm 'Removed unnecessary files left over from initial app generation.'"
|
20
|
-
puts "\n"
|
18
|
+
puts "\n"
|
@@ -7,7 +7,6 @@ copy_static_file 'Procfile'
|
|
7
7
|
copy_static_file "lib/tasks/integration.rake"
|
8
8
|
|
9
9
|
copy_static_file 'config/locales/pt-BR.yml'
|
10
|
-
copy_static_file 'public/index.html' if ENV['RAILS_TEMPLATE_TEST'] == 'true'
|
11
10
|
|
12
11
|
gsub_file 'lib/tasks/integration.rake', /PROJECT/, @app_name
|
13
12
|
|
data/lib/pah/partials/_heroku.rb
CHANGED
@@ -2,14 +2,19 @@ say "Configuring Heroku application...".magenta
|
|
2
2
|
|
3
3
|
if would_you_like? "Create Heroku apps?".red
|
4
4
|
config = {}
|
5
|
-
heroku_name = ask_unless_test "What do you want to call your app? (#{heroku_name})".red
|
6
5
|
heroku_name = @app_name.gsub('_','')
|
6
|
+
new_heroku_name = ask "What do you want to call your app? (#{heroku_name})", :red
|
7
|
+
heroku_name = new_heroku_name.present? ? new_heroku_name : heroku_name
|
7
8
|
config['staging'] = would_you_like? "Create staging app? (#{heroku_name}-staging.heroku.com) [y,n]".red
|
8
9
|
config['deploy'] = would_you_like? "Deploy immediately?".red
|
9
10
|
config['domain'] = ask_unless_test "Add custom domain(customdomain.com) or leave blank".red
|
10
11
|
|
11
12
|
say "Creating Heroku app '#{heroku_name}.herokuapp.com'".magenta
|
12
|
-
system("heroku create #{heroku_name}")
|
13
|
+
created = system("heroku create #{heroku_name}")
|
14
|
+
unless created
|
15
|
+
puts "Heroku app already exists, halting"
|
16
|
+
exit
|
17
|
+
end
|
13
18
|
|
14
19
|
if config['staging']
|
15
20
|
staging_name = ask_unless_test "What do you want to call your staging app?".red
|
@@ -38,14 +43,16 @@ if would_you_like? "Create Heroku apps?".red
|
|
38
43
|
say "Adding heroku addon [Loggly]...".magenta
|
39
44
|
run "heroku addons:add loggly:mole"
|
40
45
|
|
41
|
-
sendgrid =
|
46
|
+
sendgrid = yes? "Add sendgrid:starter addon? [yN]".red
|
42
47
|
|
43
48
|
if sendgrid
|
44
49
|
say "Adding heroku addon [Sendgrid]...".magenta
|
45
50
|
run "heroku addons:add sendgrid:starter"
|
46
51
|
end
|
47
52
|
|
48
|
-
|
49
|
-
|
53
|
+
if config['deploy']
|
54
|
+
say "Pushing application to heroku...".magenta
|
55
|
+
git :push => "heroku master" if config['deploy']
|
56
|
+
end
|
50
57
|
run "heroku open" if config['deploy']
|
51
|
-
end
|
58
|
+
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
puts "Setting up Integration... ".magenta
|
2
2
|
copy_static_file 'lib/tasks/integration.rake'
|
3
3
|
copy_static_file 'lib/tasks/tasks.rake'
|
4
|
-
gsub_file 'lib/tasks/integration.rake', /PROJECT/, @app_name
|
5
|
-
gsub_file 'lib/tasks/tasks.rake', /PROJECT/, @app_name
|
6
4
|
git :add => 'lib/tasks/integration.rake lib/tasks/tasks.rake'
|
7
5
|
git :commit => "-qm 'Adding integration'"
|
8
6
|
|
@@ -4,9 +4,9 @@ content = <<EOF
|
|
4
4
|
ensure_security_headers # See more: https://github.com/twitter/secureheaders
|
5
5
|
EOF
|
6
6
|
in_root do
|
7
|
-
inject_into_file 'app/controllers/application_controller.rb', content, {after: "
|
7
|
+
inject_into_file 'app/controllers/application_controller.rb', content, {after: "with: :exception", verbose: false}
|
8
8
|
end
|
9
9
|
git :add => 'app/controllers/application_controller.rb'
|
10
10
|
git :commit => "-qm 'Adding secure headers.'"
|
11
11
|
|
12
|
-
puts "\n"
|
12
|
+
puts "\n"
|
data/lib/pah/template.rb
CHANGED
@@ -28,7 +28,6 @@ def apply_n(partial)
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def would_you_like?(question)
|
31
|
-
return true if ENV['RAILS_TEMPLATE_TEST'] == 'true'
|
32
31
|
answer = ask("#{question} [y,n]".red)
|
33
32
|
case answer.downcase
|
34
33
|
when "yes", "y"
|
@@ -41,7 +40,7 @@ def would_you_like?(question)
|
|
41
40
|
end
|
42
41
|
|
43
42
|
def ask_unless_test(*params)
|
44
|
-
ask(*params)
|
43
|
+
ask(*params)
|
45
44
|
end
|
46
45
|
|
47
46
|
puts "\n========================================================="
|
@@ -67,18 +66,10 @@ apply_n :rvm
|
|
67
66
|
apply_n :unicorn
|
68
67
|
apply_n :integration
|
69
68
|
apply_n :finish
|
70
|
-
|
71
|
-
if ENV['RAILS_TEMPLATE_TEST'] == 'true'
|
72
|
-
in_root do
|
73
|
-
run "rake"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
69
|
apply_n :heroku
|
78
70
|
|
79
71
|
# apply_n :omniauth # TODO: add spec support files
|
80
72
|
# TODO: take care of facebook when user is not logged in on facebook (when app)
|
81
|
-
# TODO: extrair phone validator to gem
|
82
73
|
|
83
74
|
puts "\n========================================================="
|
84
75
|
puts " CONGRATS! INSTALLATION COMPLETE!".yellow.bold
|
data/lib/pah/version.rb
CHANGED
data/pah.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency 'rails', '
|
21
|
+
spec.add_dependency 'rails', '4.0.0'
|
22
22
|
spec.add_dependency 'colored', '1.2'
|
23
23
|
spec.add_dependency 'rvm', '1.11.3.8'
|
24
24
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 4.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 4.0.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: colored
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|