redis_monitor 0.1 → 0.2

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 (123) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +1 -2
  4. data/Gemfile +2 -1
  5. data/README.md +1 -1
  6. data/Rakefile +5 -0
  7. data/bin/redis_monitor +2 -2
  8. data/lib/{server/command_line_parser.rb → command_line_parser.rb} +0 -3
  9. data/lib/engine/.gitignore +16 -0
  10. data/lib/engine/.rspec +2 -0
  11. data/lib/engine/Gemfile +5 -0
  12. data/lib/engine/Rakefile +6 -0
  13. data/lib/engine/app/assets/images/.keep +0 -0
  14. data/lib/engine/app/controllers/application_controller.rb +10 -0
  15. data/lib/engine/app/controllers/concerns/.keep +0 -0
  16. data/lib/engine/app/controllers/content_controller.rb +34 -0
  17. data/lib/engine/app/controllers/info_controller.rb +6 -0
  18. data/lib/engine/app/controllers/performance_controller.rb +8 -0
  19. data/lib/engine/app/helpers/application_helper.rb +21 -0
  20. data/lib/engine/app/helpers/database_helper.rb +36 -0
  21. data/lib/engine/app/helpers/pagination_helper.rb +8 -0
  22. data/lib/engine/app/lib/backend.rb +45 -0
  23. data/lib/{modules → engine/app/lib}/performance_stats.rb +0 -0
  24. data/lib/engine/app/lib/security/authentication.rb +14 -0
  25. data/lib/engine/app/lib/security/authorization.rb +16 -0
  26. data/lib/engine/app/mailers/.keep +0 -0
  27. data/lib/engine/app/models/.keep +0 -0
  28. data/lib/engine/app/models/concerns/.keep +0 -0
  29. data/lib/{views → engine/app/views}/content/_search_form.haml +0 -0
  30. data/lib/engine/app/views/content/index.haml +1 -0
  31. data/lib/{views → engine/app/views}/content/search.haml +5 -5
  32. data/lib/{views/info/info.haml → engine/app/views/info/index.haml} +1 -1
  33. data/lib/engine/app/views/layouts/application.haml +23 -0
  34. data/lib/{views → engine/app/views}/performance/check.haml +1 -1
  35. data/lib/{views/performance/warning.haml → engine/app/views/performance/index.haml} +0 -0
  36. data/lib/engine/bin/bundle +3 -0
  37. data/lib/engine/bin/rails +4 -0
  38. data/lib/engine/bin/rake +4 -0
  39. data/lib/engine/config/application.rb +34 -0
  40. data/lib/engine/config/boot.rb +4 -0
  41. data/lib/engine/config/database.yml +25 -0
  42. data/lib/engine/config/environment.rb +5 -0
  43. data/lib/engine/config/environments/development.rb +25 -0
  44. data/lib/engine/config/environments/production.rb +65 -0
  45. data/lib/engine/config/environments/test.rb +36 -0
  46. data/lib/engine/config/initializers/backtrace_silencers.rb +7 -0
  47. data/lib/engine/config/initializers/configuration.rb +5 -0
  48. data/lib/engine/config/initializers/filter_parameter_logging.rb +4 -0
  49. data/lib/engine/config/initializers/haml.rb +1 -0
  50. data/lib/engine/config/initializers/inflections.rb +16 -0
  51. data/lib/engine/config/initializers/mime_types.rb +5 -0
  52. data/lib/engine/config/initializers/secret_token.rb +12 -0
  53. data/lib/engine/config/initializers/session_store.rb +3 -0
  54. data/lib/engine/config/initializers/will_paginate.rb +1 -0
  55. data/lib/engine/config/initializers/wrap_parameters.rb +14 -0
  56. data/lib/engine/config/locales/en.bootstrap.yml +18 -0
  57. data/lib/engine/config/locales/en.yml +23 -0
  58. data/lib/engine/config/routes.rb +73 -0
  59. data/lib/engine/config.ru +4 -0
  60. data/lib/engine/db/seeds.rb +7 -0
  61. data/lib/engine/lib/assets/.keep +0 -0
  62. data/lib/engine/lib/tasks/.keep +0 -0
  63. data/lib/engine/log/.keep +0 -0
  64. data/lib/engine/public/404.html +58 -0
  65. data/lib/engine/public/422.html +58 -0
  66. data/lib/engine/public/500.html +57 -0
  67. data/lib/engine/public/favicon.ico +0 -0
  68. data/lib/{static/scripts → engine/public/javascripts}/app.js +0 -0
  69. data/lib/{static/scripts → engine/public/javascripts}/bootstrap-select.min.js +0 -0
  70. data/lib/{static/scripts → engine/public/javascripts}/bootstrap.min.js +0 -0
  71. data/lib/{static/scripts → engine/public/javascripts}/jquery-2.0.3.min.js +0 -0
  72. data/lib/engine/public/robots.txt +5 -0
  73. data/lib/{static/styles → engine/public/stylesheets}/bootstrap-select.min.css +0 -0
  74. data/lib/{static/styles → engine/public/stylesheets}/bootstrap.min.css +0 -0
  75. data/lib/{static/styles → engine/public/stylesheets}/custom.css +0 -0
  76. data/lib/engine/spec/controllers/content_controller_spec.rb +28 -0
  77. data/lib/engine/spec/controllers/info_controller_spec.rb +10 -0
  78. data/lib/engine/spec/controllers/performance_controller_spec.rb +10 -0
  79. data/{spec/modules → lib/engine/spec/lib}/backend_spec.rb +3 -3
  80. data/{spec/modules → lib/engine/spec/lib}/performance_stats_spec.rb +1 -1
  81. data/lib/engine/spec/lib/security/authentication_spec.rb +23 -0
  82. data/{spec/modules → lib/engine/spec/lib}/security/authorization_spec.rb +1 -1
  83. data/lib/engine/spec/spec_helper.rb +47 -0
  84. data/lib/engine/test/controllers/.keep +0 -0
  85. data/lib/engine/test/fixtures/.keep +0 -0
  86. data/lib/engine/test/helpers/.keep +0 -0
  87. data/lib/engine/test/integration/.keep +0 -0
  88. data/lib/engine/test/mailers/.keep +0 -0
  89. data/lib/engine/test/models/.keep +0 -0
  90. data/lib/engine/test/test_helper.rb +15 -0
  91. data/lib/engine/vendor/assets/javascripts/.keep +0 -0
  92. data/lib/engine/vendor/assets/stylesheets/.keep +0 -0
  93. data/lib/redis_monitor.rb +14 -10
  94. data/lib/{modules/version.rb → version.rb} +1 -1
  95. data/redis_monitor.gemspec +14 -4
  96. metadata +153 -100
  97. data/lib/controllers/base_controller.rb +0 -53
  98. data/lib/controllers/content_controller.rb +0 -37
  99. data/lib/controllers/info_controller.rb +0 -14
  100. data/lib/controllers/performance_controller.rb +0 -19
  101. data/lib/errors/errors.rb +0 -1
  102. data/lib/errors/redis_not_available.rb +0 -7
  103. data/lib/helpers/base_helper.rb +0 -13
  104. data/lib/helpers/database_helper.rb +0 -40
  105. data/lib/helpers/layouts_helper.rb +0 -29
  106. data/lib/helpers/pagination_helper.rb +0 -10
  107. data/lib/modules/backend.rb +0 -49
  108. data/lib/modules/controllers.rb +0 -5
  109. data/lib/modules/helpers.rb +0 -15
  110. data/lib/modules/router.rb +0 -26
  111. data/lib/modules/security/authentication.rb +0 -29
  112. data/lib/modules/security/authorization.rb +0 -18
  113. data/lib/server/server.rb +0 -27
  114. data/lib/views/content/index.haml +0 -1
  115. data/lib/views/errors/redis_not_available.haml +0 -2
  116. data/lib/views/layouts/main.haml +0 -21
  117. data/spec/controllers/base_controller_spec.rb +0 -34
  118. data/spec/controllers/content_controller_spec.rb +0 -41
  119. data/spec/controllers/info_controller_spec.rb +0 -22
  120. data/spec/controllers/performance_controller_spec.rb +0 -21
  121. data/spec/modules/security/authentication_spec.rb +0 -48
  122. data/spec/server/command_line_parser_spec.rb +0 -42
  123. data/spec/spec_helper.rb +0 -23
@@ -0,0 +1 @@
1
+ require 'haml'
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # 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,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+ Engine::Application.config.secret_key_base = '14751f540b79f0e826fb72de7f81f986ef3d06da11a02416925187c92eb225459977f90d595d4f954c6ecc22cbafe845d1a299d14c52a6eca337783309644a91'
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Engine::Application.config.session_store :cookie_store, key: '_engine_session'
@@ -0,0 +1 @@
1
+ require 'will_paginate/array'
@@ -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] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,18 @@
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
+ helpers:
6
+ actions: "Actions"
7
+ links:
8
+ back: "Back"
9
+ cancel: "Cancel"
10
+ confirm: "Are you sure?"
11
+ destroy: "Delete"
12
+ new: "New"
13
+ edit: "Edit"
14
+ titles:
15
+ edit: "Edit %{model}"
16
+ save: "Save %{model}"
17
+ new: "New %{model}"
18
+ delete: "Delete %{model}"
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,73 @@
1
+ Engine::Application.routes.draw do
2
+ root 'info#index'
3
+
4
+ resources :info
5
+ resources :content do
6
+ collection do
7
+ get :search
8
+ post :delete
9
+ post :change_database
10
+ end
11
+ end
12
+
13
+ resources :performance do
14
+ collection do
15
+ get :check
16
+ end
17
+ end
18
+
19
+ # The priority is based upon order of creation: first created -> highest priority.
20
+ # See how all your routes lay out with "rake routes".
21
+
22
+ # You can have the root of your site routed with "root"
23
+ # root 'welcome#index'
24
+
25
+ # Example of regular route:
26
+ # get 'products/:id' => 'catalog#view'
27
+
28
+ # Example of named route that can be invoked with purchase_url(id: product.id)
29
+ # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
30
+
31
+ # Example resource route (maps HTTP verbs to controller actions automatically):
32
+ # resources :products
33
+
34
+ # Example resource route with options:
35
+ # resources :products do
36
+ # member do
37
+ # get 'short'
38
+ # post 'toggle'
39
+ # end
40
+ #
41
+ # collection do
42
+ # get 'sold'
43
+ # end
44
+ # end
45
+
46
+ # Example resource route with sub-resources:
47
+ # resources :products do
48
+ # resources :comments, :sales
49
+ # resource :seller
50
+ # end
51
+
52
+ # Example resource route with more complex sub-resources:
53
+ # resources :products do
54
+ # resources :comments
55
+ # resources :sales do
56
+ # get 'recent', on: :collection
57
+ # end
58
+ # end
59
+
60
+ # Example resource route with concerns:
61
+ # concern :toggleable do
62
+ # post 'toggle'
63
+ # end
64
+ # resources :posts, concerns: :toggleable
65
+ # resources :photos, concerns: :toggleable
66
+
67
+ # Example resource route within a namespace:
68
+ # namespace :admin do
69
+ # # Directs /admin/products/* to Admin::ProductsController
70
+ # # (app/controllers/admin/products_controller.rb)
71
+ # resources :products
72
+ # end
73
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
File without changes
File without changes
File without changes
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,5 @@
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: /
@@ -0,0 +1,28 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe ContentController do
4
+ before :each do
5
+ request.env['HTTP_REFERER'] = '/'
6
+ end
7
+
8
+ describe 'search action' do
9
+ it 'should search on backend' do
10
+ Backend.should_receive(:search){ [] }
11
+ get :search
12
+ end
13
+ end
14
+
15
+ describe 'delete action' do
16
+ it 'should call remove on Backend' do
17
+ Backend.should_receive(:remove)
18
+ post :delete
19
+ end
20
+ end
21
+
22
+ describe 'change_database' do
23
+ it 'should call set_database' do
24
+ controller.should_receive(:set_database)
25
+ post :change_database
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,10 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe InfoController do
4
+ describe 'index action' do
5
+ it 'should get info from backend' do
6
+ Backend.should_receive(:info)
7
+ get :index
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require_relative '../spec_helper'
2
+
3
+ describe PerformanceController do
4
+ describe 'check action' do
5
+ it 'should get performance stats from backend' do
6
+ Backend.should_receive(:performance_stats)
7
+ get :check
8
+ end
9
+ end
10
+ end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe Backend do
4
4
  let(:redis){ double(del: '') }
@@ -42,13 +42,13 @@ describe Backend do
42
42
  it 'should not delete content if not allowed' do
43
43
  Authorization.stub(:authorized_for?).with(:remove_content){ false }
44
44
  redis.should_receive(:del).never
45
- Backend.del('key')
45
+ Backend.remove('key')
46
46
  end
47
47
 
48
48
  it 'should remove content if allowed' do
49
49
  Authorization.stub(:authorized_for?).with(:remove_content){ true }
50
50
  redis.should_receive(:del)
51
- Backend.del('key')
51
+ Backend.remove('key')
52
52
  end
53
53
  end
54
54
 
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require_relative '../spec_helper'
2
2
 
3
3
  describe PerformanceStats do
4
4
  let(:backend){ double(get: nil, set: nil, del: nil) }
@@ -0,0 +1,23 @@
1
+ require_relative '../../spec_helper'
2
+
3
+ describe Authentication do
4
+ let(:credentials){ {user: 'user', password: 'password'} }
5
+
6
+ describe 'config' do
7
+ it 'should inject authentication in server class' do
8
+ Authentication.config(credentials)
9
+ end
10
+ end
11
+
12
+ describe 'authentication_required??' do
13
+ it 'should return true if it has some credentials' do
14
+ Authentication.config(credentials)
15
+ Authentication.authentication_required?.should eq(true)
16
+ end
17
+
18
+ it 'should return false if no credentials were provided' do
19
+ Authentication.config(nil)
20
+ Authentication.authentication_required?.should eq(false)
21
+ end
22
+ end
23
+ end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require_relative '../../spec_helper'
2
2
 
3
3
  describe Authorization do
4
4
  describe 'authorized_for?' do
@@ -0,0 +1,47 @@
1
+ # This file is copied to spec/ when you run 'rails generate rspec:install'
2
+ ENV["RAILS_ENV"] ||= 'test'
3
+ require File.expand_path("../../config/environment", __FILE__)
4
+ require 'rspec/rails'
5
+ require 'rspec/autorun'
6
+
7
+ # Requires supporting ruby files with custom matchers and macros, etc,
8
+ # in spec/support/ and its subdirectories.
9
+ Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
10
+
11
+ # Checks for pending migrations before tests are run.
12
+ # If you are not using ActiveRecord, you can remove this line.
13
+ ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
14
+
15
+ RSpec.configure do |config|
16
+ # ## Mock Framework
17
+ #
18
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
19
+ #
20
+ # config.mock_with :mocha
21
+ # config.mock_with :flexmock
22
+ # config.mock_with :rr
23
+
24
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
25
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
26
+
27
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
28
+ # examples within a transaction, remove the following line or assign false
29
+ # instead of true.
30
+ config.use_transactional_fixtures = true
31
+
32
+ # If true, the base class of anonymous controllers will be inferred
33
+ # automatically. This will be the default behavior in future versions of
34
+ # rspec-rails.
35
+ config.infer_base_class_for_anonymous_controllers = false
36
+
37
+ # Run specs in random order to surface order dependencies. If you find an
38
+ # order dependency and want to debug it, you can fix the order by providing
39
+ # the seed, which is printed after each run.
40
+ # --seed 1234
41
+ config.order = "random"
42
+ end
43
+
44
+ Backend.config(redis_host: 'localhost', redis_port: 6379)
45
+ Authorization.config({})
46
+ Authentication.config(nil)
47
+
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,15 @@
1
+ ENV["RAILS_ENV"] ||= "test"
2
+ require File.expand_path('../../config/environment', __FILE__)
3
+ require 'rails/test_help'
4
+
5
+ class ActiveSupport::TestCase
6
+ ActiveRecord::Migration.check_pending!
7
+
8
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
9
+ #
10
+ # Note: You'll currently still have to declare fixtures explicitly in integration tests
11
+ # -- they do not yet inherit this setting
12
+ fixtures :all
13
+
14
+ # Add more helper methods to be used by all tests here...
15
+ end
File without changes
File without changes
data/lib/redis_monitor.rb CHANGED
@@ -1,16 +1,20 @@
1
- require 'server/command_line_parser'
2
- require 'server/server'
3
- require 'modules/security/authorization'
4
- require 'modules/security/authentication'
1
+ require 'base64'
2
+ require 'command_line_parser'
5
3
 
6
4
  module RedisMonitor
5
+ def self.parse_arguments
6
+ CommandLineParser.parse(ARGV.dup)
7
+ end
8
+
9
+ def self.store_arguments(args)
10
+ ENV['REDIS_MONITOR_OPTS'] = Base64.encode64(Marshal.dump(args))
11
+ end
12
+
7
13
  def self.run
8
- arguments = CommandLineParser.parse(ARGV.dup)
9
- Backend.config(arguments)
10
- Server.config(arguments)
11
- Authorization.config(arguments[:permissions])
12
- Authentication.config(Server, arguments[:credentials])
14
+ args = parse_arguments
15
+ store_arguments(args)
13
16
 
14
- Server.run!
17
+ system('lib/engine/bin/rails', 's', '-p', args[:http_port].to_s)
18
+ #system('lib/engine/bin/rails', 's', '-e', 'production')
15
19
  end
16
20
  end
@@ -1,3 +1,3 @@
1
1
  module RedisMonitor
2
- VERSION = '0.1'
2
+ VERSION = '0.2'
3
3
  end