Initial rails 4.2

This commit is contained in:
Eric Schultz 2019-01-29 14:13:52 -06:00 committed by Luis Castro
parent 07298a8cd0
commit 938821ed5f
No known key found for this signature in database
GPG key ID: 0A8F33D4C4E27639
12 changed files with 116 additions and 52 deletions

View file

@ -30,9 +30,6 @@ gem 'aws-sdk', '~> 1'
# for blocking ip addressses
gem 'rack-attack'
# For modularizing javascript
# https://github.com/browserify-rails/browserify-rails
gem 'browserify-rails'
gem 'sprockets'
# for serving fonts on cdn
@ -75,6 +72,9 @@ gem 'httparty'
gem 'devise', '~> 3.5.0'
gem 'devise-async'
# https://github.com/airbrake/airbrake
gem 'airbrake', '~> 8.0.1'
# http://www.rubygeocoder.com/
gem 'geocoder' # for adding latitude and longitude to location-based tables

View file

@ -53,20 +53,36 @@ GEM
activesupport (= 4.2.11)
rack (~> 1.6)
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.4)
activesupport (4.0.0)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
addressable (2.3.8)
amq-protocol (2.2.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.11)
activesupport (= 4.2.11)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (4.2.11)
activesupport (= 4.2.11)
globalid (>= 0.3.0)
activemodel (4.2.11)
activesupport (= 4.2.11)
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)
arel (6.0.4)
ast (2.4.0)
@ -105,8 +121,6 @@ GEM
debug_inspector (>= 0.0.1)
bootsnap (1.3.2)
msgpack (~> 1.0)
browserify-rails (1.1.0)
railties (>= 4.0.0, < 5.0)
builder (3.2.3)
bunny (2.12.0)
amq-protocol (~> 2.3, >= 2.3.0)
@ -276,12 +290,16 @@ GEM
tilt
memcachier (0.0.2)
method_source (0.9.1)
mime-types (1.25.1)
mini_magick (4.9.5)
mini_portile2 (2.1.0)
money (6.10.0)
i18n (>= 0.6.4, < 1.0)
msgpack (1.2.0)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mini_magick (4.9.2)
mini_mime (1.0.1)
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_xml (0.6.0)
multipart-post (2.0.0)
@ -293,10 +311,10 @@ GEM
kdtree
require_all
netrc (0.11.0)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
orm_adapter (0.5.0)
parallel (1.12.1)
parallel (1.13.0)
parser (2.6.0.0)
ast (~> 2.4.0)
pg (0.21.0)
@ -357,6 +375,7 @@ GEM
thor (>= 0.18.1, < 2.0)
rainbow (3.0.0)
rake (12.3.2)
rbtree (0.4.2)
request_store (1.4.1)
rack (>= 1.4)
require_all (2.0.0)
@ -422,7 +441,7 @@ GEM
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sixarm_ruby_unaccent (1.2.0)
solargraph (0.31.1)
solargraph (0.31.2)
backport (~> 0.3)
htmlentities (~> 4.3, >= 4.3.4)
jaro_winkler (~> 1.5)
@ -443,6 +462,8 @@ GEM
stripe (1.58.0)
rest-client (>= 1.4, < 4.0)
table_print (1.5.6)
tdigest (0.1.1)
rbtree (~> 0.4.2)
test-unit (3.2.8)
power_assert
thor (0.19.4)
@ -479,11 +500,11 @@ PLATFORMS
DEPENDENCIES
action_mailer_matchers
aws-sdk
airbrake (~> 8.0.1)
aws-sdk (~> 1)
aws-ses
binding_of_caller
bootsnap
browserify-rails
bunny (>= 2.6.3)
carrierwave
carrierwave-aws

View file

@ -1,4 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'

29
bin/setup Executable file
View 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

View file

@ -79,9 +79,11 @@ module Commitchange
config.i18n.enforce_available_locales = false
config.active_record.raise_in_transactional_callbacks = true
# Add trailing slashes to all routes
# 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

View file

@ -49,6 +49,12 @@ Rails.application.configure do
# Expands the lines which load the assets
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.dependency_loading = true if $rails_rake_task

View file

@ -19,8 +19,9 @@ Rails.application.configure do
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = false
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
@ -67,9 +68,6 @@ Rails.application.configure do
# Send deprecation notices to registered listeners.
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.
config.log_formatter = ::Logger::Formatter.new

View file

@ -5,15 +5,15 @@ Commitchange::Application.configure do
# 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
# 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
# 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.
config.eager_load = false
# Configure static asset server for tests with Cache-Control for performance.
config.serve_static_assets = true
# Configure static file server for tests with Cache-Control for performance.
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
@ -32,6 +32,10 @@ Commitchange::Application.configure do
config.action_mailer.delivery_method = :test
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.
config.active_support.deprecation = :stderr

View file

@ -3,6 +3,9 @@
# Version of your assets, change this if you want to expire all your assets.
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.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )

View file

@ -103,7 +103,7 @@ Rails.application.routes.draw do
resource(:miscellaneous_np_info, {only: [:show, :update]})
namespace(:button) do
root({to: :advanced})
root({action: :advanced})
get(:basic)
get(:guided)
get(:advanced)

View file

@ -32,18 +32,19 @@ describe Nonprofits::DonationsController, :type => :controller do
end
end
describe 'Nonprofits::DonationsController::create_offsite', :type => :request do
describe '.create_offsite', :type => :request do
describe 'create_offsite' do
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
run_authorization_tests({method: :post, action: "/nonprofits/#{nonprofit.id}/donations/create_offsite",
successful_users: roles__open_to_campaign_editor}) do |_|
{nonprofit_id: nonprofit.id,
donation: {campaign_id: campaign.id}}
end
end
# it 'reject non-campaign editors (and np authorized folks)', :type => :request do
# run_authorization_tests({method: :post, action: "/nonprofits/#{nonprofit.id}/donations/create_offsite",
# successful_users: roles__open_to_campaign_editor}) do |_|
# {nonprofit_id: nonprofit.id,
# donation: {campaign_id: campaign.id}}
# end
# end
#include_context :open_to_np_associate, :post, :create_offsite, nonprofit_id: :__our_np
end
end