diff --git a/Gemfile b/Gemfile index 3604172f06..e1060d339e 100644 --- a/Gemfile +++ b/Gemfile @@ -50,7 +50,7 @@ gem 'protected_attributes', '~>1.0.8' # This must be loaded before some other ge gem 'ace-rails-ap', '~> 2.0.1' gem 'bootstrap-kaminari-views', '~> 0.0.3' gem 'bundler', '>= 1.5.0' -gem 'coffee-rails', '~> 4.0.0' +gem 'coffee-rails', '~> 4.1.0' gem 'daemons', '~> 1.1.9' gem 'delayed_job', '~> 4.0.0' gem 'delayed_job_active_record', '~> 4.0.0' @@ -59,7 +59,7 @@ gem 'em-http-request', '~> 1.1.2' gem 'faraday', '~> 0.9.0' gem 'faraday_middleware' gem 'feed-normalizer' -gem 'font-awesome-sass' +gem 'font-awesome-sass', '~> 4.3' gem 'foreman', '~> 0.63.0' # geokit-rails doesn't work with geokit 1.8.X but it specifies ~> 1.5 # in its own Gemfile. @@ -76,9 +76,9 @@ gem 'mysql2', '~> 0.3.16' gem 'multi_xml' gem 'nokogiri', '~> 1.6.4' gem 'omniauth' -gem 'rails' , '4.1.8' +gem 'rails' , '4.2.0' gem 'rufus-scheduler', '~> 3.0.8', require: false -gem 'sass-rails', '~> 4.0.0' +gem 'sass-rails', '~> 5.0' gem 'select2-rails', '~> 3.5.4' gem 'spectrum-rails' gem 'string-scrub' # for ruby <2.1 @@ -101,12 +101,12 @@ group :development, :test do gem 'dotenv-rails' gem 'pry' gem 'rr' - gem 'rspec', '~> 3.0' - gem 'rspec-collection_matchers', '~> 1.0.0' - gem 'rspec-rails', '~> 3.0.1' - gem 'rspec-html-matchers', '~> 0.6.1' + gem 'rspec', '~> 3.2' + gem 'rspec-collection_matchers', '~> 1.1.0' + gem 'rspec-rails', '~> 3.1' + gem 'rspec-html-matchers', '~> 0.7' gem 'shoulda-matchers' - gem 'spring', '~> 1.3.2' + gem 'spring', '~> 1.3.0' gem 'spring-commands-rspec' gem 'vcr' gem 'webmock', '~> 1.17.4', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 3965f0bcf9..f58af5897d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,60 +12,69 @@ GEM remote: https://rubygems.org/ specs: ace-rails-ap (2.0.1) - actionmailer (4.1.8) - actionpack (= 4.1.8) - actionview (= 4.1.8) + actionmailer (4.2.0) + actionpack (= 4.2.0) + actionview (= 4.2.0) + activejob (= 4.2.0) mail (~> 2.5, >= 2.5.4) - actionpack (4.1.8) - actionview (= 4.1.8) - activesupport (= 4.1.8) - rack (~> 1.5.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.0) + actionview (= 4.2.0) + activesupport (= 4.2.0) + rack (~> 1.6.0) rack-test (~> 0.6.2) - actionview (4.1.8) - activesupport (= 4.1.8) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + actionview (4.2.0) + activesupport (= 4.2.0) builder (~> 3.1) erubis (~> 2.7.0) - activemodel (4.1.8) - activesupport (= 4.1.8) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.1) + activejob (4.2.0) + activesupport (= 4.2.0) + globalid (>= 0.3.0) + activemodel (4.2.0) + activesupport (= 4.2.0) builder (~> 3.1) - activerecord (4.1.8) - activemodel (= 4.1.8) - activesupport (= 4.1.8) - arel (~> 5.0.0) - activesupport (4.1.8) - i18n (~> 0.6, >= 0.6.9) + activerecord (4.2.0) + activemodel (= 4.2.0) + activesupport (= 4.2.0) + arel (~> 6.0) + activesupport (4.2.0) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.3.7) - arel (5.0.1.20140414130214) + arel (6.0.0) autoparse (0.3.3) addressable (>= 2.3.1) extlib (>= 0.9.15) multi_json (>= 1.0.0) - bcrypt (3.1.7) + bcrypt (3.1.10) better_errors (1.1.0) coderay (>= 1.0.0) erubis (>= 2.6.6) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - bootstrap-kaminari-views (0.0.3) + bootstrap-kaminari-views (0.0.5) kaminari (>= 0.13) rails (>= 3.1) buftok (0.2.0) builder (3.2.2) - celluloid (0.15.2) - timers (~> 1.1.0) + celluloid (0.16.0) + timers (~> 4.0.0) chronic (0.10.2) coderay (1.1.0) - coffee-rails (4.0.1) + coffee-rails (4.1.0) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.3.0) coffee-script-source execjs - coffee-script-source (1.7.1) + coffee-script-source (1.9.1) cookiejar (0.3.2) coveralls (0.7.1) multi_json (~> 1.3) @@ -77,14 +86,14 @@ GEM safe_yaml (~> 1.0.0) daemons (1.1.9) debug_inspector (0.0.2) - delayed_job (4.0.2) - activesupport (>= 3.0, < 4.2) - delayed_job_active_record (4.0.2) - activerecord (>= 3.0, < 4.2) + delayed_job (4.0.6) + activesupport (>= 3.0, < 5.0) + delayed_job_active_record (4.0.3) + activerecord (>= 3.0, < 5.0) delayed_job (>= 3.0, < 4.1) delorean (2.1.0) chronic - devise (3.4.0) + devise (3.4.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) @@ -130,7 +139,7 @@ GEM hpricot (>= 0.6) simple-rss (>= 1.1) ffi (1.9.5) - font-awesome-sass (4.2.0) + font-awesome-sass (4.3.1) sass (~> 3.2) forecast_io (2.0.0) faraday @@ -145,6 +154,8 @@ GEM geokit-rails (2.0.1) geokit (~> 1.5) rails (>= 3.0) + globalid (0.3.3) + activesupport (>= 4.1.0) google-api-client (0.7.1) addressable (>= 2.3.2) autoparse (>= 0.3.3) @@ -174,6 +185,7 @@ GEM hike (1.2.3) hipchat (1.2.0) httparty + hitimes (1.2.2) hpricot (0.8.6) httmultiparty (0.3.10) httparty (>= 0.7.3) @@ -207,6 +219,8 @@ GEM celluloid (>= 0.15.2) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) + loofah (2.0.1) + nokogiri (>= 1.5.9) lumberjack (1.0.9) macaddr (1.7.1) systemu (~> 2.6.2) @@ -265,29 +279,38 @@ GEM coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - quiet_assets (1.0.3) + quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rack (1.5.2) - rack-test (0.6.2) + rack (1.6.0) + rack-test (0.6.3) rack (>= 1.0) - rails (4.1.8) - actionmailer (= 4.1.8) - actionpack (= 4.1.8) - actionview (= 4.1.8) - activemodel (= 4.1.8) - activerecord (= 4.1.8) - activesupport (= 4.1.8) + rails (4.2.0) + actionmailer (= 4.2.0) + actionpack (= 4.2.0) + actionview (= 4.2.0) + activejob (= 4.2.0) + activemodel (= 4.2.0) + activerecord (= 4.2.0) + activesupport (= 4.2.0) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.8) - sprockets-rails (~> 2.0) - rails_12factor (0.0.2) + railties (= 4.2.0) + sprockets-rails + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.5) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6.0) + rails-deprecated_sanitizer (>= 1.0.1) + rails-html-sanitizer (1.0.1) + loofah (~> 2.0) + rails_12factor (0.0.3) rails_serve_static_assets rails_stdout_logging - rails_serve_static_assets (0.0.2) + rails_serve_static_assets (0.0.4) rails_stdout_logging (0.0.3) - railties (4.1.8) - actionpack (= 4.1.8) - activesupport (= 4.1.8) + railties (4.2.0) + actionpack (= 4.2.0) + activesupport (= 4.2.0) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) raindrops (0.13.0) @@ -295,57 +318,61 @@ GEM rb-fsevent (0.9.4) rb-inotify (0.9.5) ffi (>= 0.5.0) + rdoc (4.2.0) + json (~> 1.4) ref (1.0.5) - responders (1.1.1) - railties (>= 3.2, < 4.2) + responders (2.1.0) + railties (>= 4.2.0, < 5) rest-client (1.7.3) mime-types (>= 1.16, < 3.0) netrc (~> 0.7) - retriable (1.4.1) + retriable (2.0.2) rr (1.1.2) - rspec (3.0.0) - rspec-core (~> 3.0.0) - rspec-expectations (~> 3.0.0) - rspec-mocks (~> 3.0.0) - rspec-collection_matchers (1.0.0) + rspec (3.2.0) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-collection_matchers (1.1.2) rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.0.4) - rspec-support (~> 3.0.0) - rspec-expectations (3.0.4) + rspec-core (3.2.1) + rspec-support (~> 3.2.0) + rspec-expectations (3.2.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.0.0) - rspec-html-matchers (0.6.1) + rspec-support (~> 3.2.0) + rspec-html-matchers (0.7.0) nokogiri (~> 1) rspec (~> 3) - rspec-mocks (3.0.4) - rspec-support (~> 3.0.0) - rspec-rails (3.0.2) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.0.0) - rspec-expectations (~> 3.0.0) - rspec-mocks (~> 3.0.0) - rspec-support (~> 3.0.0) - rspec-support (3.0.4) + rspec-mocks (3.2.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.2.0) + rspec-rails (3.2.1) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.2.0) + rspec-expectations (~> 3.2.0) + rspec-mocks (~> 3.2.0) + rspec-support (~> 3.2.0) + rspec-support (3.2.2) rturk (2.12.1) erector nokogiri rest-client ruby-growl (4.1) uuid (~> 2.3, >= 2.3.5) - rufus-scheduler (3.0.8) + rufus-scheduler (3.0.9) tzinfo safe_yaml (1.0.4) - sass (3.2.19) - sass-rails (4.0.3) + sass (3.4.12) + sass-rails (5.0.1) railties (>= 4.0.0, < 5.0) - sass (~> 3.2.0) - sprockets (~> 2.8, <= 2.11.0) - sprockets-rails (~> 2.0) - select2-rails (3.5.9.1) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (~> 1.1) + select2-rails (3.5.9.3) thor (~> 0.14) - shoulda-matchers (2.7.0) + shoulda-matchers (2.8.0) activesupport (>= 3.0.0) signet (0.5.1) addressable (>= 2.2.3) @@ -354,24 +381,24 @@ GEM multi_json (>= 1.0.0) simple-rss (1.3.1) simple_oauth (0.2.0) - simplecov (0.9.0) + simplecov (0.9.2) docile (~> 1.1.0) - multi_json - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) + multi_json (~> 1.0) + simplecov-html (~> 0.9.0) + simplecov-html (0.9.0) slack-notifier (1.0.0) slop (3.6.0) spectrum-rails (1.3.4) railties (>= 3.1) spring (1.3.3) - spring-commands-rspec (1.0.2) + spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (2.11.0) + sprockets (2.12.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.2.2) + sprockets-rails (2.2.4) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) @@ -385,7 +412,8 @@ GEM thor (0.19.1) thread_safe (0.3.4) tilt (1.4.1) - timers (1.1.0) + timers (4.0.1) + hitimes tins (1.3.2) treetop (1.5.3) polyglot (~> 0.3) @@ -415,7 +443,7 @@ GEM ethon (>= 0.7.1) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (2.5.3) + uglifier (2.7.0) execjs (>= 0.3.0) json (>= 1.8.0) unicorn (4.8.3) @@ -451,7 +479,7 @@ DEPENDENCIES binding_of_caller bootstrap-kaminari-views (~> 0.0.3) bundler (>= 1.5.0) - coffee-rails (~> 4.0.0) + coffee-rails (~> 4.1.0) coveralls daemons (~> 1.1.9) delayed_job (~> 4.0.0) @@ -466,7 +494,7 @@ DEPENDENCIES faraday_middleware feed-normalizer ffi (>= 1.9.4) - font-awesome-sass + font-awesome-sass (~> 4.3) forecast_io (~> 2.0.0) foreman (~> 0.63.0) geokit (~> 1.8.4) @@ -500,22 +528,22 @@ DEPENDENCIES pry quiet_assets rack - rails (= 4.1.8) + rails (= 4.2.0) rails_12factor rr - rspec (~> 3.0) - rspec-collection_matchers (~> 1.0.0) - rspec-html-matchers (~> 0.6.1) - rspec-rails (~> 3.0.1) + rspec (~> 3.2) + rspec-collection_matchers (~> 1.1.0) + rspec-html-matchers (~> 0.7) + rspec-rails (~> 3.1) rturk (~> 2.12.1) ruby-growl (~> 4.1.0) rufus-scheduler (~> 3.0.8) - sass-rails (~> 4.0.0) + sass-rails (~> 5.0) select2-rails (~> 3.5.4) shoulda-matchers slack-notifier (~> 1.0.0) spectrum-rails - spring (~> 1.3.2) + spring (~> 1.3.0) spring-commands-rspec string-scrub therubyracer (~> 0.12.1) diff --git a/app/models/agent.rb b/app/models/agent.rb index 758c0bdea4..2d1314506f 100644 --- a/app/models/agent.rb +++ b/app/models/agent.rb @@ -46,7 +46,7 @@ class Agent < ActiveRecord::Base belongs_to :user, :inverse_of => :agents belongs_to :service, :inverse_of => :agents has_many :events, -> { order("events.id desc") }, :dependent => :delete_all, :inverse_of => :agent - has_one :most_recent_event, :inverse_of => :agent, :class_name => "Event", :order => "events.id desc" + has_one :most_recent_event, -> { order("events.id desc") }, :inverse_of => :agent, :class_name => "Event" has_many :logs, -> { order("agent_logs.id desc") }, :dependent => :delete_all, :inverse_of => :agent, :class_name => "AgentLog" has_many :received_events, -> { order("events.id desc") }, :through => :sources, :class_name => "Event", :source => :events has_many :links_as_source, :dependent => :delete_all, :foreign_key => "source_id", :class_name => "Link", :inverse_of => :source diff --git a/config/application.rb b/config/application.rb index ac3e8a35ca..0fed9f3374 100644 --- a/config/application.rb +++ b/config/application.rb @@ -49,5 +49,8 @@ class Application < Rails::Application # Enable the asset pipeline config.assets.enabled = true config.assets.initialize_on_precompile = false + + # Do not swallow errors in after_commit/after_rollback callbacks. + config.active_record.raise_in_transactional_callbacks = true end end diff --git a/config/boot.rb b/config/boot.rb index f2830ae316..06d9caeb72 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -3,4 +3,4 @@ # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/environments/development.rb b/config/environments/development.rb index a7b199a12e..be2a96bdc8 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -33,6 +33,10 @@ # Expands the lines which load the assets config.assets.debug = true + # Asset digests allow you to set far-future HTTP expiration dates on all assets, + # yet still be able to expire them through the digest params. + config.assets.digest = true + config.action_mailer.default_url_options = { :host => ENV['DOMAIN'] } config.action_mailer.asset_host = ENV['DOMAIN'] config.action_mailer.perform_deliveries = false # Enable when testing! diff --git a/config/environments/production.rb b/config/environments/production.rb index b7eca13de2..81235320a3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -16,11 +16,13 @@ # Enable Rack::Cache to put a simple HTTP cache in front of your application # Add `rack-cache` to your Gemfile before enabling this. - # 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 - # 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 @@ -43,8 +45,8 @@ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = ENV['FORCE_SSL'] == 'true' - # See everything in the log (default is :info) - # config.log_level = :debug + # See everything in the log (default is will be :debug in Rails 5.0) + config.log_level = :info # Prepend all log lines with the following tags config.log_tags = [ :uuid ] # :subdomain @@ -74,9 +76,6 @@ # 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 diff --git a/config/environments/test.rb b/config/environments/test.rb index 6178bd8c46..836e9ef02d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -13,7 +13,7 @@ config.eager_load = false # Configure static asset 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" # Show full error reports and disable caching @@ -36,6 +36,9 @@ # Raise exception on mass assignment protection for Active Record models config.active_record.mass_assignment_sanitizer = :strict + # Randomize the order test cases are executed. + config.active_support.test_order = :random + # Print deprecation notices to the stderr config.active_support.deprecation = :stderr diff --git a/spec/presenters/form_configurable_agent_presenter_spec.rb b/spec/presenters/form_configurable_agent_presenter_spec.rb index bab8462a3e..babc152972 100644 --- a/spec/presenters/form_configurable_agent_presenter_spec.rb +++ b/spec/presenters/form_configurable_agent_presenter_spec.rb @@ -1,6 +1,7 @@ require 'spec_helper' describe FormConfigurableAgentPresenter do + include RSpecHtmlMatchers class FormConfigurableAgentPresenterAgent < Agent include FormConfigurable