all_seeing_eye 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -3,6 +3,8 @@ source "http://rubygems.org"
3
3
  gem 'redis'
4
4
  gem 'chronic'
5
5
  gem 'rbtree'
6
+ gem 'sinatra'
7
+ gem 'vegas'
6
8
 
7
9
  group :development do
8
10
  gem "bundler", "~> 1.0.0"
data/Gemfile.lock CHANGED
@@ -7,10 +7,17 @@ GEM
7
7
  bundler (~> 1.0)
8
8
  git (>= 1.2.5)
9
9
  rake
10
+ rack (1.2.3)
10
11
  rake (0.9.2)
11
12
  rbtree (0.3.0)
12
13
  rcov (0.9.10)
13
14
  redis (2.2.2)
15
+ sinatra (1.2.6)
16
+ rack (~> 1.1)
17
+ tilt (< 2.0, >= 1.2.2)
18
+ tilt (1.3.2)
19
+ vegas (0.1.8)
20
+ rack (>= 1.0.0)
14
21
 
15
22
  PLATFORMS
16
23
  ruby
@@ -22,3 +29,5 @@ DEPENDENCIES
22
29
  rbtree
23
30
  rcov
24
31
  redis
32
+ sinatra
33
+ vegas
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{all_seeing_eye}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josh Symonds"]
@@ -48,6 +48,7 @@ Gem::Specification.new do |s|
48
48
  "test/base_test.rb",
49
49
  "test/fixtures/all_seeing_eye.yml",
50
50
  "test/fixtures/redis-test.conf",
51
+ "test/fixtures/redis.yml",
51
52
  "test/model_test.rb",
52
53
  "test/test_helper.rb"
53
54
  ]
@@ -64,6 +65,8 @@ Gem::Specification.new do |s|
64
65
  s.add_runtime_dependency(%q<redis>, [">= 0"])
65
66
  s.add_runtime_dependency(%q<chronic>, [">= 0"])
66
67
  s.add_runtime_dependency(%q<rbtree>, [">= 0"])
68
+ s.add_runtime_dependency(%q<sinatra>, [">= 0"])
69
+ s.add_runtime_dependency(%q<vegas>, [">= 0"])
67
70
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
68
71
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
69
72
  s.add_development_dependency(%q<rcov>, [">= 0"])
@@ -71,6 +74,8 @@ Gem::Specification.new do |s|
71
74
  s.add_dependency(%q<redis>, [">= 0"])
72
75
  s.add_dependency(%q<chronic>, [">= 0"])
73
76
  s.add_dependency(%q<rbtree>, [">= 0"])
77
+ s.add_dependency(%q<sinatra>, [">= 0"])
78
+ s.add_dependency(%q<vegas>, [">= 0"])
74
79
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
75
80
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
76
81
  s.add_dependency(%q<rcov>, [">= 0"])
@@ -79,6 +84,8 @@ Gem::Specification.new do |s|
79
84
  s.add_dependency(%q<redis>, [">= 0"])
80
85
  s.add_dependency(%q<chronic>, [">= 0"])
81
86
  s.add_dependency(%q<rbtree>, [">= 0"])
87
+ s.add_dependency(%q<sinatra>, [">= 0"])
88
+ s.add_dependency(%q<vegas>, [">= 0"])
82
89
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
83
90
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
84
91
  s.add_dependency(%q<rcov>, [">= 0"])
@@ -1,43 +1,28 @@
1
- class AllSeeingEye
2
- def self.configuration(location = nil)
3
- location ||= 'config'
4
- @@configuration ||= if defined?(Rails)
5
- YAML::load_file("#{Rails.root}/#{location}/all_seeing_eye.yml")
6
- else
7
- YAML::load_file("./#{location}/all_seeing_eye.yml")
8
- end
9
- @@configuration
1
+ class AllSeeingEye
2
+ def self.environment
3
+ ENV['RUBBER_ENV'] || ENV['RAILS_ENV'] || ENV['ALL_SEEING_EYE_ENV'] || 'development'
10
4
  end
11
-
12
- def self.redis(options = {})
13
- @host, @port = options[:host], options[:port]
14
-
15
- unless @host && @port
5
+
6
+ def self.configuration
7
+ location = ENV['ALL_SEEING_EYE_CONFIG'] || 'config'
8
+ @@configuration ||= Hash.new
9
+ @@configuration[:redis] ||=
16
10
  begin
17
- resque_config = if defined?(Rails)
18
- YAML::load_file("#{Rails.root}/#{location}/resque.yml")
19
- else
20
- YAML::load_file("./#{location}/resque.yml")
21
- end
22
- @host = resque_config[ENV['RAILS_ENV']].split(':').first
23
- @port = resque_config[ENV['RAILS_ENV']].split(':').first
11
+ YAML::load_file("./#{location}/resque.yml")[AllSeeingEye.environment]
24
12
  rescue
25
- end
26
-
27
- begin
28
- redis_config = if defined?(Rails)
29
- YAML::load_file("#{Rails.root}/#{location}/resque.yml")
30
- else
31
- YAML::load_file("./#{location}/resque.yml")
13
+ begin
14
+ YAML::load_file("./#{location}/redis.yml")[AllSeeingEye.environment]
15
+ rescue
16
+ 'localhost:6379'
32
17
  end
33
- @host = resque_config[ENV['RAILS_ENV']].split(':').first
34
- @port = resque_config[ENV['RAILS_ENV']].split(':').first
35
- rescue
36
18
  end
37
- end
38
-
39
- @host, @port = 'localhost', 6379 unless @host && @port
40
- @@redis ||= Redis.new(:host => @host, :port => @port)
19
+ @@configuration[:all_seeing_eye] ||= YAML::load_file("./#{location}/all_seeing_eye.yml")
20
+ @@configuration
21
+ end
22
+
23
+ def self.redis
24
+ @@redis ||= Redis.new(:host => AllSeeingEye.configuration[:redis].split(':').first,
25
+ :port => AllSeeingEye.configuration[:redis].split(':').last)
41
26
  end
42
27
  end
43
28
 
@@ -10,7 +10,7 @@ class AllSeeingEye::Model
10
10
  end
11
11
 
12
12
  def self.fields
13
- AllSeeingEye.configuration[self.model_name]
13
+ AllSeeingEye.configuration[:all_seeing_eye][self.model_name]
14
14
  end
15
15
 
16
16
  def self.field_keys
@@ -23,7 +23,7 @@ class AllSeeingEye
23
23
  end
24
24
 
25
25
  def url_path(*path_parts)
26
- [ path_prefix, path_parts ].join("/").squeeze('/')
26
+ [ path_prefix, path_parts ].compact.join("/").squeeze('/')
27
27
  end
28
28
  alias_method :u, :url_path
29
29
 
data/test/base_test.rb CHANGED
@@ -1,8 +1,12 @@
1
1
  require 'test_helper'
2
2
 
3
3
  context 'with the base class' do
4
+ test 'get the environment' do
5
+ assert 'test', AllSeeingEye.environment
6
+ end
7
+
4
8
  test 'load the configuration' do
5
- assert AllSeeingEye.configuration['model']
9
+ assert AllSeeingEye.configuration[:all_seeing_eye]['model']
6
10
  end
7
11
 
8
12
  test 'connect to Redis' do
@@ -0,0 +1 @@
1
+ test: localhost:9736
data/test/test_helper.rb CHANGED
@@ -5,6 +5,8 @@ $LOAD_PATH.unshift dir + '/../lib'
5
5
  require 'test/unit'
6
6
  require 'yaml'
7
7
  require 'all_seeing_eye'
8
+ ENV['ALL_SEEING_EYE_ENV'] = 'test'
9
+ ENV['ALL_SEEING_EYE_CONFIG'] = 'test/fixtures'
8
10
 
9
11
  if !system("which redis-server")
10
12
  puts '', "** can't find `redis-server` in your path"
@@ -30,9 +32,6 @@ end
30
32
 
31
33
  puts "Starting redis for testing at localhost:9736..."
32
34
  `redis-server #{dir}/fixtures/redis-test.conf`
33
- AllSeeingEye.redis(:host => 'localhost', :port => 9736)
34
-
35
- AllSeeingEye.configuration('test/fixtures')
36
35
 
37
36
  ##
38
37
  # test/spec/mini 3
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: all_seeing_eye
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Josh Symonds
@@ -61,8 +61,36 @@ dependencies:
61
61
  version_requirements: *id003
62
62
  prerelease: false
63
63
  - !ruby/object:Gem::Dependency
64
- type: :development
64
+ type: :runtime
65
65
  requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ name: sinatra
75
+ version_requirements: *id004
76
+ prerelease: false
77
+ - !ruby/object:Gem::Dependency
78
+ type: :runtime
79
+ requirement: &id005 !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ name: vegas
89
+ version_requirements: *id005
90
+ prerelease: false
91
+ - !ruby/object:Gem::Dependency
92
+ type: :development
93
+ requirement: &id006 !ruby/object:Gem::Requirement
66
94
  none: false
67
95
  requirements:
68
96
  - - ~>
@@ -74,11 +102,11 @@ dependencies:
74
102
  - 0
75
103
  version: 1.0.0
76
104
  name: bundler
77
- version_requirements: *id004
105
+ version_requirements: *id006
78
106
  prerelease: false
79
107
  - !ruby/object:Gem::Dependency
80
108
  type: :development
81
- requirement: &id005 !ruby/object:Gem::Requirement
109
+ requirement: &id007 !ruby/object:Gem::Requirement
82
110
  none: false
83
111
  requirements:
84
112
  - - ~>
@@ -90,11 +118,11 @@ dependencies:
90
118
  - 4
91
119
  version: 1.6.4
92
120
  name: jeweler
93
- version_requirements: *id005
121
+ version_requirements: *id007
94
122
  prerelease: false
95
123
  - !ruby/object:Gem::Dependency
96
124
  type: :development
97
- requirement: &id006 !ruby/object:Gem::Requirement
125
+ requirement: &id008 !ruby/object:Gem::Requirement
98
126
  none: false
99
127
  requirements:
100
128
  - - ">="
@@ -104,7 +132,7 @@ dependencies:
104
132
  - 0
105
133
  version: "0"
106
134
  name: rcov
107
- version_requirements: *id006
135
+ version_requirements: *id008
108
136
  prerelease: false
109
137
  description: AllSeeingEye observes all requests, with parameters that you specify, to Redis. Then it composes them into graphs for you to see.
110
138
  email: veraticus@gmail.com
@@ -145,6 +173,7 @@ files:
145
173
  - test/base_test.rb
146
174
  - test/fixtures/all_seeing_eye.yml
147
175
  - test/fixtures/redis-test.conf
176
+ - test/fixtures/redis.yml
148
177
  - test/model_test.rb
149
178
  - test/test_helper.rb
150
179
  has_rdoc: true