pvdgm_beanstalk_api 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +9 -0
  3. data/Rakefile +38 -0
  4. data/app/controllers/beanstalk_api/application_controller.rb +68 -0
  5. data/app/controllers/beanstalk_api/jobs_controller.rb +27 -0
  6. data/app/controllers/beanstalk_api/tasks_controller.rb +16 -0
  7. data/app/controllers/beanstalk_api/tubes_controller.rb +149 -0
  8. data/app/helpers/beanstalk_api/application_helper.rb +4 -0
  9. data/app/views/layouts/beanstalk_api/application.html.erb +14 -0
  10. data/config/routes.rb +19 -0
  11. data/lib/beanstalk_api.rb +4 -0
  12. data/lib/beanstalk_api/engine.rb +11 -0
  13. data/lib/beanstalk_api/version.rb +3 -0
  14. data/lib/tasks/beanstalk_api_tasks.rake +4 -0
  15. data/spec/controllers/application_controller_spec.rb +87 -0
  16. data/spec/controllers/jobs_controller_spec.rb +35 -0
  17. data/spec/dummy/README.rdoc +261 -0
  18. data/spec/dummy/Rakefile +7 -0
  19. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  20. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  21. data/spec/dummy/app/controllers/application_controller.rb +3 -0
  22. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  23. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  24. data/spec/dummy/config.ru +4 -0
  25. data/spec/dummy/config/application.rb +65 -0
  26. data/spec/dummy/config/boot.rb +10 -0
  27. data/spec/dummy/config/database.yml +29 -0
  28. data/spec/dummy/config/environment.rb +5 -0
  29. data/spec/dummy/config/environments/development.rb +38 -0
  30. data/spec/dummy/config/environments/production.rb +68 -0
  31. data/spec/dummy/config/environments/test.rb +38 -0
  32. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/spec/dummy/config/initializers/inflections.rb +15 -0
  34. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  35. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  36. data/spec/dummy/config/initializers/session_store.rb +8 -0
  37. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  38. data/spec/dummy/config/locales/en.yml +5 -0
  39. data/spec/dummy/config/routes.rb +5 -0
  40. data/spec/dummy/db/schema.rb +121 -0
  41. data/spec/dummy/public/404.html +26 -0
  42. data/spec/dummy/public/422.html +26 -0
  43. data/spec/dummy/public/500.html +25 -0
  44. data/spec/dummy/public/favicon.ico +0 -0
  45. data/spec/dummy/script/rails +6 -0
  46. data/spec/spec_helper.rb +40 -0
  47. metadata +205 -0
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,38 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+ config.eager_load = false
9
+
10
+ # Log error messages when you accidentally call methods on nil.
11
+ config.whiny_nils = true
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Don't care if the mailer can't send
18
+ config.action_mailer.raise_delivery_errors = false
19
+
20
+ # Print deprecation notices to the Rails logger
21
+ config.active_support.deprecation = :log
22
+
23
+ # Only use best-standards-support built into browsers
24
+ config.action_dispatch.best_standards_support = :builtin
25
+
26
+ # Raise exception on mass assignment protection for Active Record models
27
+ # config.active_record.mass_assignment_sanitizer = :strict
28
+
29
+ # Log the query plan for queries taking more than this (works
30
+ # with SQLite, MySQL, and PostgreSQL)
31
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
32
+
33
+ # Do not compress assets
34
+ config.assets.compress = false
35
+
36
+ # Expands the lines which load the assets
37
+ config.assets.debug = true
38
+ end
@@ -0,0 +1,68 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # Code is not reloaded between requests
5
+ config.cache_classes = true
6
+ config.eager_load = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Disable Rails's static asset server (Apache or nginx will already do this)
13
+ config.serve_static_assets = false
14
+
15
+ # Compress JavaScripts and CSS
16
+ config.assets.compress = true
17
+
18
+ # Don't fallback to assets pipeline if a precompiled asset is missed
19
+ config.assets.compile = false
20
+
21
+ # Generate digests for assets URLs
22
+ config.assets.digest = true
23
+
24
+ # Defaults to nil and saved in location specified by config.assets.prefix
25
+ # config.assets.manifest = YOUR_PATH
26
+
27
+ # Specifies the header that your server uses for sending files
28
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
29
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
30
+
31
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
32
+ # config.force_ssl = true
33
+
34
+ # See everything in the log (default is :info)
35
+ # config.log_level = :debug
36
+
37
+ # Prepend all log lines with the following tags
38
+ # config.log_tags = [ :subdomain, :uuid ]
39
+
40
+ # Use a different logger for distributed setups
41
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
42
+
43
+ # Use a different cache store in production
44
+ # config.cache_store = :mem_cache_store
45
+
46
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server
47
+ # config.action_controller.asset_host = "http://assets.example.com"
48
+
49
+ # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
50
+ # config.assets.precompile += %w( search.js )
51
+
52
+ # Disable delivery errors, bad email addresses will be ignored
53
+ # config.action_mailer.raise_delivery_errors = false
54
+
55
+ # Enable threaded mode
56
+ # config.threadsafe!
57
+
58
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
59
+ # the I18n.default_locale when a translation can not be found)
60
+ config.i18n.fallbacks = true
61
+
62
+ # Send deprecation notices to registered listeners
63
+ config.active_support.deprecation = :notify
64
+
65
+ # Log the query plan for queries taking more than this (works
66
+ # with SQLite, MySQL, and PostgreSQL)
67
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
68
+ end
@@ -0,0 +1,38 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+ config.eager_load = false
10
+
11
+ # Configure static asset server for tests with Cache-Control for performance
12
+ config.serve_static_assets = true
13
+ config.static_cache_control = "public, max-age=3600"
14
+
15
+ # Log error messages when you accidentally call methods on nil
16
+ config.whiny_nils = true
17
+
18
+ # Show full error reports and disable caching
19
+ config.consider_all_requests_local = true
20
+ config.action_controller.perform_caching = false
21
+
22
+ # Raise exceptions instead of rendering exception templates
23
+ config.action_dispatch.show_exceptions = false
24
+
25
+ # Disable request forgery protection in test environment
26
+ config.action_controller.allow_forgery_protection = false
27
+
28
+ # Tell Action Mailer not to deliver emails to the real world.
29
+ # The :test delivery method accumulates sent emails in the
30
+ # ActionMailer::Base.deliveries array.
31
+ config.action_mailer.delivery_method = :test
32
+
33
+ # Raise exception on mass assignment protection for Active Record models
34
+ # config.active_record.mass_assignment_sanitizer = :strict
35
+
36
+ # Print deprecation notices to the stderr
37
+ config.active_support.deprecation = :stderr
38
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = 'a012f332e82416549bf80d137d4d199e9cbee007f74e254cf63a2705862e6a25dd90806258c0a11bf291d48c0837866670299bee573ee8d94298c209135c216f'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,5 @@
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"
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+
3
+ mount BeanstalkApi::Engine => "/beanstalk"
4
+
5
+ end
@@ -0,0 +1,121 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20130808191953) do
15
+
16
+ create_table "services_engine_credentials", :force => true do |t|
17
+ t.string "credentialled_type", :null => false
18
+ t.integer "credentialled_id", :null => false
19
+ t.binary "username", :limit => 255
20
+ t.binary "password", :limit => 255
21
+ t.binary "token", :limit => 255
22
+ t.datetime "created_at", :null => false
23
+ t.datetime "updated_at", :null => false
24
+ end
25
+
26
+ create_table "services_engine_sltc_requested_baselines", :force => true do |t|
27
+ t.string "request_id", :null => false
28
+ t.integer "status", :default => 0, :null => false
29
+ t.datetime "created_at", :null => false
30
+ t.datetime "updated_at", :null => false
31
+ end
32
+
33
+ create_table "services_engine_third_parties", :force => true do |t|
34
+ t.string "name", :null => false
35
+ t.string "contact_email", :null => false
36
+ t.datetime "created_at", :null => false
37
+ t.datetime "updated_at", :null => false
38
+ end
39
+
40
+ create_table "services_engine_tp_account_mappings", :force => true do |t|
41
+ t.integer "third_party_id", :null => false
42
+ t.integer "account_id", :null => false
43
+ t.string "tp_account_code", :null => false
44
+ t.datetime "created_at", :null => false
45
+ t.datetime "updated_at", :null => false
46
+ end
47
+
48
+ create_table "services_engine_tp_available_files", :force => true do |t|
49
+ t.integer "tp_service_definition_id", :null => false
50
+ t.integer "tp_configured_account_id", :null => false
51
+ t.string "file_identifier", :null => false
52
+ t.string "filename", :null => false
53
+ t.boolean "baseline", :default => false, :null => false
54
+ t.integer "status", :default => 0, :null => false
55
+ t.datetime "downloaded_at"
56
+ t.string "composite_file_name"
57
+ t.string "error"
58
+ t.datetime "created_at", :null => false
59
+ t.datetime "updated_at", :null => false
60
+ end
61
+
62
+ create_table "services_engine_tp_configured_accounts", :force => true do |t|
63
+ t.integer "tp_service_definition_id", :null => false
64
+ t.integer "account_id", :null => false
65
+ t.boolean "enabled", :default => false, :null => false
66
+ t.datetime "created_at", :null => false
67
+ t.datetime "updated_at", :null => false
68
+ end
69
+
70
+ create_table "services_engine_tp_configured_facilities", :force => true do |t|
71
+ t.integer "tp_service_definition_id", :null => false
72
+ t.integer "facility_id", :null => false
73
+ t.boolean "enabled", :default => false, :null => false
74
+ t.datetime "created_at", :null => false
75
+ t.datetime "updated_at", :null => false
76
+ end
77
+
78
+ create_table "services_engine_tp_facility_mappings", :force => true do |t|
79
+ t.integer "third_party_id", :null => false
80
+ t.integer "facility_id", :null => false
81
+ t.string "tp_facility_code", :null => false
82
+ t.boolean "top_level", :default => false, :null => false
83
+ t.datetime "created_at", :null => false
84
+ t.datetime "updated_at", :null => false
85
+ end
86
+
87
+ create_table "services_engine_tp_mds_pull_accounts", :force => true do |t|
88
+ t.integer "tp_configured_account_id", :null => false
89
+ t.datetime "pull_from"
90
+ t.datetime "pull_to"
91
+ t.integer "status", :default => 0, :null => false
92
+ t.integer "attempt", :default => 0, :null => false
93
+ t.datetime "created_at", :null => false
94
+ t.datetime "updated_at", :null => false
95
+ end
96
+
97
+ create_table "services_engine_tp_servers", :force => true do |t|
98
+ t.integer "third_party_id", :null => false
99
+ t.string "hostname", :null => false
100
+ t.string "base_uri"
101
+ t.datetime "created_at", :null => false
102
+ t.datetime "updated_at", :null => false
103
+ end
104
+
105
+ create_table "services_engine_tp_service_definitions", :force => true do |t|
106
+ t.integer "third_party_id", :null => false
107
+ t.integer "tp_service_id", :null => false
108
+ t.integer "tp_server_id", :null => false
109
+ t.string "environment", :null => false
110
+ t.string "service_class", :null => false
111
+ t.datetime "created_at", :null => false
112
+ t.datetime "updated_at", :null => false
113
+ end
114
+
115
+ create_table "services_engine_tp_services", :force => true do |t|
116
+ t.string "name", :null => false
117
+ t.datetime "created_at", :null => false
118
+ t.datetime "updated_at", :null => false
119
+ end
120
+
121
+ end
@@ -0,0 +1,26 @@
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>
@@ -0,0 +1,26 @@
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>
@@ -0,0 +1,25 @@
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
@@ -0,0 +1,6 @@
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'