movens 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in movens.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # movens
2
+ The configuration bootstrapping with redis backend.
3
+
4
+ ## Cofiguration
5
+ To configure the endpoints, use the following:
6
+
7
+ Movens.configure do |config|
8
+ config.host = "localhost"
9
+ config.port = 6379
10
+ config.db = "movens"
11
+ end
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/lib/movens.rb ADDED
@@ -0,0 +1,21 @@
1
+ require "movens/version"
2
+ require "movens/configuration"
3
+ require "redis"
4
+
5
+ module Movens
6
+ class << self
7
+ attr_accessor :configuration
8
+ attr_accessor :redis
9
+
10
+ def configure
11
+ self.configuration ||= Configuration.new
12
+ yield(configuration)
13
+ self.redis ||= Redis.new(:host => self.configuration[:host], :port => self.configuration[:port])
14
+ self.redis.select self.configuration[:db]
15
+ end
16
+
17
+ def [](option)
18
+ self.redis.get option
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ module Movens
2
+ class Configuration
3
+ OPTIONS = [:host, :port]
4
+
5
+ attr_accessor :host
6
+ attr_accessor :port
7
+ attr_accessor :db
8
+
9
+ def initialize
10
+ @host = "movens.thnkslc.com"
11
+ @port = "6380"
12
+ @db = "movens"
13
+ end
14
+
15
+ def [](option)
16
+ send(option)
17
+ end
18
+
19
+ def to_hash
20
+ OPTIONS.inject({}) do |hash, option|
21
+ hash.merge(option.to_sym => send(option))
22
+ end
23
+ end
24
+
25
+ def merge(hash)
26
+ to_hash.merge(hash)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ module Movens
2
+ VERSION = "0.0.1"
3
+ end
data/movens.gemspec ADDED
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "movens/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "movens"
7
+ s.version = Movens::VERSION
8
+ s.authors = ["Abhi Devireddy"]
9
+ s.email = ["abhi@devireddy.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Thnkslc Configuration Manager}
12
+ s.description = %q{Thnkslc Configuration Manager}
13
+
14
+ s.rubyforge_project = "movens"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ s.add_runtime_dependency "redis"
24
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: movens
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Abhi Devireddy
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-09-16 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: redis
16
+ requirement: &70215640853060 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70215640853060
25
+ description: Thnkslc Configuration Manager
26
+ email:
27
+ - abhi@devireddy.com
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files: []
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - README.md
35
+ - Rakefile
36
+ - lib/movens.rb
37
+ - lib/movens/configuration.rb
38
+ - lib/movens/version.rb
39
+ - movens.gemspec
40
+ homepage: ''
41
+ licenses: []
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ requirements: []
59
+ rubyforge_project: movens
60
+ rubygems_version: 1.8.9
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Thnkslc Configuration Manager
64
+ test_files: []