pah 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.3 (July 05, 2013)
4
+
5
+ ### features
6
+
7
+ ### improvements
8
+
9
+ - Added badges
10
+ - Updated rvm
11
+ - Added bourbon
12
+ - Removed the include of requires.rb
13
+ - Removed unused gems (like Timecop) from the default Gemfile
14
+ - Added Unicorn awesome configuration
15
+ - Making clear that we use ruby 1.9.3
16
+ - Added integration
17
+
18
+ ### bug fixes
19
+
3
20
  ## 0.0.2 (June 20, 2013)
4
21
 
5
22
  ### features
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # Pah
2
+ [![RubyGems][gem_version_badge]][ruby_gems]
3
+ [![Code Climate][code_climate_badge]][code_climate]
4
+ [![Gemnasium][gemnasium_badge]][gemnasium]
2
5
 
3
6
  A rails application template which born from [Startup DEV][startupdev] and now is used to start most projects at [HE:labs][helabs].
4
7
 
@@ -14,7 +17,7 @@ Run:
14
17
 
15
18
  pah projectname
16
19
 
17
- This will create a Rails 3.2 app in `projectname`. This script creates a new git repository. It is not meant to be used against an existing repo.
20
+ This will create a Rails 3.2 app in `projectname` with ruby 1.9.3. This script creates a new git repository. It is not meant to be used against an existing repo.
18
21
 
19
22
  Be sure to set your canonical domain on Heroku:
20
23
  ```shell
@@ -54,3 +57,10 @@ Thank you to all the [contributors](https://github.com/Helabs/pah/graphs/contrib
54
57
 
55
58
  [startupdev]: http://startupdev.com.br
56
59
  [helabs]: http://helabs.com.br
60
+ [gem_version_badge]: https://badge.fury.io/rb/pah.png
61
+ [ruby_gems]: http://rubygems.org/gems/pah
62
+ [code_climate]: https://codeclimate.com/github/Helabs/pah
63
+ [code_climate_badge]: https://codeclimate.com/github/Helabs/pah.png
64
+ [gemnasium]: https://gemnasium.com/Helabs/pah
65
+ [gemnasium_badge]: https://gemnasium.com/Helabs/pah.png
66
+
@@ -3,11 +3,13 @@ ruby "1.9.3"
3
3
 
4
4
  gem 'rails', '3.2.13'
5
5
  gem 'unicorn', '4.6.2'
6
+ gem 'unicorn-worker-killer', '0.4.1'
6
7
  gem 'secure_headers', '1.0.0'
7
8
  gem 'jquery-rails', '3.0.1'
8
9
  gem 'haml-rails', '0.4'
9
10
  gem 'pg', '0.15.1'
10
11
  gem 'rack-canonical-host', '0.0.8'
12
+ gem 'bourbon', '3.1.8'
11
13
  # gem 'paperclip', '3.4.2'
12
14
  # gem 'aws-sdk', '1.11.2'
13
15
  # gem 'paranoia', '1.2.0'
@@ -23,23 +25,23 @@ group :assets do
23
25
  end
24
26
 
25
27
  group :development do
26
- gem "letter_opener", '1.1.1'
27
- gem 'foreman', '0.63.0'
28
28
  gem 'integration', git: 'git://github.com/mergulhao/integration.git'
29
- gem 'heroku-deploy', '0.0.4'
30
29
  gem 'better_errors', '0.9.0'
31
30
  gem 'binding_of_caller', '0.7.2'
31
+ gem "letter_opener", '1.1.1'
32
+ # gem 'foreman', '0.63.0'
33
+ # gem 'guard-rspec', '3.0.2'
32
34
  end
33
35
 
34
36
  group :test do
35
- gem 'webmock', '1.11.0'
36
37
  gem 'shoulda-matchers', '2.2.0'
37
- gem 'timecop', '0.6.1'
38
38
  gem 'simplecov', '0.7.1', require: false
39
- gem 'capybara', '2.1.0'
40
- gem 'poltergeist', '1.3.0'
41
39
  gem 'valid_attribute', '1.3.1'
42
40
  gem 'email_spec', '1.4.0'
41
+ gem 'capybara', '2.1.0'
42
+ gem 'poltergeist', '1.3.0'
43
+ # gem 'webmock', '1.11.0'
44
+ # gem 'timecop', '0.6.1'
43
45
  end
44
46
 
45
47
  group :development, :test do
@@ -48,5 +50,4 @@ group :development, :test do
48
50
  gem 'pry-rails', '0.3.1'
49
51
  gem 'dotenv-rails', '0.8.0'
50
52
  gem 'awesome_print', '1.1.0'
51
- # gem 'guard-rspec', '3.0.2'
52
53
  end
@@ -0,0 +1,6 @@
1
+ @import "bourbon";
2
+ @import "reset";
3
+
4
+ body {
5
+ font-family: $helvetica;
6
+ }
@@ -2,10 +2,26 @@
2
2
 
3
3
  worker_processes Integer(ENV['WEB_CONCURRENCY'] || 3)
4
4
  timeout Integer(ENV['WEB_TIMEOUT'] || 15)
5
+
6
+ # combine Ruby 2.0.0dev or REE with "preload_app true" for memory savings
7
+ # http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow
5
8
  preload_app true
9
+ GC.respond_to?(:copy_on_write_friendly=) and
10
+ GC.copy_on_write_friendly = true
6
11
 
7
- before_fork do |server, worker|
12
+ # Enable this flag to have unicorn test client connections by writing the
13
+ # beginning of the HTTP headers before calling the application. This
14
+ # prevents calling the application for connections that have disconnected
15
+ # while queued. This is only guaranteed to detect clients on the same
16
+ # host unicorn runs on, and unlikely to detect disconnects even on a
17
+ # fast LAN.
18
+ check_client_connection false
19
+
20
+ # Listen only on Heroku TCP port.
21
+ # We use a shorter backlog for quicker failover when busy.
22
+ listen ENV['PORT'], :backlog => Integer(ENV['UNICORN_BACKLOG'] || 200), :tcp_nopush => true
8
23
 
24
+ before_fork do |server, worker|
9
25
  Signal.trap 'TERM' do
10
26
  puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
11
27
  Process.kill 'QUIT', Process.pid
@@ -13,9 +29,10 @@ before_fork do |server, worker|
13
29
 
14
30
  defined?(ActiveRecord::Base) and
15
31
  ActiveRecord::Base.connection.disconnect!
16
- end
32
+ end
17
33
 
18
34
  after_fork do |server, worker|
35
+ GC.disable
19
36
 
20
37
  Signal.trap 'TERM' do
21
38
  puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to sent QUIT'
@@ -24,4 +41,3 @@ after_fork do |server, worker|
24
41
  defined?(ActiveRecord::Base) and
25
42
  ActiveRecord::Base.establish_connection
26
43
  end
27
-
@@ -1,4 +1,32 @@
1
1
  # -*- encoding : utf-8 -*-
2
+ namespace :integration do
3
+ APP = 'PROJECT'
4
+
5
+ namespace :heroku do
6
+ task :add_remote do
7
+ remote = `git remote |grep heroku`
8
+ sh "git remote add heroku git@heroku.com:#{APP}.git" if remote.strip.blank?
9
+ end
10
+
11
+ task :check do
12
+ var = `heroku config -s --app #{APP}|grep INTEGRATING_BY`
13
+ integrating_by = var.split('=')[1] # Eu sei que é tosco, mas foda-se
14
+ user = `whoami`
15
+ if !integrating_by.blank? and integrating_by != user
16
+ p80 "Project is already being integrated by #{integrating_by}"
17
+ exit
18
+ end
19
+ end
20
+ task :lock do
21
+ user = `whoami`
22
+ sh "heroku config:add INTEGRATING_BY=#{user}"
23
+ end
24
+ task :unlock do
25
+ `heroku config:remove INTEGRATING_BY`
26
+ end
27
+ end
28
+ end
29
+
2
30
  INTEGRATION_TASKS = %w(
3
31
  integration:heroku:add_remote
4
32
  integration:heroku:check
@@ -9,6 +37,6 @@ INTEGRATION_TASKS = %w(
9
37
  spec
10
38
  integration:coverage_verify
11
39
  integration:finish
12
- heroku:deploy:production
40
+ heroku:deploy
13
41
  integration:heroku:unlock
14
- )
42
+ )
@@ -0,0 +1,28 @@
1
+ namespace :heroku do
2
+ APP = 'PROJECT'
3
+
4
+ def run(*cmd)
5
+ system(*cmd)
6
+ raise "Command #{cmd.inspect} failed!" unless $?.success?
7
+ end
8
+
9
+ def confirm(message)
10
+ print "\n#{message}\nAre you sure? [yN] "
11
+ raise 'Aborted' unless STDIN.gets.chomp.downcase == 'y'
12
+ end
13
+
14
+ desc "Deploy app to Heroku"
15
+ task :deploy do
16
+ puts "-----> Pushing..."
17
+ run "git push git@heroku.com:#{APP}.git HEAD:master -f"
18
+
19
+ puts "-----> Migrating..."
20
+ run "heroku run rake db:migrate --app #{APP}"
21
+
22
+ puts "-----> Seeding..."
23
+ run "heroku run rake db:seed --app #{APP}"
24
+
25
+ puts "-----> Restarting..."
26
+ run "heroku restart --app #{APP}"
27
+ end
28
+ end
@@ -1,7 +1,7 @@
1
- # -*- encoding : utf-8 -*-
2
1
  require 'capybara/rspec'
3
2
  require 'capybara/rails'
4
3
  require 'capybara/poltergeist'
4
+
5
5
  Capybara.javascript_driver = :poltergeist
6
6
  RSpec.configure do |config|
7
7
  config.include Capybara::DSL, :example_group => { :file_path => /\bspec\/acceptance\// }
@@ -4,7 +4,6 @@ copy_static_file 'app/assets/stylesheets/reset.css'
4
4
  copy_static_file 'app/views/layouts/application.html.haml'
5
5
  copy_static_file 'config/unicorn.rb'
6
6
  copy_static_file 'Procfile'
7
- copy_static_file "config/initializers/requires.rb"
8
7
  copy_static_file "lib/tasks/integration.rake"
9
8
 
10
9
  copy_static_file 'config/locales/pt-BR.yml'
@@ -0,0 +1,9 @@
1
+ puts "Setting up Integration... ".magenta
2
+ copy_static_file 'lib/tasks/integration.rake'
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
+ git :add => 'lib/tasks/integration.rake lib/tasks/tasks.rake'
7
+ git :commit => "-qm 'Adding integration'"
8
+
9
+ puts "\n"
@@ -0,0 +1,9 @@
1
+ puts "Adding stylesheets files ...".magenta
2
+
3
+ copy_static_file 'app/assets/stylesheets/application.css.scss'
4
+ remove_file 'app/assets/stylesheets/application.css'
5
+ copy_static_file 'app/assets/stylesheets/reset.css'
6
+
7
+ git :add => '.'
8
+ git :commit => "-aqm 'Add stylesheets files.'"
9
+ puts "\n"
@@ -0,0 +1,30 @@
1
+ puts "Configuring Unicorn... ".magenta
2
+
3
+ unicorn_configuration = <<UNICORN_CONFIGURATION
4
+ # Run GC each 10 requests
5
+ require "unicorn/oob_gc"
6
+ use Unicorn::OobGC, 10
7
+
8
+ # Unicorn Worker Killer Configuration:
9
+ #
10
+ require "unicorn/worker_killer"
11
+
12
+ # Max requests per worker
13
+ max_request_min = ENV['MAX_REQUEST_MIN'].to_i || 3072
14
+ max_request_max = ENV['MAX_REQUEST_MAX'].to_i || 4096
15
+ use Unicorn::WorkerKiller::MaxRequests, max_request_min, max_request_max
16
+
17
+ # Max memory size (RSS) per worker
18
+ oom_min = ((ENV['OOM_MIN'].to_i || 192) * (1024**2))
19
+ oom_max = ((ENV['OOM_MAX'].to_i || 216) * (1024**2))
20
+ use Unicorn::WorkerKiller::Oom, oom_min, oom_max
21
+ UNICORN_CONFIGURATION
22
+
23
+ in_root do
24
+ inject_into_file 'config.ru', unicorn_configuration, {before: "require ::File.expand_path('../config/environment', __FILE__)", verbose: false}
25
+ end
26
+
27
+ git :add => 'config.ru'
28
+ git :commit => "-qm 'Configuring Unicorn.'"
29
+
30
+ puts "\n"
@@ -56,6 +56,7 @@ apply_n :gems
56
56
  apply_n :database
57
57
  apply_n :rspec
58
58
  apply_n :default
59
+ apply_n :stylesheets
59
60
  apply_n :secure_headers
60
61
  apply_n :omniauth
61
62
  apply_n :capybara
@@ -63,6 +64,8 @@ apply_n :generators
63
64
  apply_n :letter_opener
64
65
  apply_n :canonical_host
65
66
  apply_n :rvm
67
+ apply_n :unicorn
68
+ apply_n :integration
66
69
  apply_n :finish
67
70
 
68
71
  if ENV['RAILS_TEMPLATE_TEST'] == 'true'
@@ -1,3 +1,3 @@
1
1
  module Pah
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency 'rails', '3.2.13'
22
22
  spec.add_dependency 'colored', '1.2'
23
- spec.add_dependency 'rvm', '1.11.3.7'
23
+ spec.add_dependency 'rvm', '1.11.3.8'
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rake"
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.2
4
+ version: 0.0.3
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-06-20 00:00:00.000000000 Z
12
+ date: 2013-07-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 1.11.3.7
53
+ version: 1.11.3.8
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.11.3.7
61
+ version: 1.11.3.8
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: bundler
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -113,14 +113,15 @@ files:
113
113
  - lib/pah/files/.rvmrc
114
114
  - lib/pah/files/Gemfile
115
115
  - lib/pah/files/Procfile
116
+ - lib/pah/files/app/assets/stylesheets/application.css.scss
116
117
  - lib/pah/files/app/assets/stylesheets/reset.css
117
118
  - lib/pah/files/app/views/layouts/application.html.haml
118
119
  - lib/pah/files/config/database.yml
119
120
  - lib/pah/files/config/initializers/omniauth.rb
120
- - lib/pah/files/config/initializers/requires.rb
121
121
  - lib/pah/files/config/locales/pt-BR.yml
122
122
  - lib/pah/files/config/unicorn.rb
123
123
  - lib/pah/files/lib/tasks/integration.rake
124
+ - lib/pah/files/lib/tasks/tasks.rake
124
125
  - lib/pah/files/spec/acceptance/dummy_spec.rb
125
126
  - lib/pah/files/spec/spec_helper.rb
126
127
  - lib/pah/files/spec/support/README
@@ -146,11 +147,14 @@ files:
146
147
  - lib/pah/partials/_generators.rb
147
148
  - lib/pah/partials/_git.rb
148
149
  - lib/pah/partials/_heroku.rb
150
+ - lib/pah/partials/_integration.rb
149
151
  - lib/pah/partials/_letter_opener.rb
150
152
  - lib/pah/partials/_omniauth.rb
151
153
  - lib/pah/partials/_rspec.rb
152
154
  - lib/pah/partials/_rvm.rb
153
155
  - lib/pah/partials/_secure_headers.rb
156
+ - lib/pah/partials/_stylesheets.rb
157
+ - lib/pah/partials/_unicorn.rb
154
158
  - lib/pah/template.rb
155
159
  - lib/pah/version.rb
156
160
  - pah.gemspec
@@ -167,18 +171,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
167
171
  - - ! '>='
168
172
  - !ruby/object:Gem::Version
169
173
  version: '0'
170
- segments:
171
- - 0
172
- hash: 95633388803166914
173
174
  required_rubygems_version: !ruby/object:Gem::Requirement
174
175
  none: false
175
176
  requirements:
176
177
  - - ! '>='
177
178
  - !ruby/object:Gem::Version
178
179
  version: '0'
179
- segments:
180
- - 0
181
- hash: 95633388803166914
182
180
  requirements: []
183
181
  rubyforge_project:
184
182
  rubygems_version: 1.8.25
@@ -1 +0,0 @@
1
- # add here requires that your app needs to load