ors 0.2.10 → 0.3.0
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.
- data/README.markdown +71 -0
- data/bin/ors +1 -1
- data/lib/ors.rb +21 -2
- data/lib/ors/base.rb +30 -0
- data/lib/ors/commands/base.rb +56 -12
- data/lib/ors/commands/changes.rb +21 -7
- data/lib/ors/commands/console.rb +16 -18
- data/lib/ors/commands/deploy.rb +24 -13
- data/lib/ors/commands/env.rb +9 -9
- data/lib/ors/commands/exec.rb +14 -7
- data/lib/ors/commands/help.rb +9 -11
- data/lib/ors/commands/logs.rb +16 -14
- data/lib/ors/commands/migrate.rb +8 -9
- data/lib/ors/commands/restart.rb +9 -11
- data/lib/ors/commands/ruby.rb +8 -6
- data/lib/ors/commands/runner.rb +29 -25
- data/lib/ors/commands/setup.rb +16 -16
- data/lib/ors/commands/start.rb +9 -11
- data/lib/ors/commands/stop.rb +9 -11
- data/lib/ors/commands/symlink.rb +31 -0
- data/lib/ors/commands/timestamps.rb +27 -0
- data/lib/ors/commands/update.rb +15 -11
- data/lib/ors/config.rb +88 -58
- data/lib/ors/helpers.rb +107 -76
- data/lib/ors/log_unifier.rb +2 -2
- data/lib/ors/version.rb +2 -2
- data/spec/ors/{command_spec.rb → base_spec.rb} +11 -8
- data/spec/ors/commands/base_spec.rb +17 -9
- data/spec/ors/commands/deploy_spec.rb +4 -3
- data/spec/ors/commands/runner_spec.rb +8 -27
- data/spec/ors/commands/timestamps_spec.rb +16 -0
- data/spec/ors/commands/update_spec.rb +8 -3
- data/spec/ors/config_spec.rb +56 -61
- data/spec/ors/helpers_spec.rb +6 -2
- data/spec/ors/log_unifier_spec.rb +2 -2
- metadata +82 -57
- data/README +0 -52
- data/lib/ors/command.rb +0 -46
- data/lib/ors/commands/check.rb +0 -27
- data/lib/ors/commands/sync.rb +0 -27
- data/lib/ors/core_ext.rb +0 -53
- data/spec/ors/commands/check_spec.rb +0 -15
data/spec/ors/helpers_spec.rb
CHANGED
@@ -43,7 +43,9 @@ describe ORS::Helpers do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
context "with gateway" do
|
46
|
-
before
|
46
|
+
before do
|
47
|
+
ORS.config[:use_gateway] = true
|
48
|
+
end
|
47
49
|
|
48
50
|
it "should build the command" do
|
49
51
|
subject.build_command("server", %(cd /tmp)).should == %(ssh deploy-gateway 'ssh deployer@server "cd /tmp"')
|
@@ -59,7 +61,9 @@ describe ORS::Helpers do
|
|
59
61
|
end
|
60
62
|
|
61
63
|
context "without gateway" do
|
62
|
-
before
|
64
|
+
before do
|
65
|
+
ORS.config[:use_gateway] = false
|
66
|
+
end
|
63
67
|
|
64
68
|
it "should build the command" do
|
65
69
|
subject.build_command("server", %(cd /tmp)).should == %(ssh deployer@server "cd /tmp")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
|
3
|
+
class ORS
|
4
4
|
describe LogUnifier do
|
5
5
|
|
6
6
|
context "#unify" do
|
@@ -81,7 +81,7 @@ Completed 200 OK in 41ms (Views: 3.6ms | ActiveRecord: 31.6ms)
|
|
81
81
|
[server2] Started GET "/" for 10.203.228.96 at 2011-02-02 08:52:33 -0500
|
82
82
|
[server2] Processing by ReviewsController#index as HTML
|
83
83
|
[server2] Completed 200 OK in 41ms (Views: 3.6ms | ActiveRecord: 31.6ms)
|
84
|
-
[server2]
|
84
|
+
[server2]
|
85
85
|
[server2] ERROR: WTFOMGBBQ is on fire!!! /!\\ /!\\
|
86
86
|
|
87
87
|
|
metadata
CHANGED
@@ -1,70 +1,86 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ors
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Jason Dew and John Long
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
17
|
+
|
18
|
+
date: 2012-05-20 00:00:00 -04:00
|
13
19
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
16
22
|
name: git
|
17
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
25
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
23
33
|
type: :runtime
|
24
|
-
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Dependency
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
27
36
|
name: rspec
|
28
|
-
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
39
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
version: "0"
|
34
47
|
type: :development
|
35
|
-
|
36
|
-
|
37
|
-
- !ruby/object:Gem::Dependency
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
38
50
|
name: rr
|
39
|
-
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
40
53
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
45
61
|
type: :development
|
46
|
-
|
47
|
-
version_requirements: *2160301080
|
62
|
+
version_requirements: *id003
|
48
63
|
description: Heroku-like deployment utilities for ORS
|
49
|
-
email:
|
64
|
+
email:
|
50
65
|
- jason.dew@ors.sc.gov and john.long@ors.sc.gov
|
51
|
-
executables:
|
66
|
+
executables:
|
52
67
|
- ors
|
53
68
|
extensions: []
|
69
|
+
|
54
70
|
extra_rdoc_files: []
|
55
|
-
|
71
|
+
|
72
|
+
files:
|
56
73
|
- .autotest
|
57
74
|
- .gitignore
|
58
75
|
- .rspec
|
59
76
|
- Gemfile
|
60
|
-
- README
|
77
|
+
- README.markdown
|
61
78
|
- Rakefile
|
62
79
|
- bin/ors
|
63
80
|
- lib/ors.rb
|
64
|
-
- lib/ors/
|
81
|
+
- lib/ors/base.rb
|
65
82
|
- lib/ors/commands/base.rb
|
66
83
|
- lib/ors/commands/changes.rb
|
67
|
-
- lib/ors/commands/check.rb
|
68
84
|
- lib/ors/commands/console.rb
|
69
85
|
- lib/ors/commands/deploy.rb
|
70
86
|
- lib/ors/commands/env.rb
|
@@ -78,61 +94,70 @@ files:
|
|
78
94
|
- lib/ors/commands/setup.rb
|
79
95
|
- lib/ors/commands/start.rb
|
80
96
|
- lib/ors/commands/stop.rb
|
81
|
-
- lib/ors/commands/
|
97
|
+
- lib/ors/commands/symlink.rb
|
98
|
+
- lib/ors/commands/timestamps.rb
|
82
99
|
- lib/ors/commands/update.rb
|
83
100
|
- lib/ors/config.rb
|
84
|
-
- lib/ors/core_ext.rb
|
85
101
|
- lib/ors/helpers.rb
|
86
102
|
- lib/ors/log_unifier.rb
|
87
103
|
- lib/ors/version.rb
|
88
104
|
- ors.gemspec
|
89
|
-
- spec/ors/
|
105
|
+
- spec/ors/base_spec.rb
|
90
106
|
- spec/ors/commands/base_spec.rb
|
91
|
-
- spec/ors/commands/check_spec.rb
|
92
107
|
- spec/ors/commands/console_spec.rb
|
93
108
|
- spec/ors/commands/deploy_spec.rb
|
94
109
|
- spec/ors/commands/help_spec.rb
|
95
110
|
- spec/ors/commands/logs_spec.rb
|
96
111
|
- spec/ors/commands/runner_spec.rb
|
112
|
+
- spec/ors/commands/timestamps_spec.rb
|
97
113
|
- spec/ors/commands/update_spec.rb
|
98
114
|
- spec/ors/config_spec.rb
|
99
115
|
- spec/ors/helpers_spec.rb
|
100
116
|
- spec/ors/log_unifier_spec.rb
|
101
117
|
- spec/spec_helper.rb
|
102
118
|
has_rdoc: true
|
103
|
-
homepage:
|
119
|
+
homepage: ""
|
104
120
|
licenses: []
|
121
|
+
|
105
122
|
post_install_message:
|
106
123
|
rdoc_options: []
|
107
|
-
|
124
|
+
|
125
|
+
require_paths:
|
108
126
|
- lib
|
109
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
128
|
none: false
|
111
|
-
requirements:
|
112
|
-
- -
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
hash: 3
|
133
|
+
segments:
|
134
|
+
- 0
|
135
|
+
version: "0"
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
137
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
hash: 3
|
142
|
+
segments:
|
143
|
+
- 0
|
144
|
+
version: "0"
|
121
145
|
requirements: []
|
146
|
+
|
122
147
|
rubyforge_project: ors
|
123
|
-
rubygems_version: 1.
|
148
|
+
rubygems_version: 1.3.7
|
124
149
|
signing_key:
|
125
150
|
specification_version: 3
|
126
151
|
summary: Heroku-like deployment utilities for ORS
|
127
|
-
test_files:
|
128
|
-
- spec/ors/
|
152
|
+
test_files:
|
153
|
+
- spec/ors/base_spec.rb
|
129
154
|
- spec/ors/commands/base_spec.rb
|
130
|
-
- spec/ors/commands/check_spec.rb
|
131
155
|
- spec/ors/commands/console_spec.rb
|
132
156
|
- spec/ors/commands/deploy_spec.rb
|
133
157
|
- spec/ors/commands/help_spec.rb
|
134
158
|
- spec/ors/commands/logs_spec.rb
|
135
159
|
- spec/ors/commands/runner_spec.rb
|
160
|
+
- spec/ors/commands/timestamps_spec.rb
|
136
161
|
- spec/ors/commands/update_spec.rb
|
137
162
|
- spec/ors/config_spec.rb
|
138
163
|
- spec/ors/helpers_spec.rb
|
data/README
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
== Set Up
|
2
|
-
|
3
|
-
* Set up repo on eden
|
4
|
-
|
5
|
-
|
6
|
-
Required Files:
|
7
|
-
* .rvmrc
|
8
|
-
* Gemfile
|
9
|
-
* Gemfile.lock
|
10
|
-
* config/database.yml
|
11
|
-
* .git/config
|
12
|
-
* config/unicorn.rb
|
13
|
-
|
14
|
-
=== Setting Up GitConfig
|
15
|
-
|
16
|
-
[remote "production"]
|
17
|
-
url = git@eden:ors/deployment.git
|
18
|
-
push = refs/heads/master:refs/heads/production
|
19
|
-
|
20
|
-
>> git push production # updates remote production branch without local branch
|
21
|
-
|
22
|
-
|
23
|
-
=== Setting up RVM
|
24
|
-
|
25
|
-
On your ruby servers you should create a .rvmrc in the home directory of the user running unicorn.
|
26
|
-
|
27
|
-
rvm_install_on_use_flag=1
|
28
|
-
rvm_gemset_create_on_use_flag=1
|
29
|
-
rvm_trust_rvmrcs_flag=1
|
30
|
-
|
31
|
-
|
32
|
-
=== Required gems
|
33
|
-
|
34
|
-
* rake
|
35
|
-
* bundler
|
36
|
-
|
37
|
-
|
38
|
-
Gemfile
|
39
|
-
|
40
|
-
group :production, :demo do
|
41
|
-
gem 'unicorn'
|
42
|
-
gem 'mysql2'
|
43
|
-
gem 'dalli'
|
44
|
-
gem 'exception_notification', :git => "git://github.com/rails/exception_notification", :branch => "master", :require => "exception_notifier"
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
=== Usage
|
50
|
-
|
51
|
-
run `ors help`
|
52
|
-
|
data/lib/ors/command.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require "ors/commands/base"
|
2
|
-
Dir[File.join File.dirname(__FILE__), "commands", "*.rb"].each { |c| require c }
|
3
|
-
|
4
|
-
module ORS
|
5
|
-
|
6
|
-
class Command
|
7
|
-
|
8
|
-
module ClassMethods
|
9
|
-
|
10
|
-
include ORS::Commands
|
11
|
-
|
12
|
-
def run args
|
13
|
-
command, *options = args
|
14
|
-
klass = command.to_s.capitalize
|
15
|
-
|
16
|
-
if command =~ /-*version/i
|
17
|
-
puts "ORS v#{ORS::VERSION}"
|
18
|
-
else
|
19
|
-
if available_commands.include? klass
|
20
|
-
ORS::Config.parse_options options
|
21
|
-
ORS::Config.parse_config_file
|
22
|
-
|
23
|
-
if ORS::Config.valid_options?
|
24
|
-
Base.run ORS::Commands.const_get(klass)
|
25
|
-
else
|
26
|
-
info "ERROR: Invalid options given."
|
27
|
-
Base.run Help
|
28
|
-
end
|
29
|
-
else
|
30
|
-
Base.run Help
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
def available_commands
|
38
|
-
ORS::Commands.constants.map {|klass| klass.to_s }
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
extend ClassMethods
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
data/lib/ors/commands/check.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
module ORS::Commands
|
2
|
-
class Check < Base
|
3
|
-
def execute
|
4
|
-
timestamps = app_servers.map do |server|
|
5
|
-
[
|
6
|
-
"[#{server}] ",
|
7
|
-
execute_command(server, prepare_environment, %(cat restart.timestamp), :capture => true)
|
8
|
-
].join
|
9
|
-
end.join("\n")
|
10
|
-
|
11
|
-
puts timestamps unless pretending
|
12
|
-
end
|
13
|
-
|
14
|
-
def help
|
15
|
-
puts <<-END
|
16
|
-
Usage: ./ors check [environment=production] [options]
|
17
|
-
|
18
|
-
=== Description
|
19
|
-
Prints out contents of restart.timestamp on the app servers
|
20
|
-
|
21
|
-
=== Options
|
22
|
-
--pretend (or -p) Don't execute anything, just show me what you're going to do
|
23
|
-
--no-gateway (or -ng) Don't use a gateway (if you're inside the firewall)
|
24
|
-
END
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/lib/ors/commands/sync.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
module ORS::Commands
|
2
|
-
|
3
|
-
class Sync < Base
|
4
|
-
|
5
|
-
def execute
|
6
|
-
if options.first == '--all'
|
7
|
-
environments = ORS::Config.valid_environments
|
8
|
-
else
|
9
|
-
environments = [environment]
|
10
|
-
end
|
11
|
-
|
12
|
-
environments.each do |environment|
|
13
|
-
unless ORS::Config.git.branches[environment].nil?
|
14
|
-
info "Syncing environment/branch #{environment}..."
|
15
|
-
execute_command :localhost, %(git checkout master),
|
16
|
-
%(git checkout #{environment}),
|
17
|
-
%(git pull),
|
18
|
-
%(git rebase master),
|
19
|
-
%(git push),
|
20
|
-
%(git checkout master)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
data/lib/ors/core_ext.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# copied from activesupport
|
2
|
-
class Module
|
3
|
-
def mattr_reader(*syms)
|
4
|
-
syms.each do |sym|
|
5
|
-
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
6
|
-
@@#{sym} = nil unless defined? @@#{sym}
|
7
|
-
|
8
|
-
def self.#{sym}
|
9
|
-
@@#{sym}
|
10
|
-
end
|
11
|
-
EOS
|
12
|
-
|
13
|
-
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
14
|
-
def #{sym}
|
15
|
-
@@#{sym}
|
16
|
-
end
|
17
|
-
EOS
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def mattr_writer(*syms)
|
22
|
-
syms.each do |sym|
|
23
|
-
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
24
|
-
def self.#{sym}=(obj)
|
25
|
-
@@#{sym} = obj
|
26
|
-
end
|
27
|
-
EOS
|
28
|
-
|
29
|
-
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
30
|
-
def #{sym}=(obj)
|
31
|
-
@@#{sym} = obj
|
32
|
-
end
|
33
|
-
EOS
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# Extends the module object with module and instance accessors for class attributes,
|
38
|
-
# just like the native attr* accessors for instance attributes.
|
39
|
-
#
|
40
|
-
# module AppConfiguration
|
41
|
-
# mattr_accessor :google_api_key
|
42
|
-
# self.google_api_key = "123456789"
|
43
|
-
#
|
44
|
-
# mattr_accessor :paypal_url
|
45
|
-
# self.paypal_url = "www.sandbox.paypal.com"
|
46
|
-
# end
|
47
|
-
#
|
48
|
-
# AppConfiguration.google_api_key = "overriding the api key!"
|
49
|
-
def mattr_accessor(*syms)
|
50
|
-
mattr_reader(*syms)
|
51
|
-
mattr_writer(*syms)
|
52
|
-
end
|
53
|
-
end
|