koala-rails 0.0.1

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.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2010 Steven Hancock
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/README.rdoc ADDED
@@ -0,0 +1,18 @@
1
+ = koala-rails
2
+
3
+ Installer and helpers for using Koala with Rails 3
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Steven Hancock. See LICENSE for details.
18
+
@@ -0,0 +1,19 @@
1
+ require 'generators/koala'
2
+
3
+ module Koala
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ extend TemplatePath
7
+
8
+ def copy_config_file
9
+ template "config/facebook.yml.tt", "config/facebook.yml"
10
+ end
11
+
12
+ def copy_initializer_file
13
+ template "config/initializers/koala.rb.tt", "config/initializers/koala.rb"
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+
@@ -0,0 +1,10 @@
1
+ development:
2
+ app_id: YOUR APP ID
3
+ secret: YOUR SECRET
4
+ test:
5
+ app_id: YOUR APP ID
6
+ secret: YOUR SECRET
7
+ production:
8
+ app_id: YOUR APP ID
9
+ secret: YOUR SECRET
10
+
@@ -0,0 +1,24 @@
1
+ # config/initializers/koala.rb
2
+ # Monkey-patch in Facebook config so Koala knows to
3
+ # automatically use Facebook settings from here if none are given
4
+
5
+ module Facebook
6
+ CONFIG = YAML.load(ERB.new(File.read("#{RAILS_ROOT}/config/facebook.yml")).result)[RAILS_ENV]
7
+ APP_ID = CONFIG['app_id']
8
+ SECRET = CONFIG['secret_key']
9
+ end
10
+
11
+ Koala::Facebook::OAuth.class_eval do
12
+ def initialize_with_default_settings(*args)
13
+ case args.size
14
+ when 0, 1
15
+ raise "application id and/or secret are not specified in the config" unless Facebook::APP_ID && Facebook::SECRET
16
+ initialize_without_default_settings(Facebook::APP_ID.to_s, Facebook::SECRET.to_s, args.first)
17
+ when 2, 3
18
+ initialize_without_default_settings(*args)
19
+ end
20
+ end
21
+
22
+ alias_method_chain :initialize, :default_settings
23
+ end
24
+
@@ -0,0 +1,10 @@
1
+ module Koala
2
+ module Generators
3
+ module TemplatePath
4
+ def source_root
5
+ @_koala_source_root ||= File.expand_path(File.join(File.dirname(__FILE__), 'koala', generator_name, 'templates'))
6
+ end
7
+ end
8
+ end
9
+ end
10
+
@@ -0,0 +1,12 @@
1
+ module KoalaRails
2
+ module Helpers
3
+ def facebook_cookies
4
+ @facebook_cookies ||= Koala::Facebook::OAuth.new.get_user_from_cookie(cookies)
5
+ end
6
+
7
+ def facebook_token
8
+ @facebook_token ||= facebook_cookies['access_token']
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,4 @@
1
+ module KoalaRails
2
+ VERSION = "0.0.1"
3
+ end
4
+
@@ -0,0 +1,6 @@
1
+ require "koala-rails/helpers"
2
+
3
+ ActiveSupport.on_load(:action_controller) do
4
+ include KoalaRails::Helpers
5
+ end
6
+
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: koala-rails
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Steven Hancock
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-06-21 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: koala
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 5
30
+ segments:
31
+ - 0
32
+ - 7
33
+ - 3
34
+ version: 0.7.3
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: Installer and helpers for using Koala with Rails 3
38
+ email:
39
+ - stevenh512@gmail.com
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - lib/koala-rails.rb
48
+ - lib/generators/koala/install/install_generator.rb
49
+ - lib/generators/koala.rb
50
+ - lib/koala-rails/version.rb
51
+ - lib/koala-rails/helpers.rb
52
+ - lib/generators/koala/install/templates/config/facebook.yml.tt
53
+ - lib/generators/koala/install/templates/config/initializers/koala.rb.tt
54
+ - LICENSE
55
+ - README.rdoc
56
+ has_rdoc: true
57
+ homepage: http://github.com/stevenh512/koala-rails
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options: []
62
+
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !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
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 23
80
+ segments:
81
+ - 1
82
+ - 3
83
+ - 6
84
+ version: 1.3.6
85
+ requirements: []
86
+
87
+ rubyforge_project: koala-rails
88
+ rubygems_version: 1.3.7
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: Installer and helpers for using Koala with Rails 3
92
+ test_files: []
93
+