blue_velvet 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,11 +1,32 @@
1
+ [![Heineken? Fuck that shit!](https://sphotos-a.xx.fbcdn.net/hphotos-prn1/552344_137798096358473_725002513_n.jpg)](http://www.youtube.com/watch?v=snhiofL2Rh4)
2
+
1
3
  # BlueVelvet
2
4
 
3
5
  BlueVelvet is a content management system that uses the Facebook
4
6
  platform as the data store. It allows you to map route actions to
5
7
  Facebook API calls and display the results with partials in your other
6
- pages. You can even subclass the controller and create your own actions,
8
+ ages. You can even subclass the controller and create your own actions,
7
9
  using one or more of your Facebook page's plethora of properties.
8
10
 
11
+ [![Build Status](https://secure.travis-ci.org/tubbo/blue_velvet.png?branch=master)](http://travis-ci.org/tubbo/blue_velvet)
12
+
13
+ ## In The Wild
14
+
15
+ BlueVelvet can be observed "in the wild" on <http://thewonderbars.com>.
16
+ I've also [open-sourced the
17
+ codebase](https://github.com/tubbo/thewonderbars.com/tree/develop) to
18
+ give an example as to how this gem could be/is being used.
19
+
20
+ **NOTE:** At this time, I haven't deployed the site using blue_velvet to
21
+ the server for <http://thewonderbars.com>. I've been very busy with work
22
+ and setting up gigs for the band, so I haven't gotten around to getting
23
+ all that up and running. In keeping with my philosophy of reserving the
24
+ 'master' branch for the working, released version of the code, the
25
+ source tree using this gem is available in the 'develop' branch. Soon, I
26
+ will merge this branch into master and BlueVelvet will deploy on
27
+ <http://thewonderbars.com>. Until then, check out the source and if you
28
+ don't believe me, download the app and run it yourself!
29
+
9
30
  ## Usage
10
31
 
11
32
  Add the gem to your Gemfile
@@ -17,12 +38,33 @@ Then rebundle
17
38
  $ bundle install
18
39
 
19
40
  Generate the Facebook configuration YAML file and edit it with your
20
- Facebook App details. Obtain your Facebook page ID from the URL of your
21
- Facebook page, it's the number at the end, after the hyphenated name and
22
- a "/"..
41
+ Facebook App details. If you don't know how to do that, look below
42
+ in the "Configuration" section.
23
43
 
24
44
  $ rails generate facebook:config
25
45
 
46
+ It should look something like this:
47
+
48
+ ```yaml
49
+ # This is your Facebook configuration file. Put your Facebook app info in this file
50
+ # and it will be read by the Rails application.
51
+
52
+ development:
53
+ app_id:
54
+ secret_key:
55
+ page_id:
56
+
57
+ test:
58
+ app_id:
59
+ secret_key:
60
+ page_id:
61
+
62
+ production:
63
+ app_id:
64
+ secret_key:
65
+ page_id:
66
+ ```
67
+
26
68
  And finally, add the query to your `config/routes.rb`:
27
69
 
28
70
  get "/about" => "facebook/page#description"
@@ -34,6 +76,25 @@ Facebook page's description!
34
76
  For more information on the many properties available to you, check out
35
77
  the API documentation.
36
78
 
79
+ ## Configuration
80
+
81
+ All configuration is taken care of in a file called
82
+ `config/facebook.yml`. This is also the file used by
83
+ [Koala](https://github.com/arsduo/koala), the gem that is actually
84
+ communicating with the Facebook Graph API, so if you're used
85
+ to working with that configuration this should be easy for you.
86
+
87
+ In order to use blue_velvet, you must create a Facebook app on
88
+ <https://developers.facebook.com>. Once you do that, obtain the
89
+ following information from the new app page on the control panel:
90
+
91
+ - App ID/API Key
92
+ - App Secret
93
+ - Your Facebook page ID, which can be obtained by visiting your Facebook page and observing the number at the very end of the address bar, right after the "/".
94
+
95
+ Add that information into your YAML config, and you can begin using
96
+ blue_velvet in your application.
97
+
37
98
  ## Background
38
99
 
39
100
  This project is the result of the work I've done on my band's website,
@@ -77,3 +138,10 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
77
138
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
78
139
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
79
140
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
141
+
142
+ ## Extended Documentation
143
+
144
+ - [Facebook API documentation](https://developers.facebook.com)
145
+ - [Facebook Apps Control Panel](https://developers.facebook.com/apps)
146
+ - [RDoc code documentation](http://rdoc.info/github/tubbo/blue_velvet/master/frames)
147
+ - [RubyGems page](https://rubygems.org/gems/blue_velvet)
data/Rakefile CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env rake
2
2
  begin
3
3
  require 'bundler/setup'
4
+ require 'bundler/gem_tasks'
4
5
  rescue LoadError
5
6
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
7
  end
@@ -1,3 +1,3 @@
1
1
  module BlueVelvet
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -0,0 +1,15 @@
1
+ Description:
2
+ Creates YAML configuration in +config/facebook.yml+ which helps you
3
+ connect to the Facebook platform. Required inherently by Koala, which
4
+ forms the backend of this gem. Also creates a file in
5
+ +config/initializers+ that helps set up Koala with this
6
+ configuration. You may optionally use this file to pass
7
+ configuration to Koala directly, as it conforms to most people's
8
+ conventional use of the gem.
9
+
10
+ Example:
11
+ rails generate facebook:config
12
+
13
+ This will create:
14
+ config/facebook.yml
15
+ config/initializers/koala.rb
@@ -0,0 +1,13 @@
1
+ module Facebook
2
+ # Generate configuration for BlueVelvet and Koala.
3
+ class ConfigGenerator < Rails::Generators::Base
4
+ desc "Copies Facebook/Koala configuration to your application"
5
+ source_root File.expand_path('../templates', __FILE__)
6
+
7
+ # Edit this file with your Facebook app details
8
+ def copy_configuration
9
+ copy_file "facebook.yml", "config/facebook.yml"
10
+ copy_file "koala.rb", "config/initializers/koala.rb"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ # This is your Facebook configuration file. Put your Facebook app info in this file
2
+ # and it will be read by the Rails application. and BlueVelvet.
3
+
4
+ development:
5
+ app_id:
6
+ secret_key:
7
+ page_id:
8
+
9
+ test:
10
+ app_id:
11
+ secret_key:
12
+ page_id:
13
+
14
+ production:
15
+ app_id:
16
+ secret_key:
17
+ page_id:
18
+
@@ -0,0 +1,29 @@
1
+ require 'koala'
2
+
3
+ module Facebook
4
+ def self.config
5
+ if Rails.env.staging?
6
+ ActiveSupport::HashWithIndifferentAccess.new \
7
+ app_id: ENV['FB_APP_ID'],
8
+ secret_key: ENV['FB_SECRET_KEY'],
9
+ page_id: ENV['FB_PAGE_ID']
10
+ else
11
+ ActiveSupport::HashWithIndifferentAccess.new \
12
+ YAML.load_file(Rails.root.join("config/facebook.yml"))[Rails.env]
13
+ end
14
+ end
15
+ end
16
+
17
+ Koala::Facebook::OAuth.class_eval do
18
+ def initialize_with_default_settings(*args)
19
+ case args.size
20
+ when 0, 1
21
+ raise "application id and/or secret are not specified in the config" unless Facebook.config[:app_id].present? && Facebook.config[:secret_key].present?
22
+ initialize_without_default_settings(Facebook.config[:app_id], Facebook.config[:secret], args.first)
23
+ when 2, 3
24
+ initialize_without_default_settings(*args)
25
+ end
26
+ end
27
+
28
+ alias_method_chain :initialize, :default_settings
29
+ end
@@ -0,0 +1,12 @@
1
+ Description:
2
+ Copies internal gem views for use in the main app. Any view files
3
+ encountered in the app in the same location as those in the engine
4
+ will override the default views, so this generator allows you to
5
+ customize the display of your Facebook content.
6
+
7
+ Example:
8
+ rails generate facebook:views
9
+
10
+ This will create:
11
+ app/views/facebook/page/_attribute_not_found.html.haml
12
+ app/views/facebook/page/_page_attribute.html.haml
@@ -0,0 +1,11 @@
1
+ module Facebook
2
+ # Generate views for the Facebook namespace.
3
+ class ViewsGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../../../../../app/views', __FILE__)
5
+
6
+ def copy_views
7
+ directory "facebook", "app/views/facebook"
8
+ end
9
+ end
10
+ end
11
+
@@ -933,3 +933,65 @@ Processing by Facebook::PageController#events as HTML
933
933
  Rendered /Users/necromancer/Code/blue_velvet/app/views/facebook/page/_attribute_not_found.html.erb (0.5ms)
934
934
  Completed 200 OK in 14ms (Views: 1.8ms | ActiveRecord: 0.0ms)
935
935
   (0.1ms) rollback transaction
936
+ Connecting to database specified by database.yml
937
+  (3.1ms) begin transaction
938
+  (0.1ms) rollback transaction
939
+  (0.1ms) begin transaction
940
+  (0.0ms) rollback transaction
941
+  (0.0ms) begin transaction
942
+  (0.1ms) rollback transaction
943
+  (0.1ms) begin transaction
944
+  (0.1ms) rollback transaction
945
+  (0.1ms) begin transaction
946
+  (0.1ms) rollback transaction
947
+  (0.0ms) begin transaction
948
+  (0.1ms) rollback transaction
949
+  (0.1ms) begin transaction
950
+  (0.1ms) rollback transaction
951
+  (0.0ms) begin transaction
952
+  (0.0ms) rollback transaction
953
+  (0.0ms) begin transaction
954
+  (0.0ms) rollback transaction
955
+  (0.0ms) begin transaction
956
+  (0.0ms) rollback transaction
957
+  (0.1ms) begin transaction
958
+ Processing by Facebook::PageController#events as HTML
959
+ Rendered /Users/necromancer/Code/blue_velvet/app/views/facebook/page/_attribute_not_found.html.erb (2.9ms)
960
+ Completed 200 OK in 65ms (Views: 43.7ms | ActiveRecord: 0.0ms)
961
+  (0.1ms) rollback transaction
962
+  (0.1ms) begin transaction
963
+ Processing by Facebook::PageController#about as HTML
964
+ Rendered /Users/necromancer/Code/blue_velvet/app/views/facebook/page/_page_attribute.html.erb (1.0ms)
965
+ Completed 200 OK in 327ms (Views: 16.6ms | ActiveRecord: 0.0ms)
966
+  (0.1ms) rollback transaction
967
+ Connecting to database specified by database.yml
968
+  (0.5ms) begin transaction
969
+  (0.0ms) rollback transaction
970
+  (0.1ms) begin transaction
971
+  (0.1ms) rollback transaction
972
+  (0.1ms) begin transaction
973
+  (0.2ms) rollback transaction
974
+  (0.1ms) begin transaction
975
+  (0.1ms) rollback transaction
976
+  (0.0ms) begin transaction
977
+  (0.1ms) rollback transaction
978
+  (0.1ms) begin transaction
979
+  (0.1ms) rollback transaction
980
+  (0.1ms) begin transaction
981
+  (0.1ms) rollback transaction
982
+  (0.1ms) begin transaction
983
+  (0.0ms) rollback transaction
984
+  (0.0ms) begin transaction
985
+  (0.0ms) rollback transaction
986
+  (0.0ms) begin transaction
987
+  (0.0ms) rollback transaction
988
+  (0.1ms) begin transaction
989
+ Processing by Facebook::PageController#events as HTML
990
+ Rendered /Users/necromancer/Code/blue_velvet/app/views/facebook/page/_attribute_not_found.html.erb (2.5ms)
991
+ Completed 200 OK in 33ms (Views: 14.6ms | ActiveRecord: 0.0ms)
992
+  (0.1ms) rollback transaction
993
+  (0.0ms) begin transaction
994
+ Processing by Facebook::PageController#about as HTML
995
+ Rendered /Users/necromancer/Code/blue_velvet/app/views/facebook/page/_page_attribute.html.erb (0.9ms)
996
+ Completed 200 OK in 151ms (Views: 2.4ms | ActiveRecord: 0.0ms)
997
+  (0.3ms) rollback transaction
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blue_velvet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-16 00:00:00.000000000 Z
12
+ date: 2012-07-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -81,8 +81,12 @@ files:
81
81
  - lib/blue_velvet/engine.rb
82
82
  - lib/blue_velvet/version.rb
83
83
  - lib/blue_velvet.rb
84
- - lib/generators/facebook/config_generator.rb
85
- - lib/generators/facebook/views_generator.rb
84
+ - lib/generators/facebook/config/config_generator.rb
85
+ - lib/generators/facebook/config/templates/facebook.yml
86
+ - lib/generators/facebook/config/templates/koala.rb
87
+ - lib/generators/facebook/config/USAGE
88
+ - lib/generators/facebook/views/USAGE
89
+ - lib/generators/facebook/views/views_generator.rb
86
90
  - MIT-LICENSE
87
91
  - Rakefile
88
92
  - README.md
@@ -1,15 +0,0 @@
1
- # Creates YAML configuration in +config/facebook.yml+ which helps you
2
- # connect to the Facebook platform. Required inherently by Koala, which
3
- # forms the backend of this gem.
4
- class Facebook::ConfigGenerator < Rails::Generators::Base
5
- # Edit this file with your Facebook app details
6
- def create_yaml_file
7
- copy_file "config/facebook.yml", "#{Rails.root}/config/facebook/yml"
8
- end
9
-
10
- # Don't touch this file, all it does is read from YAML and instantiate
11
- # Koala.
12
- def create_initializer
13
- copy_file "config/initializers/koala.rb", "#{Rails.root}/config/initializers/koala.rb"
14
- end
15
- end
@@ -1,14 +0,0 @@
1
- # Copies internal gem views for use in the main app. Any view files
2
- # encountered in the app in the same location as those in the engine
3
- # will override the default views, so this generator allows you to
4
- # customize the display of your Facebook content.
5
- class Facebook::ViewsGenerator < Rails::Generators::Base
6
- def copy_page_views
7
- views_dir = File.join(__FILE__, 'app', 'views', 'facebook')
8
- Dir[views_dir].each do |view_file_path|
9
- view_file = File.basename view_file_path
10
- app_path = "#{Rails.root}/app/views/facebook/#{view_file}"
11
- copy_file view_file_path, app_path
12
- end
13
- end
14
- end