producer-rails 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e47134856bd5d3447bc62bfc3be0b9fef1afa1f6
4
- data.tar.gz: a1ef63458c408b2e8fb7379c4e788ff2b392cdda
3
+ metadata.gz: c3d5fcbe9b3be613c7f2920d17f2615181b84f69
4
+ data.tar.gz: 5ffa8ba35a20987ae7e525d5548c53e779191096
5
5
  SHA512:
6
- metadata.gz: 07e1b5dfc4d6f4418c23c75e9faab80c552f04b894b657cbfa2a9bd0f2a754f6b6f730a04d1aa3db6f55aa3255731f5f61cc098b4d6ea5e98700054cc0c9d383
7
- data.tar.gz: 34c13ff707c882f577bddeb4263482d4af0456f5f4a09a18b669dfb4965104703bcb78885508fff6d70581efee44c24a36ec06af9d704b028b7e68f6e0d7a0d0
6
+ metadata.gz: 32c9700fec0967891df08474f3cbfd248109128745ef6e052215c6fec86a7963a8aa6ab5a22eb91dd5edb94a8077ae83494266e1c145accdfaf89dc7848cac74
7
+ data.tar.gz: cbddfc4e9fff13b02830de1fe5d1a036c7ffc9e24dc167f446f204347e4564cdc3db9335ffaff2d582781f0d9c5c9f1c4e17c863737f2af5cfaaab6e3e931428
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  producer-rails
2
2
  ==============
3
3
 
4
- Ruby on Rails specific macros and tests for [producer][].
4
+ [![Version ][badge-version-img]][badge-version-uri]
5
+ [![Build status ][badge-build-img]][badge-build-uri]
6
+
5
7
 
6
- [![Version][badge-version-img]][badge-version-uri]
8
+ Ruby on Rails specific macros and tests for [producer][].
7
9
 
8
10
 
9
11
  Usage
@@ -20,10 +22,10 @@ deploy
20
22
  ```
21
23
 
22
24
  ```
23
- # Deploy for the first time:
25
+ # Deploy for the first time
24
26
  $ producer config/deploy.rb -t host.example -- init
25
27
 
26
- # Deploy updated application (with application restart):
28
+ # Deploy updated application (with application restart)
27
29
  $ producer config/deploy.rb -t host.example -- update
28
30
 
29
31
  # Start application
@@ -41,3 +43,5 @@ $ producer config/deploy.rb -t host.example -- restart
41
43
  [producer]: https://github.com/tjouan/producer-core
42
44
  [badge-version-img]: https://img.shields.io/gem/v/producer-rails.svg?style=flat-square
43
45
  [badge-version-uri]: https://rubygems.org/gems/producer-rails
46
+ [badge-build-img]: https://img.shields.io/travis/tjouan/producer-rails/master.svg?style=flat-square
47
+ [badge-build-uri]: https://travis-ci.org/tjouan/producer-rails
@@ -1,5 +1,5 @@
1
1
  module Producer
2
2
  module Rails
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.2.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: producer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-06 00:00:00.000000000 Z
11
+ date: 2015-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: producer-core
@@ -108,34 +108,19 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '4.2'
111
- description: |
112
- Rails helpers for producer (gem: producer-core).
111
+ description: Rails helpers for producer (producer-core gem)
113
112
  email: tj@a13.fr
114
113
  executables: []
115
114
  extensions: []
116
- extra_rdoc_files: []
115
+ extra_rdoc_files:
116
+ - README.md
117
117
  files:
118
- - ".gitignore"
119
- - ".travis.yml"
120
- - Gemfile
121
- - Guardfile
122
- - LICENSE
123
118
  - README.md
124
- - Rakefile
125
- - features/arguments.feature
126
- - features/deploy_init.feature
127
- - features/deploy_restart.feature
128
- - features/deploy_start.feature
129
- - features/deploy_stop.feature
130
- - features/deploy_update.feature
131
- - features/steps/deploy_steps.rb
132
- - features/steps/repository_steps.rb
133
- - features/support/env.rb
134
119
  - lib/producer/rails.rb
135
120
  - lib/producer/rails/version.rb
136
- - producer-rails.gemspec
137
121
  homepage: https://rubygems.org/gems/producer-rails
138
- licenses: []
122
+ licenses:
123
+ - BSD-3-Clause
139
124
  metadata: {}
140
125
  post_install_message:
141
126
  rdoc_options: []
data/.gitignore DELETED
@@ -1,3 +0,0 @@
1
- /Gemfile-custom.rb
2
- /Gemfile.lock
3
- /tmp/
data/.travis.yml DELETED
@@ -1,13 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.2
6
- - ruby-head
7
- - 2.1
8
- before_script:
9
- - ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''
10
- - cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
11
- - chmod 600 ~/.ssh/authorized_keys
12
- - eval `ssh-agent -s`
13
- - ssh-add ~/.ssh/id_rsa
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- eval File.read('Gemfile-custom.rb') if File.exist?('Gemfile-custom.rb')
data/Guardfile DELETED
@@ -1,7 +0,0 @@
1
- directories %w[features lib]
2
-
3
- guard :cucumber, cli: '--format pretty --quiet', all_on_start: false do
4
- watch(%r{\Afeatures/.+\.feature\z})
5
- watch(%r{\Afeatures/support/.+\.rb\z}) { 'features' }
6
- watch(%r{\Afeatures/step_definitions/.+_steps\.rb\z}) { 'features' }
7
- end
data/LICENSE DELETED
@@ -1,30 +0,0 @@
1
- Copyright 2014 Thibault Jouan. All rights reserved.
2
-
3
- Redistribution and use in source and binary forms, with or without
4
- modification, are permitted provided that the following conditions are
5
- met:
6
-
7
- * Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
-
10
- * Redistributions in binary form must reproduce the above copyright
11
- notice, this list of conditions and the following disclaimer in
12
- the documentation and/or other materials provided with the
13
- distribution.
14
-
15
- * Neither the name of the software nor the names of its contributors
16
- may be used to endorse or promote products derived from this
17
- software without specific prior written permission.
18
-
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS "AS IS" AND
21
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS
24
- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
27
- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
29
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
30
- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/Rakefile DELETED
@@ -1,5 +0,0 @@
1
- require 'cucumber/rake/task'
2
-
3
- task default: :features
4
-
5
- Cucumber::Rake::Task.new(:features)
@@ -1,40 +0,0 @@
1
- @sshd @sshd_gem_env
2
- Feature: producer recipe arguments usage
3
-
4
- Background:
5
- Given a rails app repository
6
-
7
- Scenario: `init' recipe argument is given
8
- Given I write a standard deployment recipe
9
- When I execute the deployment recipe with "init" recipe argument
10
- Then the deployed app must be initialized
11
-
12
- Scenario: `update' recipe argument is given
13
- Given I make the initial deployment
14
- And I make a change in the rails app repository
15
- And I write a standard deployment recipe
16
- When I execute the deployment recipe with "update" recipe argument
17
- Then the deployed app repository must be up to date
18
-
19
- @unicorn_kill
20
- Scenario: `start' recipe argument is given
21
- Given I make the initial deployment
22
- And I write a standard deployment recipe
23
- When I execute the deployment recipe with "start" recipe argument
24
- Then the deployed app unicorn server must be running
25
-
26
- Scenario: `stop' recipe argument is given
27
- Given I make the initial deployment
28
- And I start the deployed app
29
- And I write a standard deployment recipe
30
- When I execute the deployment recipe with "stop" recipe argument
31
- Then the deployed app unicorn server must not be running
32
-
33
- @unicorn_kill
34
- Scenario: `restart' recipe argument is given
35
- Given I make the initial deployment
36
- And I start the deployed app
37
- And the deployed app unicorn server is running with a certain pid
38
- And I write a standard deployment recipe
39
- When I execute the deployment recipe with "restart" recipe argument
40
- Then the deployed app unicorn server must have a different pid
@@ -1,30 +0,0 @@
1
- @sshd @sshd_gem_env
2
- Feature: `deploy_init' macro
3
-
4
- Background:
5
- Given a rails app repository
6
- And I write a deployment recipe calling "deploy_init"
7
-
8
- Scenario: clones the app in configured remote directory
9
- When I execute the deployment recipe
10
- Then the deployed app repository must be cloned
11
-
12
- Scenario: configures the database connection
13
- When I execute the deployment recipe
14
- Then the deployed app must have its database connection configured
15
-
16
- Scenario: installs dependencies with bundler
17
- When I execute the deployment recipe
18
- Then the deployed app must have its dependencies installed
19
-
20
- Scenario: executes database migrations
21
- When I execute the deployment recipe
22
- Then the deployed app must have its database migrations up
23
-
24
- Scenario: generates a secret key for production
25
- When I execute the deployment recipe
26
- Then the deployed app must have secret key setup
27
-
28
- Scenario: configures unicorn server
29
- When I execute the deployment recipe
30
- Then the deployed app must have unicorn configuration
@@ -1,14 +0,0 @@
1
- @sshd @sshd_gem_env
2
- Feature: `deploy_restart' macro
3
-
4
- Background:
5
- Given a rails app repository
6
- And I make the initial deployment
7
- And I start the deployed app
8
- And the deployed app unicorn server is running with a certain pid
9
- And I write a deployment recipe calling "deploy_restart"
10
-
11
- @unicorn_kill
12
- Scenario: restarts unicorn server
13
- When I execute the deployment recipe
14
- Then the deployed app unicorn server must have a different pid
@@ -1,12 +0,0 @@
1
- @sshd @sshd_gem_env
2
- Feature: `deploy_start' macro
3
-
4
- Background:
5
- Given a rails app repository
6
- And I make the initial deployment
7
- And I write a deployment recipe calling "deploy_start"
8
-
9
- @unicorn_kill
10
- Scenario: starts unicorn server
11
- When I execute the deployment recipe
12
- Then the deployed app unicorn server must be running
@@ -1,12 +0,0 @@
1
- @sshd @sshd_gem_env
2
- Feature: `deploy_stop' macro
3
-
4
- Background:
5
- Given a rails app repository
6
- And I make the initial deployment
7
- And I start the deployed app
8
- And I write a deployment recipe calling "deploy_stop"
9
-
10
- Scenario: stops unicorn server
11
- When I execute the deployment recipe
12
- Then the deployed app unicorn server must not be running
@@ -1,12 +0,0 @@
1
- @sshd @sshd_gem_env
2
- Feature: `deploy_update' macro
3
-
4
- Background:
5
- Given a rails app repository
6
- And I make the initial deployment
7
- And I make a change in the rails app repository
8
- And I write a deployment recipe calling "deploy_update"
9
-
10
- Scenario: updates the deployed app repository
11
- When I execute the deployment recipe
12
- Then the deployed app repository must be up to date
@@ -1,131 +0,0 @@
1
- RECIPE_PATH = 'recipe.rb'.freeze
2
- DEPLOY_PATH = 'deploys/my_app'.freeze
3
-
4
- def deploy_recipe_write(repository, macro)
5
- @deploy_path = DEPLOY_PATH
6
- write_file RECIPE_PATH, <<-eoh
7
- require 'producer/rails'
8
-
9
- set :repository, '#{repository}'
10
- set :app_path, '#{@deploy_path}'
11
-
12
- #{macro}
13
- eoh
14
- end
15
-
16
- def deploy_recipe_run(rargv: [])
17
- run_recipe remote: true, check: true, rargv: rargv, options: '-v'
18
- end
19
-
20
- Given /^I write a deployment recipe calling "([^"]+)"$/ do |macro|
21
- deploy_recipe_write @repository, macro
22
- end
23
-
24
- Given /^I write a standard deployment recipe$/ do
25
- deploy_recipe_write @repository, 'deploy'
26
- end
27
-
28
- Given /^I make the initial deployment$/ do
29
- deploy_recipe_write @repository, 'deploy_init'
30
- deploy_recipe_run
31
- end
32
-
33
- Given /^I start the deployed app$/ do
34
- deploy_recipe_write @repository, 'deploy_start'
35
- deploy_recipe_run
36
- end
37
-
38
- Given /^the deployed app unicorn server is running with a certain pid$/ do
39
- in_current_dir do
40
- @deploy_unicorn_pid = File.read("#{@deploy_path}/tmp/run/www.pid").to_i
41
- end
42
- end
43
-
44
- When /^I execute the deployment recipe$/ do
45
- deploy_recipe_run
46
- end
47
-
48
- When /^I execute the deployment recipe with "([^"]+)" recipe argument$/ do |arg|
49
- deploy_recipe_run rargv: [arg]
50
- end
51
-
52
- Then /^the deployed app must be initialized$/ do
53
- step 'the deployed app must have unicorn configuration'
54
- end
55
-
56
- Then /^the deployed app repository must be cloned$/ do
57
- in_current_dir do
58
- expect(`git -C #{@deploy_path} log --oneline -1`)
59
- .to include 'Add generated rails app'
60
- end
61
- end
62
-
63
- Then /^the deployed app repository must be up to date$/ do
64
- in_current_dir do
65
- expect(`git -C #{@deploy_path} log --oneline -1`).to include 'Make change'
66
- end
67
- end
68
-
69
- Then /^the deployed app must have its database connection configured$/ do
70
- check_file_content "#{@deploy_path}/config/database.yml", <<-eoh
71
- default: &default
72
- adapter: postgresql
73
- encoding: unicode
74
- pool: 5
75
-
76
- production:
77
- <<: *default
78
- database: some_host_test
79
- eoh
80
- end
81
-
82
- Then /^the deployed app must have its dependencies installed$/ do
83
- check_file_presence "#{@deploy_path}/Gemfile.lock", true
84
- end
85
-
86
- Then /^the deployed app must have its database migrations up$/ do
87
- unset_bundler_env_vars
88
- with_env 'RUBYLIB' => nil, 'RAILS_ENV' => 'production' do
89
- in_current_dir do
90
- expect(`cd #{@deploy_path} && bundle exec rake db:migrate:status`)
91
- .to match /up\s+\d+\s+Create users/
92
- end
93
- end
94
- end
95
-
96
- Then /^the deployed app must have secret key setup$/ do
97
- in_current_dir do
98
- secrets = YAML.load(File.read("#{@deploy_path}/config/secrets.yml"))
99
- expect(secrets['production']['secret_key_base']).to be
100
- end
101
- end
102
-
103
- Then /^the deployed app must have unicorn configuration$/ do
104
- check_file_content "#{@deploy_path}/config/unicorn.rb", <<-eoh
105
- worker_processes 2
106
- timeout 60
107
- preload_app false
108
- pid 'tmp/run/www.pid'
109
- listen "\#{ENV['HOME']}/#{@deploy_path}/tmp/run/www.sock"
110
- eoh
111
- end
112
-
113
- Then /^the deployed app unicorn server must be running$/ do
114
- pid_path = "#{@deploy_path}/tmp/run/www.pid"
115
- check_file_presence pid_path, true
116
- in_current_dir do
117
- expect { expect(Process.kill(0, File.read(pid_path).to_i)).to eq 1 }
118
- .not_to raise_error
119
- end
120
- end
121
-
122
- Then /^the deployed app unicorn server must not be running$/ do
123
- check_file_presence "#{@deploy_path}/tmp/run/www.pid", false
124
- end
125
-
126
- Then /^the deployed app unicorn server must have a different pid$/ do
127
- in_current_dir do
128
- expect(File.read("#{@deploy_path}/tmp/run/www.pid").to_i)
129
- .not_to eq @deploy_unicorn_pid
130
- end
131
- end
@@ -1,34 +0,0 @@
1
- Given /^a rails app repository$/ do
2
- @repository = 'repos/my_app'
3
- env = {
4
- 'BUNDLE_GEMFILE' => nil,
5
- 'RUBYLIB' => nil,
6
- 'RUBYOPT' => nil
7
- }
8
- in_current_dir do
9
- [
10
- "rails new --database=postgresql --skip-bundle #{@repository} > /dev/null",
11
- "rm -f #{@repository}/config/secrets.yml",
12
- "echo gem \\'unicorn\\' >> #{@repository}/Gemfile",
13
- "cd #{@repository} && bundle install > /dev/null",
14
- "cd #{@repository} && bundle exec rails g model User name:string > /dev/null 2>&1",
15
- "rm -f #{@repository}/config/database.yml",
16
- "echo /config/database.yml > #{@repository}/.gitignore",
17
- "echo /config/secrets.yml >> #{@repository}/.gitignore",
18
- "echo /log/*.log >> #{@repository}/.gitignore",
19
- "echo /public/assets/ >> #{@repository}/.gitignore",
20
- "echo /tmp/ >> #{@repository}/.gitignore",
21
- "git -C #{@repository} init > /dev/null",
22
- "git -C #{@repository} config user.email bob@example",
23
- "git -C #{@repository} config user.name Bob",
24
- "git -C #{@repository} add . > /dev/null",
25
- "git -C #{@repository} commit -m 'Add generated rails app' > /dev/null"
26
- ].each { |cmd| fail unless with_env(env) { system cmd } }
27
- end
28
- end
29
-
30
- Given /^I make a change in the rails app repository$/ do
31
- in_current_dir do
32
- fail unless system "git -C #{@repository} commit --allow-empty -m 'Make change'"
33
- end
34
- end
@@ -1,24 +0,0 @@
1
- require 'aruba/cucumber'
2
- require 'producer/core/testing/cucumber'
3
-
4
- GEMRC = "gem: --no-ri --no-rdoc\n".freeze
5
-
6
- Before('@sshd_gem_env') do
7
- write_file '.gemrc', GEMRC
8
- write_file '.ssh/rc', <<-eoh
9
- export GEM_HOME=#{ENV['GEM_HOME']}
10
- export PATH=#{ENV['GEM_HOME']}/bin:$PATH
11
- export RAILS_ENV=production
12
- eoh
13
- end
14
-
15
- After('@unicorn_kill') do
16
- in_current_dir do
17
- pid = File.read("#{@deploy_path}/tmp/run/www.pid").to_i
18
- Process.kill('QUIT', pid)
19
- end
20
- end
21
-
22
- Before do
23
- system 'dropdb --if-exists some_host_test > /dev/null'
24
- end
@@ -1,25 +0,0 @@
1
- require File.expand_path('../lib/producer/rails/version', __FILE__)
2
-
3
- Gem::Specification.new do |s|
4
- s.name = 'producer-rails'
5
- s.version = Producer::Rails::VERSION.dup
6
- s.summary = 'producer rails addon'
7
- s.description = <<-eoh.gsub(/^ +/, '')
8
- Rails helpers for producer (gem: producer-core).
9
- eoh
10
- s.homepage = 'https://rubygems.org/gems/producer-rails'
11
-
12
- s.authors = 'Thibault Jouan'
13
- s.email = 'tj@a13.fr'
14
-
15
- s.files = `git ls-files`.split $/
16
-
17
- s.add_dependency 'producer-core', '~> 0.5'
18
- s.add_dependency 'producer-stdlib', '~> 0.1'
19
-
20
- s.add_development_dependency 'aruba', '~> 0.6'
21
- s.add_development_dependency 'cucumber', '~> 2.0'
22
- s.add_development_dependency 'cucumber-sshd', '~> 1.1'
23
- s.add_development_dependency 'rake', '~> 10.4'
24
- s.add_development_dependency 'rails', '~> 4.2'
25
- end