inploy 1.9.5 → 1.9.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +33 -7
- data/Rakefile +1 -1
- data/lib/inploy.rb +1 -1
- data/lib/inploy/deploy.rb +12 -5
- data/lib/inploy/dsl.rb +11 -6
- data/lib/inploy/helper.rb +6 -4
- metadata +21 -41
- data/Rakefile.orig +0 -63
data/README.textile
CHANGED
@@ -2,7 +2,7 @@ h2. ABOUT:
|
|
2
2
|
|
3
3
|
Inploy was born as an option to setup and deploy Rails applications in an easier and smarter way.
|
4
4
|
|
5
|
-
It executes
|
5
|
+
It automatically executes common tasks like migrate the database, install gems, package the assets, clean the cache, notify Hoptoad, restart the server, etc. This means you will not have a big deploy script calld 'recipe' like with other tools, only a simple deploy script with a few lines.
|
6
6
|
|
7
7
|
It uses Git to version the deploys and to pull or push only the modifications in each one. This means you will not have a lot of folders in the server (only one) with duplicated code and that ech deploy will be very fast.
|
8
8
|
|
@@ -61,7 +61,7 @@ When using Inploy with Rake, there are five tasks:
|
|
61
61
|
* inploy:local:setup
|
62
62
|
|
63
63
|
- creates directories db and tmp/pids
|
64
|
-
- copies config/*.sample
|
64
|
+
- copies config/*.[example|sample|template] files to config/*
|
65
65
|
- creates the database
|
66
66
|
- executes init.sh file case it exists
|
67
67
|
- inits and updates the git submodules
|
@@ -83,7 +83,7 @@ When using Inploy with Rake, there are five tasks:
|
|
83
83
|
|
84
84
|
- pulls the repository
|
85
85
|
- inits and updates the git submodules
|
86
|
-
- copies config/*.sample
|
86
|
+
- copies config/*.[example|sample|template] files to config/*
|
87
87
|
- installs gems
|
88
88
|
- migrates the database
|
89
89
|
- updates the crontab from Whenever if being used
|
@@ -131,15 +131,18 @@ cache_dirs = ['public/cache', 'tmp/cache'] # default ['public/cache']
|
|
131
131
|
skip_steps = ['install_gems', 'clear_cache'] # default []
|
132
132
|
app_folder = 'project_folder' # default empty
|
133
133
|
login_shell = true # default false
|
134
|
-
|
134
|
+
bundler_opts = '--binstubs' # default '--deployment --without development test cucumber'
|
135
135
|
</code></pre>
|
136
136
|
|
137
|
+
The <code>bundler_path</code> option has been removed. To migrate your existing config/deploy.rb file simply replace <code>bundler_path = '/path/to/gems'</code> with <code>bundler_opts = '--path /path/to/gems'</code>
|
138
|
+
|
137
139
|
h2. SKIP STEPS
|
138
140
|
|
139
141
|
You can skip some steps when running a Rake task, just add "skip_steps" into your rake command line or add "skip_steps" to your deploy.rb to always skip those steps.
|
140
142
|
|
141
143
|
Currently the steps available to skip are:
|
142
144
|
|
145
|
+
- copy_sample_files: skip copying config/*.[example|sample|template] files to config/*
|
143
146
|
- install_gems: skip rake gems:install
|
144
147
|
- migrate_database: skip rake db:migrate
|
145
148
|
- clear_cache: skip removing cache directories
|
@@ -151,9 +154,32 @@ Currently the steps available to skip are:
|
|
151
154
|
|
152
155
|
h2. HOOKS
|
153
156
|
|
154
|
-
Currently
|
157
|
+
Currently, the following three hooks are available:
|
158
|
+
|
159
|
+
- before_git (not called before initial git clone)
|
160
|
+
- after_git
|
161
|
+
- after_setup
|
162
|
+
- before_restarting_server
|
163
|
+
- after_restarting_server
|
164
|
+
|
165
|
+
To show a "down for maintenance" page during the deployment, use the before_git and after_restarting_server hooks.
|
166
|
+
|
167
|
+
If you need another hook, please fork the project and implement it. Or submit an issue, it's very easy.
|
168
|
+
|
169
|
+
h3. say
|
155
170
|
|
156
|
-
|
171
|
+
Use the <code>say</code> method to show messages issued by your hooks.
|
172
|
+
|
173
|
+
<pre><code># Show a simple message
|
174
|
+
say 'restart custom daemons'
|
175
|
+
|
176
|
+
# Show a message (blank output lines are suppressed)
|
177
|
+
say 'revert local changes' do |output|
|
178
|
+
output << `git checkout . 2>&1`
|
179
|
+
end
|
180
|
+
</pre></code>
|
181
|
+
|
182
|
+
h2. CONTRIBUTORS
|
157
183
|
|
158
184
|
Inploy is brought to you by:
|
159
185
|
|
@@ -171,7 +197,7 @@ Inploy is brought to you by:
|
|
171
197
|
* Erik Dahlstrand
|
172
198
|
* Carlos Brando
|
173
199
|
* Thomas Ritz
|
174
|
-
|
200
|
+
* Sven Schwyn
|
175
201
|
|
176
202
|
h2. LICENSE:
|
177
203
|
|
data/Rakefile
CHANGED
data/lib/inploy.rb
CHANGED
data/lib/inploy/deploy.rb
CHANGED
@@ -3,9 +3,9 @@ module Inploy
|
|
3
3
|
include Helper
|
4
4
|
include DSL
|
5
5
|
|
6
|
-
attr_accessor :repository, :user, :application, :hosts, :path, :app_folder, :ssh_opts, :branch, :environment, :port, :skip_steps, :cache_dirs, :sudo, :login_shell, :
|
6
|
+
attr_accessor :repository, :user, :application, :hosts, :path, :app_folder, :ssh_opts, :branch, :environment, :port, :skip_steps, :cache_dirs, :sudo, :login_shell, :bundler_opts
|
7
7
|
|
8
|
-
define_callbacks :after_setup, :before_restarting_server
|
8
|
+
define_callbacks :before_git, :after_git, :after_setup, :before_restarting_server, :after_restarting_server
|
9
9
|
|
10
10
|
def initialize
|
11
11
|
self.server = :passenger
|
@@ -45,6 +45,7 @@ module Inploy
|
|
45
45
|
|
46
46
|
def local_setup
|
47
47
|
create_folders 'public', 'tmp/pids', 'db'
|
48
|
+
callback :after_git
|
48
49
|
copy_sample_files
|
49
50
|
rake "db:create RAILS_ENV=#{environment}"
|
50
51
|
run "./init.sh" if file_exists?("init.sh")
|
@@ -61,7 +62,9 @@ module Inploy
|
|
61
62
|
end
|
62
63
|
|
63
64
|
def remote_reset(params)
|
65
|
+
callback :before_git
|
64
66
|
remote_run "cd #{application_path} && git reset --hard #{params[:to]}"
|
67
|
+
callback :after_git
|
65
68
|
end
|
66
69
|
|
67
70
|
def local_update
|
@@ -70,13 +73,15 @@ module Inploy
|
|
70
73
|
end
|
71
74
|
|
72
75
|
def update_code
|
73
|
-
|
76
|
+
callback :before_git
|
77
|
+
raise "ERROR: git pull failed with error status = #{$?}" unless run "git pull origin #{branch}"
|
78
|
+
callback :after_git
|
74
79
|
end
|
75
80
|
|
76
81
|
private
|
77
82
|
|
78
83
|
def checkout
|
79
|
-
branch.eql?("master") ? "" : "&&
|
84
|
+
branch.eql?("master") ? "" : "&& git checkout -f -b #{branch} origin/#{branch}"
|
80
85
|
end
|
81
86
|
|
82
87
|
def bundle
|
@@ -90,16 +95,18 @@ module Inploy
|
|
90
95
|
migrate_database
|
91
96
|
update_crontab
|
92
97
|
run "rm -R -f public/assets" if jammit_is_installed?
|
93
|
-
run "RAILS_ENV=#{environment}
|
98
|
+
run "script/delayed_job restart RAILS_ENV=#{environment}" if file_exists?("script/delayed_job")
|
94
99
|
rake_if_included "more:parse"
|
95
100
|
run "compass compile" if file_exists?("config/compass.rb")
|
96
101
|
rake_if_included "barista:brew"
|
97
102
|
rake_if_included "asset:packager:build_all"
|
98
103
|
rake_if_included "hoptoad:deploy RAILS_ENV=#{environment} TO=#{environment} REPO=#{repository} REVISION=#{`git log | head -1 | cut -d ' ' -f 2`}"
|
104
|
+
rake_if_included "assets:precompile"
|
99
105
|
notify_new_relic
|
100
106
|
callback :before_restarting_server
|
101
107
|
restart_server
|
102
108
|
clear_cache
|
109
|
+
callback :after_restarting_server
|
103
110
|
end
|
104
111
|
end
|
105
112
|
end
|
data/lib/inploy/dsl.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
|
1
3
|
module Inploy
|
2
4
|
module DSL
|
3
5
|
module ClassMethods
|
@@ -32,10 +34,6 @@ module Inploy
|
|
32
34
|
extend eval(filename.split("/").map { |word| camelize(word) }.join("::"))
|
33
35
|
end
|
34
36
|
|
35
|
-
def log(command)
|
36
|
-
puts "Inploy => #{command}"
|
37
|
-
end
|
38
|
-
|
39
37
|
def rake(command)
|
40
38
|
run "rake #{command}"
|
41
39
|
end
|
@@ -56,8 +54,15 @@ module Inploy
|
|
56
54
|
file_exists?("Gemfile")
|
57
55
|
end
|
58
56
|
|
57
|
+
def say(message)
|
58
|
+
puts "Inploy => #{message}"
|
59
|
+
output = []
|
60
|
+
yield output if block_given?
|
61
|
+
output.each {|o| puts o if o =~ /\S/ }
|
62
|
+
end
|
63
|
+
|
59
64
|
def run(command, disable_sudo = false)
|
60
|
-
|
65
|
+
say command
|
61
66
|
|
62
67
|
Bundler.with_clean_env do
|
63
68
|
if disable_sudo
|
@@ -81,7 +86,7 @@ module Inploy
|
|
81
86
|
|
82
87
|
def secure_copy(src, dest)
|
83
88
|
unless file_exists?(dest)
|
84
|
-
|
89
|
+
say "cp #{src} #{dest}"
|
85
90
|
FileUtils.cp src, dest
|
86
91
|
end
|
87
92
|
end
|
data/lib/inploy/helper.rb
CHANGED
@@ -41,9 +41,11 @@ module Inploy
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def copy_sample_files
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
unless skip_step?('copy_sample_files')
|
45
|
+
["example", "sample", "template"].each do |extension|
|
46
|
+
Dir.glob("config/*.#{extension}*").each do |file|
|
47
|
+
secure_copy file, file.gsub(".#{extension}", '')
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
@@ -57,7 +59,7 @@ module Inploy
|
|
57
59
|
end
|
58
60
|
|
59
61
|
def bundle_cmd
|
60
|
-
"bundle install
|
62
|
+
"bundle install #{bundler_opts || '--deployment --without development test cucumber'}"
|
61
63
|
end
|
62
64
|
|
63
65
|
def bundle_install
|
metadata
CHANGED
@@ -1,32 +1,24 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: inploy
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.9.6
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 9
|
9
|
-
- 5
|
10
|
-
version: 1.9.5
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Diego Carrion
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-11-18 00:00:00 Z
|
12
|
+
date: 2012-12-07 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
14
|
description:
|
22
15
|
email: dc.rec1@gmail.com
|
23
|
-
executables:
|
16
|
+
executables:
|
24
17
|
- inploy
|
25
18
|
extensions: []
|
26
|
-
|
27
19
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
|
20
|
+
files:
|
21
|
+
- lib/inploy.rb
|
30
22
|
- lib/inploy/cli.rb
|
31
23
|
- lib/inploy/deploy.rb
|
32
24
|
- lib/inploy/dsl.rb
|
@@ -39,46 +31,34 @@ files:
|
|
39
31
|
- lib/inploy/templates/rails3.rb
|
40
32
|
- lib/inploy/templates/rails3_push.rb
|
41
33
|
- lib/inploy/templates/sinatra.rb
|
42
|
-
- lib/inploy.rb
|
43
34
|
- lib/tasks/inploy.rake
|
44
35
|
- bin/inploy
|
45
36
|
- Gemfile
|
46
37
|
- Gemfile.lock
|
47
|
-
- Rakefile
|
48
|
-
- Rakefile.orig
|
49
38
|
- README.textile
|
39
|
+
- Rakefile
|
50
40
|
homepage: http://www.diegocarrion.com
|
51
41
|
licenses: []
|
52
|
-
|
53
42
|
post_install_message:
|
54
43
|
rdoc_options: []
|
55
|
-
|
56
|
-
require_paths:
|
44
|
+
require_paths:
|
57
45
|
- lib
|
58
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
47
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
|
65
|
-
- 0
|
66
|
-
version: "0"
|
67
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ! '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
53
|
none: false
|
69
|
-
requirements:
|
70
|
-
- -
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
segments:
|
74
|
-
- 0
|
75
|
-
version: "0"
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
76
58
|
requirements: []
|
77
|
-
|
78
59
|
rubyforge_project: inploy
|
79
|
-
rubygems_version: 1.8.
|
60
|
+
rubygems_version: 1.8.24
|
80
61
|
signing_key:
|
81
62
|
specification_version: 3
|
82
63
|
summary: Rails and Sinatra deployment made easy
|
83
64
|
test_files: []
|
84
|
-
|
data/Rakefile.orig
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rubygems/specification'
|
3
|
-
require 'rake'
|
4
|
-
require 'rake/gempackagetask'
|
5
|
-
require 'rspec/core/rake_task'
|
6
|
-
|
7
|
-
GEM = "inploy"
|
8
|
-
<<<<<<< HEAD
|
9
|
-
GEM_VERSION = "1.9.3"
|
10
|
-
=======
|
11
|
-
GEM_VERSION = "1.9.2"
|
12
|
-
>>>>>>> bumped to 1.9.2
|
13
|
-
SUMMARY = "Rails and Sinatra deployment made easy"
|
14
|
-
AUTHOR = "Diego Carrion"
|
15
|
-
EMAIL = "dc.rec1@gmail.com"
|
16
|
-
HOMEPAGE = "http://www.diegocarrion.com"
|
17
|
-
|
18
|
-
spec = Gem::Specification.new do |s|
|
19
|
-
s.name = GEM
|
20
|
-
s.version = GEM_VERSION
|
21
|
-
s.platform = Gem::Platform::RUBY
|
22
|
-
s.summary = SUMMARY
|
23
|
-
s.files = FileList['lib/**/*','bin/*', '[A-Z]*'].to_a
|
24
|
-
s.executables << "inploy"
|
25
|
-
|
26
|
-
s.author = AUTHOR
|
27
|
-
s.email = EMAIL
|
28
|
-
s.homepage = HOMEPAGE
|
29
|
-
|
30
|
-
s.rubyforge_project = GEM # GitHub bug, gem isn't being build when this miss
|
31
|
-
end
|
32
|
-
|
33
|
-
RSpec::Core::RakeTask.new :spec do |t|
|
34
|
-
t.rspec_opts = %w(-fp --color)
|
35
|
-
end
|
36
|
-
|
37
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
38
|
-
pkg.gem_spec = spec
|
39
|
-
end
|
40
|
-
|
41
|
-
desc "Install the gem locally"
|
42
|
-
task :install => [:package] do
|
43
|
-
sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
|
44
|
-
end
|
45
|
-
|
46
|
-
desc "Create a gemspec file"
|
47
|
-
task :make_spec do
|
48
|
-
File.open("#{GEM}.gemspec", "w") do |file|
|
49
|
-
file.puts spec.to_ruby
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
desc "Run all examples with RCov"
|
54
|
-
RSpec::Core::RakeTask.new :spec do |t|
|
55
|
-
t.rcov = true
|
56
|
-
t.rcov_opts = ['--no-html', '-T', '--exclude', 'spec']
|
57
|
-
end
|
58
|
-
|
59
|
-
desc "Run specs with all the Ruby versions supported"
|
60
|
-
task :build do
|
61
|
-
system "rvm 1.8.7 specs"
|
62
|
-
system "rvm 1.9.2 specs"
|
63
|
-
end
|