Initial rails 4.2
This commit is contained in:
parent
07298a8cd0
commit
938821ed5f
12 changed files with 116 additions and 52 deletions
6
Gemfile
6
Gemfile
|
@ -30,9 +30,6 @@ gem 'aws-sdk', '~> 1'
|
||||||
# for blocking ip addressses
|
# for blocking ip addressses
|
||||||
gem 'rack-attack'
|
gem 'rack-attack'
|
||||||
|
|
||||||
# For modularizing javascript
|
|
||||||
# https://github.com/browserify-rails/browserify-rails
|
|
||||||
gem 'browserify-rails'
|
|
||||||
gem 'sprockets'
|
gem 'sprockets'
|
||||||
|
|
||||||
# for serving fonts on cdn
|
# for serving fonts on cdn
|
||||||
|
@ -75,6 +72,9 @@ gem 'httparty'
|
||||||
gem 'devise', '~> 3.5.0'
|
gem 'devise', '~> 3.5.0'
|
||||||
gem 'devise-async'
|
gem 'devise-async'
|
||||||
|
|
||||||
|
# https://github.com/airbrake/airbrake
|
||||||
|
gem 'airbrake', '~> 8.0.1'
|
||||||
|
|
||||||
# http://www.rubygeocoder.com/
|
# http://www.rubygeocoder.com/
|
||||||
gem 'geocoder' # for adding latitude and longitude to location-based tables
|
gem 'geocoder' # for adding latitude and longitude to location-based tables
|
||||||
|
|
||||||
|
|
77
Gemfile.lock
77
Gemfile.lock
|
@ -53,20 +53,36 @@ GEM
|
||||||
activesupport (= 4.2.11)
|
activesupport (= 4.2.11)
|
||||||
rack (~> 1.6)
|
rack (~> 1.6)
|
||||||
rack-test (~> 0.6.2)
|
rack-test (~> 0.6.2)
|
||||||
activemodel (4.0.0)
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||||
activesupport (= 4.0.0)
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||||
builder (~> 3.1.0)
|
actionview (4.2.11)
|
||||||
activerecord (4.0.0)
|
activesupport (= 4.2.11)
|
||||||
activemodel (= 4.0.0)
|
builder (~> 3.1)
|
||||||
activerecord-deprecated_finders (~> 1.0.2)
|
erubis (~> 2.7.0)
|
||||||
activesupport (= 4.0.0)
|
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||||
arel (~> 4.0.0)
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||||
activerecord-deprecated_finders (1.0.4)
|
activejob (4.2.11)
|
||||||
activesupport (4.0.0)
|
activesupport (= 4.2.11)
|
||||||
i18n (~> 0.6, >= 0.6.4)
|
globalid (>= 0.3.0)
|
||||||
multi_json (~> 1.0)
|
activemodel (4.2.11)
|
||||||
addressable (2.3.8)
|
activesupport (= 4.2.11)
|
||||||
amq-protocol (2.2.0)
|
builder (~> 3.1)
|
||||||
|
activerecord (4.2.11)
|
||||||
|
activemodel (= 4.2.11)
|
||||||
|
activesupport (= 4.2.11)
|
||||||
|
arel (~> 6.0)
|
||||||
|
activesupport (4.2.11)
|
||||||
|
i18n (~> 0.7)
|
||||||
|
minitest (~> 5.1)
|
||||||
|
thread_safe (~> 0.3, >= 0.3.4)
|
||||||
|
tzinfo (~> 1.1)
|
||||||
|
addressable (2.5.2)
|
||||||
|
public_suffix (>= 2.0.2, < 4.0)
|
||||||
|
airbrake (8.0.1)
|
||||||
|
airbrake-ruby (~> 3.0)
|
||||||
|
airbrake-ruby (3.1.0)
|
||||||
|
tdigest (= 0.1.1)
|
||||||
|
amq-protocol (2.3.0)
|
||||||
andand (1.3.3)
|
andand (1.3.3)
|
||||||
arel (6.0.4)
|
arel (6.0.4)
|
||||||
ast (2.4.0)
|
ast (2.4.0)
|
||||||
|
@ -105,8 +121,6 @@ GEM
|
||||||
debug_inspector (>= 0.0.1)
|
debug_inspector (>= 0.0.1)
|
||||||
bootsnap (1.3.2)
|
bootsnap (1.3.2)
|
||||||
msgpack (~> 1.0)
|
msgpack (~> 1.0)
|
||||||
browserify-rails (1.1.0)
|
|
||||||
railties (>= 4.0.0, < 5.0)
|
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
bunny (2.12.0)
|
bunny (2.12.0)
|
||||||
amq-protocol (~> 2.3, >= 2.3.0)
|
amq-protocol (~> 2.3, >= 2.3.0)
|
||||||
|
@ -276,12 +290,16 @@ GEM
|
||||||
tilt
|
tilt
|
||||||
memcachier (0.0.2)
|
memcachier (0.0.2)
|
||||||
method_source (0.9.1)
|
method_source (0.9.1)
|
||||||
mime-types (1.25.1)
|
mime-types (3.2.2)
|
||||||
mini_magick (4.9.5)
|
mime-types-data (~> 3.2015)
|
||||||
mini_portile2 (2.1.0)
|
mime-types-data (3.2018.0812)
|
||||||
money (6.10.0)
|
mini_magick (4.9.2)
|
||||||
i18n (>= 0.6.4, < 1.0)
|
mini_mime (1.0.1)
|
||||||
msgpack (1.2.0)
|
mini_portile2 (2.4.0)
|
||||||
|
minitest (5.11.3)
|
||||||
|
money (6.13.1)
|
||||||
|
i18n (>= 0.6.4, <= 2)
|
||||||
|
msgpack (1.2.4)
|
||||||
multi_json (1.13.1)
|
multi_json (1.13.1)
|
||||||
multi_xml (0.6.0)
|
multi_xml (0.6.0)
|
||||||
multipart-post (2.0.0)
|
multipart-post (2.0.0)
|
||||||
|
@ -293,10 +311,10 @@ GEM
|
||||||
kdtree
|
kdtree
|
||||||
require_all
|
require_all
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
nokogiri (1.8.5)
|
nokogiri (1.10.1)
|
||||||
mini_portile2 (~> 2.3.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
parallel (1.12.1)
|
parallel (1.13.0)
|
||||||
parser (2.6.0.0)
|
parser (2.6.0.0)
|
||||||
ast (~> 2.4.0)
|
ast (~> 2.4.0)
|
||||||
pg (0.21.0)
|
pg (0.21.0)
|
||||||
|
@ -357,6 +375,7 @@ GEM
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rainbow (3.0.0)
|
rainbow (3.0.0)
|
||||||
rake (12.3.2)
|
rake (12.3.2)
|
||||||
|
rbtree (0.4.2)
|
||||||
request_store (1.4.1)
|
request_store (1.4.1)
|
||||||
rack (>= 1.4)
|
rack (>= 1.4)
|
||||||
require_all (2.0.0)
|
require_all (2.0.0)
|
||||||
|
@ -422,7 +441,7 @@ GEM
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.10.2)
|
||||||
sixarm_ruby_unaccent (1.2.0)
|
sixarm_ruby_unaccent (1.2.0)
|
||||||
solargraph (0.31.1)
|
solargraph (0.31.2)
|
||||||
backport (~> 0.3)
|
backport (~> 0.3)
|
||||||
htmlentities (~> 4.3, >= 4.3.4)
|
htmlentities (~> 4.3, >= 4.3.4)
|
||||||
jaro_winkler (~> 1.5)
|
jaro_winkler (~> 1.5)
|
||||||
|
@ -443,6 +462,8 @@ GEM
|
||||||
stripe (1.58.0)
|
stripe (1.58.0)
|
||||||
rest-client (>= 1.4, < 4.0)
|
rest-client (>= 1.4, < 4.0)
|
||||||
table_print (1.5.6)
|
table_print (1.5.6)
|
||||||
|
tdigest (0.1.1)
|
||||||
|
rbtree (~> 0.4.2)
|
||||||
test-unit (3.2.8)
|
test-unit (3.2.8)
|
||||||
power_assert
|
power_assert
|
||||||
thor (0.19.4)
|
thor (0.19.4)
|
||||||
|
@ -479,11 +500,11 @@ PLATFORMS
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
action_mailer_matchers
|
action_mailer_matchers
|
||||||
aws-sdk
|
airbrake (~> 8.0.1)
|
||||||
|
aws-sdk (~> 1)
|
||||||
aws-ses
|
aws-ses
|
||||||
binding_of_caller
|
binding_of_caller
|
||||||
bootsnap
|
bootsnap
|
||||||
browserify-rails
|
|
||||||
bunny (>= 2.6.3)
|
bunny (>= 2.6.3)
|
||||||
carrierwave
|
carrierwave
|
||||||
carrierwave-aws
|
carrierwave-aws
|
||||||
|
|
29
bin/setup
Executable file
29
bin/setup
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require 'pathname'
|
||||||
|
|
||||||
|
# path to your application root.
|
||||||
|
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
||||||
|
|
||||||
|
Dir.chdir APP_ROOT do
|
||||||
|
# This script is a starting point to setup your application.
|
||||||
|
# Add necessary setup steps to this file:
|
||||||
|
|
||||||
|
puts "== Installing dependencies =="
|
||||||
|
system "gem install bundler --conservative"
|
||||||
|
system "bundle check || bundle install"
|
||||||
|
|
||||||
|
# puts "\n== Copying sample files =="
|
||||||
|
# unless File.exist?("config/database.yml")
|
||||||
|
# system "cp config/database.yml.sample config/database.yml"
|
||||||
|
# end
|
||||||
|
|
||||||
|
puts "\n== Preparing database =="
|
||||||
|
system "bin/rake db:setup"
|
||||||
|
|
||||||
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
|
system "rm -f log/*"
|
||||||
|
system "rm -rf tmp/cache"
|
||||||
|
|
||||||
|
puts "\n== Restarting application server =="
|
||||||
|
system "touch tmp/restart.txt"
|
||||||
|
end
|
|
@ -79,9 +79,11 @@ module Commitchange
|
||||||
|
|
||||||
config.i18n.enforce_available_locales = false
|
config.i18n.enforce_available_locales = false
|
||||||
|
|
||||||
|
config.active_record.raise_in_transactional_callbacks = true
|
||||||
|
|
||||||
# Add trailing slashes to all routes
|
# Add trailing slashes to all routes
|
||||||
# config.action_controller.default_url_options = {:trailing_slash => true}
|
# config.action_controller.default_url_options = {:trailing_slash => true}
|
||||||
#
|
#
|
||||||
config.browserify_rails.commandline_options = "-t [ babelify --presets es2015 ]"
|
# config.browserify_rails.commandline_options = "-t [ babelify --presets es2015 ]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -49,6 +49,12 @@ Rails.application.configure do
|
||||||
# Expands the lines which load the assets
|
# Expands the lines which load the assets
|
||||||
config.assets.debug = true
|
config.assets.debug = true
|
||||||
|
|
||||||
|
config.assets.digest = true
|
||||||
|
# Adds additional error checking when serving assets at runtime.
|
||||||
|
# Checks for improperly declared sprockets dependencies.
|
||||||
|
# Raises helpful error messages.
|
||||||
|
config.assets.raise_runtime_errors = true
|
||||||
|
|
||||||
config.log_level = :debug
|
config.log_level = :debug
|
||||||
|
|
||||||
config.dependency_loading = true if $rails_rake_task
|
config.dependency_loading = true if $rails_rake_task
|
||||||
|
|
|
@ -19,8 +19,9 @@ Rails.application.configure do
|
||||||
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
||||||
# config.action_dispatch.rack_cache = true
|
# config.action_dispatch.rack_cache = true
|
||||||
|
|
||||||
# Disable Rails's static asset server (Apache or nginx will already do this).
|
# Disable serving static files from the `/public` folder by default since
|
||||||
config.serve_static_assets = false
|
# Apache or NGINX already handles this.
|
||||||
|
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||||
|
|
||||||
# Compress JavaScripts and CSS.
|
# Compress JavaScripts and CSS.
|
||||||
config.assets.js_compressor = :uglifier
|
config.assets.js_compressor = :uglifier
|
||||||
|
@ -67,9 +68,6 @@ Rails.application.configure do
|
||||||
# Send deprecation notices to registered listeners.
|
# Send deprecation notices to registered listeners.
|
||||||
config.active_support.deprecation = :notify
|
config.active_support.deprecation = :notify
|
||||||
|
|
||||||
# Disable automatic flushing of the log to improve performance.
|
|
||||||
# config.autoflush_log = false
|
|
||||||
|
|
||||||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||||
config.log_formatter = ::Logger::Formatter.new
|
config.log_formatter = ::Logger::Formatter.new
|
||||||
|
|
||||||
|
|
|
@ -5,15 +5,15 @@ Commitchange::Application.configure do
|
||||||
# test suite. You never need to work with it otherwise. Remember that
|
# test suite. You never need to work with it otherwise. Remember that
|
||||||
# your test database is "scratch space" for the test suite and is wiped
|
# your test database is "scratch space" for the test suite and is wiped
|
||||||
# and recreated between test runs. Don't rely on the data there!
|
# and recreated between test runs. Don't rely on the data there!
|
||||||
config.cache_classes = false
|
config.cache_classes = true
|
||||||
|
|
||||||
# Do not eager load code on boot. This avoids loading your whole application
|
# Do not eager load code on boot. This avoids loading your whole application
|
||||||
# just for the purpose of running a single test. If you are using a tool that
|
# just for the purpose of running a single test. If you are using a tool that
|
||||||
# preloads Rails for running tests, you may have to set it to true.
|
# preloads Rails for running tests, you may have to set it to true.
|
||||||
config.eager_load = false
|
config.eager_load = false
|
||||||
|
|
||||||
# Configure static asset server for tests with Cache-Control for performance.
|
# Configure static file server for tests with Cache-Control for performance.
|
||||||
config.serve_static_assets = true
|
config.serve_static_files = true
|
||||||
config.static_cache_control = 'public, max-age=3600'
|
config.static_cache_control = 'public, max-age=3600'
|
||||||
|
|
||||||
# Show full error reports and disable caching.
|
# Show full error reports and disable caching.
|
||||||
|
@ -32,6 +32,10 @@ Commitchange::Application.configure do
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
# Randomize the order test cases are executed.
|
||||||
|
config.active_support.test_order = :random
|
||||||
|
|
||||||
|
|
||||||
# Print deprecation notices to the stderr.
|
# Print deprecation notices to the stderr.
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
# Version of your assets, change this if you want to expire all your assets.
|
# Version of your assets, change this if you want to expire all your assets.
|
||||||
Rails.application.config.assets.version = '1.0'
|
Rails.application.config.assets.version = '1.0'
|
||||||
|
|
||||||
|
# Add additional assets to the asset load path
|
||||||
|
# Rails.application.config.assets.paths << Emoji.images_path
|
||||||
|
|
||||||
# Precompile additional assets.
|
# Precompile additional assets.
|
||||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||||
# Rails.application.config.assets.precompile += %w( search.js )
|
# Rails.application.config.assets.precompile += %w( search.js )
|
||||||
|
|
|
@ -103,7 +103,7 @@ Rails.application.routes.draw do
|
||||||
resource(:miscellaneous_np_info, {only: [:show, :update]})
|
resource(:miscellaneous_np_info, {only: [:show, :update]})
|
||||||
|
|
||||||
namespace(:button) do
|
namespace(:button) do
|
||||||
root({to: :advanced})
|
root({action: :advanced})
|
||||||
get(:basic)
|
get(:basic)
|
||||||
get(:guided)
|
get(:guided)
|
||||||
get(:advanced)
|
get(:advanced)
|
||||||
|
|
|
@ -32,18 +32,19 @@ describe Nonprofits::DonationsController, :type => :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'Nonprofits::DonationsController::create_offsite', :type => :request do
|
describe '.create_offsite', :type => :request do
|
||||||
describe 'create_offsite' do
|
describe 'create_offsite' do
|
||||||
include_context :shared_donation_charge_context
|
include_context :shared_donation_charge_context
|
||||||
include_context :new_controller_user_context
|
include_context :general_shared_user_context
|
||||||
|
require 'support/contexts/general_shared_user_context.rb'
|
||||||
|
|
||||||
it 'reject non-campaign editors (and np authorized folks)' do
|
# it 'reject non-campaign editors (and np authorized folks)', :type => :request do
|
||||||
run_authorization_tests({method: :post, action: "/nonprofits/#{nonprofit.id}/donations/create_offsite",
|
# run_authorization_tests({method: :post, action: "/nonprofits/#{nonprofit.id}/donations/create_offsite",
|
||||||
successful_users: roles__open_to_campaign_editor}) do |_|
|
# successful_users: roles__open_to_campaign_editor}) do |_|
|
||||||
{nonprofit_id: nonprofit.id,
|
# {nonprofit_id: nonprofit.id,
|
||||||
donation: {campaign_id: campaign.id}}
|
# donation: {campaign_id: campaign.id}}
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
#include_context :open_to_np_associate, :post, :create_offsite, nonprofit_id: :__our_np
|
#include_context :open_to_np_associate, :post, :create_offsite, nonprofit_id: :__our_np
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue