ors 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ors/command.rb +2 -2
- data/lib/ors/commands/env.rb +3 -4
- data/lib/ors/commands/update.rb +3 -0
- data/lib/ors/config.rb +2 -1
- data/lib/ors/helpers.rb +4 -4
- data/lib/ors/version.rb +1 -1
- data/spec/ors/command_spec.rb +1 -1
- data/spec/ors/commands/update_spec.rb +19 -0
- metadata +5 -3
data/lib/ors/command.rb
CHANGED
@@ -14,7 +14,7 @@ module ORS
|
|
14
14
|
klass = command.to_s.capitalize
|
15
15
|
|
16
16
|
if command =~ /-*version/i
|
17
|
-
|
17
|
+
info "ORS v#{ORS::VERSION}"
|
18
18
|
else
|
19
19
|
if available_commands.include? klass
|
20
20
|
ORS::Config.parse_options options
|
@@ -23,7 +23,7 @@ module ORS
|
|
23
23
|
if ORS::Config.valid_options?
|
24
24
|
Base.run ORS::Commands.const_get(klass)
|
25
25
|
else
|
26
|
-
|
26
|
+
info "ERROR: Invalid options given."
|
27
27
|
Base.run Help
|
28
28
|
end
|
29
29
|
else
|
data/lib/ors/commands/env.rb
CHANGED
@@ -3,12 +3,11 @@ module ORS::Commands
|
|
3
3
|
class Env < Base
|
4
4
|
|
5
5
|
def execute
|
6
|
-
puts "ORS
|
7
|
-
puts "=" * 80
|
6
|
+
puts "ORS v#{ORS::VERSION} configuration:\n\n"
|
8
7
|
|
9
8
|
[:name, :environment, :use_gateway, :pretending, :log_lines, :rails2, :gateway, :deploy_user,
|
10
|
-
:repo, :base_path, :web_servers, :app_servers, :migration_server, :console_server].each do |config_variable|
|
11
|
-
puts "
|
9
|
+
:repo, :base_path, :web_servers, :app_servers, :migration_server, :console_server, :cron_server].each do |config_variable|
|
10
|
+
puts "%20s: %-40s" % [config_variable, ORS::Config.send(config_variable).inspect]
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
data/lib/ors/commands/update.rb
CHANGED
@@ -7,6 +7,9 @@ module ORS::Commands
|
|
7
7
|
|
8
8
|
execute_in_parallel(all_servers) {|server| update_code server }
|
9
9
|
execute_in_parallel(ruby_servers) {|server| bundle_install server }
|
10
|
+
|
11
|
+
execute_command cron_server, %(cd #{base_path}),
|
12
|
+
%(if [ -f config/schedule.rb ]; then bundle exec whenever; fi)
|
10
13
|
end
|
11
14
|
|
12
15
|
end
|
data/lib/ors/config.rb
CHANGED
@@ -4,7 +4,7 @@ module ORS
|
|
4
4
|
CONFIG_FILENAME="config/deploy.yml"
|
5
5
|
|
6
6
|
mattr_accessor :name, :environment, :use_gateway, :pretending, :log_lines, :rails2
|
7
|
-
mattr_accessor :gateway, :deploy_user, :repo, :base_path, :web_servers, :app_servers, :migration_server, :console_server
|
7
|
+
mattr_accessor :gateway, :deploy_user, :repo, :base_path, :web_servers, :app_servers, :migration_server, :console_server, :cron_server
|
8
8
|
|
9
9
|
self.environment = "production"
|
10
10
|
self.pretending = false
|
@@ -37,6 +37,7 @@ module ORS
|
|
37
37
|
self.app_servers = %w(eel jellyfish squid)
|
38
38
|
self.migration_server = "tuna"
|
39
39
|
self.console_server = "tuna"
|
40
|
+
self.cron_server = "tuna"
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
data/lib/ors/helpers.rb
CHANGED
@@ -7,10 +7,10 @@ module ORS
|
|
7
7
|
info "[#{server}] installing codebase..."
|
8
8
|
|
9
9
|
execute_command server, %(cd #{base_path}),
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
%(rm -rf #{deploy_directory}),
|
11
|
+
%(git clone #{repo}:#{name} #{deploy_directory}),
|
12
|
+
%(mkdir -p #{deploy_directory}/tmp/pids),
|
13
|
+
%(mkdir -p #{deploy_directory}/log)
|
14
14
|
end
|
15
15
|
|
16
16
|
def setup_ruby server
|
data/lib/ors/version.rb
CHANGED
data/spec/ors/command_spec.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe ORS::Commands::Update do
|
4
|
+
|
5
|
+
context "#run" do
|
6
|
+
it "should update code, bundle install, and set up cron" do
|
7
|
+
stub(subject).all_servers { :all_servers }
|
8
|
+
stub(subject).ruby_servers { :ruby_servers }
|
9
|
+
stub(subject).cron_server { :cron_server }
|
10
|
+
|
11
|
+
mock(subject).info /updating/
|
12
|
+
mock(subject).execute_in_parallel(:all_servers)
|
13
|
+
mock(subject).execute_in_parallel(:ruby_servers)
|
14
|
+
mock(subject).execute_command(:cron_server, is_a(String), is_a(String))
|
15
|
+
|
16
|
+
subject.execute
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jason Dew and John Long
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- spec/ors/commands/deploy_spec.rb
|
105
105
|
- spec/ors/commands/help_spec.rb
|
106
106
|
- spec/ors/commands/logs_spec.rb
|
107
|
+
- spec/ors/commands/update_spec.rb
|
107
108
|
- spec/ors/config_spec.rb
|
108
109
|
- spec/ors/helpers_spec.rb
|
109
110
|
- spec/ors/log_unifier_spec.rb
|
@@ -149,6 +150,7 @@ test_files:
|
|
149
150
|
- spec/ors/commands/deploy_spec.rb
|
150
151
|
- spec/ors/commands/help_spec.rb
|
151
152
|
- spec/ors/commands/logs_spec.rb
|
153
|
+
- spec/ors/commands/update_spec.rb
|
152
154
|
- spec/ors/config_spec.rb
|
153
155
|
- spec/ors/helpers_spec.rb
|
154
156
|
- spec/ors/log_unifier_spec.rb
|