inploy 1.6.8 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +2 -0
- data/Rakefile +1 -1
- data/lib/inploy/cli.rb +2 -1
- data/lib/inploy/deploy.rb +9 -4
- data/lib/inploy/dsl.rb +5 -1
- data/lib/inploy/helper.rb +6 -2
- data/lib/inploy/templates/rails3_push.rb +1 -1
- data/lib/tasks/inploy.rake +6 -0
- metadata +7 -4
data/README.textile
CHANGED
@@ -116,6 +116,8 @@ branch = 'production' # default master
|
|
116
116
|
sudo = true # default false
|
117
117
|
cache_dirs = ['public/cache', 'tmp/cache'] # default ['public/cache']
|
118
118
|
skip_steps = ['install_gems', 'clear_cache'] # default []
|
119
|
+
app_folder = 'project_folder' # default empty
|
120
|
+
login_shell = true # default false
|
119
121
|
</code></pre>
|
120
122
|
|
121
123
|
h2. SKIP STEPS
|
data/Rakefile
CHANGED
data/lib/inploy/cli.rb
CHANGED
data/lib/inploy/deploy.rb
CHANGED
@@ -3,8 +3,8 @@ module Inploy
|
|
3
3
|
include Helper
|
4
4
|
include DSL
|
5
5
|
|
6
|
-
attr_accessor :repository, :user, :application, :hosts, :path, :ssh_opts, :branch, :environment,
|
7
|
-
:port, :skip_steps, :cache_dirs, :sudo
|
6
|
+
attr_accessor :repository, :user, :application, :hosts, :path, :app_folder, :ssh_opts, :branch, :environment,
|
7
|
+
:port, :skip_steps, :cache_dirs, :sudo, :login_shell
|
8
8
|
|
9
9
|
define_callbacks :after_setup, :before_restarting_server
|
10
10
|
|
@@ -15,6 +15,7 @@ module Inploy
|
|
15
15
|
@environment = 'production'
|
16
16
|
@user = "deploy"
|
17
17
|
@path = "/var/local/apps"
|
18
|
+
@app_folder = nil
|
18
19
|
configure
|
19
20
|
end
|
20
21
|
|
@@ -40,7 +41,7 @@ module Inploy
|
|
40
41
|
end
|
41
42
|
|
42
43
|
def remote_setup
|
43
|
-
remote_run "cd #{path} && #{@sudo}git clone --depth 1 #{repository} #{application} && cd #{
|
44
|
+
remote_run "cd #{path} && #{@sudo}git clone --depth 1 #{repository} #{application} && cd #{application_folder} #{checkout}#{bundle} && #{@sudo}rake inploy:local:setup environment=#{environment}#{skip_steps_cmd}"
|
44
45
|
end
|
45
46
|
|
46
47
|
def local_setup
|
@@ -60,6 +61,10 @@ module Inploy
|
|
60
61
|
remote_run "cd #{application_path} && rake #{task} RAILS_ENV=#{environment}"
|
61
62
|
end
|
62
63
|
|
64
|
+
def remote_reset(params)
|
65
|
+
remote_run "cd #{application_path} && git reset --hard #{params[:to]}"
|
66
|
+
end
|
67
|
+
|
63
68
|
def local_update
|
64
69
|
update_code
|
65
70
|
after_update_code
|
@@ -80,7 +85,7 @@ module Inploy
|
|
80
85
|
end
|
81
86
|
|
82
87
|
def after_update_code
|
83
|
-
run "git submodule update --init"
|
88
|
+
run "cd #{path}/#{application} && git submodule update --init && cd #{path}/#{application}/#{app_folder}"
|
84
89
|
copy_sample_files
|
85
90
|
return unless install_gems
|
86
91
|
migrate_database
|
data/lib/inploy/dsl.rb
CHANGED
@@ -69,10 +69,14 @@ module Inploy
|
|
69
69
|
def remote_run(command)
|
70
70
|
port_opts = port ? "-p #{port} " : ''
|
71
71
|
hosts.each do |host|
|
72
|
-
run "ssh #{ssh_opts} #{port_opts}#{user}@#{host}
|
72
|
+
run "ssh #{ssh_opts} #{port_opts}#{user}@#{host} #{login_shell_wrap(command)}", true
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
def login_shell_wrap(cmd)
|
77
|
+
login_shell ? "\"sh -l -c '#{cmd}'\"" : "'#{cmd}'"
|
78
|
+
end
|
79
|
+
|
76
80
|
def secure_copy(src, dest)
|
77
81
|
unless file_exists?(dest)
|
78
82
|
log "mv #{src} #{dest}"
|
data/lib/inploy/helper.rb
CHANGED
@@ -33,7 +33,11 @@ module Inploy
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def application_path
|
36
|
-
"#{path}/#{application}"
|
36
|
+
app_folder.nil? ? "#{path}/#{application}" : "#{path}/#{application}/#{app_folder}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def application_folder
|
40
|
+
app_folder.nil? ? application : "#{application}/#{app_folder}"
|
37
41
|
end
|
38
42
|
|
39
43
|
def copy_sample_files
|
@@ -53,7 +57,7 @@ module Inploy
|
|
53
57
|
end
|
54
58
|
|
55
59
|
def bundle_cmd
|
56
|
-
"bundle install ~/.bundle --without development test"
|
60
|
+
"bundle install --path ~/.bundle --without development test"
|
57
61
|
end
|
58
62
|
|
59
63
|
def bundle_install
|
data/lib/tasks/inploy.rake
CHANGED
@@ -6,6 +6,7 @@ deploy = Inploy::Deploy.new
|
|
6
6
|
deploy.environment = ENV['environment'] || deploy.environment
|
7
7
|
deploy.skip_steps = ENV['skip_steps'].split(',') unless ENV['skip_steps'].nil?
|
8
8
|
|
9
|
+
|
9
10
|
namespace :inploy do
|
10
11
|
namespace :local do
|
11
12
|
desc "Local Setup"
|
@@ -39,3 +40,8 @@ namespace :inploy do
|
|
39
40
|
desc "Alias to Remote Update"
|
40
41
|
task :up => "remote:update"
|
41
42
|
end
|
43
|
+
|
44
|
+
namespace :in do
|
45
|
+
desc "Alias to Remote Update"
|
46
|
+
task :up => "remote:update"
|
47
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 11
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 1.
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
version: 1.7.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Diego Carrion
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-10-16 23:00:00 -03:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -57,6 +58,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
58
|
requirements:
|
58
59
|
- - ">="
|
59
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
60
62
|
segments:
|
61
63
|
- 0
|
62
64
|
version: "0"
|
@@ -65,6 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
67
|
requirements:
|
66
68
|
- - ">="
|
67
69
|
- !ruby/object:Gem::Version
|
70
|
+
hash: 3
|
68
71
|
segments:
|
69
72
|
- 0
|
70
73
|
version: "0"
|