diff --git a/.gitignore b/.gitignore index ac2a9578..0ff77427 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,3 @@ rdoc/* pkg log test/tmp/* -gemfiles/*.lock diff --git a/.travis.yml b/.travis.yml index a0e07367..7a8555e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,21 @@ language: ruby script: "bundle exec rake test" -before_install: - - gem install bundler -v '>= 1.5.1' +install: script/cached-bundle install --deployment --path vendor/bundle rvm: - 1.9.3 - 2.0.0 - 2.1.0 env: - - DEVISE_ORM=mongoid - - DEVISE_ORM=active_record + matrix: + - DEVISE_ORM=mongoid + - DEVISE_ORM=active_record + global: + # AMAZON_S3_BUCKET + - secure: "owrGpYVco0CptAcWAGdVUHqoLNcc7s1sl0UrH5kzw7T8mqrskoaI8yrNyqvhCYA/fXdTLlbhXO3GgYW8yMFe8CtcJbWKWpnk2XUDlsYj0pwPp9FPWBK2w7kSsJOjn+SNeJOTPrSkWnmwmDtGSkVW2tIqwb9k4YfOpYEruhhgBJk=" + # AMAZON_ACCESS_KEY_ID + - secure: "iODI901bQTs5s96zS9YbXtIB9V1sikZE6jpLqf8YfA8rDNIk6yzSXWdrqV5NxtI5vTmaor2BXUMXPQ3MAe6CjEn45WqVWfmYnllAl9avREfzxuvGIewPcMzOIiy22R+nKd9gzntVK/czbKoby73RtTpHZmJ74n7hxF8h3pBMy20=" + # AMAZON_SECRET_ACCESS_KEY + - secure: "B9CsMAopxaG7rrIbIZGQku/zte+wJf9RIVsRZTHrlWFLWm572J17FlJmJAcHQGCUHlD8K1HY0hVTRUp9rD3Mt1bUz3FDPWUDuSJO0f/hvN01bqGvuz1snq7Xpi8v09uzAZ+WWjBmv84TbwbHSoqjI2oPp5PePWThuCiEzkIe34Y=" gemfile: - gemfiles/Gemfile.rails-head - gemfiles/Gemfile.rails-4.0-stable diff --git a/gemfiles/Gemfile.rails-3.2-stable.lock b/gemfiles/Gemfile.rails-3.2-stable.lock new file mode 100644 index 00000000..7dde1d36 --- /dev/null +++ b/gemfiles/Gemfile.rails-3.2-stable.lock @@ -0,0 +1,167 @@ +GIT + remote: git://github.com/rails/rails.git + revision: a3bda38467377cb8c3cdd52b6fcf6c6c31f74b82 + branch: 3-2-stable + specs: + actionmailer (3.2.17) + actionpack (= 3.2.17) + mail (~> 2.5.4) + actionpack (3.2.17) + activemodel (= 3.2.17) + activesupport (= 3.2.17) + builder (~> 3.0.0) + erubis (~> 2.7.0) + journey (~> 1.0.4) + rack (~> 1.4.5) + rack-cache (~> 1.2) + rack-test (~> 0.6.1) + sprockets (~> 2.2.1) + activemodel (3.2.17) + activesupport (= 3.2.17) + builder (~> 3.0.0) + activerecord (3.2.17) + activemodel (= 3.2.17) + activesupport (= 3.2.17) + arel (~> 3.0.2) + tzinfo (~> 0.3.29) + activeresource (3.2.17) + activemodel (= 3.2.17) + activesupport (= 3.2.17) + activesupport (3.2.17) + i18n (~> 0.6, >= 0.6.4) + multi_json (~> 1.0) + rails (3.2.17) + actionmailer (= 3.2.17) + actionpack (= 3.2.17) + activerecord (= 3.2.17) + activeresource (= 3.2.17) + activesupport (= 3.2.17) + bundler (~> 1.0) + railties (= 3.2.17) + railties (3.2.17) + actionpack (= 3.2.17) + activesupport (= 3.2.17) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (>= 0.14.6, < 2.0) + +PATH + remote: .. + specs: + devise (3.2.4) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 3.2.6, < 5) + thread_safe (~> 0.1) + warden (~> 1.2.3) + +GEM + remote: https://rubygems.org/ + specs: + arel (3.0.3) + atomic (1.1.16) + bcrypt (3.1.7) + builder (3.0.4) + erubis (2.7.0) + faraday (0.9.0) + multipart-post (>= 1.2, < 3) + hashie (1.2.0) + hike (1.2.3) + httpauth (0.2.1) + i18n (0.6.9) + journey (1.0.4) + json (1.8.1) + jwt (0.1.11) + multi_json (>= 1.5) + mail (2.5.4) + mime-types (~> 1.16) + treetop (~> 1.4.8) + metaclass (0.0.4) + mime-types (1.25.1) + mini_portile (0.5.2) + mocha (1.0.0) + metaclass (~> 0.0.1) + mongoid (3.1.6) + activemodel (~> 3.2) + moped (~> 1.4) + origin (~> 1.0) + tzinfo (~> 0.3.29) + moped (1.5.2) + multi_json (1.8.4) + multipart-post (2.0.0) + nokogiri (1.6.1) + mini_portile (~> 0.5.0) + oauth2 (0.8.1) + faraday (~> 0.8) + httpauth (~> 0.1) + jwt (~> 0.1.4) + multi_json (~> 1.0) + rack (~> 1.2) + omniauth (1.0.3) + hashie (~> 1.2) + rack + omniauth-facebook (1.4.0) + omniauth-oauth2 (~> 1.0.2) + omniauth-oauth2 (1.0.3) + oauth2 (~> 0.8.0) + omniauth (~> 1.0) + omniauth-openid (1.0.1) + omniauth (~> 1.0) + rack-openid (~> 1.3.1) + origin (1.1.0) + orm_adapter (0.5.0) + polyglot (0.3.4) + rack (1.4.5) + rack-cache (1.2) + rack (>= 0.4) + rack-openid (1.3.1) + rack (>= 1.1.0) + ruby-openid (>= 2.1.8) + rack-ssl (1.3.3) + rack + rack-test (0.6.2) + rack (>= 1.0) + rake (10.1.1) + rdoc (3.12.2) + json (~> 1.4) + ruby-openid (2.5.0) + sprockets (2.2.2) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sqlite3 (1.3.8) + thor (0.18.1) + thread_safe (0.2.0) + atomic (>= 1.1.7, < 2) + tilt (1.4.1) + treetop (1.4.15) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.38) + warden (1.2.3) + rack (>= 1.0) + webrat (0.7.3) + nokogiri (>= 1.2.0) + rack (>= 1.0) + rack-test (>= 0.5.3) + +PLATFORMS + ruby + +DEPENDENCIES + activerecord-jdbc-adapter + activerecord-jdbcsqlite3-adapter + devise! + jruby-openssl + mocha (~> 1.0.0) + mongoid (~> 3.0) + omniauth (~> 1.0.0) + omniauth-facebook + omniauth-oauth2 (~> 1.0.0) + omniauth-openid (~> 1.0.1) + rails! + rdoc + sqlite3 + webrat (= 0.7.3) diff --git a/gemfiles/Gemfile.rails-4.0-stable.lock b/gemfiles/Gemfile.rails-4.0-stable.lock new file mode 100644 index 00000000..a5b66ea5 --- /dev/null +++ b/gemfiles/Gemfile.rails-4.0-stable.lock @@ -0,0 +1,174 @@ +GIT + remote: git://github.com/mongoid/mongoid.git + revision: 5b0f031992cbec66d68c6cb288a4edb952ed5336 + branch: master + specs: + mongoid (4.0.0.beta1) + activemodel (>= 4.0.0) + moped (~> 2.0.beta6) + origin (~> 2.1) + tzinfo (>= 0.3.37) + +GIT + remote: git://github.com/rails/rails.git + revision: ccb0301bd43a385305f2d000aa085407926a1059 + branch: 4-0-stable + specs: + actionmailer (4.0.2) + actionpack (= 4.0.2) + mail (~> 2.5.4) + actionpack (4.0.2) + activesupport (= 4.0.2) + builder (~> 3.1.0) + erubis (~> 2.7.0) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + activemodel (4.0.2) + activesupport (= 4.0.2) + builder (~> 3.1.0) + activerecord (4.0.2) + activemodel (= 4.0.2) + activerecord-deprecated_finders (~> 1.0.2) + activesupport (= 4.0.2) + arel (~> 4.0.0) + activesupport (4.0.2) + i18n (~> 0.6, >= 0.6.9) + minitest (~> 4.2) + multi_json (~> 1.3) + thread_safe (~> 0.1) + tzinfo (~> 0.3.37) + rails (4.0.2) + actionmailer (= 4.0.2) + actionpack (= 4.0.2) + activerecord (= 4.0.2) + activesupport (= 4.0.2) + bundler (>= 1.3.0, < 2.0) + railties (= 4.0.2) + sprockets-rails (~> 2.0.0) + railties (4.0.2) + actionpack (= 4.0.2) + activesupport (= 4.0.2) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + +PATH + remote: .. + specs: + devise (3.2.4) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 3.2.6, < 5) + thread_safe (~> 0.1) + warden (~> 1.2.3) + +GEM + remote: https://rubygems.org/ + specs: + activerecord-deprecated_finders (1.0.3) + arel (4.0.2) + atomic (1.1.14) + bcrypt (3.1.7) + bson (2.2.0) + builder (3.1.4) + connection_pool (1.2.0) + erubis (2.7.0) + faraday (0.9.0) + multipart-post (>= 1.2, < 3) + hashie (1.2.0) + hike (1.2.3) + httpauth (0.2.1) + i18n (0.6.9) + json (1.8.1) + jwt (0.1.11) + multi_json (>= 1.5) + mail (2.5.4) + mime-types (~> 1.16) + treetop (~> 1.4.8) + metaclass (0.0.4) + mime-types (1.25.1) + mini_portile (0.5.2) + minitest (4.7.5) + mocha (1.0.0) + metaclass (~> 0.0.1) + moped (2.0.0.beta6) + bson (~> 2.2) + connection_pool (~> 1.2) + optionable (~> 0.2.0) + multi_json (1.8.4) + multipart-post (2.0.0) + nokogiri (1.6.1) + mini_portile (~> 0.5.0) + oauth2 (0.8.1) + faraday (~> 0.8) + httpauth (~> 0.1) + jwt (~> 0.1.4) + multi_json (~> 1.0) + rack (~> 1.2) + omniauth (1.0.3) + hashie (~> 1.2) + rack + omniauth-facebook (1.4.0) + omniauth-oauth2 (~> 1.0.2) + omniauth-oauth2 (1.0.3) + oauth2 (~> 0.8.0) + omniauth (~> 1.0) + omniauth-openid (1.0.1) + omniauth (~> 1.0) + rack-openid (~> 1.3.1) + optionable (0.2.0) + origin (2.1.0) + orm_adapter (0.5.0) + polyglot (0.3.3) + rack (1.5.2) + rack-openid (1.3.1) + rack (>= 1.1.0) + ruby-openid (>= 2.1.8) + rack-test (0.6.2) + rack (>= 1.0) + rake (10.1.1) + rdoc (4.1.1) + json (~> 1.4) + ruby-openid (2.5.0) + sprockets (2.10.1) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.0.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) + sqlite3 (1.3.8) + thor (0.18.1) + thread_safe (0.1.3) + atomic + tilt (1.4.1) + treetop (1.4.15) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.38) + warden (1.2.3) + rack (>= 1.0) + webrat (0.7.3) + nokogiri (>= 1.2.0) + rack (>= 1.0) + rack-test (>= 0.5.3) + +PLATFORMS + ruby + +DEPENDENCIES + activerecord-jdbc-adapter + activerecord-jdbcsqlite3-adapter + devise! + jruby-openssl + mocha (~> 1.0.0) + mongoid! + omniauth (~> 1.0.0) + omniauth-facebook + omniauth-oauth2 (~> 1.0.0) + omniauth-openid (~> 1.0.1) + rails! + rdoc + sqlite3 + webrat (= 0.7.3) diff --git a/gemfiles/Gemfile.rails-head.lock b/gemfiles/Gemfile.rails-head.lock new file mode 100644 index 00000000..6f83c440 --- /dev/null +++ b/gemfiles/Gemfile.rails-head.lock @@ -0,0 +1,178 @@ +GIT + remote: git://github.com/mongoid/mongoid.git + revision: 5fcb8ddd0ac749a81f499d31722582bda7e654b1 + branch: master + specs: + mongoid (4.0.0.beta1) + activemodel (>= 4.0.0) + moped (~> 2.0.beta6) + origin (~> 2.1) + tzinfo (>= 0.3.37) + +GIT + remote: git://github.com/rails/rails.git + revision: 25ce856c3ea8beb864994b4b13df07b48574df9b + specs: + actionmailer (4.1.0.beta2) + actionpack (= 4.1.0.beta2) + actionview (= 4.1.0.beta2) + mail (~> 2.5.4) + actionpack (4.1.0.beta2) + actionview (= 4.1.0.beta2) + activesupport (= 4.1.0.beta2) + rack (~> 1.5.2) + rack-test (~> 0.6.2) + actionview (4.1.0.beta2) + activesupport (= 4.1.0.beta2) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.0.beta2) + activesupport (= 4.1.0.beta2) + builder (~> 3.1) + activerecord (4.1.0.beta2) + activemodel (= 4.1.0.beta2) + activesupport (= 4.1.0.beta2) + arel (~> 5.0.0) + activesupport (4.1.0.beta2) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) + thread_safe (~> 0.1) + tzinfo (~> 1.1) + rails (4.1.0.beta2) + actionmailer (= 4.1.0.beta2) + actionpack (= 4.1.0.beta2) + actionview (= 4.1.0.beta2) + activemodel (= 4.1.0.beta2) + activerecord (= 4.1.0.beta2) + activesupport (= 4.1.0.beta2) + bundler (>= 1.3.0, < 2.0) + railties (= 4.1.0.beta2) + sprockets-rails (~> 2.0.0) + railties (4.1.0.beta2) + actionpack (= 4.1.0.beta2) + activesupport (= 4.1.0.beta2) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + +PATH + remote: .. + specs: + devise (3.2.4) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 3.2.6, < 5) + thread_safe (~> 0.1) + warden (~> 1.2.3) + +GEM + remote: https://rubygems.org/ + specs: + arel (5.0.0) + atomic (1.1.14) + bcrypt (3.1.7) + bson (2.2.1) + builder (3.2.2) + connection_pool (1.2.0) + erubis (2.7.0) + faraday (0.9.0) + multipart-post (>= 1.2, < 3) + hashie (1.2.0) + hike (1.2.3) + httpauth (0.2.1) + i18n (0.6.9) + json (1.8.1) + jwt (0.1.11) + multi_json (>= 1.5) + mail (2.5.4) + mime-types (~> 1.16) + treetop (~> 1.4.8) + metaclass (0.0.4) + mime-types (1.25.1) + mini_portile (0.5.2) + minitest (5.2.3) + mocha (1.0.0) + metaclass (~> 0.0.1) + moped (2.0.0.beta6) + bson (~> 2.2) + connection_pool (~> 1.2) + optionable (~> 0.2.0) + multi_json (1.8.4) + multipart-post (2.0.0) + nokogiri (1.6.1) + mini_portile (~> 0.5.0) + oauth2 (0.8.1) + faraday (~> 0.8) + httpauth (~> 0.1) + jwt (~> 0.1.4) + multi_json (~> 1.0) + rack (~> 1.2) + omniauth (1.0.3) + hashie (~> 1.2) + rack + omniauth-facebook (1.4.0) + omniauth-oauth2 (~> 1.0.2) + omniauth-oauth2 (1.0.3) + oauth2 (~> 0.8.0) + omniauth (~> 1.0) + omniauth-openid (1.0.1) + omniauth (~> 1.0) + rack-openid (~> 1.3.1) + optionable (0.2.0) + origin (2.1.0) + orm_adapter (0.5.0) + polyglot (0.3.4) + rack (1.5.2) + rack-openid (1.3.1) + rack (>= 1.1.0) + ruby-openid (>= 2.1.8) + rack-test (0.6.2) + rack (>= 1.0) + rake (10.1.1) + rdoc (4.1.1) + json (~> 1.4) + ruby-openid (2.5.0) + sprockets (2.10.1) + hike (~> 1.2) + multi_json (~> 1.0) + rack (~> 1.0) + tilt (~> 1.1, != 1.3.0) + sprockets-rails (2.0.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + sprockets (~> 2.8) + sqlite3 (1.3.8) + thor (0.18.1) + thread_safe (0.1.3) + atomic + tilt (1.4.1) + treetop (1.4.15) + polyglot + polyglot (>= 0.3.1) + tzinfo (1.1.0) + thread_safe (~> 0.1) + warden (1.2.3) + rack (>= 1.0) + webrat (0.7.3) + nokogiri (>= 1.2.0) + rack (>= 1.0) + rack-test (>= 0.5.3) + +PLATFORMS + ruby + +DEPENDENCIES + activerecord-jdbc-adapter + activerecord-jdbcsqlite3-adapter + devise! + jruby-openssl + mocha (~> 1.0.0) + mongoid! + omniauth (~> 1.0.0) + omniauth-facebook + omniauth-oauth2 (~> 1.0.0) + omniauth-openid (~> 1.0.1) + rails! + rdoc + sqlite3 + webrat (= 0.7.3) diff --git a/script/cached-bundle b/script/cached-bundle new file mode 100755 index 00000000..51427780 --- /dev/null +++ b/script/cached-bundle @@ -0,0 +1,49 @@ +#!/usr/bin/env bash +# Usage: cached-bundle install --deployment +# +# After running `bundle`, caches the `vendor/bundle` directory to S3. +# On the next run, restores the cached directory before running `bundle`. +# When `Gemfile.lock` changes, the cache gets rebuilt. +# +# Requirements: +# - Gemfile.lock +# - TRAVIS_REPO_SLUG +# - TRAVIS_RUBY_VERSION +# - AMAZON_S3_BUCKET +# - script/s3-put +# - bundle +# - curl +# +# Author: Mislav Marohnić + +set -e + +compute_md5() { + local output="$(openssl md5)" + echo "${output##* }" +} + +download() { + curl --tcp-nodelay -qsfL "$1" -o "$2" +} + + +gemfile="${BUNDLE_GEMFILE:-Gemfile}" +bundle_fullpath="$(dirname $gemfile)/vendor/bundle" +bundle_path=${bundle_fullpath#$PWD/} +gemfile_hash="$(compute_md5 <"${gemfile}.lock")" +cache_name="${TRAVIS_RUBY_VERSION}-${gemfile_hash}.tgz" +fetch_url="http://${AMAZON_S3_BUCKET}.s3.amazonaws.com/${TRAVIS_REPO_SLUG}/${cache_name}" + +if download "$fetch_url" "$cache_name"; then + echo "Reusing cached bundle ${cache_name}" + tar xzf "$cache_name" +fi + +bundle "$@" + +if [ ! -f "$cache_name" ] && [ -n "$AMAZON_SECRET_ACCESS_KEY" ]; then + echo "Caching \`${bundle_path}' to S3" + tar czf "$cache_name" "$bundle_path" + script/s3-put "$cache_name" "${AMAZON_S3_BUCKET}:${TRAVIS_REPO_SLUG}/${cache_name}" +fi diff --git a/script/s3-put b/script/s3-put new file mode 100755 index 00000000..036e845d --- /dev/null +++ b/script/s3-put @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# Usage: s3-put [:] [] +# +# Uploads a file to the Amazon S3 service. +# Outputs the URL for the newly uploaded file. +# +# Requirements: +# - AMAZON_ACCESS_KEY_ID +# - AMAZON_SECRET_ACCESS_KEY +# - openssl +# - curl +# +# Author: Mislav Marohnić + +set -e + +authorization() { + local signature="$(string_to_sign | hmac_sha1 | base64)" + echo "AWS ${AMAZON_ACCESS_KEY_ID?}:${signature}" +} + +hmac_sha1() { + openssl dgst -binary -sha1 -hmac "${AMAZON_SECRET_ACCESS_KEY?}" +} + +base64() { + openssl enc -base64 +} + +bin_md5() { + openssl dgst -binary -md5 +} + +string_to_sign() { + echo "$http_method" + echo "$content_md5" + echo "$content_type" + echo "$date" + echo "x-amz-acl:$acl" + printf "/$bucket/$remote_path" +} + +date_string() { + LC_TIME=C date "+%a, %d %h %Y %T %z" +} + +file="$1" +bucket="${2%%:*}" +remote_path="${2#*:}" +content_type="$3" + +if [ -z "$remote_path" ] || [ "$remote_path" = "$bucket" ]; then + remote_path="${file##*/}" +fi + +http_method=PUT +acl="public-read" +content_md5="$(bin_md5 < "$file" | base64)" +date="$(date_string)" + +url="https://$bucket.s3.amazonaws.com/$remote_path" + +curl -qsSf -T "$file" \ + -H "Authorization: $(authorization)" \ + -H "x-amz-acl: $acl" \ + -H "Date: $date" \ + -H "Content-MD5: $content_md5" \ + -H "Content-Type: $content_type" \ + "$url" + +echo "$url"