Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run app on Heroku #123

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.6
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
language: ruby
branches:
only:
- master
cache:
bundler: true
sudo: false
bundler_args: --without development
rvm:
- 1.9.2
- 2.1.3
- 2.1.6
before_install:
- 'echo ''gem: --no-ri --no-rdoc'' > ~/.gemrc'
before_script:
Expand All @@ -14,4 +20,3 @@ before_script:
script: "bundle exec rake test:travis"
services:
- redis-server
cache: bundler
9 changes: 6 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
source 'http://rubygems.org'
ruby '2.1.6'

gem 'rails', '~> 3.2.21'
gem 'test-unit'
gem 'foreman'

gem 'pg', '~> 0.11'
gem 'pg'
gem 'simple_form', '~> 1.5'
gem 'kaminari', '~> 0.12'
gem 'make_voteable', '~> 0.1'
gem 'acts-as-taggable-on', '~> 2.1'
gem 'haml-rails', '~> 0.3.5'
gem 'friendly_id', '~> 4.0.9'
gem 'redis', '~> 2.2'
gem 'redis'
gem 'date_validator', '~> 0.6.3'
gem 'recaptcha', '~> 0.3', :require => 'recaptcha/rails'
gem 'httparty'
Expand All @@ -35,7 +38,7 @@ gem 'nokogiri', '~> 1.3'
gem 'sanitize', '~> 2.0'

# Social
gem 'twitter', '~> 4.4'
gem 'twitter'
gem 'gravtastic', '~> 3.2'

# SEO
Expand Down
84 changes: 57 additions & 27 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ GEM
albino (1.3.3)
posix-spawn (>= 0.3.6)
arel (3.0.3)
atomic (1.1.99)
aws-ses (0.4.4)
builder
mail (> 2.2.5)
Expand All @@ -43,6 +44,7 @@ GEM
bcrypt-ruby (3.0.1)
bourne (1.1.2)
mocha (= 0.10.5)
buftok (0.1)
builder (3.0.4)
cancan (1.6.8)
capybara (2.0.2)
Expand All @@ -65,11 +67,14 @@ GEM
coffee-script-source (1.4.0)
date_validator (0.6.3)
activemodel (~> 3.0)
descendants_tracker (0.0.3)
devise (1.4.7)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)
diff-lcs (1.1.3)
diff-lcs (1.2.5)
dotenv (2.0.1)
equalizer (0.0.11)
erubis (2.7.0)
exceptional (2.0.32)
rack
Expand All @@ -81,9 +86,12 @@ GEM
factory_girl (~> 2.5.0)
railties (>= 3.0.0)
fakeweb (1.3.0)
faraday (0.8.5)
multipart-post (~> 1.1)
faraday (0.9.1)
multipart-post (>= 1.2, < 3)
ffi (1.4.0)
foreman (0.63.0)
dotenv (>= 0.7)
thor (>= 0.13.6)
friendly_id (4.0.9)
geocoder (1.0.5)
gravtastic (3.2.6)
Expand All @@ -94,15 +102,18 @@ GEM
haml (~> 3.1)
railties (>= 3.1, < 4.1)
hike (1.2.3)
http (0.5.1)
http_parser.rb
http_parser.rb (0.5.3)
httparty (0.8.1)
multi_json
multi_xml
i18n (0.6.11)
i18n (0.7.0)
journey (1.0.4)
jquery-rails (1.0.14)
railties (~> 3.0)
thor (~> 0.14)
json (1.8.1)
json (1.8.2)
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
Expand All @@ -116,21 +127,24 @@ GEM
treetop (~> 1.4.8)
make_voteable (0.1.1)
activerecord (~> 3.0)
memoizable (0.2.0)
thread_safe (~> 0.1.3)
meta-tags (1.2.4)
actionpack
metaclass (0.0.1)
metaclass (0.0.4)
method_source (0.7.1)
mime-types (1.25.1)
mocha (0.10.5)
metaclass (~> 0.0.1)
multi_json (1.10.1)
multi_json (1.11.0)
multi_xml (0.5.1)
multipart-post (1.1.5)
multipart-post (2.0.0)
nokogiri (1.5.5)
orm_adapter (0.0.5)
pg (0.11.0)
pg (0.18.1)
polyglot (0.3.5)
posix-spawn (0.3.6)
power_assert (0.2.3)
pry (0.9.9.4)
coderay (~> 1.0.5)
method_source (~> 0.7.1)
Expand All @@ -143,7 +157,7 @@ GEM
rack-gauges (1.1.0)
rack-ssl (1.3.4)
rack
rack-test (0.6.2)
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.21)
actionmailer (= 3.2.21)
Expand All @@ -164,26 +178,30 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.3.2)
rake (10.4.2)
rdoc (3.12.2)
json (~> 1.4)
recaptcha (0.3.1)
redcarpet (1.17.2)
redis (2.2.2)
redis (3.2.1)
ref (1.0.5)
routing-filter (0.3.0)
actionpack
rspec-core (2.12.0)
rspec-expectations (2.12.0)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.0)
rspec-rails (2.12.0)
rspec-collection_matchers (1.1.2)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.99.3)
rspec-rails (2.99.0)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-collection_matchers
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rubyzip (0.9.9)
sanitize (2.0.3)
nokogiri (>= 1.4.4, < 1.6)
Expand Down Expand Up @@ -211,18 +229,28 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
state_machine (1.0.2)
test-unit (3.0.9)
power_assert
therubyracer (0.12.1)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
twitter (4.5.0)
faraday (~> 0.8, < 0.10)
multi_json (~> 1.0)
simple_oauth (~> 0.2)
twitter (5.0.0)
buftok (~> 0.1.0)
descendants_tracker (~> 0.0.1)
equalizer (~> 0.0.7)
faraday (>= 0.8, < 0.10)
http (~> 0.5.0)
http_parser.rb (~> 0.5.0)
json (~> 1.8)
memoizable (~> 0.2.0)
simple_oauth (~> 0.2.0)
tzinfo (0.3.42)
uglifier (1.0.3)
execjs (>= 0.3.0)
Expand Down Expand Up @@ -253,6 +281,7 @@ DEPENDENCIES
exceptional (~> 2.0)
factory_girl_rails (~> 1.6)
fakeweb
foreman
friendly_id (~> 4.0.9)
geocoder (~> 1.0)
gravtastic (~> 3.2)
Expand All @@ -264,23 +293,24 @@ DEPENDENCIES
make_voteable (~> 0.1)
meta-tags (~> 1.2)
nokogiri (~> 1.3)
pg (~> 0.11)
pg
pry-rails
rack-gauges
rails (~> 3.2.21)
rails3-jquery-autocomplete (~> 1.0)
rails_config (~> 0.2)
recaptcha (~> 0.3)
redcarpet (~> 1.17)
redis (~> 2.2)
redis
routing-filter (~> 0.3.0)
rspec-rails (~> 2.6)
sanitize (~> 2.0)
sass-rails (~> 3.2.3)
shoulda-matchers
simple_form (~> 1.5)
state_machine (~> 1.0)
test-unit
therubyracer (~> 0.12.1)
twitter (~> 4.4)
twitter
uglifier (>= 1.0.3)
whenever
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: bundle exec rails server -p $PORT
1 change: 0 additions & 1 deletion app/models/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class Job < ActiveRecord::Base
end

after_transition confirmed: :activated do |job, trans|

job.send(:notify_observers, :after_activation)
end

Expand Down
14 changes: 12 additions & 2 deletions app/observers/job_observer.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
class JobObserver < ActiveRecord::Observer

def after_activation(record)
unless Rails.env.development?
Twitter.update I18n.t('twitter.new_job', title: record.title.truncate(60),
twitter_client.update I18n.t('twitter.new_job', title: record.title.truncate(60),
url: Rails.application.routes.url_helpers.job_url(record, host: "railsfrance.org"))
end
end

private

def twitter_client
@twitter_client ||= Twitter::REST::Client.new do |config|
config.consumer_key = Settings.twitter.consumer_key
config.consumer_secret = Settings.twitter.consumer_secret
config.access_token = Settings.twitter.oauth_token
config.access_token_secret = Settings.twitter.oauth_token_secret
end
end
end
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require File.expand_path('../boot', __FILE__)

require 'rails/all'
require File.expand_path('../../lib/dotcloud.rb', __FILE__)

if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Expand Down Expand Up @@ -35,6 +34,7 @@ class Application < Rails::Application
config.time_zone = 'Paris'

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
I18n.config.enforce_available_locales = false
config.i18n.load_path += Dir[Rails.root.join('config','locales', '**','*.{rb,yml}').to_s]
config.i18n.default_locale = :fr
I18n.locale = config.i18n.locale = config.i18n.default_locale
Expand Down
2 changes: 1 addition & 1 deletion config/exceptional.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
api-key: <%= Dotcloud.env["EXCEPTIONAL_API_KEY"] %>
api-key: <%= ENV["EXCEPTIONAL_API_KEY"] %>
2 changes: 1 addition & 1 deletion config/initializers/redis.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
require 'redis'

$redis = Redis.new(Settings.redis.to_hash)
$redis = Redis.new(url: ENV["REDISTOGO_URL"])
6 changes: 0 additions & 6 deletions config/initializers/twitter.rb

This file was deleted.

30 changes: 13 additions & 17 deletions config/settings/production.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
app:
secret_token: <%= Dotcloud.env["SECRET_TOKEN"] %>
secret_token: <%= ENV["SECRET_TOKEN"] %>
cookie_key: "_rails_france_session"
devise:
pepper: <%= Dotcloud.env["PEPPER"] %>
pepper: <%= ENV["PEPPER"] %>
mailer:
host: "railsfrance.org"
from: "[email protected]"
aws_ses:
access_key_id: <%= Dotcloud.env["ACCESS_KEY_ID"] %>
secret_access_key: <%= Dotcloud.env["SECRET_ACCESS_KEY"] %>
access_key_id: <%= ENV["ACCESS_KEY_ID"] %>
secret_access_key: <%= ENV["SECRET_ACCESS_KEY"] %>
redis:
host: <%= Dotcloud.env["DOTCLOUD_REDIS_REDIS_HOST"] %>
port: <%= Dotcloud.env["DOTCLOUD_REDIS_REDIS_PORT"] %>
login: <%= Dotcloud.env["DOTCLOUD_REDIS_REDIS_LOGIN"] %>
password: <%= Dotcloud.env["DOTCLOUD_REDIS_REDIS_PASSWORD"] %>
db: 1
url: <%= ENV["REDISTOGO_URL"] %>
expire_view: 86400
expire_tweet: 3600
twitter:
account: <%= Dotcloud.env['TWITTER_ACCOUNT'] %>
consumer_key: <%= Dotcloud.env['TWITTER_CONSUMER_KEY'] %>
consumer_secret: <%= Dotcloud.env['TWITTER_CONSUMER_SECRET'] %>
oauth_token: <%= Dotcloud.env['TWITTER_OAUTH_TOKEN'] %>
oauth_token_secret: <%= Dotcloud.env['TWITTER_OAUTH_TOKEN_SECRET'] %>
account: <%= ENV['TWITTER_ACCOUNT'] %>
consumer_key: <%= ENV['TWITTER_CONSUMER_KEY'] %>
consumer_secret: <%= ENV['TWITTER_CONSUMER_SECRET'] %>
oauth_token: <%= ENV['TWITTER_OAUTH_TOKEN'] %>
oauth_token_secret: <%= ENV['TWITTER_OAUTH_TOKEN_SECRET'] %>
recaptcha:
public_key: <%= Dotcloud.env['RECAPTCHA_PUBLIC_KEY'] %>
private_key: <%= Dotcloud.env['RECAPTCHA_PRIVATE_KEY'] %>
public_key: <%= ENV['RECAPTCHA_PUBLIC_KEY'] %>
private_key: <%= ENV['RECAPTCHA_PRIVATE_KEY'] %>
api:
meetup:
key: <%= Dotcloud.env['MEETUP_KEY'] %>
key: <%= ENV['MEETUP_KEY'] %>
6 changes: 0 additions & 6 deletions lib/dotcloud.rb

This file was deleted.

Loading