ops 1.0.0.pre → 1.1.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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +27 -7
  3. data/lib/ops.rb +2 -3
  4. data/lib/ops/config.rb +8 -8
  5. data/lib/ops/heartbeat.rb +4 -7
  6. data/lib/ops/revision.rb +89 -31
  7. data/lib/ops/server.rb +22 -12
  8. data/lib/ops/server/helpers.rb +6 -14
  9. data/lib/ops/server/views/{env.html.erb → env.erb} +0 -0
  10. data/lib/ops/server/views/{layout.html.erb → layout.erb} +0 -0
  11. data/lib/ops/server/views/version.erb +76 -0
  12. data/lib/ops/version.rb +1 -1
  13. metadata +25 -73
  14. data/.gitignore +0 -18
  15. data/.rspec +0 -2
  16. data/Gemfile +0 -16
  17. data/Gemfile.lock +0 -129
  18. data/LICENSE +0 -7
  19. data/Rakefile +0 -28
  20. data/examples/rails3/.gitignore +0 -15
  21. data/examples/rails3/.rspec +0 -3
  22. data/examples/rails3/Gemfile +0 -5
  23. data/examples/rails3/Gemfile.lock +0 -130
  24. data/examples/rails3/Rakefile +0 -13
  25. data/examples/rails3/config.ru +0 -4
  26. data/examples/rails3/config/application.rb +0 -37
  27. data/examples/rails3/config/boot.rb +0 -6
  28. data/examples/rails3/config/environment.rb +0 -5
  29. data/examples/rails3/config/initializers/secret_token.rb +0 -1
  30. data/examples/rails3/config/locales/en.yml +0 -5
  31. data/examples/rails3/config/routes.rb +0 -3
  32. data/examples/rails3/public/404.html +0 -26
  33. data/examples/rails3/public/422.html +0 -26
  34. data/examples/rails3/public/500.html +0 -25
  35. data/examples/rails3/public/favicon.ico +0 -0
  36. data/examples/rails3/public/index.html +0 -14
  37. data/examples/rails3/public/robots.txt +0 -5
  38. data/examples/rails3/script/rails +0 -6
  39. data/examples/rails3/spec/functional/ops_routes_spec.rb +0 -69
  40. data/examples/rails3/spec/spec_helper.rb +0 -5
  41. data/examples/sample_deploys/1234/REVISION +0 -1
  42. data/examples/sample_deploys/1234/VERSION +0 -1
  43. data/examples/sample_deploys/2341/REVISION +0 -1
  44. data/examples/sample_deploys/2341/VERSION +0 -1
  45. data/examples/sample_deploys/3412/REVISION +0 -1
  46. data/examples/sample_deploys/3412/VERSION +0 -1
  47. data/examples/sample_deploys/4123/REVISION +0 -1
  48. data/examples/sample_deploys/4123/VERSION +0 -1
  49. data/examples/sinatra/.rspec +0 -3
  50. data/examples/sinatra/Rakefile +0 -15
  51. data/examples/sinatra/app.rb +0 -14
  52. data/examples/sinatra/config.ru +0 -20
  53. data/examples/sinatra/spec/functional/ops_routes_spec.rb +0 -69
  54. data/examples/sinatra/spec/spec_helper.rb +0 -3
  55. data/lib/ops/server/views/version.html.erb +0 -53
  56. data/ops.gemspec +0 -22
  57. data/spec/functional/ops_routes_spec.rb +0 -69
  58. data/spec/ops/config_spec.rb +0 -0
  59. data/spec/ops/heartbeat_spec.rb +0 -49
  60. data/spec/ops/revision_spec.rb +0 -42
  61. data/spec/ops/server_spec.rb +0 -66
  62. data/spec/ops/version_spec.rb +0 -7
  63. data/spec/ops_spec.rb +0 -9
  64. data/spec/spec_helper.rb +0 -11
@@ -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
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Rails3::Application
@@ -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,6 +0,0 @@
1
- require 'rubygems'
2
-
3
- # Set up gems listed in the Gemfile.
4
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
-
6
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,5 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- Rails3::Application.initialize!
@@ -1 +0,0 @@
1
- Rails3::Application.config.secret_token = "some secret phrase of at least 30 characters"
@@ -1,5 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
@@ -1,3 +0,0 @@
1
- Rails3::Application.routes.draw do
2
- mount Ops.new, :at => "/ops"
3
- end
@@ -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,5 +0,0 @@
1
- # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
- #
3
- # To ban all spiders from the entire site uncomment the next two lines:
4
- # User-Agent: *
5
- # Disallow: /
@@ -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,5 +0,0 @@
1
- require File.expand_path("../../config/environment", __FILE__)
2
-
3
- def app
4
- Rails3::Application
5
- 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^{}
@@ -1,3 +0,0 @@
1
- --color
2
- -fn
3
- --tty
@@ -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
@@ -1,14 +0,0 @@
1
- require 'sinatra/base'
2
-
3
- module Demo
4
- class App < Sinatra::Base
5
- get '/' do
6
- "Hello, world. I'm a demo app."
7
- end
8
-
9
- get '/test' do
10
- "Still me, the demo app."
11
- end
12
-
13
- end
14
- end
@@ -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
@@ -1,3 +0,0 @@
1
- def app
2
- eval "Rack::Builder.new {( " + File.read(File.dirname(__FILE__) + '/../config.ru') + "\n )}"
3
- end