memcached-manager 0.2.2 → 0.2.3

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 (74) hide show
  1. data/config.ru +3 -1
  2. metadata +5 -77
  3. data/.rspec +0 -2
  4. data/.travis.yml +0 -19
  5. data/CONTRIBUTING.md +0 -28
  6. data/Gemfile +0 -26
  7. data/Gemfile.lock +0 -143
  8. data/Rakefile +0 -59
  9. data/VERSION +0 -1
  10. data/features/api/create_memcached_key.feature +0 -6
  11. data/features/api/delete_memcached_key.feature +0 -6
  12. data/features/api/list_memcached_keys.feature +0 -6
  13. data/features/api/set_memcached_info.feature +0 -5
  14. data/features/api/show_memcached_key.feature +0 -10
  15. data/features/api/show_memcached_stats.feature +0 -5
  16. data/features/api/update_memcached_key.feature +0 -7
  17. data/features/step_definitions/api/create_memcached_key.rb +0 -21
  18. data/features/step_definitions/api/delete_memcached_key.rb +0 -7
  19. data/features/step_definitions/api/list_memcached_keys.rb +0 -16
  20. data/features/step_definitions/api/show_memcached_key.rb +0 -18
  21. data/features/step_definitions/api/show_memcached_stats.rb +0 -3
  22. data/features/step_definitions/api/update_memcached_key.rb +0 -18
  23. data/features/step_definitions/set_memcached_info.rb +0 -25
  24. data/features/step_definitions/webapp/create_memcached_key.rb +0 -10
  25. data/features/step_definitions/webapp/delete_memcached_key.rb +0 -16
  26. data/features/step_definitions/webapp/edit_memcached_key.rb +0 -3
  27. data/features/step_definitions/webapp/list_memcached_keys.rb +0 -4
  28. data/features/step_definitions/webapp/show_memcached_key.rb +0 -4
  29. data/features/step_definitions/webapp/show_memcached_stats.rb +0 -5
  30. data/features/support/env.rb +0 -28
  31. data/features/support/hooks.rb +0 -3
  32. data/features/webapp/create_memcached_key.feature +0 -9
  33. data/features/webapp/delete_memcached_key.feature +0 -8
  34. data/features/webapp/edit_memcached_key.feature +0 -9
  35. data/features/webapp/list_memcached_keys.feature +0 -8
  36. data/features/webapp/show_memcached_key.feature +0 -7
  37. data/features/webapp/show_memcached_stats.feature +0 -6
  38. data/lib/api.rb +0 -85
  39. data/lib/extensions.rb +0 -14
  40. data/lib/extensions/api_response.rb +0 -15
  41. data/lib/extensions/errors.rb +0 -19
  42. data/lib/extensions/memcached_connection.rb +0 -15
  43. data/lib/extensions/memcached_inspector.rb +0 -49
  44. data/lib/extensions/memcached_settings.rb +0 -18
  45. data/lib/public/images/glyphicons-halflings-white.png +0 -0
  46. data/lib/public/images/glyphicons-halflings.png +0 -0
  47. data/lib/public/javascripts/angular-resource.min.js +0 -10
  48. data/lib/public/javascripts/angular-ui-states.min.js +0 -7
  49. data/lib/public/javascripts/angular.min.js +0 -161
  50. data/lib/public/javascripts/angular/controllers.js +0 -89
  51. data/lib/public/javascripts/angular/routes.js +0 -66
  52. data/lib/public/javascripts/angular/services/notification.js +0 -16
  53. data/lib/public/javascripts/angular/services/resources.js +0 -20
  54. data/lib/public/javascripts/angular/services/response.js +0 -10
  55. data/lib/public/javascripts/application.js +0 -18
  56. data/lib/public/javascripts/jquery-1.9.1.min.js +0 -5
  57. data/lib/public/javascripts/noty/jquery.noty.js +0 -547
  58. data/lib/public/javascripts/noty/layouts/top.js +0 -34
  59. data/lib/public/javascripts/noty/themes/default.js +0 -156
  60. data/lib/public/javascripts/noty_config.js +0 -25
  61. data/lib/public/stylesheets/app.css +0 -50
  62. data/lib/public/stylesheets/base.css +0 -269
  63. data/lib/public/stylesheets/icons.css +0 -492
  64. data/lib/public/stylesheets/layout.css +0 -58
  65. data/lib/public/stylesheets/skeleton.css +0 -242
  66. data/lib/public/templates/edit.html.erb +0 -6
  67. data/lib/public/templates/keys.html.erb +0 -36
  68. data/lib/public/templates/new.html.erb +0 -6
  69. data/lib/public/templates/show.html.erb +0 -2
  70. data/lib/public/templates/stats.html.erb +0 -8
  71. data/lib/views/index.erb +0 -13
  72. data/lib/views/layout.erb +0 -52
  73. data/lib/webapp.rb +0 -14
  74. data/memcached-manager.gemspec +0 -152
@@ -1,10 +0,0 @@
1
- @api
2
- Feature: Show memcached keys
3
- Scenario: Success
4
- Given there's the "username" memcached key avaiable
5
- When I visit "/keys/username.json" in the API
6
- Then I should receive a json response with this key
7
-
8
- Scenario: Key doesn't exist
9
- When I visit "/keys/username.json" in the API
10
- Then I should receive a json telling me that the key doesn't exist
@@ -1,5 +0,0 @@
1
- @api
2
- Feature: Show memcached stats
3
- Scenario: Success
4
- When I visit "/stats.json" in the API
5
- Then I should receive a json response with the memcached's current stats
@@ -1,7 +0,0 @@
1
- @api
2
- Feature: Update memcached pair
3
- Scenario: Success
4
- Given there's the "username" memcached key avaiable
5
- When I put some data to "/keys.json" in the API
6
- Then I should receive a json response that it was edited successfully
7
- And it should be updated in memcached
@@ -1,21 +0,0 @@
1
- When /^I post some data to "(.*?)" in the API$/ do |route|
2
- @data = { key: 'all.i.want.to.do', value: 'is.bang.bang.bang' }
3
- @response = API.post do |req|
4
- req.url "api/#{route}"
5
- req.params = @data
6
- end
7
- end
8
-
9
- Then /^I should receive a json response that it was saved successfully$/ do
10
- @response.status.should be 200
11
- response_json = JSON.parse(@response.body)
12
- response_json.class.should eql Hash
13
- response_json.keys.should_not include 'errors'
14
- response_json.values.should include 'all.i.want.to.do'
15
- response_json.keys.should include 'expired'
16
- end
17
-
18
- Then /^it should be saved in memcached$/ do
19
- key = Memcached.get(@data[:key])
20
- key.should == @data[:value]
21
- end
@@ -1,7 +0,0 @@
1
- When /^I visit "(.*?)" in the API with the delete method$/ do |route|
2
- API.delete("api/#{route}")
3
- end
4
-
5
- Then /^this key shouldn't exist\.$/ do
6
- Memcached.get('username').should eql nil
7
- end
@@ -1,16 +0,0 @@
1
- # encoding: utf-8
2
-
3
- Given /^there's some memcached keys avaiable$/ do
4
- Memcached.set('foo', 'bar')
5
- Memcached.set('ineed', 'togetalife')
6
- end
7
-
8
- When /^I visit "(.*?)" in the API$/ do |route|
9
- @response = JSON.parse(API.get("api/#{route}").body)
10
- end
11
-
12
- Then /^I should receive a json response with those keys$/ do
13
- @response.should_not equal nil
14
- @response.last.values.should include 'foo'
15
- @response.first.values.should include 'ineed'
16
- end
@@ -1,18 +0,0 @@
1
- # Scenario: Success
2
- Given /^there's the "(.*?)" memcached key avaiable$/ do |key|
3
- @key = key
4
- Memcached.set(@key, 'John Doe')
5
- end
6
-
7
- Then /^I should receive a json response with this key$/ do
8
- @response.class.should eql Hash
9
- @response["key"].should include 'name'
10
- @response["value"].should include 'John Doe'
11
- end
12
-
13
- # Scenario: Key doesn't exist
14
- Then /^I should receive a json telling me that the key doesn't exist$/ do
15
- @response.class.should eql Hash
16
- @response.keys.should include 'errors'
17
- @response["errors"].should include 'Key not found.'
18
- end
@@ -1,3 +0,0 @@
1
- Then /^I should receive a json response with the memcached's current stats$/ do
2
- @response.keys.should include("#{MemcachedConfigs[:host]}:#{MemcachedConfigs[:port]}")
3
- end
@@ -1,18 +0,0 @@
1
- When /^I put some data to "(.*?)" in the API$/ do |route|
2
- @data = { key: 'username', value: 'thiagofm' }
3
- @response = API.put do |req|
4
- req.url "api/#{route}"
5
- req.params = @data
6
- end
7
- end
8
-
9
- Then /^I should receive a json response that it was edited successfully$/ do
10
- @response.status.should be 200
11
- response_json = JSON.parse(@response.body)
12
- response_json.class.should eql Hash
13
- response_json.keys.should include 'key'
14
- end
15
-
16
- Then /^it should be updated in memcached$/ do
17
- Memcached.get(@key).should eql 'thiagofm'
18
- end
@@ -1,25 +0,0 @@
1
- When /^I post configs to "(.*?)" in the API$/ do |route|
2
- @data = { 'host' => 'i.am', 'port' => '1337' }
3
- @route = route
4
-
5
- API.post do |req|
6
- req.url "api/#{@route}"
7
- req.params = @data
8
- end
9
- end
10
-
11
- Then /^the memcached config should be set$/ do
12
- response = API.get("api/#{@route}")
13
- response_json = JSON.parse(response.body)
14
-
15
- response.status.should be 200
16
- response_json['host'].should eql @data['host']
17
- response_json['port'].should eql @data['port']
18
-
19
- # Workaround so the next feature don't use the current memcached configs
20
- @data = { 'host' => MemcachedConfigs[:host], 'port' => MemcachedConfigs[:port] }
21
- API.post do |req|
22
- req.url "api/#{@route}"
23
- req.params = @data
24
- end
25
- end
@@ -1,10 +0,0 @@
1
- When /^click on the X inside a div$/ do
2
- within(".key-actions") do
3
- find('.icon-remove').click
4
- end
5
- sleep 5
6
- end
7
-
8
- Then /^"(.*?)" key shouldn't exist in memcached$/ do |key|
9
- Memcached.get(key).should be nil
10
- end
@@ -1,16 +0,0 @@
1
- When /^I visit "(.*?)"$/ do |route|
2
- visit route
3
- end
4
-
5
- When /^fill in "(.*?)" with "(.*?)"$/ do |field, value|
6
- fill_in(field, :with => value)
7
- end
8
-
9
- When /^click "(.*?)"$/ do |button|
10
- click_button button
11
- end
12
-
13
- Then /^"(.*?)" key should have the "(.*?)" value in memcached$/ do |key, value|
14
- sleep 1
15
- Memcached.get(key).should == value
16
- end
@@ -1,3 +0,0 @@
1
- Given /^a key named "(.*?)" with the content "(.*?)" exists$/ do |key, value|
2
- Memcached.set(key, value)
3
- end
@@ -1,4 +0,0 @@
1
- Then /^I should see "(.*?)" and "(.*?)" keys in the listing$/ do |key1, key2|
2
- page.should have_content(key1)
3
- page.should have_content(key2)
4
- end
@@ -1,4 +0,0 @@
1
- Then /^I should be able to see the "(.*?)" key with the "(.*?)" value$/ do |key, value|
2
- page.should have_content(key)
3
- page.should have_content(value)
4
- end
@@ -1,5 +0,0 @@
1
- Then /^I should see memcached stats$/ do
2
- page.should have_content('Stats')
3
- page.should have_content("#{MemcachedConfigs[:host]}")
4
- page.should have_content("#{MemcachedConfigs[:port]}")
5
- end
@@ -1,28 +0,0 @@
1
- require 'cucumber'
2
- require 'capybara/cucumber'
3
- require 'faraday'
4
- require 'dalli'
5
- require 'rspec'
6
- require 'rspec/expectations'
7
- require 'capybara/poltergeist'
8
- require 'sinatra'
9
-
10
- Capybara.javascript_driver = :poltergeist
11
-
12
- World(RSpec::Matchers)
13
-
14
- # Files
15
- Dir.glob("lib/**/*.rb").each do |file|
16
- require_relative "../../#{file}"
17
- end
18
-
19
- Capybara.app = Rack::Builder.parse_file(File.expand_path('../../../config.ru', __FILE__)).first
20
-
21
- API = Faraday.new do |conn| conn.adapter :rack, Rack::URLMap.new({
22
- "/api" => MemcachedManager::API.new,
23
- "/" => MemcachedManager::Webapp.new
24
- })
25
- end
26
-
27
- MemcachedConfigs = { host: 'localhost', port: '11211' }
28
- Memcached = Dalli::Client.new("#{MemcachedConfigs[:host]}:#{MemcachedConfigs[:port]}")
@@ -1,3 +0,0 @@
1
- After do
2
- Memcached.flush
3
- end
@@ -1,9 +0,0 @@
1
- @webapp
2
- @javascript
3
- Feature: Create memcached pair
4
- Scenario: Success
5
- When I visit "#/new"
6
- And fill in "Key" with "foo"
7
- And fill in "Value" with "bar"
8
- And click "Create"
9
- Then "foo" key should have the "bar" value in memcached
@@ -1,8 +0,0 @@
1
- @webapp
2
- @javascript
3
- Feature: Delete memcached pair
4
- Scenario: Success
5
- Given a key named "foo" with the content "bar" exists
6
- When I visit "#/"
7
- And click on the X inside a div
8
- Then "foo" key shouldn't exist in memcached
@@ -1,9 +0,0 @@
1
- @webapp
2
- @javascript
3
- Feature: Edit memcached pair
4
- Scenario: Success
5
- Given a key named "foo" with the content "bar" exists
6
- When I visit "#/edit/foo"
7
- And fill in "Value" with "baz"
8
- And click "Edit"
9
- Then "foo" key should have the "baz" value in memcached
@@ -1,8 +0,0 @@
1
- @webapp
2
- @javascript
3
- Feature: List memcached pair
4
- Scenario: Success
5
- Given a key named "foo" with the content "bar" exists
6
- And a key named "fu" with the content "bar" exists
7
- When I visit "#/"
8
- Then I should see "foo" and "fu" keys in the listing
@@ -1,7 +0,0 @@
1
- @webapp
2
- @javascript
3
- Feature: Show memcached key
4
- Scenario: Success
5
- Given a key named "foo" with the content "bar" exists
6
- When I visit "#/key/foo"
7
- Then I should be able to see the "foo" key with the "bar" value
@@ -1,6 +0,0 @@
1
- @webapp
2
- @javascript
3
- Feature: Show memcached stats
4
- Scenario: Success
5
- When I visit "#/"
6
- Then I should see memcached stats
data/lib/api.rb DELETED
@@ -1,85 +0,0 @@
1
- # Sinatra
2
- require 'sinatra/base'
3
- require 'sinatra/contrib'
4
- require 'json'
5
-
6
- # Libs
7
- require 'dalli'
8
- require 'net/telnet'
9
-
10
- # Project files
11
- require_relative './extensions'
12
-
13
- module MemcachedManager
14
- class API < Sinatra::Base
15
- enable :inline_templates
16
- enable :sessions
17
-
18
- set :public_folder, 'public'
19
-
20
- helpers Sinatra::MemcachedSettings
21
- helpers Sinatra::MemcachedConnection
22
- helpers Sinatra::MemcachedInspector
23
- helpers Sinatra::Errors
24
- helpers Sinatra::APIResponse
25
-
26
- before do
27
- content_type :json
28
-
29
- setup_errors
30
-
31
- try { setup_memcached(memcached_host(session), memcached_port(session)) }
32
- end
33
-
34
- after do
35
- close_memcached
36
- end
37
-
38
- get '/config.json' do
39
- api_response { { host: memcached_host(session), port: memcached_port(session) } }
40
- end
41
-
42
- post '/config.json' do
43
- session['host'] = params['host']
44
- session['port'] = params['port']
45
-
46
- api_response { { host: memcached_host(session), port: memcached_port(session) } }
47
- end
48
-
49
- post '/keys.json' do
50
- try { memcached_connection.set(params[:key], params[:value]) }
51
-
52
- api_response { memcached_inspect(host: memcached_host(session), port: memcached_port(session), key: params[:key]) }
53
- end
54
-
55
- put '/keys.json' do
56
- try { memcached_connection.replace(params[:key], params[:value]) }
57
-
58
- api_response { memcached_inspect(host: memcached_host(session), port: memcached_port(session), key: params[:key]) }
59
- end
60
-
61
- get '/keys.json' do
62
- api_response do
63
- memcached_inspect(host: memcached_host(session), port: memcached_port(session))
64
- end
65
- end
66
-
67
- get '/keys/:key.json' do
68
- value = memcached_connection.get(params[:key])
69
-
70
- try { raise 'Key not found.' if value.nil? }
71
-
72
- api_response { { key: params[:key], value: value } }
73
- end
74
-
75
- delete '/keys/:key.json' do
76
- try { memcached_connection.delete(params[:key]) }
77
-
78
- api_response { { key: params[:key] } }
79
- end
80
-
81
- get '/stats.json' do
82
- api_response { memcached_connection.stats }
83
- end
84
- end
85
- end
data/lib/extensions.rb DELETED
@@ -1,14 +0,0 @@
1
- #TODO: autoload extensions
2
- require_relative 'extensions/errors'
3
- require_relative 'extensions/memcached_settings'
4
- require_relative 'extensions/memcached_connection'
5
- require_relative 'extensions/memcached_inspector'
6
- require_relative 'extensions/api_response'
7
-
8
- module Sinatra
9
- helpers Errors
10
- helpers MemcachedSettings
11
- helpers MemcachedConnection
12
- helpers MemcachedInspector
13
- helpers APIResponse
14
- end
@@ -1,15 +0,0 @@
1
- module Sinatra
2
- module APIResponse
3
- # This makes the api very DRY by taking care of API errors and converting the object
4
- # or value passed by the block to json.
5
- def api_response(&block)
6
- raise 'No block given' unless block_given?
7
-
8
- if errors.any?
9
- return { errors: errors }.to_json
10
- else
11
- block.call.tap {|response| return response.to_json }
12
- end
13
- end
14
- end
15
- end
@@ -1,19 +0,0 @@
1
- module Sinatra
2
- module Errors
3
- def setup_errors
4
- @errors = []
5
- end
6
-
7
- def try(&block)
8
- begin
9
- yield
10
- rescue Exception => e
11
- @errors << e.message
12
- end
13
- end
14
-
15
- def errors
16
- @errors
17
- end
18
- end
19
- end
@@ -1,15 +0,0 @@
1
- module Sinatra
2
- module MemcachedConnection
3
- def setup_memcached host, port
4
- @memcached = Dalli::Client.new("#{host}:#{port}")
5
- end
6
-
7
- def close_memcached
8
- @memcached.close
9
- end
10
-
11
- def memcached_connection
12
- @memcached
13
- end
14
- end
15
- end