Permalink
Browse files

settings with 'choices', new version of twitter-login

  • Loading branch information...
1 parent ca6ff87 commit 42511c102fdf6ae7bd4c629ab5d4a30147fa880e @mislav mislav committed Dec 17, 2010
View
@@ -3,4 +3,4 @@
db/*.sqlite3
log/*.log
tmp
-config/settings.yml
+config/settings.local.yml
View
@@ -1,30 +1,9 @@
source 'http://rubygems.org'
gem 'rails', '~> 3.0'
-gem 'arel'
+gem 'twitter-login', '~> 0.4.1', :require => 'twitter/login'
+gem 'choices'
-gem 'sqlite3-ruby', :require => 'sqlite3'
-
-gem 'twitter-login', '~> 0.2.1', :require => 'twitter/login'
-
-# Use unicorn as the web server
-# gem 'unicorn'
-
-# Deploy with Capistrano
-# gem 'capistrano'
-
-# To use debugger
-# gem 'ruby-debug'
-
-# Bundle the extra gems:
-# gem 'bj'
-# gem 'nokogiri', '1.4.1'
-# gem 'sqlite3-ruby', :require => 'sqlite3'
-# gem 'aws-s3', :require => 'aws/s3'
-
-# Bundle gems for the local environment. Make sure to
-# put test-only gems in this group so their generators
-# and rake tasks are available in development mode:
-# group :development, :test do
-# gem 'webrat'
-# end
+group :development, :test do
+ gem 'sqlite3-ruby', :require => 'sqlite3'
+end
View
@@ -2,87 +2,83 @@ GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
- actionmailer (3.0.0)
- actionpack (= 3.0.0)
- mail (~> 2.2.5)
- actionpack (3.0.0)
- activemodel (= 3.0.0)
- activesupport (= 3.0.0)
+ actionmailer (3.0.3)
+ actionpack (= 3.0.3)
+ mail (~> 2.2.9)
+ actionpack (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
builder (~> 2.1.2)
erubis (~> 2.6.6)
- i18n (~> 0.4.1)
+ i18n (~> 0.4)
rack (~> 1.2.1)
- rack-mount (~> 0.6.12)
- rack-test (~> 0.5.4)
+ rack-mount (~> 0.6.13)
+ rack-test (~> 0.5.6)
tzinfo (~> 0.3.23)
- activemodel (3.0.0)
- activesupport (= 3.0.0)
+ activemodel (3.0.3)
+ activesupport (= 3.0.3)
builder (~> 2.1.2)
- i18n (~> 0.4.1)
- activerecord (3.0.0)
- activemodel (= 3.0.0)
- activesupport (= 3.0.0)
- arel (~> 1.0.0)
+ i18n (~> 0.4)
+ activerecord (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ arel (~> 2.0.2)
tzinfo (~> 0.3.23)
- activeresource (3.0.0)
- activemodel (= 3.0.0)
- activesupport (= 3.0.0)
- activesupport (3.0.0)
- arel (1.0.1)
- activesupport (~> 3.0.0)
+ activeresource (3.0.3)
+ activemodel (= 3.0.3)
+ activesupport (= 3.0.3)
+ activesupport (3.0.3)
+ arel (2.0.6)
builder (2.1.2)
- crack (0.1.6)
+ choices (0.2.0)
+ hashie (>= 0.4.0)
erubis (2.6.6)
abstract (>= 1.0.0)
- hashie (0.2.2)
- httparty (0.5.2)
- crack (= 0.1.6)
- i18n (0.4.1)
- mail (2.2.6)
+ hashie (0.4.0)
+ i18n (0.5.0)
+ mail (2.2.12)
activesupport (>= 2.3.6)
- mime-types
- treetop (>= 1.4.5)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
mime-types (1.16)
- oauth (0.4.3)
+ oauth (0.4.4)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack (>= 1.0.0)
- rack-test (0.5.4)
+ rack-test (0.5.6)
rack (>= 1.0)
- rails (3.0.0)
- actionmailer (= 3.0.0)
- actionpack (= 3.0.0)
- activerecord (= 3.0.0)
- activeresource (= 3.0.0)
- activesupport (= 3.0.0)
- bundler (~> 1.0.0)
- railties (= 3.0.0)
- railties (3.0.0)
- actionpack (= 3.0.0)
- activesupport (= 3.0.0)
- rake (>= 0.8.4)
- thor (~> 0.14.0)
+ rails (3.0.3)
+ actionmailer (= 3.0.3)
+ actionpack (= 3.0.3)
+ activerecord (= 3.0.3)
+ activeresource (= 3.0.3)
+ activesupport (= 3.0.3)
+ bundler (~> 1.0)
+ railties (= 3.0.3)
+ railties (3.0.3)
+ actionpack (= 3.0.3)
+ activesupport (= 3.0.3)
+ rake (>= 0.8.7)
+ thor (~> 0.14.4)
rake (0.8.7)
- sqlite3-ruby (1.3.1)
- thor (0.14.0)
- treetop (1.4.8)
+ sqlite3-ruby (1.3.2)
+ thor (0.14.6)
+ treetop (1.4.9)
polyglot (>= 0.3.1)
- twitter (0.9.8)
- hashie (~> 0.2.0)
- httparty (~> 0.5.0)
- oauth (~> 0.4.1)
- yajl-ruby (~> 0.7.0)
- twitter-login (0.2.3)
- twitter (~> 0.9.5)
+ twitter-login (0.4.1)
+ hashie (>= 0.2.2)
+ oauth (~> 0.4.2)
+ yajl-ruby (>= 0.7.7)
tzinfo (0.3.23)
- yajl-ruby (0.7.7)
+ yajl-ruby (0.7.8)
PLATFORMS
ruby
DEPENDENCIES
- arel
+ choices
rails (~> 3.0)
sqlite3-ruby
- twitter-login (~> 0.2.1)
+ twitter-login (~> 0.4.1)
@@ -36,7 +36,7 @@
</header>
<% unless logged_in? %>
- <a class="main" href="/login">Sign in with Twitter</a>
+ <%= link_to 'Sign in with Twitter', twitter_login_path, :class => 'main' %>
<% end %>
<%= yield %>
View
@@ -6,15 +6,14 @@
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)
-settings = ERB.new(IO.read(File.expand_path('../settings.yml', __FILE__))).result
-$settings = Hashie::Mash.new YAML::load(settings)[Rails.env.to_s]
-
module Todaslistas
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
+ config.from_file 'settings.yml'
+
# Add additional load paths for your own custom dirs
# config.autoload_paths += %W( #{config.root}/extras )
@@ -45,7 +44,8 @@ class Application < Rails::Application
# Configure sensitive parameters which will be filtered from the log file.
config.filter_parameters += [:password]
-
- config.middleware.use Twitter::Login, :consumer_key => $settings.twitter.consumer_key, :secret => $settings.twitter.secret
+
+ config.twitter_login = Twitter::Login.new \
+ :consumer_key => config.twitter.consumer_key, :secret => config.twitter.secret
end
end
@@ -1,7 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# Your secret key for verifying the integrity of signed cookies.
-# If you change this key, all old signed cookies will become invalid!
-# Make sure the secret is at least 30 characters and all random,
-# no regular words or you'll be exposed to dictionary attacks.
-Todaslistas::Application.config.secret_token = 'bd4d05d8d0f3b08c68c8ace012e04ddd87bd9d1039167d457237d79ffec2fce0f92c6c4b974647ecaa2ede334b741a8e62cfc1ffbe4ec959154cd2a6f8516f1c'
View
@@ -7,6 +7,10 @@
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
+ config = Todaslistas::Application.config
+ twitter = config.twitter_login.login_handler(:return_to => '/')
+ mount twitter => 'login', :as => :twitter_login
+
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
@@ -1,5 +0,0 @@
-development:
- twitter:
- consumer_key: KEY
- secret: SECRET
-
View
@@ -0,0 +1,19 @@
+defaults: &defaults
+ secret_token: <%= ENV['COOKIE_SECRET'] %>
+ heroku: <%= !!ENV['HEROKU_TYPE'] %>
+ twitter:
+ consumer_key: <%= ENV['TWITTER_KEY'] %>
+ secret: <%= ENV['TWITTER_SECRET'] %>
+
+development:
+ <<: *defaults
+
+test: &testing
+ <<: *defaults
+ secret_token: <%= "banana" * 5 %>
+
+cucumber:
+ <<: *testing
+
+production:
+ <<: *defaults

0 comments on commit 42511c1

Please sign in to comment.