capistrano-exfel 0.0.17 → 0.0.18

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: 95dd80dbaa8df5fc542124be50a2408e313c319f
4
- data.tar.gz: 531b15f2bcd149ddceb9cf9717df87deda34769a
3
+ metadata.gz: 2239cc98b74cd76785e83ceebe56d8de007fd0f1
4
+ data.tar.gz: 3db9e5a1b2423b624d61c36adac4d004bd3e5f26
5
5
  SHA512:
6
- metadata.gz: 213c98a64155ec999365fbd1d68ef918b4706e2d7b97d6f1efdd77f475086767471e35d430bc9d641ff3f4e3770ac7f463fc1a6cbd480912197459d777550be2
7
- data.tar.gz: 9cce640671bc6df2e58d1d08bd8dd318a8318783dfc1d32530a2b07ae63147864fcc9e57d0c9a43220d025c587ba4d423e5a9f19138a98afe621bc1d427a1ff9
6
+ metadata.gz: bf154b2a1f39069b0266340b8501acf59467099ef3abc77b1f8da053a20c4b7f3bca1b059fb32c6287d9977ff7145a5612576e4c9977997e78a31ea366fdbb9a
7
+ data.tar.gz: 72f7d76b5913c3980eddb537cb12d484f0de12d63c67a4d827da592568f6481462786dd821a5bd1e9f05f6465d5e9848be91c40cc02a2dd65e5acb46fad32761
data/README.md CHANGED
@@ -12,15 +12,19 @@ Add these lines to your application's Gemfile:
12
12
  gem 'capistrano', '~> 3.4.0'
13
13
  gem 'capistrano-rails', '~> 1.1.2'
14
14
  gem 'capistrano-rvm', '~> 0.1.2'
15
- gem 'capistrano-exfel', '~> 0.0.17'
15
+ gem 'capistrano-exfel', '~> 0.0.18'
16
16
 
17
- And then execute:
18
17
 
19
- $ bundle
18
+ And then execute:
20
19
 
20
+ ```bash
21
+ $ bundle
22
+ ```
21
23
  Or install it yourself as:
22
24
 
23
- $ gem install capistrano-exfel
25
+ ```bash
26
+ $ gem install capistrano-exfel
27
+ ```
24
28
 
25
29
  ## Usage
26
30
 
@@ -73,42 +77,44 @@ Additional Tasks:
73
77
 
74
78
  The most important configurable options and their defaults:options can be added to the `deploy.rb` file:
75
79
 
76
- # Set username and password
77
- set :username, ask('username', 'maial') # If not specified will ask for it proposing the current user
78
- set :password, ask('password', nil, echo: false) # If not specified will ask for it
80
+ ```ruby
81
+ # Set username and password
82
+ set :username, ask('username', 'maial') # If not specified will ask for it proposing the current user
83
+ set :password, ask('password', nil, echo: false) # If not specified will ask for it
79
84
 
80
- # Application Name
81
- set :app_name, 'my_app_name' # If not specified will ask for it
85
+ # Application Name
86
+ set :app_name, 'my_app_name' # If not specified will ask for it
82
87
 
83
- # Set application related information
84
- # set :app_domain, 'https://domain.com/'
85
- # set :app_name_uri, 'my_app_uri'
88
+ # Set application related information
89
+ # set :app_domain, 'https://domain.com/'
90
+ # set :app_name_uri, 'my_app_uri'
86
91
 
87
- # Set git repository information
88
- set :repo_url, 'exfl_git_server:/my_app_repo_path' # 'git@example.com:me/my_repo.git'
92
+ # Set git repository information
93
+ set :repo_url, 'exfl_git_server:/my_app_repo_path' # 'git@example.com:me/my_repo.git'
89
94
 
90
- # Default branch is :master
91
- # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
95
+ # Default branch is :master
96
+ # ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
92
97
 
93
- # Default value for :format is :pretty
94
- # set :format, :pretty
98
+ # Default value for :format is :pretty
99
+ # set :format, :pretty
95
100
 
96
- # Default value for :log_level is :debug
97
- # set :log_level, :info
101
+ # Default value for :log_level is :debug
102
+ # set :log_level, :info
98
103
 
99
- # Default value for :linked_files is []
100
- # set :linked_files, %w(config/database.yml config/secrets.yml)
104
+ # Default value for :linked_files is []
105
+ # set :linked_files, %w(config/database.yml config/secrets.yml)
101
106
 
102
- # Default value for linked_dirs is []
103
- # set :linked_dirs, %w(bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system)
107
+ # Default value for linked_dirs is []
108
+ # set :linked_dirs, %w(bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system)
104
109
 
105
- # Default value for keep_releases is 5
106
- # set :keep_releases, 5
110
+ # Default value for keep_releases is 5
111
+ # set :keep_releases, 5
107
112
 
108
- # RVM related information
109
- # set :rvm_type, :system
110
- set :rvm_ruby_version, '2.1.5' # If not specified will ask for it
111
- # set :rvm_roles, [:app, :web]
113
+ # RVM related information
114
+ # set :rvm_type, :system
115
+ set :rvm_ruby_version, '2.1.5' # If not specified will ask for it
116
+ # set :rvm_roles, [:app, :web]
117
+ ```
112
118
 
113
119
  As an example, to configure GIT plugin, add the following to the Capfile:
114
120
 
@@ -1,6 +1,6 @@
1
1
  module Capistrano
2
2
  # Capistrano::Exfel version information
3
3
  module Exfel
4
- VERSION = '0.0.17'.freeze
4
+ VERSION = '0.0.18'.freeze
5
5
  end
6
6
  end
@@ -16,7 +16,7 @@ namespace :apache do
16
16
 
17
17
  desc 'Check that we have the right permission to the folder the app should be deployed to'
18
18
  task :check_write_permissions_on_deploy do
19
- on roles(:app) do |host|
19
+ on roles(:app), in: :sequence do |host|
20
20
  debug '#' * 50
21
21
  debug "Checking folder '#{fetch(:deploy_to)}' (where the application has to be deployed) "\
22
22
  "for the right permissions on Host '#{host}'"
@@ -68,6 +68,8 @@ namespace :apache do
68
68
  desc 'Configure Apache to start at bootup'
69
69
  task :chkconfig_on do
70
70
  on roles(:web) do
71
+ info 'In task apache:chkconfig_on'
72
+
71
73
  sudo_cmd = "echo #{fetch(:password)} | sudo -S"
72
74
 
73
75
  debug '#' * 50
@@ -103,7 +105,7 @@ namespace :apache do
103
105
 
104
106
  desc 'Create symbolic link to application public folder in Apache DocumentRoot folder'
105
107
  task :create_symbolic_link do
106
- on roles(:web) do
108
+ on roles(:web), in: :sequence do
107
109
  sudo_cmd = "echo #{fetch(:password)} | sudo -S"
108
110
 
109
111
  info '#' * 50
@@ -1,17 +1,14 @@
1
1
  namespace :apache do
2
2
  desc 'Configure Apache configuration files'
3
3
  task :configure do
4
- on roles(:app) do
5
- sudo_cmd = "echo #{fetch(:password)} | sudo -S"
6
-
7
- set :shared_path, "#{fetch(:deploy_to)}/shared"
8
- set :shared_apache_path, "#{fetch(:shared_path)}/apache"
4
+ sudo_cmd = "echo #{fetch(:password)} | sudo -S"
9
5
 
10
- invoke 'apache:create_apache_shared_folder'
11
- invoke 'apache:configure_apache_modules'
12
- invoke 'apache:configure_app_conf_file'
13
- invoke 'apache:configure_app_ssl_conf_file'
6
+ invoke 'apache:create_apache_shared_folder'
7
+ invoke 'apache:configure_apache_modules'
8
+ invoke 'apache:configure_app_conf_file'
9
+ invoke 'apache:configure_app_ssl_conf_file'
14
10
 
11
+ on roles(:app) do
15
12
  if remote_file_exists?('/etc/httpd/conf.d/ssl.conf')
16
13
  execute "#{sudo_cmd} mv /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf_bck"
17
14
  end
@@ -56,7 +53,7 @@ namespace :apache do
56
53
 
57
54
  # desc 'Configure (HTTP) Apache Application configuration files'
58
55
  task :configure_app_conf_file do
59
- on roles(:app) do
56
+ on roles(:app), in: :sequence do
60
57
  sudo_cmd = "echo #{fetch(:password)} | sudo -S"
61
58
 
62
59
  debug '#' * 50
@@ -83,7 +80,7 @@ namespace :apache do
83
80
 
84
81
  # desc 'Configure (HTTPS) Apache Application configuration files'
85
82
  task :configure_app_ssl_conf_file do
86
- on roles(:app) do
83
+ on roles(:app), in: :sequence do
87
84
  sudo_cmd = "echo #{fetch(:password)} | sudo -S"
88
85
 
89
86
  debug '#' * 50
@@ -1,16 +1,13 @@
1
1
  namespace :apache do
2
2
  desc 'Configure Apache configuration files'
3
3
  task :configure do
4
- on roles(:app) do
5
- sudo_cmd = "echo #{fetch(:password)} | sudo -S"
6
-
7
- set :shared_path, "#{fetch(:deploy_to)}/shared"
8
- set :shared_apache_path, "#{fetch(:shared_path)}/apache"
4
+ sudo_cmd = "echo #{fetch(:password)} | sudo -S"
9
5
 
10
- invoke 'apache:create_apache_shared_folder'
11
- invoke 'apache:configure_app_conf_file'
12
- invoke 'apache:configure_app_ssl_conf_file'
6
+ invoke 'apache:create_apache_shared_folder'
7
+ invoke 'apache:configure_app_conf_file'
8
+ invoke 'apache:configure_app_ssl_conf_file'
13
9
 
10
+ on roles(:app) do
14
11
  if remote_file_exists?('/etc/httpd/conf.d/ssl.conf')
15
12
  execute "#{sudo_cmd} mv /etc/httpd/conf.d/ssl.conf /etc/httpd/conf.d/ssl.conf_bck"
16
13
  end
@@ -19,7 +16,7 @@ namespace :apache do
19
16
 
20
17
  # desc 'Configure (HTTP) Apache Application configuration files'
21
18
  task :configure_app_conf_file do
22
- on roles(:app) do
19
+ on roles(:app), in: :sequence do
23
20
  sudo_cmd = "echo #{fetch(:password)} | sudo -S"
24
21
 
25
22
  debug '#' * 50
@@ -52,7 +49,7 @@ namespace :apache do
52
49
 
53
50
  # desc 'Configure (HTTPS) Apache Application configuration files'
54
51
  task :configure_app_ssl_conf_file do
55
- on roles(:app) do
52
+ on roles(:app), in: :sequence do
56
53
  sudo_cmd = "echo #{fetch(:password)} | sudo -S"
57
54
 
58
55
  debug '#' * 50
@@ -8,7 +8,7 @@ namespace :app_home do
8
8
 
9
9
  desc 'Create application deploy folders on server and give it the correct permissions'
10
10
  task :create_deploy_folder do
11
- on roles(:app) do
11
+ on roles(:app), in: :sequence do
12
12
  sudo_cmd = "echo #{fetch(:password)} | sudo -S"
13
13
 
14
14
  debug '#' * 50
@@ -28,7 +28,7 @@ namespace :app_home do
28
28
 
29
29
  desc 'Create shared folder on server DEPLOY folder and give it the correct permissions'
30
30
  task :create_shared_folder do
31
- on roles(:app) do
31
+ on roles(:app), in: :sequence do
32
32
  sudo_cmd = "echo #{fetch(:password)} | sudo -S"
33
33
 
34
34
  debug '#' * 50
@@ -53,7 +53,7 @@ namespace :app_home do
53
53
 
54
54
  desc 'create revisions.log file on server DEPLOY folder and give it the correct permissions'
55
55
  task :create_revisions_file do
56
- on roles(:app) do
56
+ on roles(:app), in: :sequence do
57
57
  debug '#' * 50
58
58
 
59
59
  set :revisions_log_file_path, "#{fetch(:deploy_to)}/revisions.log"
@@ -70,7 +70,7 @@ namespace :app_home do
70
70
 
71
71
  desc 'Correct shared folder permissions'
72
72
  task :correct_shared_permissions do
73
- on roles(:app), in: :sequence, wait: 5 do
73
+ on roles(:app), in: :sequence do
74
74
  within release_path do
75
75
  sudo_cmd = "echo #{fetch(:password)} | sudo -S"
76
76
 
@@ -133,17 +133,33 @@ namespace :app_home do
133
133
  end
134
134
 
135
135
  task :reload_server_cache do
136
- on roles(:app), in: :sequence, wait: 5 do
136
+ on roles(:app) do |host|
137
137
  debug '#' * 100
138
- debug "wget -v -p --spider #{fetch(:app_domain)}#{fetch(:app_name_uri)}"
139
- execute :wget, "-v -p --spider #{fetch(:app_domain)}#{fetch(:app_name_uri)}"
138
+ debug "wget -v -p --no-check-certificate --spider https://#{host}.desy.de/#{fetch(:app_name_uri)}"
139
+ execute :wget, "-v -p --no-check-certificate --spider https://#{host}.desy.de/#{fetch(:app_name_uri)}"
140
140
  debug 'Application visited successfully...'
141
141
  debug '#' * 100
142
142
  end
143
143
  end
144
144
 
145
+ task :deploy_first_time_start_msg do
146
+ on roles(:msg) do
147
+ info '#' * 100
148
+ info '#' * 10 + ' => Start Application first time deployment...'
149
+ info '#' * 100
150
+ end
151
+ end
152
+
153
+ task :deploy_start_msg do
154
+ on roles(:msg) do
155
+ info '#' * 100
156
+ info '#' * 10 + ' => Start Application re-deployment...'
157
+ info '#' * 100
158
+ end
159
+ end
160
+
145
161
  task :deploy_success_msg do
146
- on roles(:app), in: :sequence, wait: 5 do
162
+ on roles(:msg) do
147
163
  info '#' * 100
148
164
  info '#' * 10 + ' => Application Successfully deployed...'
149
165
  info '#' * 100
@@ -157,7 +173,7 @@ namespace :app_home do
157
173
  # desc 'Restart application'
158
174
  ###
159
175
  task :restart do
160
- on roles(:app), in: :sequence, wait: 5 do
176
+ on roles(:app) do
161
177
  info '#' * 10 + ' Touching restart.txt...'
162
178
  execute :touch, release_path.join('tmp/restart.txt')
163
179
  end
@@ -5,38 +5,28 @@ namespace :application do
5
5
  desc 'Configures Apache and deploys the Application for the first time in the configured server(s) ' \
6
6
  'with the right permissions'
7
7
  task :deploy_first_time do
8
- on roles(:app, :web) do
9
- info '#' * 100
10
- info '#' * 10 + ' => Start Application first time deployment...'
11
- info '#' * 100
12
-
13
- invoke 'app_home:create_all'
14
- invoke 'database:configure_mysql'
15
- invoke 'secrets:configure'
16
- invoke 'apache:configure_and_start'
17
- invoke 'apache:check_write_permissions'
18
- invoke :deploy
19
- invoke 'app_home:correct_shared_permissions'
20
- invoke 'application:restart'
21
- end
8
+ invoke 'app_home:deploy_first_time_start_msg'
9
+ invoke 'app_home:create_all'
10
+ invoke 'database:configure_mysql'
11
+ invoke 'secrets:configure'
12
+ invoke 'apache:configure_and_start'
13
+ invoke 'apache:check_write_permissions'
14
+ invoke :deploy
15
+ invoke 'app_home:correct_shared_permissions'
16
+ invoke 'application:restart'
22
17
  end
23
18
 
24
19
  # Task 'application:deploy' deploys a new version of the application in the configured server(s)
25
20
  desc 'Re-deploys existent Application in the configured server(s)'
26
21
  task :deploy do
27
- on roles(:app, :web) do
28
- info '#' * 100
29
- info '#' * 10 + ' => Start Application re-deployment...'
30
- info '#' * 100
31
-
32
- # This is advisable to kill users cookies after the upgrade.
33
- # The consequence is that users will be logged out automatically from the Application after the upgrade.
34
- # This is important to avoid errors with old validity_token in forms
35
- invoke 'secrets:update_app_secret'
36
- invoke :deploy
37
- invoke 'app_home:correct_shared_permissions'
38
- invoke 'application:restart'
39
- end
22
+ invoke 'app_home:deploy_start_msg'
23
+ # This is advisable to kill users cookies after the upgrade.
24
+ # The consequence is that users will be logged out automatically from the Application after the upgrade.
25
+ # This is important to avoid errors with old validity_token in forms
26
+ invoke 'secrets:update_app_secret'
27
+ invoke :deploy
28
+ invoke 'app_home:correct_shared_permissions'
29
+ invoke 'application:restart'
40
30
  end
41
31
 
42
32
  desc 'Restarts the application, including reloading server cache'
@@ -55,7 +45,7 @@ namespace :application do
55
45
 
56
46
  desc 'Shows variables values generated without deploying anything'
57
47
  task :show_variables do
58
- on roles(:app, :web) do
48
+ on roles(:app, :web), in: :sequence do
59
49
  info '#' * 100
60
50
  info "username => #{fetch(:username)}"
61
51
  info 'password => **********'
@@ -65,6 +55,7 @@ namespace :application do
65
55
  info "default_app_uri => #{fetch(:default_app_uri)}"
66
56
  info "app_name_uri => #{fetch(:app_name_uri)}"
67
57
  info "app_full_url => #{fetch(:app_full_url)}"
58
+ info "secrets_key_base => #{fetch(:secrets_key_base)}"
68
59
  info "deploy_to => #{fetch(:deploy_to)}"
69
60
  info "shared_path => #{fetch(:shared_path)}"
70
61
  info "repo_url => #{fetch(:repo_url)}"
@@ -92,11 +83,11 @@ namespace :load do
92
83
  set :password, -> { ask('password', nil, echo: false) }
93
84
 
94
85
  # Application Name
95
- set :app_name, -> { ask('Please specify the application name (i.e. my_app)', 'my_app') }
86
+ set :app_name, -> { ask('the application name (i.e. my_app)', 'my_app') }
96
87
 
97
88
  # Set application related information
98
89
  set :app_domain, -> do
99
- ask('Please specify the application domain with an "/" at the end (i.e. https://example.com/)',
90
+ ask('application domain with an "/" at the end (i.e. https://example.com/)',
100
91
  'https://example.com/')
101
92
  end
102
93
 
@@ -104,9 +95,11 @@ namespace :load do
104
95
  set :default_app_uri, -> { rails_default_app_name }
105
96
 
106
97
  set :app_name_uri, -> do
107
- ask("Please specify the application URI (i.e. #{fetch(:default_app_uri)})", fetch(:default_app_uri))
98
+ ask("the application URI (i.e. #{fetch(:default_app_uri)})", fetch(:default_app_uri))
108
99
  end
109
100
 
101
+ set :secrets_key_base, -> { ask('application secrets key base', SecureRandom.hex(64)) }
102
+
110
103
  set :app_full_url, -> { "#{fetch(:app_domain)}#{fetch(:app_name_uri)}" }
111
104
 
112
105
  # Default deploy_to directory value is /var/www/
@@ -114,6 +107,7 @@ namespace :load do
114
107
 
115
108
  # Shared folder inside deployment directory
116
109
  set :shared_path, -> { File.join(fetch(:deploy_to), 'shared') }
110
+ set :shared_apache_path, -> { File.join(fetch(:shared_path), 'apache') }
117
111
 
118
112
  # Set git repository information
119
113
  set :repo_url, -> { '' }
@@ -121,6 +115,16 @@ namespace :load do
121
115
  # Default branch is :master
122
116
  ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
123
117
 
118
+ set :default_host, '127.0.0.1'
119
+ set :default_database, -> { rails_default_db_name }
120
+ set :default_username, -> { rails_default_db_name }
121
+ set :default_password, -> { '' }
122
+
123
+ set :database_host, -> { ask('Database host:', fetch(:default_host)) }
124
+ set :database_name, -> { ask('Database Name:', fetch(:default_database)) }
125
+ set :database_username, -> { ask('Database Username:', fetch(:default_username)) }
126
+ set :database_password, -> { ask('Database Password:', fetch(:default_password)) }
127
+
124
128
  # Default value for :format is :pretty
125
129
  set :format, -> { :pretty }
126
130
 
@@ -158,7 +162,7 @@ namespace :load do
158
162
 
159
163
  # RVM related information
160
164
  set :rvm_type, -> { :system }
161
- set :rvm_ruby_version, -> { ask('Please specify the Ruby version (i.e. 2.1.5)', '') }
165
+ set :rvm_ruby_version, -> { ask('the Ruby version (i.e. 2.4.0)', '') }
162
166
  set :rvm_roles, %i(app web)
163
167
  # set :rvm_custom_path, '~/.myveryownrvm' # only needed if not detected
164
168
 
@@ -8,56 +8,38 @@ namespace :database do
8
8
 
9
9
  desc 'Create MySQL specific database.yml in the shared path'
10
10
  task :configure_mysql do
11
- on roles(:app) do
12
- set :database_original_file_name, 'database_mysql.yml'
13
- invoke 'database:configure_database_file'
14
- end
11
+ set :database_original_file_name, 'database_mysql.yml'
12
+ invoke 'database:configure_database_file'
15
13
  end
16
14
 
17
15
  desc 'Create PostgreSQL specific database.yml in the shared path'
18
16
  task :configure_postgresql do
19
- on roles(:app) do
20
- set :database_original_file_name, 'database_postgresql.yml'
21
- invoke 'database:configure_database_file'
22
- end
17
+ set :database_original_file_name, 'database_postgresql.yml'
18
+ invoke 'database:configure_database_file'
23
19
  end
24
20
 
25
21
  desc 'Create SQLite specific database.yml in the shared path'
26
22
  task :configure_sqlite do
27
- on roles(:app) do
28
- set :database_original_file_name, 'database_sqlite.yml'
29
- invoke 'database:configure_database_file'
30
- end
23
+ set :database_original_file_name, 'database_sqlite.yml'
24
+ invoke 'database:configure_database_file'
31
25
  end
32
26
 
33
27
  # desc 'Configure database.yml in the shared path'
34
28
  task :configure_database_file do
35
- on roles(:app) do
36
- set :database_file_path, "#{fetch(:shared_path)}/config/database.yml"
29
+ set :database_file_path, "#{fetch(:shared_path)}/config/database.yml"
37
30
 
38
- invoke 'database:set_permissions_pre_update'
39
- invoke 'database:set_database_file'
40
- invoke 'database:set_permissions_post_update'
41
- end
31
+ invoke 'database:set_permissions_pre_update'
32
+ invoke 'database:set_database_file'
33
+ invoke 'database:set_permissions_post_update'
42
34
  end
43
35
 
44
36
  # desc 'Set (create or replace) database.yml in the shared path'
45
37
  task :set_database_file do
46
- on roles(:app) do
38
+ on roles(:app), in: :sequence do
47
39
  debug '#' * 50
48
40
  debug 'Create and configure database.yml file'
49
41
 
50
- default_host = '127.0.0.1'
51
- default_database = rails_default_db_name
52
- default_username = rails_default_db_name
53
- default_password = ''
54
-
55
42
  set :db_orig_file_path, File.expand_path("../../recipes/config/#{fetch(:database_original_file_name)}", __FILE__)
56
- set :database_host, ask('Database host:', default_host)
57
- set :database_name, ask('Database Name:', default_database)
58
- set :database_username, ask('Database Username:', default_username)
59
- set :database_password, ask('Database Password:', default_password)
60
-
61
43
  upload! StringIO.new(File.read(fetch(:db_orig_file_path).to_s)), fetch(:database_file_path).to_s
62
44
 
63
45
  execute "sed -i 's/<<database_name>>/#{fetch(:database_name)}/g' #{fetch(:database_file_path)}"
@@ -1,30 +1,26 @@
1
1
  namespace :secrets do
2
2
  desc 'Create secrets.yml in shared path'
3
3
  task :configure do
4
- on roles(:app) do
5
- set :secrets_file_path, "#{fetch(:shared_path)}/config/secrets.yml"
4
+ set :secrets_file_path, "#{fetch(:shared_path)}/config/secrets.yml"
6
5
 
7
- invoke 'secrets:set_permissions_pre_update'
8
- invoke 'secrets:set_secrets_file'
9
- invoke 'secrets:replace_token'
10
- invoke 'secrets:set_permissions_post_update'
11
- end
6
+ invoke 'secrets:set_permissions_pre_update'
7
+ invoke 'secrets:set_secrets_file'
8
+ invoke 'secrets:replace_token'
9
+ invoke 'secrets:set_permissions_post_update'
12
10
  end
13
11
 
14
12
  desc 'Update Application secret in file secrets.yml'
15
13
  task :update_app_secret do
16
- on roles(:app) do
17
- set :secrets_file_path, "#{fetch(:shared_path)}/config/secrets.yml"
14
+ set :secrets_file_path, "#{fetch(:shared_path)}/config/secrets.yml"
18
15
 
19
- invoke 'secrets:set_permissions_pre_update'
20
- invoke 'secrets:replace_token'
21
- invoke 'secrets:set_permissions_post_update'
22
- end
16
+ invoke 'secrets:set_permissions_pre_update'
17
+ invoke 'secrets:replace_token'
18
+ invoke 'secrets:set_permissions_post_update'
23
19
  end
24
20
 
25
21
  # desc 'Set (create or replace) secrets.yml in the shared path'
26
22
  task :set_secrets_file do
27
- on roles(:app) do
23
+ on roles(:app), in: :sequence do
28
24
  debug '#' * 50
29
25
  debug 'Create and configure secrets.yml file'
30
26
  secrets_file_path = fetch(:secrets_file_path).to_s
@@ -46,11 +42,11 @@ namespace :secrets do
46
42
 
47
43
  # desc 'Replace the secure secret key in your secrets.yml'
48
44
  task :replace_token do
49
- on roles(:app) do
45
+ on roles(:app), in: :sequence do
50
46
  debug '#' * 50
51
47
 
52
48
  pattern = 'secret_key_base:.*'
53
- new_secret = "secret_key_base: '#{SecureRandom.hex(64)}'"
49
+ new_secret = "secret_key_base: '#{fetch(:secrets_key_base)}'"
54
50
  secrets_file_path = fetch(:secrets_file_path).to_s
55
51
 
56
52
  if remote_file_exists?(secrets_file_path)
@@ -3,7 +3,7 @@ def remote_file_exists?(full_path)
3
3
  end
4
4
 
5
5
  def get_num_occurrences_in_file(file_path, string)
6
- get_command_output("less #{file_path} | grep '#{string}' | wc -l").to_i
6
+ get_command_output("cat #{file_path} | grep '#{string}' | wc -l").to_i
7
7
  end
8
8
 
9
9
  def get_command_output(command)
@@ -16,7 +16,6 @@ def rails_default_app_name
16
16
  end
17
17
 
18
18
  def rails_default_db_name
19
- return fetch(:app_name).to_s if get_rails_env_abbr == 'prod'
20
19
  "#{fetch(:app_name)}_#{get_rails_env_abbr}"
21
20
  end
22
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-exfel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.17
4
+ version: 0.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Maia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-21 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler