diff --git a/.travis.yml b/.travis.yml index a39df4c..4635478 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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.2.2 before_install: - 'echo ''gem: --no-ri --no-rdoc'' > ~/.gemrc' before_script: @@ -14,4 +20,3 @@ before_script: script: "bundle exec rake test:travis" services: - redis-server -cache: bundler diff --git a/Gemfile b/Gemfile index bbca2e9..c641040 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,18 @@ source 'http://rubygems.org' +ruby '2.2.2' gem 'rails', '~> 3.2.21' -gem 'pg', '~> 0.11' +gem 'foreman' + +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' @@ -75,7 +78,9 @@ end group :test do gem 'rake', '~> 10.0' + gem 'test-unit', '~> 3.1' + gem 'minitest' gem 'capybara', '~> 2.0' gem 'fakeweb' - gem 'shoulda-matchers' + gem 'shoulda-matchers', '~> 2.8' end diff --git a/Gemfile.lock b/Gemfile.lock index 4637925..bbed12b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -41,8 +41,6 @@ GEM xml-simple basic_active_model (1.0.0) bcrypt-ruby (3.0.1) - bourne (1.1.2) - mocha (= 0.10.5) builder (3.0.4) cancan (1.6.8) capybara (2.0.2) @@ -70,6 +68,7 @@ GEM orm_adapter (~> 0.0.3) warden (~> 1.0.3) diff-lcs (1.1.3) + dotenv (2.0.1) erubis (2.7.0) exceptional (2.0.32) rack @@ -84,6 +83,9 @@ GEM faraday (0.8.5) multipart-post (~> 1.1) 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) @@ -97,7 +99,7 @@ GEM 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) @@ -118,19 +120,18 @@ GEM activerecord (~> 3.0) meta-tags (1.2.4) actionpack - metaclass (0.0.1) method_source (0.7.1) mime-types (1.25.1) - mocha (0.10.5) - metaclass (~> 0.0.1) - multi_json (1.10.1) + minitest (5.6.1) + multi_json (1.11.0) multi_xml (0.5.1) multipart-post (1.1.5) 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) @@ -169,7 +170,7 @@ GEM 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 @@ -197,9 +198,8 @@ GEM multi_json (~> 1.0) rubyzip websocket (~> 1.0.4) - shoulda-matchers (1.4.2) + shoulda-matchers (2.8.0) activesupport (>= 3.0.0) - bourne (~> 1.1.2) simple_form (1.5.2) actionpack (~> 3.0) activemodel (~> 3.0) @@ -211,6 +211,8 @@ GEM rack (~> 1.0) tilt (~> 1.1, != 1.3.0) state_machine (1.0.2) + test-unit (3.1.2) + power_assert therubyracer (0.12.1) libv8 (~> 3.16.14.0) ref @@ -253,6 +255,7 @@ DEPENDENCIES exceptional (~> 2.0) factory_girl_rails (~> 1.6) fakeweb + foreman friendly_id (~> 4.0.9) geocoder (~> 1.0) gravtastic (~> 3.2) @@ -263,8 +266,9 @@ DEPENDENCIES letter_opener make_voteable (~> 0.1) meta-tags (~> 1.2) + minitest nokogiri (~> 1.3) - pg (~> 0.11) + pg pry-rails rack-gauges rails (~> 3.2.21) @@ -273,15 +277,19 @@ DEPENDENCIES rake (~> 10.0) 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 + shoulda-matchers (~> 2.8) simple_form (~> 1.5) state_machine (~> 1.0) + test-unit (~> 3.1) therubyracer (~> 0.12.1) twitter (~> 4.4) uglifier (>= 1.0.3) whenever + +BUNDLED WITH + 1.10.3 diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..443f2e3 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: bundle exec rails server -p $PORT diff --git a/config/application.rb b/config/application.rb index 2d457fa..b7bac6b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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 @@ -34,10 +33,10 @@ class Application < Rails::Application # config.time_zone = 'Central Time (US & Canada)' config.time_zone = 'Paris' - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # The default locale is :fr and all translations from config/locales/*.rb,yml are auto loaded. + config.i18n.available_locales = [:fr] 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 # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" diff --git a/config/exceptional.yml b/config/exceptional.yml index 77117a5..829d586 100644 --- a/config/exceptional.yml +++ b/config/exceptional.yml @@ -1 +1 @@ -api-key: <%= Dotcloud.env["EXCEPTIONAL_API_KEY"] %> +api-key: <%= ENV["EXCEPTIONAL_API_KEY"] %> diff --git a/config/initializers/redis.rb b/config/initializers/redis.rb index fc35b05..4bd20eb 100644 --- a/config/initializers/redis.rb +++ b/config/initializers/redis.rb @@ -1,3 +1,3 @@ require 'redis' -$redis = Redis.new(Settings.redis.to_hash) +$redis = Redis.new(url: ENV["REDISTOGO_URL"]) diff --git a/config/settings/production.yml b/config/settings/production.yml index e0d088a..59c49c5 100644 --- a/config/settings/production.yml +++ b/config/settings/production.yml @@ -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: "railsfrance.org@gmail.com" 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'] %> \ No newline at end of file + key: <%= ENV['MEETUP_KEY'] %> diff --git a/lib/dotcloud.rb b/lib/dotcloud.rb deleted file mode 100644 index aa57ac9..0000000 --- a/lib/dotcloud.rb +++ /dev/null @@ -1,6 +0,0 @@ -module Dotcloud - module_function - def env - @env ||= JSON.parse(File.read('/home/dotcloud/environment.json')) - end -end diff --git a/nginx.conf b/nginx.conf deleted file mode 100644 index a3cbfaa..0000000 --- a/nginx.conf +++ /dev/null @@ -1,17 +0,0 @@ -#GZIP -gzip on; -gzip_http_version 1.0; -gzip_comp_level 2; -gzip_proxied any; -gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; -gzip_vary on; - -error_page 404 /404.html; -error_page 500 503 502 504 /500.html; - -location ^~ /assets/ { - gzip_static on; - expires max; - add_header Cache-Control public; -} - diff --git a/spec/models/job_spec.rb b/spec/models/job_spec.rb index 214271a..45ff54c 100644 --- a/spec/models/job_spec.rb +++ b/spec/models/job_spec.rb @@ -16,13 +16,13 @@ it { should validate_presence_of(:description) } it { should validate_presence_of(:postal_code) } #url - it { should validate_format_of(:url).with('http://railsfrance.org') } - it { should validate_format_of(:url).with('http://www.railsfrance.org') } - it { should validate_format_of(:url).with('https://railsfrance.org') } - it { should validate_format_of(:url).with('https://www.railsfrance.org') } + it { should allow_value('http://railsfrance.org').for(:url) } + it { should allow_value('http://www.railsfrance.org').for(:url) } + it { should allow_value('https://railsfrance.org').for(:url) } + it { should allow_value('https://www.railsfrance.org').for(:url) } #email it { should validate_presence_of(:email) } - it { should validate_format_of(:email).with('p@o.fr') } + it { should allow_value('p@o.fr').for(:email) } #title it { should validate_presence_of(:title) } it { should validate_uniqueness_of(:title) } diff --git a/spec/support/addresseable_object.rb b/spec/support/addresseable_object.rb index 29a7e1f..b46c38f 100644 --- a/spec/support/addresseable_object.rb +++ b/spec/support/addresseable_object.rb @@ -2,10 +2,10 @@ shared_examples_for "an addresseable object" do context "validations" do - it { should validate_format_of(:postal_code).with(75018) } - it { should validate_format_of(:postal_code).not_with(5018) } - it { should validate_format_of(:postal_code).not_with(750183) } - it { should validate_format_of(:postal_code).not_with("yo") } + it { should allow_value(75018).for(:postal_code) } + it { should_not allow_value(5018).for(:postal_code) } + it { should_not allow_value(750183).for(:postal_code) } + it { should_not allow_value("yo").for(:postal_code) } end it { should respond_to :address }