ops 1.0.0.pre → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +27 -7
- data/lib/ops.rb +2 -3
- data/lib/ops/config.rb +8 -8
- data/lib/ops/heartbeat.rb +4 -7
- data/lib/ops/revision.rb +89 -31
- data/lib/ops/server.rb +22 -12
- data/lib/ops/server/helpers.rb +6 -14
- data/lib/ops/server/views/{env.html.erb → env.erb} +0 -0
- data/lib/ops/server/views/{layout.html.erb → layout.erb} +0 -0
- data/lib/ops/server/views/version.erb +76 -0
- data/lib/ops/version.rb +1 -1
- metadata +25 -73
- data/.gitignore +0 -18
- data/.rspec +0 -2
- data/Gemfile +0 -16
- data/Gemfile.lock +0 -129
- data/LICENSE +0 -7
- data/Rakefile +0 -28
- data/examples/rails3/.gitignore +0 -15
- data/examples/rails3/.rspec +0 -3
- data/examples/rails3/Gemfile +0 -5
- data/examples/rails3/Gemfile.lock +0 -130
- data/examples/rails3/Rakefile +0 -13
- data/examples/rails3/config.ru +0 -4
- data/examples/rails3/config/application.rb +0 -37
- data/examples/rails3/config/boot.rb +0 -6
- data/examples/rails3/config/environment.rb +0 -5
- data/examples/rails3/config/initializers/secret_token.rb +0 -1
- data/examples/rails3/config/locales/en.yml +0 -5
- data/examples/rails3/config/routes.rb +0 -3
- data/examples/rails3/public/404.html +0 -26
- data/examples/rails3/public/422.html +0 -26
- data/examples/rails3/public/500.html +0 -25
- data/examples/rails3/public/favicon.ico +0 -0
- data/examples/rails3/public/index.html +0 -14
- data/examples/rails3/public/robots.txt +0 -5
- data/examples/rails3/script/rails +0 -6
- data/examples/rails3/spec/functional/ops_routes_spec.rb +0 -69
- data/examples/rails3/spec/spec_helper.rb +0 -5
- data/examples/sample_deploys/1234/REVISION +0 -1
- data/examples/sample_deploys/1234/VERSION +0 -1
- data/examples/sample_deploys/2341/REVISION +0 -1
- data/examples/sample_deploys/2341/VERSION +0 -1
- data/examples/sample_deploys/3412/REVISION +0 -1
- data/examples/sample_deploys/3412/VERSION +0 -1
- data/examples/sample_deploys/4123/REVISION +0 -1
- data/examples/sample_deploys/4123/VERSION +0 -1
- data/examples/sinatra/.rspec +0 -3
- data/examples/sinatra/Rakefile +0 -15
- data/examples/sinatra/app.rb +0 -14
- data/examples/sinatra/config.ru +0 -20
- data/examples/sinatra/spec/functional/ops_routes_spec.rb +0 -69
- data/examples/sinatra/spec/spec_helper.rb +0 -3
- data/lib/ops/server/views/version.html.erb +0 -53
- data/ops.gemspec +0 -22
- data/spec/functional/ops_routes_spec.rb +0 -69
- data/spec/ops/config_spec.rb +0 -0
- data/spec/ops/heartbeat_spec.rb +0 -49
- data/spec/ops/revision_spec.rb +0 -42
- data/spec/ops/server_spec.rb +0 -66
- data/spec/ops/version_spec.rb +0 -7
- data/spec/ops_spec.rb +0 -9
- data/spec/spec_helper.rb +0 -11
data/examples/rails3/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env rake
|
2
|
-
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
3
|
-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
4
|
-
|
5
|
-
require File.expand_path('../config/application', __FILE__)
|
6
|
-
require 'rake'
|
7
|
-
require 'rspec/core/rake_task'
|
8
|
-
|
9
|
-
Rails3::Application.load_tasks
|
10
|
-
|
11
|
-
RSpec::Core::RakeTask.new('test:ops') do |test|
|
12
|
-
test.pattern = "spec/functional/*_spec.rb"
|
13
|
-
end
|
data/examples/rails3/config.ru
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
# Pick the frameworks you want:
|
4
|
-
# require "active_record/railtie"
|
5
|
-
require "action_controller/railtie"
|
6
|
-
require "action_mailer/railtie"
|
7
|
-
require "active_resource/railtie"
|
8
|
-
|
9
|
-
if defined?(Bundler)
|
10
|
-
# If you precompile assets before deploying to production, use this line
|
11
|
-
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
12
|
-
# If you want your assets lazily compiled in production, use this line
|
13
|
-
# Bundler.require(:default, :assets, Rails.env)
|
14
|
-
end
|
15
|
-
|
16
|
-
module Rails3
|
17
|
-
class Application < Rails::Application
|
18
|
-
config.encoding = "utf-8"
|
19
|
-
|
20
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
21
|
-
config.filter_parameters += [:password]
|
22
|
-
|
23
|
-
# Enable escaping HTML in JSON.
|
24
|
-
config.active_support.escape_html_entities_in_json = true
|
25
|
-
|
26
|
-
config.active_support.deprecation = :log
|
27
|
-
|
28
|
-
Ops.setup do |config|
|
29
|
-
config.file_root = File.join(Rails.root,'/../sample_deploys/4123')
|
30
|
-
config.environment = Rails.env
|
31
|
-
|
32
|
-
# Optionally use a configuration service
|
33
|
-
# config.config_service_adapter = something_that_responds_to_call
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
Rails3::Application.config.secret_token = "some secret phrase of at least 30 characters"
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
</div>
|
24
|
-
</body>
|
25
|
-
</html>
|
File without changes
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>ops gem: Rails 3 demo app</title>
|
5
|
-
<body>
|
6
|
-
<h1>Welcome to the ops gem rails 3 demo app!</h1>
|
7
|
-
<h2>The following routes are available:</h2>
|
8
|
-
<ul>
|
9
|
-
<li><a href="/ops/version">/ops/version</a></li>
|
10
|
-
<li><a href="/ops/version.json">/ops/version.json</a></li>
|
11
|
-
<li><a href="/ops/heartbeat">/ops/heartbeat</a></li>
|
12
|
-
</ul>
|
13
|
-
</body>
|
14
|
-
</html>
|
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'rack/test'
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
RSpec::Matchers.define :have_content_type do |content_type|
|
7
|
-
CONTENT_HEADER_MATCHER = /^([A-Za-z]+\/[\w\-+\.]+)(;charset=(.*))?/
|
8
|
-
|
9
|
-
chain :with_charset do |charset|
|
10
|
-
@charset = charset
|
11
|
-
end
|
12
|
-
|
13
|
-
match do |response|
|
14
|
-
_, content, _, charset = *content_type_header.match(CONTENT_HEADER_MATCHER).to_a
|
15
|
-
|
16
|
-
if @charset
|
17
|
-
@charset == charset && content == content_type
|
18
|
-
else
|
19
|
-
content == content_type
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
failure_message_for_should do |response|
|
24
|
-
if @charset
|
25
|
-
"Content type #{content_type_header.inspect} should match #{content_type.inspect} with charset #{@charset}"
|
26
|
-
else
|
27
|
-
"Content type #{content_type_header.inspect} should match #{content_type.inspect}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
failure_message_for_should_not do |model|
|
32
|
-
if @charset
|
33
|
-
"Content type #{content_type_header.inspect} should not match #{content_type.inspect} with charset #{@charset}"
|
34
|
-
else
|
35
|
-
"Content type #{content_type_header.inspect} should not match #{content_type.inspect}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def content_type_header
|
40
|
-
last_response.headers['Content-Type']
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'routes', :type => :controller do
|
45
|
-
include Rack::Test::Methods
|
46
|
-
|
47
|
-
|
48
|
-
it 'renders a env page' do
|
49
|
-
get "/ops/env"
|
50
|
-
last_response.should be_ok
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'renders a version page' do
|
54
|
-
get "/ops/version"
|
55
|
-
last_response.should be_ok
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'renders a json version page' do
|
59
|
-
get "/ops/version.json"
|
60
|
-
last_response.should be_ok
|
61
|
-
last_response.should have_content_type('application/json').with_charset('utf-8')
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'renders a heartbeat page' do
|
65
|
-
get "/ops/heartbeat"
|
66
|
-
last_response.should be_ok
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
1234567890
|
@@ -1 +0,0 @@
|
|
1
|
-
v1.0.0^{}
|
@@ -1 +0,0 @@
|
|
1
|
-
2345678901
|
@@ -1 +0,0 @@
|
|
1
|
-
v1.0.1^{}
|
@@ -1 +0,0 @@
|
|
1
|
-
3456789012
|
@@ -1 +0,0 @@
|
|
1
|
-
v1.1.1^{}
|
@@ -1 +0,0 @@
|
|
1
|
-
4567890123
|
@@ -1 +0,0 @@
|
|
1
|
-
v2.0.0^{}
|
data/examples/sinatra/.rspec
DELETED
data/examples/sinatra/Rakefile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
|
2
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) unless $LOAD_PATH.include?(File.dirname(__FILE__))
|
3
|
-
|
4
|
-
require 'rspec/core/rake_task'
|
5
|
-
|
6
|
-
desc "Start the demo using `rackup`"
|
7
|
-
task :start do
|
8
|
-
exec "rackup config.ru"
|
9
|
-
end
|
10
|
-
|
11
|
-
task default: [:start]
|
12
|
-
|
13
|
-
RSpec::Core::RakeTask.new('test:ops') do |test|
|
14
|
-
test.pattern = "spec/functional/*_spec.rb"
|
15
|
-
end
|
data/examples/sinatra/app.rb
DELETED
data/examples/sinatra/config.ru
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'logger'
|
3
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
|
4
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) unless $LOAD_PATH.include?(File.dirname(__FILE__))
|
5
|
-
require 'app'
|
6
|
-
require 'ops'
|
7
|
-
|
8
|
-
use Rack::ShowExceptions
|
9
|
-
|
10
|
-
Ops.setup do |config|
|
11
|
-
config.file_root = '../sample_deploys/4123'
|
12
|
-
config.environment = ENV['RACK_ENV']
|
13
|
-
|
14
|
-
# Optionally use a configuration service
|
15
|
-
# config.config_service_adapter = something_that_responds_to_call
|
16
|
-
end
|
17
|
-
|
18
|
-
run Rack::URLMap.new \
|
19
|
-
"/" => Demo::App.new,
|
20
|
-
"/ops" => Ops::Server.new
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'rack/test'
|
3
|
-
require 'spec_helper'
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
RSpec::Matchers.define :have_content_type do |content_type|
|
7
|
-
CONTENT_HEADER_MATCHER = /^([A-Za-z]+\/[\w\-+\.]+)(;charset=(.*))?/
|
8
|
-
|
9
|
-
chain :with_charset do |charset|
|
10
|
-
@charset = charset
|
11
|
-
end
|
12
|
-
|
13
|
-
match do |response|
|
14
|
-
_, content, _, charset = *content_type_header.match(CONTENT_HEADER_MATCHER).to_a
|
15
|
-
|
16
|
-
if @charset
|
17
|
-
@charset == charset && content == content_type
|
18
|
-
else
|
19
|
-
content == content_type
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
failure_message_for_should do |response|
|
24
|
-
if @charset
|
25
|
-
"Content type #{content_type_header.inspect} should match #{content_type.inspect} with charset #{@charset}"
|
26
|
-
else
|
27
|
-
"Content type #{content_type_header.inspect} should match #{content_type.inspect}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
failure_message_for_should_not do |model|
|
32
|
-
if @charset
|
33
|
-
"Content type #{content_type_header.inspect} should not match #{content_type.inspect} with charset #{@charset}"
|
34
|
-
else
|
35
|
-
"Content type #{content_type_header.inspect} should not match #{content_type.inspect}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def content_type_header
|
40
|
-
last_response.headers['Content-Type']
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe 'routes', :type => :controller do
|
45
|
-
include Rack::Test::Methods
|
46
|
-
|
47
|
-
|
48
|
-
it 'renders a env page' do
|
49
|
-
get "/ops/env"
|
50
|
-
last_response.should be_ok
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'renders a version page' do
|
54
|
-
get "/ops/version"
|
55
|
-
last_response.should be_ok
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'renders a json version page' do
|
59
|
-
get "/ops/version.json"
|
60
|
-
last_response.should be_ok
|
61
|
-
last_response.should have_content_type('application/json').with_charset('utf-8')
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'renders a heartbeat page' do
|
65
|
-
get "/ops/heartbeat"
|
66
|
-
last_response.should be_ok
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|