escualo 0.4.1 → 0.5.0

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: 385c0ddef83465ce3be3b5aaae2c5306982de886
4
- data.tar.gz: 7cb43a1d0008547536eddca4c6881b4048b5adff
3
+ metadata.gz: 3827d539f18c31abf1aaec81a89e06a42a70a58a
4
+ data.tar.gz: 02efc2c36af8bcffe6fc5be8400398c69daf0548
5
5
  SHA512:
6
- metadata.gz: 3c904315d18c412774d419d8222ff3636b22c8ba08325c40845ac3d63be9586820e98cf0c4e774087a657e48cdd4c0055f3b1bf3294394638be7e19714f0d058
7
- data.tar.gz: c44dae46ec6a3b99ba10167456ac528a72998c54a6cf8dbbbd5b7a25270cc4d9889e0059134f194431e626e968c5db437c46972f2e85f3985c0de5f5891e8d6b
6
+ metadata.gz: 6feadff99ff05b7df68ef80a2f243ec03aed1421faae87075fef2dda457297c9b4195fbfb3b6eef2eec57c1a87d53904436179a045855688e08b234458c3d648
7
+ data.tar.gz: 0ec8e3e187abeaa19e6707f3e2c5bfb7145d1813d0e737b6e88b09e654ff1fb7f2b6c59b1784d1f258d55b7fdf508111a7ac2ba1b742453b68e723e2d6391b79
@@ -1,3 +1,8 @@
1
+ def ask_monit_password(options)
2
+ password = ask('Monit Password: ') { |q| q.echo = '*' }
3
+ options.default monit_password: password
4
+ end
5
+
1
6
  command 'bootstrap' do |c|
2
7
  c.syntax = 'escualo bootstrap'
3
8
  c.description = 'Prepare environment to be an escualo host'
@@ -5,23 +10,22 @@ command 'bootstrap' do |c|
5
10
  c.option '--monit-version VERSION', String, 'Monit version'
6
11
  c.option '--monit-password PASSWORD', String, 'Monit password. Will be prompted otherwise'
7
12
  c.option '--no-monit', TrueClass, 'Skip monit installation'
13
+ c.option '--env', String, 'Environment. Valid options are development and production. default is production'
8
14
  c.option '--with-rbenv', TrueClass, 'Use rbenv instead of native ruby installation'
9
15
 
10
16
  c.option '-f', '--force', TrueClass, 'Force bootstrap even if already done?'
11
17
 
12
18
  c.ssh_action do |_args, options, ssh|
13
- unless options.monit_password
14
- password = ask('Monit Password: ') { |q| q.echo = '*' }
15
- options.default monit_password: password
16
- end
17
- options.default monit_version: '5.16'
19
+ ask_monit_password(options) unless options.monit_password || options.no_monit
20
+ options.default monit_version: '5.16',
21
+ environment: 'production'
18
22
 
19
23
  do_unless Escualo::Env.present?(ssh, :ESCUALO_BASE_VERSION),
20
24
  'This host has already been bootstrapped',
21
25
  options do
22
26
  step 'Configuring variables...' do
23
27
  Escualo::Env.setup ssh
24
- Escualo::Env.set_builtins ssh
28
+ Escualo::Env.set_builtins ssh, options
25
29
  end
26
30
 
27
31
  step 'Installing base software...' do
data/lib/commands/env.rb CHANGED
@@ -31,6 +31,6 @@ command 'env clean' do |c|
31
31
  c.syntax = 'escualo env clean'
32
32
  c.description = 'Unset all escualo variables on host'
33
33
  c.ssh_action do |args, options, ssh|
34
- Escualo::Env.clean ssh
34
+ Escualo::Env.clean ssh, options
35
35
  end
36
36
  end
@@ -67,7 +67,7 @@ module Escualo
67
67
  end
68
68
 
69
69
  def self.install_gems(ssh, options)
70
- ssh.perform! 'gem install bundler && gem install escualo', options
70
+ ssh.shell.perform! 'gem install bundler && gem install escualo', options
71
71
  end
72
72
  end
73
73
  end
data/lib/escualo/env.rb CHANGED
@@ -10,19 +10,19 @@ module Escualo
10
10
  }
11
11
  end
12
12
 
13
- def self.set_builtins(ssh)
13
+ def self.set_builtins(ssh, options)
14
14
  set ssh, ESCUALO_BASE_VERSION: Escualo::BASE_VERSION
15
15
  set ssh, Escualo::Env.locale_variables
16
- set ssh, Escualo::Env.production_variables
16
+ set ssh, Escualo::Env.environment_variables(options.environment)
17
17
  end
18
18
 
19
19
  def self.list(ssh)
20
20
  ssh.exec!("cat ~/.escualo/vars/*").gsub("export ", '')
21
21
  end
22
22
 
23
- def self.clean(ssh)
23
+ def self.clean(ssh, options)
24
24
  ssh.exec!("rm ~/.escualo/vars/*")
25
- set_builtins ssh
25
+ set_builtins ssh, options
26
26
  end
27
27
 
28
28
  def self.present?(ssh, variable)
@@ -52,9 +52,9 @@ module Escualo
52
52
  end.to_h
53
53
  end
54
54
 
55
- def self.production_variables
55
+ def self.environment_variables(environment)
56
56
  %w{RAILS_ENV NODE_ENV RACK_ENV}.map do |it|
57
- [it, 'production']
57
+ [it, environment]
58
58
  end.to_h
59
59
  end
60
60
 
@@ -1,4 +1,4 @@
1
1
  module Escualo
2
- VERSION = '0.4.1'
2
+ VERSION = '0.5.0'
3
3
  BASE_VERSION = '3.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escualo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli