redsquare 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6e01942bde738c4203eeae03cc1e61c3a8a423c4
4
+ data.tar.gz: 655f6d5f299cf87753e7045d061a820c93474c9d
5
+ SHA512:
6
+ metadata.gz: 0bdea34c85ecf6be10c97fee60fb659ff8dba8ec2b6f3734a3ca16e3be30c2d2b674a765b6b03b125ce25a08fc7540df21e5a6c21ed9c2e9602ace0427ccd342
7
+ data.tar.gz: e166d7f76a00d41c721b15dcb7426daffc364dd5016bf404014fc33e4cab7097ea3f27c0899108b83d15b177b9fe1110592f50c73e3e816523e71fcace252a59
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .ruby-version
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ dump.rdb
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in redsquare.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 JC Grubbs
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Redsquare
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'redsquare'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install redsquare
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require "redsquare"
5
+ Redsquare::App.run!
6
+ rescue LoadError => e
7
+ require "rubygems"
8
+ path = File.expand_path "../../lib", __FILE__
9
+ $:.unshift(path) if File.directory?(path) && !$:.include?(path)
10
+ require "redsquare"
11
+ Redsquare::App.run!
12
+ end
@@ -0,0 +1,6 @@
1
+ require "redsquare/version"
2
+ require "active_support/all"
3
+ require "sinatra"
4
+ require "redis"
5
+ require "json"
6
+ require "redsquare/application/app"
@@ -0,0 +1,92 @@
1
+ module Redsquare
2
+ class App < Sinatra::Base
3
+
4
+ POST_COMMANDS = [
5
+ :setrange,
6
+ :setnx,
7
+ :setbit,
8
+ :set,
9
+ :sdiffstore,
10
+ :sadd,
11
+ :rpush,
12
+ :rpoplpush,
13
+ :rpop,
14
+ :renamex,
15
+ :rename,
16
+ :psetex,
17
+ :pexpireat,
18
+ :pexpire,
19
+ :persist,
20
+ :msetnx,
21
+ :mset,
22
+ :ltrim,
23
+ :lset,
24
+ :lrem,
25
+ :lpushx,
26
+ :lpush,
27
+ :lpop,
28
+ :linsert,
29
+ :incrbyfloat,
30
+ :incrby,
31
+ :incr,
32
+ :hsetnx,
33
+ :hset,
34
+ :hmset,
35
+ :hincrbyfloat,
36
+ :hincrby,
37
+ :hdel,
38
+ :getset,
39
+ :expireat,
40
+ :expire,
41
+ :del,
42
+ :decrby,
43
+ :decr,
44
+ :append
45
+ ]
46
+
47
+ GET_COMMANDS = [
48
+ :sinter,
49
+ :sdiff,
50
+ :scard,
51
+ :randomkey,
52
+ :pttl,
53
+ :mget,
54
+ :lrange,
55
+ :llen,
56
+ :lindex,
57
+ :keys,
58
+ :hvals,
59
+ :hmget,
60
+ :hlen,
61
+ :hkeys,
62
+ :hgetall,
63
+ :hget,
64
+ :hexists,
65
+ :getrange,
66
+ :getbit,
67
+ :get,
68
+ :exists,
69
+ :dump,
70
+ :dbsize
71
+ ]
72
+
73
+ POST_COMMANDS.each do |command|
74
+ post "/#{command}/?*" do
75
+ content_type :json
76
+ args = params[:splat].select { |a| a.present? }.compact
77
+ val = Redis.current.send command, *args
78
+ { result: val }.to_json
79
+ end
80
+ end
81
+
82
+ GET_COMMANDS.each do |command|
83
+ get "/#{command}/?*" do
84
+ content_type :json
85
+ args = params[:splat][0].split("/")
86
+ val = Redis.current.send command, *args
87
+ { result: val }.to_json
88
+ end
89
+ end
90
+
91
+ end
92
+ end
@@ -0,0 +1,17 @@
1
+ module Commands
2
+ module Keys
3
+
4
+ def self.included(klass)
5
+ redis = Redis.current
6
+
7
+ klass.class_eval do
8
+
9
+ get "/keys/(:pattern)" do
10
+ redis.keys
11
+ end
12
+
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Redsquare
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ require "redsquare/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "redsquare"
9
+ spec.version = Redsquare::VERSION
10
+ spec.authors = ["JC Grubbs"]
11
+ spec.email = ["jc.grubbs@devmynd.com"]
12
+ spec.description = %q{Redsquare is a server that supplies a restful interface to Redis.}
13
+ spec.summary = %q{Redsquare is a server that supplies a restful interface to Redis.}
14
+ spec.homepage = "http://github.com/thegrubbsian/redsquare"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "redis", "~> 3.0.4"
23
+ spec.add_dependency "sinatra", "~> 1.4.3"
24
+ spec.add_dependency "activesupport", ">= 3.2.0"
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.3"
27
+ spec.add_development_dependency "rake"
28
+ spec.add_development_dependency "rspec"
29
+ spec.add_development_dependency "pry"
30
+ end
metadata ADDED
@@ -0,0 +1,154 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redsquare
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - JC Grubbs
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-07-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: redis
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: sinatra
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 1.4.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 3.2.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Redsquare is a server that supplies a restful interface to Redis.
112
+ email:
113
+ - jc.grubbs@devmynd.com
114
+ executables:
115
+ - redsquare
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - .gitignore
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - bin/redsquare
125
+ - lib/redsquare.rb
126
+ - lib/redsquare/application/app.rb
127
+ - lib/redsquare/application/commands/keys.rb
128
+ - lib/redsquare/version.rb
129
+ - redsquare.gemspec
130
+ homepage: http://github.com/thegrubbsian/redsquare
131
+ licenses:
132
+ - MIT
133
+ metadata: {}
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ requirements: []
149
+ rubyforge_project:
150
+ rubygems_version: 2.0.2
151
+ signing_key:
152
+ specification_version: 4
153
+ summary: Redsquare is a server that supplies a restful interface to Redis.
154
+ test_files: []