facebook-rails-starterkit 0.1.1 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,12 +1,16 @@
1
1
  source :rubygems
2
2
 
3
3
  # Facebook
4
- gem 'koala', '~> 1.3.0'
4
+ gem 'koala', '>= 1.4.0'
5
5
  gem 'hashie', '~> 1.2.0'
6
6
  gem 'joey', '~> 0.1.1', :git => 'git://github.com/kristianmandrup/Joey.git' # wrapper on top of koala
7
7
 
8
- group :development do
8
+ group :development, :Test do
9
9
  gem "rspec", ">= 2.8.0"
10
+ end
11
+
12
+
13
+ group :development do
10
14
  gem "rdoc", ">= 3.12"
11
15
  gem "bundler", ">= 1.1.0"
12
16
  gem "jeweler", ">= 1.8.3"
@@ -22,9 +22,9 @@ GEM
22
22
  rake
23
23
  rdoc
24
24
  json (1.6.6)
25
- koala (1.3.0)
25
+ koala (1.4.1)
26
26
  faraday (~> 0.7.0)
27
- multi_json (~> 1.0)
27
+ multi_json (~> 1.3.0)
28
28
  multi_json (1.3.2)
29
29
  multipart-post (1.1.5)
30
30
  rack (1.4.1)
@@ -52,7 +52,7 @@ DEPENDENCIES
52
52
  hashie (~> 1.2.0)
53
53
  jeweler (>= 1.8.3)
54
54
  joey (~> 0.1.1)!
55
- koala (~> 1.3.0)
55
+ koala (>= 1.4.0)
56
56
  rdoc (>= 3.12)
57
57
  rspec (>= 2.8.0)
58
58
  simplecov (>= 0.5)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "facebook-rails-starterkit"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
12
- s.date = "2012-04-23"
12
+ s.date = "2012-05-03"
13
13
  s.description = "Make it simple to get started using Facebook with Rails!"
14
14
  s.email = "kmandrup@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -32,20 +32,23 @@ Gem::Specification.new do |s|
32
32
  "lib/facebook/app.rb",
33
33
  "lib/facebook/auth/devise.rb",
34
34
  "lib/facebook/graph_api.rb",
35
+ "spec/facebook-rails-starterkit/config_loader/yaml_spec.rb",
35
36
  "spec/facebook-rails-starterkit_spec.rb",
37
+ "spec/fixtures/config/facebook.yml",
38
+ "spec/fixtures/config/htc.yml",
36
39
  "spec/spec_helper.rb"
37
40
  ]
38
41
  s.homepage = "http://github.com/kristianmandrup/facebook-rails-starterkit"
39
42
  s.licenses = ["MIT"]
40
43
  s.require_paths = ["lib"]
41
- s.rubygems_version = "1.8.22"
44
+ s.rubygems_version = "1.8.24"
42
45
  s.summary = "Starterkit for using Facebook with Rails"
43
46
 
44
47
  if s.respond_to? :specification_version then
45
48
  s.specification_version = 3
46
49
 
47
50
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
- s.add_runtime_dependency(%q<koala>, ["~> 1.3.0"])
51
+ s.add_runtime_dependency(%q<koala>, [">= 1.4.0"])
49
52
  s.add_runtime_dependency(%q<hashie>, ["~> 1.2.0"])
50
53
  s.add_runtime_dependency(%q<joey>, ["~> 0.1.1"])
51
54
  s.add_development_dependency(%q<rspec>, [">= 2.8.0"])
@@ -54,7 +57,7 @@ Gem::Specification.new do |s|
54
57
  s.add_development_dependency(%q<jeweler>, [">= 1.8.3"])
55
58
  s.add_development_dependency(%q<simplecov>, [">= 0.5"])
56
59
  else
57
- s.add_dependency(%q<koala>, ["~> 1.3.0"])
60
+ s.add_dependency(%q<koala>, [">= 1.4.0"])
58
61
  s.add_dependency(%q<hashie>, ["~> 1.2.0"])
59
62
  s.add_dependency(%q<joey>, ["~> 0.1.1"])
60
63
  s.add_dependency(%q<rspec>, [">= 2.8.0"])
@@ -64,7 +67,7 @@ Gem::Specification.new do |s|
64
67
  s.add_dependency(%q<simplecov>, [">= 0.5"])
65
68
  end
66
69
  else
67
- s.add_dependency(%q<koala>, ["~> 1.3.0"])
70
+ s.add_dependency(%q<koala>, [">= 1.4.0"])
68
71
  s.add_dependency(%q<hashie>, ["~> 1.2.0"])
69
72
  s.add_dependency(%q<joey>, ["~> 0.1.1"])
70
73
  s.add_dependency(%q<rspec>, [">= 2.8.0"])
@@ -1,32 +1,42 @@
1
+ require 'hashie'
2
+
1
3
  module ConfigLoader
2
4
  class Yaml
3
- def initialize path, file_name
4
- @path = path
5
+ attr_reader :path, :file_name, :ext, :file_path, :root
5
6
 
6
- file_name += '.yml' unless file_name =~ /\.ya?ml/
7
- @file_name = file_name
8
-
9
- Hashie::Mash.new yaml
7
+ # will try root element if such exists
8
+ def initialize file_path, root = nil
9
+ @file_path = file_path
10
+ @path = File.dirname file_path
11
+ @file_name = File.basename file_path
12
+ @ext = file_name.split(/(ya?ml$)/).last
13
+ @root = (root || file_name.split('.').first).to_s
14
+ @root = nil unless mashie.send(@root)
15
+ @mashie = mashie.send(@root) if @root
10
16
  end
11
-
12
- protected
13
17
 
14
- def yaml
15
- @yaml ||= YAML::load File.open(file_path)
18
+ def as_hash
19
+ @as_hash ||= mashie
16
20
  end
17
21
 
18
- def config_path
19
- @config_path ||= File.join Rails.root, 'config'
22
+ def as_yaml
23
+ @as_yaml ||= ::YAML::load File.open(config_file_path)
24
+ end
25
+
26
+ protected
27
+
28
+ def mashie
29
+ @mashie ||= ::Hashie::Mash.new as_yaml
20
30
  end
21
31
 
22
- def file_path
23
- @file_path = File.join config_path, path, file_name
32
+ def config_file_path
33
+ @config_file_path ||= File.join(Rails.root.to_s, 'config', file_path)
24
34
  end
25
35
  end
26
36
 
27
37
  module Delegator
28
38
  def method_missing(m, *args, &block)
29
- raise 'A #config method must be defined for the LoaderDelegator to work' unless respond_to?(:config)
39
+ raise "A #config method must be defined in the container for ConfigLoader::Delegator, for it to delegate to #config: delegation attempted with #{m}" unless self.respond_to?(:config)
30
40
  config.send(m)
31
41
  end
32
42
  end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ module Rails
4
+ def self.root
5
+ File.join SPEC_DIR, 'fixtures'
6
+ end
7
+ end
8
+
9
+ describe ConfigLoader::Yaml do
10
+ subject { config }
11
+ let(:config) { ConfigLoader::Yaml.new('facebook.yml') }
12
+
13
+ its(:file_name) { should == 'facebook.yml' }
14
+ its(:root) { should == 'facebook' }
15
+ its(:ext) { should == 'yml' }
16
+
17
+ its(:as_yaml) { should_not be_nil }
18
+ its(:as_hash) { should be_a Hash }
19
+
20
+ specify { subject.as_hash.domain == 'www.facebook.com' }
21
+
22
+ describe 'no root' do
23
+ subject { config }
24
+ let(:config) { ConfigLoader::Yaml.new('htc.yml') }
25
+
26
+ its(:root) { should == nil }
27
+ specify { subject.as_hash.domain == 'www.htc.com' }
28
+ end
29
+
30
+ describe 'specific root' do
31
+ subject { config }
32
+ let(:config) { ConfigLoader::Yaml.new('htc.yml', :root) }
33
+
34
+ its(:root) { should == 'root' }
35
+ specify { subject.as_hash.domain == 'www.htc.dk' }
36
+ end
37
+ end
@@ -1,7 +1,4 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
1
+ require 'spec_helper'
2
2
 
3
3
  describe "FacebookRailsStarterkit" do
4
- it "fails" do
5
- fail "hey buddy, you should probably rename this file and start specing for real"
6
- end
7
4
  end
@@ -0,0 +1,3 @@
1
+ facebook:
2
+ domain: www.facebook.com
3
+ app_id: 12345
@@ -0,0 +1,3 @@
1
+ domain: www.htc.com
2
+ root:
3
+ domain: www.domain.dk
@@ -1,11 +1,7 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
1
  require 'rspec'
4
2
  require 'facebook-rails-starterkit'
5
3
 
6
- # Requires supporting files with custom matchers and macros, etc,
7
- # in ./support/ and its subdirectories.
8
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
4
+ SPEC_DIR = File.dirname(__FILE__)
9
5
 
10
6
  RSpec.configure do |config|
11
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebook-rails-starterkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-23 00:00:00.000000000 Z
12
+ date: 2012-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: koala
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.3.0
21
+ version: 1.4.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.3.0
29
+ version: 1.4.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: hashie
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -162,7 +162,10 @@ files:
162
162
  - lib/facebook/app.rb
163
163
  - lib/facebook/auth/devise.rb
164
164
  - lib/facebook/graph_api.rb
165
+ - spec/facebook-rails-starterkit/config_loader/yaml_spec.rb
165
166
  - spec/facebook-rails-starterkit_spec.rb
167
+ - spec/fixtures/config/facebook.yml
168
+ - spec/fixtures/config/htc.yml
166
169
  - spec/spec_helper.rb
167
170
  homepage: http://github.com/kristianmandrup/facebook-rails-starterkit
168
171
  licenses:
@@ -179,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
179
182
  version: '0'
180
183
  segments:
181
184
  - 0
182
- hash: -1126046914443620564
185
+ hash: 357547551403460719
183
186
  required_rubygems_version: !ruby/object:Gem::Requirement
184
187
  none: false
185
188
  requirements:
@@ -188,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
191
  version: '0'
189
192
  requirements: []
190
193
  rubyforge_project:
191
- rubygems_version: 1.8.22
194
+ rubygems_version: 1.8.24
192
195
  signing_key:
193
196
  specification_version: 3
194
197
  summary: Starterkit for using Facebook with Rails