diff --git a/.env.example b/.env.example index bbb417f..4de4c17 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ -APPNAME= +APP_NAME=my_app +APP_NAME_DASHED=my-app DEVELOPER_EMAIL=$(git config user.email) # To quickly generate a 128-character token, you can use: @@ -7,14 +8,16 @@ DEVELOPER_EMAIL=$(git config user.email) # # And to configure heroku: # heroku config:add RAILS_SECRET_TOKEN=$(ruby -e "puts rand(36**128).to_s(36)") -r production -export RAILS_SECRET_TOKEN=dw19w73upxp02rxrmsy2vbg7o0lmhqepsm4s3zw5iyz0hccs1a9tbflcxhnk19ivdlgdlio4nevbxfi5rlcpkpwx6 +export RAILS_SECRET_TOKEN=dhb0h20edrflpzdy3b6ywdkijegvzvo9hnwoh6qegw2ytn0klvvmhdgczkkefxl1c6kgszzgogomayo + +export DATABASE_URL=postgresql://localhost/${APP_NAME}_development export EMAIL_RECIPIENTS=$DEVELOPER_EMAIL export MAIL_DELIVERY_METHOD=letter_opener export AWS_ACCESS_KEY_ID= export AWS_SECRET_ACCESS_KEY= -export FOG_DIRECTORY=$APPNAME-dev-$USER +export FOG_DIRECTORY=$APP_NAME_DASHED-dev-$USER export FOG_PROVIDER=AWS export MANDRILL_USERNAME=user@email.com @@ -35,6 +38,6 @@ export USER_NAME='Chester Tester' export USER_PASSWORD=password # Settings for the dev/admin seed user: -export ADMIN_EMAIL=$DEVELOPER_EMAIL -export ADMIN_NAME=$(get config user.name) -export ADMIN_PASSWORD=ridiculous +export ADMIN_EMAIL=admin@example.com +export ADMIN_NAME='Adam Minister' +export ADMIN_PASSWORD=password diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..e2396c2 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +export PATH=$PWD/vendor/bundle/bin:$PWD/bin:$PATH diff --git a/.gitignore b/.gitignore index eca00e4..f7526eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,24 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. +# See https://help.github.com/articles/ignoring-files for more about ignoring files. # # If you find yourself ignoring temporary files generated by your text editor # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile '~/.gitignore_global' # Ignore bundler config. -.bundle +/.bundle vendor/bundle -# Ignore any SQLite databases. -db/*.sqlite3 -db/*.sqlite3-journal - # Ignore all logfiles and tempfiles. -log/*.log +/log/*.log log/*.yml tmp # Ignore enviroment variable files .env* !.env.example +!.envrc .powenv -# Ignore local TDDium config -.tddium* - -# Ignore .rvmrc (used by RVM for certain environments) -.rvmrc - # Ignore swp files *.swp diff --git a/Gemfile b/Gemfile index 0c1af54..fca20c9 100644 --- a/Gemfile +++ b/Gemfile @@ -1,92 +1,44 @@ source 'https://rubygems.org' -ruby '2.0.0' # Tell heroku to use ruby 2.0.0 - -gem 'rails', '4.0.0' # Latest version of the best web framework in the world - -gem 'american_date', '~> 1.1.0' # American style month/day/year date parsing -gem 'authority', '~> 2.9.0' # Authorize user actions in your Rails app -gem 'bootstrap-sass', '~> 3.0.0.0' # Twitter Bootstrap front-end framework -gem 'carrierwave', '~> 0.9.0' # Server side file uploads (hand off from s3_direct_upload) -gem 'coffee-rails', '~> 4.0.0' # Outside assets for respondes to coffee -gem 'compass-rails', '~> 1.1.2' # CSS framework -gem 'dalli', '~> 2.6.4' # Caching with Memcached -gem 'devise', '~> 3.1.1' # Authentication with Warden -gem 'fog', '~> 1.14.0' # Ruby cloud services library (used by carrierwave) -gem 'font_assets', '~> 0.1.10' # Addresses Access-Control-Allow-Origin asset problems in Firefox -gem 'has_scope', '~> 0.5.1' # Easy controller scopes -gem 'high_voltage', '~> 2.0.0' # Static pages -gem 'jquery-fileupload-rails', '~> 0.4.1' # Direct upload files to S3 -gem 'jquery-rails', '~> 3.0.4' # jQuery yo -gem 'memcachier', '~> 0.0.2' # Simple memcachier configuration -gem 'mini_magick', '~> 3.6.0' # Image resizing for carrierwave -gem 'momentjs-rails', '~> 2.2.1' # JS time library -gem 'newrelic_rpm', '~> 3.6.8.168' # Production monitoring -gem 'nprogress-rails', '~> 0.1.2.2' # Loading bar for turbolinks -gem 'pg', '~> 0.17.0' # Postgres ActiveRecord adapter -gem 'queue_classic', '~> 2.2.3' # Backgrounding queue that uses postgres for db -gem 'rack-canonical-host', '~> 0.0.8' # Automatically redirect to canonical host -gem 'rack-mini-profiler', '~> 0.1.29' # Middleware that displays speed badge for every html page -gem 'redcarpet', '~> 3.0.0' # Add markdown parsing and rendering -gem 'responders', '~> 1.0.0.rc' # Minimal controllers via responders.yml -gem 'retina_tag', '~> 1.2.2' # Retina image tags -gem 'rolify', '~> 3.3.0.rc4' # Role management library with resource scoping -gem 'rollout', '~> 2.0.0' # Feature flipper -gem 's3_direct_upload', '~> 0.1.6' # Client-side straight-to-s3 file uploads -gem 'sass-rails', '~> 4.0.0' # CSS3 extension (mixins, variables, nesting, etc) -gem 'selectize-rails', '~> 0.8.1' # Textbox/select autocopmlete for tagging and contact lists -gem 'simple_form', '~> 3.0.0.rc' # Simplified DSL for forms''' -gem 'slim-rails', '~> 2.0.3' # Our favorite Ruby templating engine for html -gem 'turbolinks', '~> 1.3.0' # Makes following links in your web application faster -gem 'uglifier', '>= 1.0.3' # Makes your JS ugly (compressed) -gem 'unicorn', '~> 4.6.2' # HTTP server for fast clients on low-latency, high-bandwidth connections -gem 'validates_existence', '~> 0.8.0' # Validates Rails model belongs_to association existence -gem 'will_paginate', '~> 3.0.5' # Pagination +ruby '2.1.1' + +gem 'rails', '4.1.0' + +gem 'american_date', '~> 1.1.0' # American style month/day/year date parsing +gem 'dalli', '~> 2.7.0' # High performance memcached client +gem 'pg', '~> 0.17.1' # Postgres ActiveRecord adapter +gem 'queue_classic', '~> 3.0.0rc' # Backgrounding queue that uses postgres for its queue +gem 'rack-canonical-host', '~> 0.1.0' # Automatically redirect to canonical host +gem 'simple_form', '~> 3.0.1' # Forms made easy +gem 'unicorn', '~> 4.8.2' # HTTP server for fast clients on low-latency, high-bandwidth connections + +# Asset/View related gems +gem 'bootstrap-sass', '~> 3.1.1.1' # Sleek, intuitive, and powerful mobile first front-end framework +gem 'coffee-rails', '~> 4.0.0' # Add Coffescript support to the asset pipeline +gem 'font_assets', '~> 0.1.10' # Addresses Access-Control-Allow-Origin asset problems in Firefox +gem 'high_voltage', '~> 2.1.0' # Easily include static pages +gem 'jquery-rails', '~> 3.1.0' # jQuery 1.10 for pipeline +gem 'momentjs-rails', '~> 2.6.0' # JavaScript Time Library +gem 'sass-rails', '~> 4.0.3' # CSS3 extension (mixins, variables, nesting, etc) +gem 'slim-rails', '~> 2.1.4' # A fast, lightweight templating engine +gem 'turbolinks', '~> 2.2.2' # Makes following links in your web application faster +gem 'uglifier', '~> 2.5.0' # Makes your JS ugly (compressed) + +gem 'jbuilder', '~> 2.0.7' # Build JSON APIs with ease + +gem 'sdoc', group: :doc, require: false # bundle exec rake doc:rails generates the API under doc/api group :development do - gem 'awesome_print' # Inspect your objects with style (and color) - gem 'brakeman' # Security auditing - gem 'bullet' # Finds your N+1 problems - gem 'foreman' # Manage Procfile-based applications (run multiple ruby processes by running foreman) - gem 'binding_of_caller' # Provide advanced features for better_errors pages - gem 'better_errors' # More helpful error pages in development - gem 'letter_opener' # Open development emails in a browser instead of sending them - gem 'lol_dba' # Scan your models for columns that (probably) should be indexed - gem 'quiet_assets' # No more "Served asset" in your logs - gem 'rails_best_practices' # Code metric tool for showing best practices you're missing out on - gem 'switch_user' # Easily switch users in dev - gem 'thin' # Fast threaded HTTP server for local development - gem 'traceroute' # Finds unused routes - gem 'xray-rails' # See into your views to easily open a partial from your browser + gem 'spring' # Spring speeds up development by keeping your application running in the background + gem 'thin' # Fast threaded HTTP server for local development end group :development, :test do - gem 'dotenv-rails' # Autoload ENV vars in .env - gem 'pry-awesome_print' # Auto AP in pry - gem 'pry-rails' # Interactive REPL debugger - gem 'pry-plus' # Add a bunch of awesome pry stuff (rescue, stack_explorer, doc) - gem 'pry-remote' # Use pry with pow - gem 'recipient_interceptor' # Intercept recipients when delivering email with the Mail gem - gem 'table_print' # Explore your ActiveRecord data with ease -end - -group :test do - gem 'capybara' # Acceptance test framework - gem 'capybara_minitest_spec' # Integrates capybara and minitest; Duh - gem 'database_cleaner' # Cleans db between test runs - gem 'factory_girl_rails' # For stubbing/creating objects with factories - gem 'minitest-metadata' # Metadata (key-value) support for minitest/spec - gem 'minitest-spec-rails' # Nice minitest integration with Rails - gem 'poltergeist' # Uses phantomjs to headlessly test your views - gem 'simplecov', require: false # Test coverage reporting - gem 'timecop' # Freeze/change time for your tests -end - -group :staging, :production do - gem 'rails_12factor', '~> 0.0.2' # Heroku gem for logging and asset serving - gem 'heroku', '~> 3.0.1' # For continous deployment -end - -group :production do - gem 'airbrake', '~> 3.1.12' # Logs exceptions on airbrake.io + gem 'autotest-rails' # Run 'autotest' to continually run your tests on change + gem 'dotenv-rails' # Autoload ENV vars in .env + gem 'minitest-spec-rails' # MiniTest integration for Rails 3 and 4 + gem 'minitest-reporters' # Customizable MiniTest output formats + gem 'pry-awesome_print' # Auto AP in pry + gem 'pry-rails' # Interactive REPL debugger + gem 'pry-plus' # Add a bunch of awesome pry stuff (rescue, stack_explorer, doc) end diff --git a/Gemfile.lock b/Gemfile.lock index 43761dc..2f926d2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,213 +1,109 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.0.0) - actionpack (= 4.0.0) - mail (~> 2.5.3) - actionpack (4.0.0) - activesupport (= 4.0.0) - builder (~> 3.1.0) - erubis (~> 2.7.0) + ZenTest (4.10.0) + actionmailer (4.1.0) + actionpack (= 4.1.0) + actionview (= 4.1.0) + mail (~> 2.5.4) + actionpack (4.1.0) + actionview (= 4.1.0) + activesupport (= 4.1.0) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.0) - activesupport (= 4.0.0) - builder (~> 3.1.0) - activerecord (4.0.0) - activemodel (= 4.0.0) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.0) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.3) - activesupport (4.0.0) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) + actionview (4.1.0) + activesupport (= 4.1.0) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.0) + activesupport (= 4.1.0) + builder (~> 3.1) + activerecord (4.1.0) + activemodel (= 4.1.0) + activesupport (= 4.1.0) + arel (~> 5.0.0) + activesupport (4.1.0) + i18n (~> 0.6, >= 0.6.9) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - addressable (2.3.5) - airbrake (3.1.14) - builder - json + tzinfo (~> 1.1) + addressable (2.3.6) american_date (1.1.0) - arel (4.0.1) - atomic (1.1.14) - authority (2.9.0) - activesupport (>= 3.0.0) - rake (>= 0.8.7) + ansi (1.4.3) + arel (5.0.1.20140414130214) + autotest-rails (4.2.1) + ZenTest (~> 4.5) awesome_print (1.1.0) - bcrypt-ruby (3.1.2) - better_errors (1.0.1) - coderay (>= 1.0.0) - erubis (>= 2.6.6) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bond (0.4.3) - bootstrap-sass (3.0.0.0) + bond (0.5.1) + bootstrap-sass (3.1.1.1) sass (~> 3.2) - brakeman (2.2.0) - erubis (~> 2.6) - fastercsv (~> 1.5) - haml (>= 3.0, < 5.0) - highline (~> 1.6.20) - multi_json (~> 1.2) - ruby2ruby (~> 2.0.5) - ruby_parser (~> 3.2.2) - sass (~> 3.0) - slim (>= 1.3.6, < 3.0) - terminal-table (~> 1.4) - builder (3.1.4) - bullet (4.6.0) - uniform_notifier - capybara (2.1.0) - mime-types (>= 1.16) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (~> 2.0) - capybara_minitest_spec (1.0.1) - capybara (>= 2) - minitest (>= 2) - carrierwave (0.9.0) - activemodel (>= 3.2.0) - activesupport (>= 3.2.0) - json (>= 1.7) - chunky_png (1.2.9) - cliver (0.2.2) - code_analyzer (0.4.3) - sexp_processor - coderay (1.0.9) + builder (3.2.2) + coderay (1.1.0) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.6.3) - colored (1.2) - columnize (0.3.6) - compass (0.12.2) - chunky_png (~> 1.2) - fssm (>= 0.2.7) - sass (~> 3.1) - compass-rails (1.1.2) - compass (>= 0.12.2) + coffee-script-source (1.7.0) + columnize (0.8.9) daemons (1.1.9) - dalli (2.6.4) - database_cleaner (1.2.0) + dalli (2.7.0) debug_inspector (0.0.2) - debugger (1.6.2) + debugger (1.6.6) columnize (>= 0.3.1) debugger-linecache (~> 1.2.0) - debugger-ruby_core_source (~> 1.2.3) + debugger-ruby_core_source (~> 1.3.2) debugger-linecache (1.2.0) - debugger-ruby_core_source (1.2.3) - devise (3.1.1) - bcrypt-ruby (~> 3.0) - orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) - thread_safe (~> 0.1) - warden (~> 1.2.3) - dotenv (0.9.0) - dotenv-rails (0.9.0) - dotenv (= 0.9.0) + debugger-ruby_core_source (1.3.2) + dotenv (0.11.1) + dotenv-deployment (~> 0.0.2) + dotenv-deployment (0.0.2) + dotenv-rails (0.11.1) + dotenv (= 0.11.1) erubis (2.7.0) eventmachine (1.0.3) - excon (0.25.3) execjs (2.0.2) - factory_girl (4.2.0) - activesupport (>= 3.0.0) - factory_girl_rails (4.2.1) - factory_girl (~> 4.2.0) - railties (>= 3.0.0) - fastercsv (1.5.5) - fog (1.14.0) - builder - excon (~> 0.25.0) - formatador (~> 0.2.0) - mime-types - multi_json (~> 1.0) - net-scp (~> 1.1) - net-ssh (>= 2.1.3) - nokogiri (~> 1.5) - ruby-hmac - font_assets (0.1.10) + font_assets (0.1.11) rack - foreman (0.63.0) - dotenv (>= 0.7) - thor (>= 0.13.6) - formatador (0.2.4) - fssm (0.2.10) - haml (4.0.3) - tilt - has_scope (0.5.1) - heroku (3.0.1) - heroku-api (~> 0.3.7) - launchy (>= 0.3.2) - netrc (~> 0.7.7) - rest-client (~> 1.6.1) - rubyzip - heroku-api (0.3.15) - excon (~> 0.25.1) - high_voltage (2.0.0) - highline (1.6.20) + high_voltage (2.1.0) hike (1.2.3) - i18n (0.6.5) - interception (0.3) + i18n (0.6.9) + interception (0.5) + jbuilder (2.0.7) + activesupport (>= 3.0.0, < 5) + multi_json (~> 1.2) jist (1.5.1) json - jquery-fileupload-rails (0.4.1) - actionpack (>= 3.1) - railties (>= 3.1) - jquery-rails (3.0.4) + jquery-rails (3.1.0) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.1) - kgio (2.8.1) - launchy (2.3.0) - addressable (~> 2.3) - letter_opener (1.1.2) - launchy (~> 2.2) - lol_dba (1.6.0) - actionpack (>= 3.0) - activerecord (>= 3.0) - railties (>= 3.0) + kgio (2.9.2) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) - memcachier (0.0.2) method_source (0.8.2) - mime-types (1.25) - mini_magick (3.6.0) - subexec (~> 0.2.1) - mini_portile (0.5.2) - minitest (4.7.5) - minitest-metadata (0.4.0) - minitest (~> 4.7) - minitest-spec-rails (4.7.4) - minitest (~> 4.7) - rails (<= 4.0) - momentjs-rails (2.2.1) + mime-types (1.25.1) + minitest (5.3.3) + minitest-reporters (1.0.4) + ansi + builder + minitest (>= 5.0) + ruby-progressbar + minitest-spec-rails (5.0.3) + minitest (~> 5.0) + rails (~> 4.1.0.rc2) + momentjs-rails (2.6.0) railties (>= 3.1) - multi_json (1.8.2) - net-scp (1.1.2) - net-ssh (>= 2.6.5) - net-ssh (2.7.0) - netrc (0.7.7) - newrelic_rpm (3.6.8.168) - nokogiri (1.6.0) - mini_portile (~> 0.5.0) - nprogress-rails (0.1.2.3) - orm_adapter (0.4.0) - pg (0.17.0) - poltergeist (1.4.1) - capybara (~> 2.1.0) - cliver (~> 0.2.1) - multi_json (~> 1.0) - websocket-driver (>= 0.2.0) - polyglot (0.3.3) - pry (0.9.12.2) - coderay (~> 1.0.5) + multi_json (1.9.3) + pg (0.17.1) + polyglot (0.3.4) + pry (0.9.12.6) + coderay (~> 1.0) method_source (~> 0.8) slop (~> 3.4) pry-awesome_print (9.6.8) @@ -216,9 +112,9 @@ GEM pry-debugger (0.2.2) debugger (~> 1.3) pry (~> 0.9.10) - pry-doc (0.4.6) - pry (>= 0.9) - yard (>= 0.8) + pry-doc (0.6.0) + pry (~> 0.9) + yard (~> 0.8) pry-docmore (0.1.1) pry pry-doc @@ -232,231 +128,125 @@ GEM pry-stack_explorer pry-rails (0.3.2) pry (>= 0.9.10) - pry-remote (0.1.7) - pry (~> 0.9) - slop (~> 3.0) - pry-rescue (1.2.0) - interception (>= 0.3) + pry-rescue (1.4.1) + interception (>= 0.5) pry pry-stack_explorer (0.4.9.1) binding_of_caller (>= 0.7) pry (>= 0.9.11) - queue_classic (2.2.3) + queue_classic (3.0.0rc) pg (~> 0.17.0) - quiet_assets (1.0.2) - railties (>= 3.1, < 5.0) rack (1.5.2) - rack-canonical-host (0.0.8) + rack-canonical-host (0.1.0) addressable rack (~> 1.0) - rack-mini-profiler (0.1.31) - rack (>= 1.1.3) rack-test (0.6.2) rack (>= 1.0) - rails (4.0.0) - actionmailer (= 4.0.0) - actionpack (= 4.0.0) - activerecord (= 4.0.0) - activesupport (= 4.0.0) + rails (4.1.0) + actionmailer (= 4.1.0) + actionpack (= 4.1.0) + actionview (= 4.1.0) + activemodel (= 4.1.0) + activerecord (= 4.1.0) + activesupport (= 4.1.0) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.0) - sprockets-rails (~> 2.0.0) - rails_12factor (0.0.2) - rails_serve_static_assets - rails_stdout_logging - rails_best_practices (1.14.4) - activesupport - awesome_print - code_analyzer (>= 0.4.3) - colored - erubis - i18n - require_all - ruby-progressbar - rails_serve_static_assets (0.0.1) - rails_stdout_logging (0.0.3) - railties (4.0.0) - actionpack (= 4.0.0) - activesupport (= 4.0.0) + railties (= 4.1.0) + sprockets-rails (~> 2.0) + railties (4.1.0) + actionpack (= 4.1.0) + activesupport (= 4.1.0) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - raindrops (0.12.0) - rake (10.1.0) - recipient_interceptor (0.1.2) - mail - redcarpet (3.0.0) - redis (3.0.5) - require_all (1.3.2) - responders (1.0.0) - railties (>= 3.2, < 5) - rest-client (1.6.7) - mime-types (>= 1.16) - retina_tag (1.2.2) - jquery-rails - rails (>= 4.0) - rolify (3.3.0.rc4) - rollout (2.0.0) - redis - ruby-hmac (0.4.0) - ruby-progressbar (1.2.0) - ruby2ruby (2.0.6) - ruby_parser (~> 3.1) - sexp_processor (~> 4.0) - ruby_parser (3.2.2) - sexp_processor (~> 4.1) - rubyzip (1.0.0) - s3_direct_upload (0.1.6) - coffee-rails (>= 3.2.1) - jquery-fileupload-rails (~> 0.4.1) - rails (>= 3.2) - sass-rails (>= 3.2.5) - sass (3.2.12) - sass-rails (4.0.1) + raindrops (0.13.0) + rake (10.3.1) + rdoc (4.1.1) + json (~> 1.4) + ruby-progressbar (1.4.2) + sass (3.2.19) + sass-rails (4.0.3) railties (>= 4.0.0, < 5.0) - sass (>= 3.1.10) - sprockets-rails (~> 2.0.0) - selectize-rails (0.8.1) - sexp_processor (4.4.0) - simple_form (3.0.0) - actionpack (>= 4.0.0, < 4.1) - activemodel (>= 4.0.0, < 4.1) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) + sass (~> 3.2.0) + sprockets (~> 2.8, <= 2.11.0) + sprockets-rails (~> 2.0) + sdoc (0.4.0) + json (~> 1.8) + rdoc (~> 4.0, < 5.0) + simple_form (3.0.2) + actionpack (~> 4.0) + activemodel (~> 4.0) slim (2.0.2) temple (~> 0.6.6) tilt (>= 1.3.3, < 2.1) - slim-rails (2.0.3) - actionpack (>= 3.0, < 4.1) - activesupport (>= 3.0, < 4.1) - railties (>= 3.0, < 4.1) + slim-rails (2.1.4) + actionpack (>= 3.0, < 4.2) + activesupport (>= 3.0, < 4.2) + railties (>= 3.0, < 4.2) slim (~> 2.0) - slop (3.4.6) - sprockets (2.10.0) + slop (3.5.0) + spring (1.1.2) + sprockets (2.8.0) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) + sprockets-rails (2.1.3) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (~> 2.8) - subexec (0.2.3) - switch_user (0.9.3) - table_print (1.5.1) temple (0.6.7) - terminal-table (1.4.5) - thin (1.6.1) + thin (1.6.2) daemons (>= 1.0.9) eventmachine (>= 1.0.0) rack (>= 1.0.0) - thor (0.18.1) - thread_safe (0.1.3) - atomic + thor (0.19.1) + thread_safe (0.3.3) tilt (1.4.1) - timecop (0.6.3) - traceroute (0.3.0) - rails (>= 3.0.0) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - turbolinks (1.3.0) + turbolinks (2.2.2) coffee-rails - tzinfo (0.3.38) - uglifier (2.3.0) + tzinfo (1.1.0) + thread_safe (~> 0.1) + uglifier (2.5.0) execjs (>= 0.3.0) json (>= 1.8.0) - unicorn (4.6.3) + unicorn (4.8.2) kgio (~> 2.6) rack raindrops (~> 0.7) - uniform_notifier (1.3.0) - validates_existence (0.8.0) - warden (1.2.3) - rack (>= 1.0) - websocket-driver (0.3.0) - will_paginate (3.0.5) - xpath (2.0.0) - nokogiri (~> 1.3) - xray-rails (0.1.6) - coffee-rails - rails (>= 3.1.0) - yard (0.8.7.2) + yard (0.8.7.4) PLATFORMS ruby DEPENDENCIES - airbrake (~> 3.1.12) american_date (~> 1.1.0) - authority (~> 2.9.0) - awesome_print - better_errors - binding_of_caller - bootstrap-sass (~> 3.0.0.0) - brakeman - bullet - capybara - capybara_minitest_spec - carrierwave (~> 0.9.0) + autotest-rails + bootstrap-sass (~> 3.1.1.1) coffee-rails (~> 4.0.0) - compass-rails (~> 1.1.2) - dalli (~> 2.6.4) - database_cleaner - devise (~> 3.1.1) + dalli (~> 2.7.0) dotenv-rails - factory_girl_rails - fog (~> 1.14.0) font_assets (~> 0.1.10) - foreman - has_scope (~> 0.5.1) - heroku (~> 3.0.1) - high_voltage (~> 2.0.0) - jquery-fileupload-rails (~> 0.4.1) - jquery-rails (~> 3.0.4) - letter_opener - lol_dba - memcachier (~> 0.0.2) - mini_magick (~> 3.6.0) - minitest-metadata + high_voltage (~> 2.1.0) + jbuilder (~> 2.0.7) + jquery-rails (~> 3.1.0) + minitest-reporters minitest-spec-rails - momentjs-rails (~> 2.2.1) - newrelic_rpm (~> 3.6.8.168) - nprogress-rails (~> 0.1.2.2) - pg (~> 0.17.0) - poltergeist + momentjs-rails (~> 2.6.0) + pg (~> 0.17.1) pry-awesome_print pry-plus pry-rails - pry-remote - queue_classic (~> 2.2.3) - quiet_assets - rack-canonical-host (~> 0.0.8) - rack-mini-profiler (~> 0.1.29) - rails (= 4.0.0) - rails_12factor (~> 0.0.2) - rails_best_practices - recipient_interceptor - redcarpet (~> 3.0.0) - responders (~> 1.0.0.rc) - retina_tag (~> 1.2.2) - rolify (~> 3.3.0.rc4) - rollout (~> 2.0.0) - s3_direct_upload (~> 0.1.6) - sass-rails (~> 4.0.0) - selectize-rails (~> 0.8.1) - simple_form (~> 3.0.0.rc) - simplecov - slim-rails (~> 2.0.3) - switch_user - table_print + queue_classic (~> 3.0.0rc) + rack-canonical-host (~> 0.1.0) + rails (= 4.1.0) + sass-rails (~> 4.0.3) + sdoc + simple_form (~> 3.0.1) + slim-rails (~> 2.1.4) + spring thin - timecop - traceroute - turbolinks (~> 1.3.0) - uglifier (>= 1.0.3) - unicorn (~> 4.6.2) - validates_existence (~> 0.8.0) - will_paginate (~> 3.0.5) - xray-rails + turbolinks (~> 2.2.2) + uglifier (~> 2.5.0) + unicorn (~> 4.8.2) diff --git a/Rakefile b/Rakefile index 897266d..d119c1e 100644 --- a/Rakefile +++ b/Rakefile @@ -3,4 +3,7 @@ require File.expand_path('../config/application', __FILE__) -MyApp::Application.load_tasks +Rails.application.load_tasks + +Rake::Task['default'].clear +task default: 'test:all' diff --git a/app/assets/javascripts/application.coffee b/app/assets/javascripts/application.coffee new file mode 100644 index 0000000..a37af36 --- /dev/null +++ b/app/assets/javascripts/application.coffee @@ -0,0 +1,4 @@ +#= require jquery +#= require jquery_ujs +#= require turbolinks +#= require_tree . diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js deleted file mode 100644 index d6925fa..0000000 --- a/app/assets/javascripts/application.js +++ /dev/null @@ -1,16 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, -// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. -// -// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details -// about supported directives. -// -//= require jquery -//= require jquery_ujs -//= require turbolinks -//= require_tree . diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css deleted file mode 100644 index 3192ec8..0000000 --- a/app/assets/stylesheets/application.css +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, - * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the top of the - * compiled file, but it's generally better to create a new file per style scope. - * - *= require_self - *= require_tree . - */ diff --git a/app/assets/stylesheets/application.css.sass b/app/assets/stylesheets/application.css.sass new file mode 100644 index 0000000..79ffd23 --- /dev/null +++ b/app/assets/stylesheets/application.css.sass @@ -0,0 +1 @@ +@import "bootstrap" diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 25b28d6..8fa1d9c 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -7,5 +7,4 @@ html = csrf_meta_tags body - = yield diff --git a/app/views/pages/index.html.slim b/app/views/pages/index.html.slim index 31c11a2..a3f2a2c 100644 --- a/app/views/pages/index.html.slim +++ b/app/views/pages/index.html.slim @@ -1,4 +1,3 @@ h1 Welcome to Rails -a href='/rails/info/properties' - | Application properties +a href='/rails/info/properties' Application properties diff --git a/bin/rename b/bin/rename deleted file mode 100755 index 29be61a..0000000 --- a/bin/rename +++ /dev/null @@ -1,8 +0,0 @@ -#! /usr/bin/env bash -[[ -z $1 ]] && echo 'Provide an app name' && exit 1 -input_string=${2:-MyApp} -input_string_underscored=$(ruby -r'active_support/inflector' -e "puts '$input_string'.strip.underscore") -output_string=$1 -output_string_underscored=$(ruby -r'active_support/inflector' -e "puts '$output_string'.strip.underscore") -git grep -l -e "$input_string" | grep -v 'bin/rename' | xargs sed -i '' "s/$input_string/$output_string/g" -git grep -l -e "$input_string_underscored" | grep -v 'bin/rename' | xargs sed -i '' "s/$input_string_underscored/$output_string_underscored/g" diff --git a/config.ru b/config.ru index b34eb62..fc51304 100644 --- a/config.ru +++ b/config.ru @@ -1,6 +1,7 @@ # This file is used by Rack-based servers to start the application. -require File.expand_path('config/environment', __dir__) +require ::File.expand_path('../config/environment', __FILE__) + use Rack::CanonicalHost, ENV['CANONICAL_HOST'] if ENV['CANONICAL_HOST'] run Rails.application diff --git a/config/application.rb b/config/application.rb index 8d00360..3b7fee2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -4,55 +4,29 @@ # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. -Bundler.require(:default, Rails.env) +Bundler.require(*Rails.groups) -module MyApp - class Application < Rails::Application +raise %Q( + Please set an APP_NAME environment variable in .env. + If you are initializing this app, run bin/setup to copy over the example .env. +) unless ENV['APP_NAME'] + +Object.const_set(ENV.fetch('APP_NAME').camelize, Module.new do + const_set :Application, Class.new(Rails::Application) do # 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. - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - # Use SQL instead of Active Record's schema dumper when creating the database (for QueueClassic) - # This is necessary if your schema can't be completely dumped by the schema dumper, - # like if you have constraints or database-specific column types config.active_record.schema_format = :sql - # Tell Unicorn to log to STDOUT on Heroku - config.logger = Logger.new(STDOUT) unless Rails.env.development? - # Raise errors when an unpermitted param is sent to a controller action ActiveRecord::Base.send(:include, ActiveModel::ForbiddenAttributesProtection) - config.app_uri = URI.parse ENV.fetch('APP_URI') - - # ActionMailer Config with Mandrill from Mailchimp for transactional mail - config.action_mailer.delivery_method = ENV.fetch('MAIL_DELIVERY_METHOD', :smtp).to_sym - if config.action_mailer.delivery_method == :smtp - config.action_mailer.smtp_settings = { - address: 'smtp.mandrillapp.com', - port: 587, - enable_starttls_auto: true, - user_name: ENV.fetch('MANDRILL_USERNAME'), - password: ENV.fetch('MANDRILL_APIKEY'), - authentication: :plain, - domain: config.app_uri.host - } - end - - config.action_mailer.perform_deliveries = true - config.action_mailer.raise_delivery_errors = false - config.action_mailer.default charset: "utf-8" - config.action_mailer.default_url_options = { protocol: config.app_uri.scheme, host: config.app_uri.host } - config.action_mailer.asset_host = config.app_uri.to_s - end -end + # Add the fonts path + config.assets.paths << Rails.root.join('app', 'assets', 'fonts') -Mail.register_interceptor RecipientInterceptor.new(ENV['EMAIL_RECIPIENTS']) if ENV['EMAIL_RECIPIENTS'] && defined?(Mail) && !Rails.env.test? + # Precompile additional assets + config.assets.precompile += %w(.svg .eot .woff .ttf) + end +end) diff --git a/config/boot.rb b/config/boot.rb index 3596736..5e5f0c1 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) diff --git a/config/database.yml b/config/database.yml index a23c995..acbc13c 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,19 +1,19 @@ development: &development adapter : postgresql encoding : unicode - database : my_app_development + database : <%= ENV['APP_NAME'] %>_development template : template0 pool : 5 min_messages : warning test: &test <<: *development - database : my_app_test + database : <%= ENV['APP_NAME'] %>_test staging: &staging <<: *development - database : my_app_staging + database : <%= ENV['APP_NAME'] %>_staging production: &production <<: *development - database : my_app_production + database : <%= ENV['APP_NAME'] %>_production diff --git a/config/environment.rb b/config/environment.rb index 98a6efb..ee8d90d 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -2,4 +2,4 @@ require File.expand_path('../application', __FILE__) # Initialize the Rails application. -MyApp::Application.initialize! +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 139f526..28bfb50 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,4 @@ -MyApp::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on @@ -14,42 +14,19 @@ config.action_controller.perform_caching = true # Cache stuff in memcache - config.cache_store = :mem_cache_store, { expires_in: 10.minutes } + config.cache_store = :dalli_store, { expires_in: 10.minutes } - # Open email in browser or send via smtp - if ENV['EMAIL_RECIPIENTS'] == 'letter_opener' - config.action_mailer.delivery_method = :letter_opener - end - - # Enable serving of images, stylesheets, and JavaScripts from an asset server for mailers. - config.action_mailer.asset_host = "http://localhost:3000" - - # Raise real errors in development - config.action_mailer.raise_delivery_errors = true + # Don't care if the mailer can't send. + config.action_mailer.raise_delivery_errors = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raise an error on page load if there are pending migrations + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true - - # Add the fonts path - config.assets.paths << Rails.root.join('app', 'assets', 'fonts') - - # Precompile additional assets - config.assets.precompile += %w( .svg .eot .woff .ttf ) - - # Configure Bullet - config.after_initialize do - Bullet.enable = true - Bullet.console = true - Bullet.rails_logger = true - end - - BetterErrors::Middleware.allow_ip! ENV['BETTER_ERRORS_TRUSTED_IP'] if (IPAddr(ENV['BETTER_ERRORS_TRUSTED_IP']) rescue false) end diff --git a/config/environments/production.rb b/config/environments/production.rb index e501ef6..0a43015 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,4 +1,4 @@ -MyApp::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. @@ -19,14 +19,14 @@ # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. # config.action_dispatch.rack_cache = true - # Enable Rails's static asset server (for passthrough CDNs) + # Enable Rails's static asset server (for passthrough CDNs). config.serve_static_assets = true # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass - # Fallback to assets pipeline if a precompiled asset is missed + # Fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = true # Generate digests for assets URLs. @@ -57,14 +57,11 @@ # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) - # Use a different cache store in production + # Use a different cache store in production. config.cache_store = :dalli_store - # Add the fonts path - config.assets.paths << Rails.root.join('app', 'assets', 'fonts') - - # Precompile additional assets - config.assets.precompile += %w( .svg .eot .woff .ttf ) + # Addresses Access-Control-Allow-Origin asset problems in Firefox + config.font_assets.origin = "https://#{ENV['CANONICAL_HOST']}" # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = "http://assets.example.com" diff --git a/config/environments/test.rb b/config/environments/test.rb index 912165d..2b47988 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,4 @@ -MyApp::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's @@ -16,12 +16,6 @@ config.serve_static_assets = true config.static_cache_control = "public, max-age=3600" - # Add the fonts path - config.assets.paths << Rails.root.join('app', 'assets', 'fonts') - - # Precompile additional assets - config.assets.precompile += %w( .svg .eot .woff .ttf ) - # Silence SQL and other logging in test (tail log/test.log instead) config.logger = nil diff --git a/config/initializers/queue_classic_patch.rb b/config/initializers/queue_classic_patch.rb deleted file mode 100644 index 4aa1502..0000000 --- a/config/initializers/queue_classic_patch.rb +++ /dev/null @@ -1,12 +0,0 @@ -# Resolves "connection is closed" in integration tests. See: https://github.com/ryandotsmith/queue_classic/issues/96#issuecomment-24118800 -if Rails.env.development? || Rails.env.test? - module QC - module Conn - def connect - conn = ActiveRecord::Base.connection.raw_connection - log(:level => :error, :message => conn.error) if conn.status != PGconn::CONNECTION_OK - conn - end - end - end -end diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index 17b7eab..d72e18c 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -9,4 +9,4 @@ # Make sure your secret_key_base is kept private # if you're sharing your code publicly. -MyApp::Application.config.secret_key_base = ENV.fetch('RAILS_SECRET_TOKEN') +Rails.application.config.secret_key_base = ENV.fetch('RAILS_SECRET_TOKEN') diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 96daa03..639915c 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -MyApp::Application.config.session_store :cookie_store, key: "_#{Rails.application.class.parent_name}_session" +Rails.application.config.session_store :cookie_store, key: "_#{Rails.application.class.parent_name.underscore}_session" diff --git a/config/initializers/simple_form.rb b/config/initializers/simple_form.rb new file mode 100644 index 0000000..6986de9 --- /dev/null +++ b/config/initializers/simple_form.rb @@ -0,0 +1,145 @@ +# Use this setup block to configure all options available in SimpleForm. +SimpleForm.setup do |config| + # Wrappers are used by the form builder to generate a + # complete input. You can remove any component from the + # wrapper, change the order or even add your own to the + # stack. The options given below are used to wrap the + # whole input. + config.wrappers :default, class: :input, + hint_class: :field_with_hint, error_class: :field_with_errors do |b| + ## Extensions enabled by default + # Any of these extensions can be disabled for a + # given input by passing: `f.input EXTENSION_NAME => false`. + # You can make any of these extensions optional by + # renaming `b.use` to `b.optional`. + + # Determines whether to use HTML5 (:email, :url, ...) + # and required attributes + b.use :html5 + + # Calculates placeholders automatically from I18n + # You can also pass a string as f.input placeholder: "Placeholder" + b.use :placeholder + + ## Optional extensions + # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup` + # to the input. If so, they will retrieve the values from the model + # if any exists. If you want to enable the lookup for any of those + # extensions by default, you can change `b.optional` to `b.use`. + + # Calculates maxlength from length validations for string inputs + b.optional :maxlength + + # Calculates pattern from format validations for string inputs + b.optional :pattern + + # Calculates min and max from length validations for numeric inputs + b.optional :min_max + + # Calculates readonly automatically from readonly attributes + b.optional :readonly + + ## Inputs + b.use :label_input + b.use :hint, wrap_with: { tag: :span, class: :hint } + b.use :error, wrap_with: { tag: :span, class: :error } + end + + # The default wrapper to be used by the FormBuilder. + config.default_wrapper = :default + + # Define the way to render check boxes / radio buttons with labels. + # Defaults to :nested for bootstrap config. + # inline: input + label + # nested: label > input + config.boolean_style = :nested + + # Default class for buttons + config.button_class = 'btn' + + # Method used to tidy up errors. Specify any Rails Array method. + # :first lists the first message for each field. + # Use :to_sentence to list all errors for each field. + # config.error_method = :first + + # Default tag used for error notification helper. + config.error_notification_tag = :div + + # CSS class to add for error notification helper. + config.error_notification_class = 'alert alert-error' + + # ID to add for error notification helper. + # config.error_notification_id = nil + + # Series of attempts to detect a default label method for collection. + # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] + + # Series of attempts to detect a default value method for collection. + # config.collection_value_methods = [ :id, :to_s ] + + # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. + # config.collection_wrapper_tag = nil + + # You can define the class to use on all collection wrappers. Defaulting to none. + # config.collection_wrapper_class = nil + + # You can wrap each item in a collection of radio/check boxes with a tag, + # defaulting to :span. Please note that when using :boolean_style = :nested, + # SimpleForm will force this option to be a label. + # config.item_wrapper_tag = :span + + # You can define a class to use in all item wrappers. Defaulting to none. + # config.item_wrapper_class = nil + + # How the label text should be generated altogether with the required text. + # config.label_text = lambda { |label, required| "#{required} #{label}" } + + # You can define the class to use on all labels. Default is nil. + config.label_class = 'control-label' + + # You can define the class to use on all forms. Default is simple_form. + # config.form_class = :simple_form + + # You can define which elements should obtain additional classes + # config.generate_additional_classes_for = [:wrapper, :label, :input] + + # Whether attributes are required by default (or not). Default is true. + # config.required_by_default = true + + # Tell browsers whether to use the native HTML5 validations (novalidate form option). + # These validations are enabled in SimpleForm's internal config but disabled by default + # in this configuration, which is recommended due to some quirks from different browsers. + # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, + # change this configuration to true. + config.browser_validations = false + + # Collection of methods to detect if a file type was given. + # config.file_methods = [ :mounted_as, :file?, :public_filename ] + + # Custom mappings for input types. This should be a hash containing a regexp + # to match as key, and the input type that will be used when the field name + # matches the regexp as value. + # config.input_mappings = { /count/ => :integer } + + # Custom wrappers for input types. This should be a hash containing an input + # type as key and the wrapper that will be used for all inputs with specified type. + # config.wrapper_mappings = { string: :prepend } + + # Default priority for time_zone inputs. + # config.time_zone_priority = nil + + # Default priority for country inputs. + # config.country_priority = nil + + # When false, do not use translations for labels. + # config.translate_labels = true + + # Automatically discover new inputs in Rails' autoload path. + # config.inputs_discovery = true + + # Cache SimpleForm inputs discovery + # config.cache_discovery = !Rails.env.development? + + # Default class for inputs + # config.input_class = nil +end diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb new file mode 100644 index 0000000..ad4ca74 --- /dev/null +++ b/config/initializers/simple_form_bootstrap.rb @@ -0,0 +1,45 @@ +# Use this setup block to configure all options available in SimpleForm. +SimpleForm.setup do |config| + config.wrappers :bootstrap, tag: 'div', class: 'control-group', error_class: 'error' do |b| + b.use :html5 + b.use :placeholder + b.use :label + b.wrapper tag: 'div', class: 'controls' do |ba| + ba.use :input + ba.use :error, wrap_with: { tag: 'span', class: 'help-inline' } + ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } + end + end + + config.wrappers :prepend, tag: 'div', class: "control-group", error_class: 'error' do |b| + b.use :html5 + b.use :placeholder + b.use :label + b.wrapper tag: 'div', class: 'controls' do |input| + input.wrapper tag: 'div', class: 'input-prepend' do |prepend| + prepend.use :input + end + input.use :hint, wrap_with: { tag: 'span', class: 'help-block' } + input.use :error, wrap_with: { tag: 'span', class: 'help-inline' } + end + end + + config.wrappers :append, tag: 'div', class: "control-group", error_class: 'error' do |b| + b.use :html5 + b.use :placeholder + b.use :label + b.wrapper tag: 'div', class: 'controls' do |input| + input.wrapper tag: 'div', class: 'input-append' do |append| + append.use :input + end + input.use :hint, wrap_with: { tag: 'span', class: 'help-block' } + input.use :error, wrap_with: { tag: 'span', class: 'help-inline' } + end + end + + # Wrappers for forms and inputs using the Twitter Bootstrap toolkit. + # Check the Bootstrap docs (http://twitter.github.com/bootstrap) + # to learn about the different styles for forms and inputs, + # buttons and other elements. + config.default_wrapper = :bootstrap +end diff --git a/config/locales/simple_form.en.yml b/config/locales/simple_form.en.yml new file mode 100644 index 0000000..0df11fe --- /dev/null +++ b/config/locales/simple_form.en.yml @@ -0,0 +1,26 @@ +en: + simple_form: + "yes": 'Yes' + "no": 'No' + required: + text: 'required' + mark: '*' + # You can uncomment the line below if you need to overwrite the whole required html. + # When using html, text and mark won't be used. + # html: '*' + error_notification: + default_message: "Please review the problems below:" + # Labels and hints examples + # labels: + # defaults: + # password: 'Password' + # user: + # new: + # email: 'E-mail to sign in.' + # edit: + # email: 'E-mail.' + # hints: + # defaults: + # username: 'User name to sign in.' + # password: 'No special characters, please.' + diff --git a/config/routes.rb b/config/routes.rb index 4bef8a4..8f82795 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -MyApp::Application.routes.draw do +Rails.application.routes.draw do # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes". @@ -39,7 +39,7 @@ # get 'recent', on: :collection # end # end - + # Example resource route with concerns: # concern :toggleable do # post 'toggle' @@ -53,11 +53,11 @@ # # (app/controllers/admin/products_controller.rb) # resources :products # end - + # # Point root to static index file using high_voltage gem - root to: 'high_voltage/pages#show', id: 'index' + root to: 'high_voltage/pages#show', id: 'index' # Point fallback route to any matching static page # Keep this at the end to avoid conflicting with other routes - get ':id' => 'high_voltage/pages#show', as: :static + get ':id' => 'high_voltage/pages#show', as: :static end diff --git a/config/unicorn.rb b/config/unicorn.rb index e025676..f0c30cf 100644 --- a/config/unicorn.rb +++ b/config/unicorn.rb @@ -3,7 +3,7 @@ GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true before_exec do |server| - ENV['RUBY_HEAP_MIN_SLOTS']=800000 + ENV['RUBY_GC_HEAP_INIT_SLOTS']=800000 ENV['RUBY_GC_MALLOC_LIMIT']=90000000 ENV['RUBY_HEAP_SLOTS_INCREMENT']=10000 ENV['RUBY_HEAP_SLOTS_GROWTH_FACTOR']=1 diff --git a/custom_plan.rb b/custom_plan.rb deleted file mode 100644 index fc903c1..0000000 --- a/custom_plan.rb +++ /dev/null @@ -1,13 +0,0 @@ -require 'zeus/rails' - -class CustomPlan < Zeus::Rails - - def test_environment - require 'minitest/unit' - MiniTest::Unit.class_variable_set("@@installed_at_exit", true) - super - end - -end - -Zeus.plan = CustomPlan.new diff --git a/db/migrate/20131121215515_add_queue_classic.rb b/db/migrate/20140115230618_add_queue_classic.rb similarity index 100% rename from db/migrate/20131121215515_add_queue_classic.rb rename to db/migrate/20140115230618_add_queue_classic.rb diff --git a/db/structure.sql b/db/structure.sql index e658d87..5e65862 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3,6 +3,7 @@ -- SET statement_timeout = 0; +SET lock_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SET check_function_bodies = false; @@ -199,4 +200,5 @@ CREATE TRIGGER queue_classic_notify AFTER INSERT ON queue_classic_jobs FOR EACH SET search_path TO "$user",public; -INSERT INTO schema_migrations (version) VALUES ('20131121215515'); +INSERT INTO schema_migrations (version) VALUES ('20140115230618'); + diff --git a/lib/tasks/test_environment.rake b/lib/tasks/test_environment.rake new file mode 100644 index 0000000..0e0bb39 --- /dev/null +++ b/lib/tasks/test_environment.rake @@ -0,0 +1,8 @@ +namespace :test do + desc "Run environment tests for each environment" + task environments: :environment do + Dir[File.expand_path('test/environments/*.rb', Rails.root)].each do |f| + system("ruby -Itest -Iconfig/environments #{f}") + end + end +end diff --git a/lib/templates/slim/scaffold/_form.html.slim b/lib/templates/slim/scaffold/_form.html.slim new file mode 100644 index 0000000..a2ff775 --- /dev/null +++ b/lib/templates/slim/scaffold/_form.html.slim @@ -0,0 +1,10 @@ += simple_form_for(@<%= singular_table_name %>) do |f| + = f.error_notification + + .form-inputs +<%- attributes.each do |attribute| -%> + = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> +<%- end -%> + + .form-actions + = f.button :submit diff --git a/public/404.html b/public/404.html index a0daa0c..b612547 100644 --- a/public/404.html +++ b/public/404.html @@ -2,17 +2,23 @@ The page you were looking for doesn't exist (404) + @@ -50,9 +57,11 @@
-

The page you were looking for doesn't exist.

-

You may have mistyped the address or the page may have moved.

+
+

The page you were looking for doesn't exist.

+

You may have mistyped the address or the page may have moved.

+
+

If you are the application owner check the logs for more information.

-

If you are the application owner check the logs for more information.

diff --git a/public/422.html b/public/422.html index fbb4b84..a21f82b 100644 --- a/public/422.html +++ b/public/422.html @@ -2,17 +2,23 @@ The change you wanted was rejected (422) + @@ -50,9 +57,11 @@
-

The change you wanted was rejected.

-

Maybe you tried to change something you didn't have access to.

+
+

The change you wanted was rejected.

+

Maybe you tried to change something you didn't have access to.

+
+

If you are the application owner check the logs for more information.

-

If you are the application owner check the logs for more information.

diff --git a/public/500.html b/public/500.html index e9052d3..061abc5 100644 --- a/public/500.html +++ b/public/500.html @@ -2,17 +2,23 @@ We're sorry, but something went wrong (500) + @@ -50,8 +57,10 @@
-

We're sorry, but something went wrong.

+
+

We're sorry, but something went wrong.

+
+

If you are the application owner check the logs for more information.

-

If you are the application owner check the logs for more information.

diff --git a/public/robots.txt b/public/robots.txt index 1a3a5e4..3c9c7c0 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,4 +1,4 @@ -# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file +# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file # # To ban all spiders from the entire site uncomment the next two lines: # User-agent: * diff --git a/test/environments/application.rb b/test/environments/application.rb new file mode 100644 index 0000000..00b22a3 --- /dev/null +++ b/test/environments/application.rb @@ -0,0 +1,103 @@ +require 'test_helper' + +describe "General Environment" do + it "has an application name" do + # This will need changing when you rename your app manually + Rails.application.class.parent_name.must_equal "MyApp" + end + + it "uses american date" do + DateTime.parse('01/10/1999').month.must_equal 1 + end + + it "has a rails-rename bin" do + File.size(Rails.root + 'bin/rails-rename').must_equal 589 + end + + it "has a setup bin" do + File.size(Rails.root + 'bin/setup').must_equal 81 + end + + it "has a .env.example" do + File.exist?(Rails.root + '.env.example').must_equal true + end + + it "has a .envrc" do + File.exist?(Rails.root + '.envrc').must_equal true + end + + it "has a Procfile" do + File.exist?(Rails.root + 'Procfile').must_equal true + end + + it "has a unicorn config" do + File.exist?(Rails.root + 'config/unicorn.rb').must_equal true + end + + it "disconnects currently connected database connections" do + File.size(Rails.root + 'lib/tasks/database_tasks.rake').must_equal 912 + end + + it "will output details on AR validation error" do + @output = StringIO.new + @logger = Logger.new(@output) + Rails.logger = @logger + + class TestImp < ActiveRecord::Base + def self.columns; []; end; def self.column_types; {}; end # Set up a tableless AR Model + + attr_accessor :name + validates_presence_of :name + end + + TestImp.new.save + @output.string.must_include %Q[WARN -- : TestImp failed to save!] + @output.string.must_include %Q[WARN -- : Attributes:] + @output.string.must_include %Q[WARN -- : {"id"=>nil}] + @output.string.must_include %Q[WARN -- : Errors:] + @output.string.must_include %Q[WARN -- : Name can't be blank] + end + + describe "Gems" do + it "has momentjs available" do + Rails.application.config.assets.paths.any? {|p| p.include? 'momentjs-rails' } + end + + it "has dalli available" do + Rails.cache.stats.values.wont_include nil + # ActiveSupport::Cache.lookup_store(:dalli_store).stats.values.wont_include nil + end + + it "has pg available" do + defined?(PG).wont_be_nil + ActiveRecord::Base.connection.wont_be_nil + end + + it "has unicorn available" do + defined?(Unicorn).wont_be_nil + end + + it "has autotest-rails available" do + defined?(Autotest::Rails).wont_be_nil + end + end + + describe "Bins" do + it "has .git/safe/../../bin in PATH" do + ENV['PATH'].split(':').grep('^bin$').wont_be_nil + ENV['PATH'].split(':').grep('^vendor/bundle/bin$').wont_be_nil + end + + it "has autotest" do + system("command -v autotest >/dev/null 2>&1").must_equal true + end + + it "has imagemagick" do + system("command -v identify >/dev/null 2>&1").must_equal true + end + + it "has phantomjs" do + system("command -v phantomjs >/dev/null 2>&1").must_equal true + end + end +end diff --git a/test/environments/development.rb b/test/environments/development.rb new file mode 100644 index 0000000..f9469ca --- /dev/null +++ b/test/environments/development.rb @@ -0,0 +1,10 @@ +require 'test_helper' +require 'development' + +describe "Development Environment" do + describe "Gems" do + it "has dotenv" do + defined?(Dotenv).wont_equal nil + end + end +end diff --git a/test/environments/production.rb b/test/environments/production.rb new file mode 100644 index 0000000..a983195 --- /dev/null +++ b/test/environments/production.rb @@ -0,0 +1,10 @@ +require 'test_helper' +require 'production' + +describe "Production Environment" do + it "only allows SSL in production" do + Rails.application.config.force_ssl.must_equal true + end + + #TODO: Check all the different production env configs (fonts in pipeline, caching, etc) +end diff --git a/test/environments/test.rb b/test/environments/test.rb new file mode 100644 index 0000000..0ba636d --- /dev/null +++ b/test/environments/test.rb @@ -0,0 +1,14 @@ +require 'test_helper' +require 'test' + +describe "Test Environment" do + describe "Gems" do + it "has minitest-reporters" do + defined?(Minitest::Reporters).wont_be_nil + end + + it "has pry" do + defined?(Pry).wont_be_nil + end + end +end diff --git a/test/support/initializers/capybara.rb b/test/support/initializers/capybara.rb deleted file mode 100644 index 144611c..0000000 --- a/test/support/initializers/capybara.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'capybara/rails' -require 'capybara/poltergeist' - -# This hack is to surpress warnings in Mavericks. See: https://github.com/ariya/phantomjs/issues/11418#issuecomment-26938117 -class Capybara::Poltergeist::Client - private - - def redirect_stdout - orig_stdout = STDOUT.dup - orig_stdout.autoclose = false - $stdout = @write_io - STDOUT.reopen(@write_io) - - orig_stderr = STDERR.dup - orig_stderr.autoclose = false - $stderr = @write_io - STDERR.reopen(@write_io) - - yield - ensure - STDOUT.reopen(orig_stdout) - $stdout = STDOUT - STDERR.reopen(orig_stderr) - $stderr = STDERR - end -end - -class WarningSuppressor - def self.write(message) - if message =~ /QFont::setPixelSize: Pixel size <= 0|CoreText performance note:/ - 0 - else - puts message - 1 - end - end -end - -Capybara.register_driver :poltergeist do |app| - Capybara::Poltergeist::Driver.new(app, phantomjs_logger: WarningSuppressor) -end - -Capybara.register_driver :poltergeist_debug do |app| - Capybara::Poltergeist::Driver.new(app, inspector: true, debug: true) -end - -Capybara.default_driver = :rack_test -Capybara.javascript_driver = :poltergeist diff --git a/test/support/initializers/integration_test.rb b/test/support/initializers/integration_test.rb deleted file mode 100644 index 329677c..0000000 --- a/test/support/initializers/integration_test.rb +++ /dev/null @@ -1,16 +0,0 @@ -class ActionDispatch::IntegrationTest - include Rails.application.routes.url_helpers - include Capybara::DSL - - before do - if metadata[:js] - Capybara.current_driver = Capybara.javascript_driver - metadata[:db_clean_strategy] = :truncation - end - end - - after do - Capybara.reset_sessions! # Forget the (simulated) browser state - Capybara.use_default_driver # Revert Capybara.current_driver to Capybara.default_driver - end -end diff --git a/test/support/initializers/test_case.rb b/test/support/initializers/test_case.rb deleted file mode 100644 index 741d188..0000000 --- a/test/support/initializers/test_case.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'database_cleaner' -DatabaseCleaner.clean_with(:truncation) -DatabaseCleaner.strategy = :transaction - -class ActiveSupport::TestCase - include MiniTest::Metadata - include FactoryGirl::Syntax::Methods - - ActiveRecord::Migration.check_pending! - - # Leave db cleanup to the master--DatabaseCleaner - self.use_transactional_fixtures = false - - before do - DatabaseCleaner.clean - DatabaseCleaner.strategy = :transaction - DatabaseCleaner.start - end - - def run_all_queued_jobs - worker = QC::Worker.new - worker.work while worker.queue.count > 0 - end -end diff --git a/test/support/initializers/turn.rb b/test/support/initializers/turn.rb deleted file mode 100644 index 292794c..0000000 --- a/test/support/initializers/turn.rb +++ /dev/null @@ -1,14 +0,0 @@ -# To enable turn formatting, set the TURN_FORMAT variable to one of the following: -# pretty, dot, cue, marshal, outline, or progress -# or set to true (or on, yes, or 1) to use the default turn format -if ENV['TURN_FORMAT'].to_s !~ /^(|false|0|off|no|pride)$/i - require 'turn/autorun' - - if ENV['TURN_FORMAT'] =~ /^(on|yes|1|true)$/i - ENV['TURN_FORMAT'] = Turn.config.format.to_s - else - Turn.config.format = ENV['TURN_FORMAT'].intern - end -else - require 'minitest/pride' -end diff --git a/test/test_helper.rb b/test/test_helper.rb index 55403fe..e0fbd51 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,10 +1,20 @@ ENV["RAILS_ENV"] ||= "test" -require_relative '../config/environment' -require_relative '../config/boot' +require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' +require 'dotenv'; Dotenv.load +require 'minitest/reporters'; Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new -require 'dotenv' -Dotenv.load +class ActiveSupport::TestCase + ActiveRecord::Migration.check_pending! + + # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherit this setting + fixtures :all + + # Add more helper methods to be used by all tests here... +end # Load all support files Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f } diff --git a/zeus.json b/zeus.json deleted file mode 100644 index 71193b9..0000000 --- a/zeus.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "command": "ruby -rubygems -r./custom_plan -eZeus.go", - - "plan": { - "boot": { - "default_bundle": { - "development_environment": { - "prerake": {"rake": []}, - "runner": ["r"], - "console": ["c"], - "server": ["s"], - "generate": ["g"], - "destroy": ["d"], - "dbconsole": [] - }, - "test_environment": { - "test_helper": {"test": ["testrb"]} - } - } - } - } -}