capistrano-exfel 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac8d8376221fd414caea1a171e504075556f32cc
4
- data.tar.gz: d9429c9efd767346e59382e5d8148d1f5cbd43a5
3
+ metadata.gz: 7d4b2db13e0647bc4d83d0c8d96a17bcc3f32815
4
+ data.tar.gz: b2623f8c30b472fe140f90b0fe059dbad62c8487
5
5
  SHA512:
6
- metadata.gz: 59c1cfb6de84e62176ad49aa96146da98047248d526238226b107ad4b735571e84f794b78dd2894da66cd1d17418d9269ee60b5b040dee8bf0f9a3ea39ab8d00
7
- data.tar.gz: f46b46e8aaee29436f38bdc6e10052bb4cd4d234ecd9cd14c6febb585265d30c4042f6aee6f86b0e35522f22500c4c1a8f49fb5f512baf2f99009955babf859a
6
+ metadata.gz: 10f1b98400d54c171216746efe087043c32a742416b82634063fff7df10ec50047ed64cb9975fc3289f1ebb8d5ffac36935dc9cb7e63cc39b634db3d8a95a979
7
+ data.tar.gz: 471e7b436d7d2d444056227f0ee01119199fce74991c9b416355ebbba194cf6571342e20c1eee703343649d7ddafd312aa946c6c6c0112873ec280602cba8a7d
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Capistrano::Exfel
2
2
 
3
- Deploys Ruby on Rails 4 Applications in EXFEL VMs using Capistrano3 throw username/password authentication.
3
+ Deploys Ruby on Rails Applications in EXFEL VMs using Capistrano3 throw username/password authentication.
4
4
  The standard EXFEL VMs consist of Scientific Linux 6 with Apache.
5
5
  Installation of Phusion Passenger and RVM are also required to this gem.
6
6
 
@@ -12,7 +12,7 @@ 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.1'
15
+ gem 'capistrano-exfel', '~> 0.0.3'
16
16
 
17
17
  And then execute:
18
18
 
@@ -31,33 +31,44 @@ Add this line to your `Capfile`:
31
31
 
32
32
  This gem will reuse `capistrano-rails` and `capistrano-rvm` tasks to build the following tasks:
33
33
 
34
+ Task **application:deploy_first_time**:
35
+
34
36
  # Task 'application:deploy_first_time' deploys an application for the first time in the configured server(s).
35
37
  # This task besides deploying the application also make all the necessary configurations
36
- # Description: Re-deploys existent Application in the configured server(s):
37
- cap application:deploy
38
-
39
- # Task 'application:deploy' deploys a new version of the application in the configured server(s)
40
38
  # Description: Configures Apache and deploys the Application for the first time in the configured server(s)
41
39
  # with the right permissions:
42
40
  cap application:deploy_first_time
43
41
 
42
+ Task **application:deploy**:
43
+
44
+ # Task 'application:deploy' deploys a new version of the application in the configured server(s)
45
+ # Description: Re-deploys existent Application in the configured server(s):
46
+ cap application:deploy
47
+
48
+ Task **application:restart**:
49
+
44
50
  # Description: 'Restarts the application, including reloading server cache'
45
51
  cap application:restart
46
52
 
53
+ Task **application:reconfigure_apache**:
54
+
47
55
  # Description: 'Re-deploys apache configuration files and restart it'
48
56
  cap application:reconfigure_apache
49
57
 
58
+ Task **application:show_variables**:
59
+
50
60
  # Description: 'Shows variables values generated without deploying anything'
51
61
  cap application:show_variables
52
62
 
53
- #
63
+ Additional Tasks:
64
+
54
65
  # See all the additional available tasks using the command:
55
66
  cap -T
56
67
 
57
68
  The most important configurable options and their defaults:options can be added to the `deploy.rb` file:
58
69
 
59
70
  # Set username and password
60
- set :username, ask('username', 'maial') # If not specified will present current user
71
+ set :username, ask('username', 'maial') # If not specified will ask for it proposing the current user
61
72
  set :password, ask('password', nil, echo: false) # If not specified will ask for it
62
73
 
63
74
  # Application Name
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ['Luis Maia']
10
10
  spec.email = ['luisgoncalo.maia@gmail.com']
11
11
  spec.summary = 'Deploy Ruby on Rails 4 Applications in EXFEL VMs (Scientific Linux using Apache and Passenger)'
12
- spec.description = 'Deployment of Ruby on Rails 4 Applications in EXFEL VMs gem '\
12
+ spec.description = 'Deployment of Ruby on Rails 4 Applications in EXFEL VMs gem ' \
13
13
  '(Scientific Linux + Apache + RVM + Phusion Passenger) using Capistrano3'
14
14
  spec.homepage = ''
15
15
  spec.license = 'MIT'
@@ -1,6 +1,6 @@
1
1
  module Capistrano
2
2
  # Capistrano::Exfel version information
3
3
  module Exfel
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
  end
6
6
  end
File without changes
File without changes
@@ -50,6 +50,8 @@ namespace :apache do
50
50
  desc 'Configure Apache configuration files'
51
51
  task :configure do
52
52
  on roles(:app) do
53
+ sudo_cmd = "echo #{fetch(:password)} | sudo -S"
54
+
53
55
  set :shared_path, "#{fetch(:deploy_to)}/shared"
54
56
  set :shared_apache_path, "#{fetch(:shared_path)}/apache"
55
57
 
@@ -90,8 +92,9 @@ namespace :apache do
90
92
  debug 'Configure (HTTP) Apache Application configuration files'
91
93
 
92
94
  set :shared_apache_conf_file, "#{fetch(:shared_apache_path)}/app_#{fetch(:app_name_uri)}.conf"
95
+ http_file = File.expand_path('../../recipes/apache_http.conf', __FILE__)
96
+ upload! StringIO.new(File.read(http_file)), "#{fetch(:shared_apache_conf_file)}"
93
97
 
94
- upload! StringIO.new(File.read('config/recipes/apache_http.conf')), "#{fetch(:shared_apache_conf_file)}"
95
98
  debug "chmod g+w #{fetch(:shared_apache_conf_file)}"
96
99
  execute "chmod g+w #{fetch(:shared_apache_conf_file)}"
97
100
 
@@ -122,8 +125,9 @@ namespace :apache do
122
125
  debug 'Configure (HTTPS) Apache Application configuration files'
123
126
 
124
127
  set :shared_apache_conf_ssl_file, "#{fetch(:shared_apache_path)}/app_#{fetch(:app_name_uri)}_ssl.conf"
128
+ http_ssl_file = File.expand_path('../../recipes/apache_ssl.conf', __FILE__)
129
+ upload! StringIO.new(File.read(http_ssl_file)), "#{fetch(:shared_apache_conf_ssl_file)}"
125
130
 
126
- upload! StringIO.new(File.read('config/recipes/apache_ssl.conf')), "#{fetch(:shared_apache_conf_ssl_file)}"
127
131
  debug "chmod g+w #{fetch(:shared_apache_conf_ssl_file)}"
128
132
  execute "chmod g+w #{fetch(:shared_apache_conf_ssl_file)}"
129
133
 
@@ -2,8 +2,8 @@
2
2
  namespace :application do
3
3
  # Task 'application:deploy_first_time' deploys an application for the first time in the configured server(s).
4
4
  # This task besides deploying the application also make all the necessary configurations
5
- desc 'Configures Apache and deploys the Application for the first time in the configured server(s) '/
6
- 'with the right permissions'
5
+ desc 'Configures Apache and deploys the Application for the first time in the configured server(s) ' \
6
+ 'with the right permissions'
7
7
  task :deploy_first_time do
8
8
  on roles(:app, :web) do
9
9
  info '#' * 100
@@ -95,23 +95,14 @@ namespace :load do
95
95
  # Application Name
96
96
  set :app_name, -> { ask('Please specify the application name (i.e. my_app)', 'my_app') }
97
97
 
98
- # Build default application URI
99
- set :default_app_uri, -> do
100
- case fetch(:rails_env).to_s
101
- when 'development'
102
- "dev_#{fetch(:app_name)}"
103
- when 'test'
104
- "test_#{fetch(:app_name)}"
105
- else
106
- "#{fetch(:app_name)}"
107
- end
108
- end
109
-
110
98
  # Set application related information
111
99
  set :app_domain, -> do
112
100
  ask('Please specify the application domain (i.e. https://in.xfel.eu/)', 'https://in.xfel.eu/')
113
101
  end
114
102
 
103
+ # Build default application URI
104
+ set :default_app_uri, -> { "#{get_rails_env_abbr}_#{fetch(:app_name)}" }
105
+
115
106
  set :app_name_uri, -> do
116
107
  ask("Please specify the application URI (i.e. #{fetch(:default_app_uri)})", fetch(:default_app_uri))
117
108
  end
@@ -33,7 +33,6 @@ namespace :database do
33
33
  # desc 'Configure database.yml in the shared path'
34
34
  task :configure_database_file do
35
35
  on roles(:app) do
36
- set :database_original_file_path, "config/recipes/config/#{fetch(:database_original_file_name)}"
37
36
  set :database_file_path, "#{fetch(:shared_path)}/config/database.yml"
38
37
 
39
38
  invoke 'database:set_permissions_pre_update'
@@ -49,16 +48,17 @@ namespace :database do
49
48
  debug 'Create and configure database.yml file'
50
49
 
51
50
  default_host = '127.0.0.1'
52
- default_database = "#{fetch(:app_name)}_dev"
53
- default_username = "#{fetch(:app_name)}_dev"
51
+ default_database = "#{fetch(:app_name)}_#{get_rails_env_abbr}"
52
+ default_username = "#{fetch(:app_name)}_#{get_rails_env_abbr}"
54
53
  default_password = ''
55
54
 
55
+ set :db_orig_file_path, File.expand_path("../../recipes/config/#{fetch(:database_original_file_name)}", __FILE__)
56
56
  set :database_host, ask('Database host:', default_host)
57
57
  set :database_name, ask('Database Name:', default_database)
58
58
  set :database_username, ask('Database Username:', default_username)
59
59
  set :database_password, ask('Database Password:', default_password)
60
60
 
61
- upload! StringIO.new(File.read("#{fetch(:database_original_file_path)}")), "#{fetch(:database_file_path)}"
61
+ upload! StringIO.new(File.read("#{fetch(:db_orig_file_path)}")), "#{fetch(:database_file_path)}"
62
62
 
63
63
  execute "sed -i 's/<<database_name>>/#{fetch(:database_name)}/g' #{fetch(:database_file_path)}"
64
64
  execute "sed -i 's/<<database_username>>/#{fetch(:database_username)}/g' #{fetch(:database_file_path)}"
@@ -29,7 +29,7 @@ namespace :secrets do
29
29
  debug 'Create and configure secrets.yml file'
30
30
  secrets_file_path = "#{fetch(:secrets_file_path)}"
31
31
 
32
- set :secrets_original_file_path, 'config/recipes/config/secrets_example.yml'
32
+ set :secrets_original_file_path, File.expand_path('../../recipes/config/secrets_example.yml', __FILE__)
33
33
 
34
34
  unless remote_file_exists?(secrets_file_path)
35
35
  upload! StringIO.new(File.read("#{fetch(:secrets_original_file_path)}")), "#{fetch(:secrets_file_path)}"
@@ -10,6 +10,19 @@ def get_command_output(command)
10
10
  capture("#{command}").strip
11
11
  end
12
12
 
13
+ def get_rails_env_abbr(rails_env_abbr = nil)
14
+ return rails_env_abbr unless rails_env_abbr.nil?
15
+
16
+ case fetch(:rails_env).to_s
17
+ when 'development'
18
+ 'dev'
19
+ when 'test'
20
+ 'test'
21
+ else
22
+ ''
23
+ end
24
+ end
25
+
13
26
  def execute_rake_command(task)
14
27
  within release_path do
15
28
  execute :rake, task, "RAILS_ENV=#{fetch(:environment)}"
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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis Maia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-30 00:00:00.000000000 Z
11
+ date: 2015-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,15 +53,15 @@ files:
53
53
  - README.md
54
54
  - Rakefile
55
55
  - capistrano-exfel.gemspec
56
- - config/recipes/apache_http.conf
57
- - config/recipes/apache_ssl.conf
58
- - config/recipes/config/database_mysql.yml
59
- - config/recipes/config/database_postgresql.yml
60
- - config/recipes/config/database_sqlite.yml
61
- - config/recipes/config/secrets_example.yml
62
56
  - lib/capistrano/exfel.rb
63
57
  - lib/capistrano/exfel/sl6.rb
64
58
  - lib/capistrano/exfel/version.rb
59
+ - lib/capistrano/recipes/apache_http.conf
60
+ - lib/capistrano/recipes/apache_ssl.conf
61
+ - lib/capistrano/recipes/config/database_mysql.yml
62
+ - lib/capistrano/recipes/config/database_postgresql.yml
63
+ - lib/capistrano/recipes/config/database_sqlite.yml
64
+ - lib/capistrano/recipes/config/secrets_example.yml
65
65
  - lib/capistrano/tasks/apache.rake
66
66
  - lib/capistrano/tasks/app_home.rake
67
67
  - lib/capistrano/tasks/application.rake