capistrano-base_helper 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/capistrano-base_helper.gemspec +1 -1
- data/lib/capistrano/base_helper/base_helper.rb +16 -12
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.10
|
@@ -5,9 +5,9 @@ Capistrano::Configuration.instance(true).load do
|
|
5
5
|
desc "[internal] set the capistrano instance in Capistrano::BaseHelper module"
|
6
6
|
task :set_capistrano_instance do
|
7
7
|
Capistrano::BaseHelper::set_capistrano_instance(self)
|
8
|
-
end
|
8
|
+
end
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
on :start, "base_helper:set_capistrano_instance"
|
12
12
|
end
|
13
13
|
|
@@ -32,23 +32,27 @@ module Capistrano
|
|
32
32
|
"#{@@capistrano_instance.fetch(:user)[0...1]}_#{environment[0...1]}_#{@@capistrano_instance.fetch(:application)}"
|
33
33
|
end
|
34
34
|
|
35
|
+
def user_app_env_underscore_short_char_safe
|
36
|
+
user_app_env_underscore_short.gsub!("-","_")
|
37
|
+
end
|
38
|
+
|
35
39
|
def user_app_env_path
|
36
40
|
File.join(get_capistrano_instance.fetch(:user), "#{get_capistrano_instance.fetch(:application)}_#{environment}")
|
37
41
|
end
|
38
42
|
|
39
|
-
##
|
43
|
+
##
|
40
44
|
# Automatically sets the environment based on presence of
|
41
45
|
# :stage (multistage)
|
42
|
-
# :rails_env
|
43
|
-
# RAILS_ENV variable;
|
44
|
-
#
|
46
|
+
# :rails_env
|
47
|
+
# RAILS_ENV variable;
|
48
|
+
#
|
45
49
|
# Defaults to "production" if not found
|
46
50
|
#
|
47
51
|
def environment
|
48
52
|
if @@capistrano_instance.exists?(:rails_env)
|
49
53
|
@@capistrano_instance.fetch(:rails_env)
|
50
54
|
elsif @@capistrano_instance.exists?(:rack_env)
|
51
|
-
@@capistrano_instance.fetch(:rack_env)
|
55
|
+
@@capistrano_instance.fetch(:rack_env)
|
52
56
|
elsif @@capistrano_instance.exists?(:stage)
|
53
57
|
@@capistrano_instance.fetch(:stage)
|
54
58
|
elsif(ENV['RAILS_ENV'])
|
@@ -79,15 +83,15 @@ module Capistrano
|
|
79
83
|
Capistrano::CLI.ui.agree(message)
|
80
84
|
end
|
81
85
|
|
82
|
-
##
|
86
|
+
##
|
83
87
|
# Generate a config file by parsing an ERB template and uploading the file
|
84
88
|
# Fetches local file and uploads it to remote_file
|
85
89
|
# Make sure your user has the right permissions.
|
86
|
-
#
|
90
|
+
#
|
87
91
|
# @local_file full path to local file
|
88
92
|
# @remote_file full path to remote file
|
89
93
|
# @use_sudo use sudo or not...
|
90
|
-
#
|
94
|
+
#
|
91
95
|
def generate_and_upload_config(local_file, remote_file, use_sudo=false)
|
92
96
|
temp_file = '/tmp/' + File.basename(local_file)
|
93
97
|
erb_buffer = Capistrano::BaseHelper::parse_config(local_file)
|
@@ -120,7 +124,7 @@ module Capistrano
|
|
120
124
|
def prepare_path(path, user, group, use_sudo = false)
|
121
125
|
commands = []
|
122
126
|
commands << "#{use_sudo ? @@capistrano_instance.sudo : ""} mkdir -p #{path}"
|
123
|
-
commands << "#{use_sudo ? @@capistrano_instance.sudo : ""} chown #{user}:#{group} #{path} -R"
|
127
|
+
commands << "#{use_sudo ? @@capistrano_instance.sudo : ""} chown #{user}:#{group} #{path} -R"
|
124
128
|
commands << "#{use_sudo ? @@capistrano_instance.sudo : ""} chmod +rw #{path}"
|
125
129
|
@@capistrano_instance.run commands.join(" &&")
|
126
130
|
end
|
@@ -137,6 +141,6 @@ module Capistrano
|
|
137
141
|
|
138
142
|
results == [true]
|
139
143
|
end
|
140
|
-
|
144
|
+
|
141
145
|
end
|
142
146
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-base_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
segments:
|
101
101
|
- 0
|
102
|
-
hash:
|
102
|
+
hash: 1097852219184187389
|
103
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
104
|
none: false
|
105
105
|
requirements:
|