mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Merge branch 'rails41' of https://github.com/dsander/huginn into dsander-rails41
This commit is contained in:
commit
8e6addc5b8
21 changed files with 204 additions and 173 deletions
33
Gemfile
33
Gemfile
|
@ -1,12 +1,14 @@
|
|||
source 'https://rubygems.org'
|
||||
|
||||
gem 'rails', '3.2.17'
|
||||
gem 'mysql2', '~> 0.3.13'
|
||||
gem 'devise', '~> 3.0.0'
|
||||
gem 'kaminari', '~> 0.14.1'
|
||||
gem 'protected_attributes', '~>1.0.7'
|
||||
|
||||
gem 'rails', '4.1.0'
|
||||
gem 'mysql2', '~> 0.3.15'
|
||||
gem 'devise', '~> 3.2.4'
|
||||
gem 'kaminari', '~> 0.15.1'
|
||||
gem 'bootstrap-kaminari-views', '~> 0.0.2'
|
||||
gem 'rufus-scheduler', '~> 3.0.7', require: false
|
||||
gem 'json', '>= 1.7.7'
|
||||
gem 'json', '~> 1.8.1'
|
||||
gem 'jsonpath', '~> 0.5.3'
|
||||
gem 'twilio-ruby', '~> 3.10.0'
|
||||
gem 'ruby-growl', '~> 4.1.0'
|
||||
|
@ -20,23 +22,23 @@ gem 'daemons', '~> 1.1.9'
|
|||
|
||||
gem 'foreman', '~> 0.63.0'
|
||||
|
||||
gem 'sass-rails', '~> 3.2.3'
|
||||
gem 'coffee-rails', '~> 3.2.1'
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
gem 'select2-rails', '~> 3.4.3'
|
||||
gem 'jquery-rails', '~> 3.0.4'
|
||||
gem 'sass-rails', '~> 4.0.0'
|
||||
gem 'coffee-rails', '~> 4.0.0'
|
||||
gem 'uglifier', '>= 1.3.0'
|
||||
gem 'select2-rails', '~> 3.5.4'
|
||||
gem 'jquery-rails', '~> 3.1.0'
|
||||
gem 'ace-rails-ap', '~> 2.0.1'
|
||||
|
||||
# geokit-rails doesn't work with geokit 1.8.X but it specifies ~> 1.5
|
||||
# in its own Gemfile.
|
||||
gem 'geokit', '~> 1.6.7'
|
||||
gem 'geokit-rails3', '~> 0.1.5'
|
||||
gem 'geokit', '~> 1.8.4'
|
||||
gem 'geokit-rails', '~> 2.0.1'
|
||||
|
||||
gem 'kramdown', '~> 1.1.0'
|
||||
gem 'kramdown', '~> 1.3.3'
|
||||
gem 'typhoeus', '~> 0.6.3'
|
||||
gem 'nokogiri', '~> 1.6.0'
|
||||
gem 'nokogiri', '~> 1.6.1'
|
||||
|
||||
gem 'wunderground', '~> 1.1.0'
|
||||
gem 'wunderground', '~> 1.2.0'
|
||||
gem 'forecast_io', '~> 2.0.0'
|
||||
gem 'rturk', '~> 2.11.0'
|
||||
|
||||
|
@ -60,6 +62,7 @@ group :development, :test do
|
|||
gem 'rspec'
|
||||
gem 'shoulda-matchers'
|
||||
gem 'rr'
|
||||
gem 'delorean'
|
||||
gem 'webmock', require: false
|
||||
gem 'coveralls', require: false
|
||||
end
|
||||
|
|
178
Gemfile.lock
178
Gemfile.lock
|
@ -12,38 +12,35 @@ GEM
|
|||
remote: https://rubygems.org/
|
||||
specs:
|
||||
ace-rails-ap (2.0.1)
|
||||
actionmailer (3.2.17)
|
||||
actionpack (= 3.2.17)
|
||||
actionmailer (4.1.0)
|
||||
actionpack (= 4.1.0)
|
||||
actionview (= 4.1.0)
|
||||
mail (~> 2.5.4)
|
||||
actionpack (3.2.17)
|
||||
activemodel (= 3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
builder (~> 3.0.0)
|
||||
actionpack (4.1.0)
|
||||
actionview (= 4.1.0)
|
||||
activesupport (= 4.1.0)
|
||||
rack (~> 1.5.2)
|
||||
rack-test (~> 0.6.2)
|
||||
actionview (4.1.0)
|
||||
activesupport (= 4.1.0)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
journey (~> 1.0.4)
|
||||
rack (~> 1.4.5)
|
||||
rack-cache (~> 1.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.2.1)
|
||||
activemodel (3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
builder (~> 3.0.0)
|
||||
activerecord (3.2.17)
|
||||
activemodel (= 3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.2.17)
|
||||
activemodel (= 3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
activesupport (3.2.17)
|
||||
i18n (~> 0.6, >= 0.6.4)
|
||||
multi_json (~> 1.0)
|
||||
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 (~> 1.1)
|
||||
addressable (2.3.6)
|
||||
arel (3.0.3)
|
||||
arel (5.0.1.20140414130214)
|
||||
bcrypt (3.1.7)
|
||||
bcrypt-ruby (3.1.5)
|
||||
bcrypt (>= 3.1.3)
|
||||
better_errors (1.1.0)
|
||||
coderay (>= 1.0.0)
|
||||
erubis (>= 2.6.6)
|
||||
|
@ -53,11 +50,12 @@ GEM
|
|||
kaminari (>= 0.13)
|
||||
rails (>= 3.1)
|
||||
buftok (0.2.0)
|
||||
builder (3.0.4)
|
||||
builder (3.2.2)
|
||||
chronic (0.10.2)
|
||||
coderay (1.1.0)
|
||||
coffee-rails (3.2.2)
|
||||
coffee-rails (4.0.1)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (~> 3.2.0)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
coffee-script (2.2.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
|
@ -78,10 +76,13 @@ GEM
|
|||
delayed_job_active_record (4.0.1)
|
||||
activerecord (>= 3.0, < 4.2)
|
||||
delayed_job (>= 3.0, < 4.1)
|
||||
devise (3.0.4)
|
||||
bcrypt-ruby (~> 3.0)
|
||||
delorean (2.1.0)
|
||||
chronic
|
||||
devise (3.2.4)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 3.2.6, < 5)
|
||||
thread_safe (~> 0.1)
|
||||
warden (~> 1.2.3)
|
||||
diff-lcs (1.2.5)
|
||||
docile (1.1.3)
|
||||
|
@ -114,11 +115,11 @@ GEM
|
|||
foreman (0.63.0)
|
||||
dotenv (>= 0.7)
|
||||
thor (>= 0.13.6)
|
||||
geokit (1.6.7)
|
||||
geokit (1.8.4)
|
||||
multi_json (>= 1.3.2)
|
||||
geokit-rails3 (0.1.5)
|
||||
geokit-rails (2.0.1)
|
||||
geokit (~> 1.5)
|
||||
rails (~> 3.0)
|
||||
rails (>= 3.0)
|
||||
hashie (2.0.5)
|
||||
hike (1.2.3)
|
||||
hipchat (1.1.0)
|
||||
|
@ -130,8 +131,7 @@ GEM
|
|||
json (~> 1.8)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (0.6.9)
|
||||
journey (1.0.4)
|
||||
jquery-rails (3.0.4)
|
||||
jquery-rails (3.1.0)
|
||||
railties (>= 3.0, < 5.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (1.8.1)
|
||||
|
@ -139,10 +139,10 @@ GEM
|
|||
multi_json
|
||||
jwt (0.1.11)
|
||||
multi_json (>= 1.5)
|
||||
kaminari (0.14.1)
|
||||
kaminari (0.15.1)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
kramdown (1.1.0)
|
||||
kramdown (1.3.3)
|
||||
libv8 (3.16.14.3)
|
||||
macaddr (1.7.1)
|
||||
systemu (~> 2.6.2)
|
||||
|
@ -154,6 +154,7 @@ GEM
|
|||
method_source (0.8.2)
|
||||
mime-types (1.25.1)
|
||||
mini_portile (0.5.3)
|
||||
minitest (5.3.3)
|
||||
multi_json (1.9.2)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
|
@ -169,35 +170,31 @@ GEM
|
|||
rack (~> 1.2)
|
||||
orm_adapter (0.5.0)
|
||||
polyglot (0.3.4)
|
||||
protected_attributes (1.0.7)
|
||||
activemodel (>= 4.0.1, < 5.0)
|
||||
pry (0.9.12.6)
|
||||
coderay (~> 1.0)
|
||||
method_source (~> 0.8)
|
||||
slop (~> 3.4)
|
||||
rack (1.4.5)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
rack-ssl (1.3.4)
|
||||
rack
|
||||
rack (1.5.2)
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
rails (3.2.17)
|
||||
actionmailer (= 3.2.17)
|
||||
actionpack (= 3.2.17)
|
||||
activerecord (= 3.2.17)
|
||||
activeresource (= 3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.17)
|
||||
railties (3.2.17)
|
||||
actionpack (= 3.2.17)
|
||||
activesupport (= 3.2.17)
|
||||
rack-ssl (~> 1.3.2)
|
||||
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.1.0)
|
||||
sprockets-rails (~> 2.0)
|
||||
railties (4.1.0)
|
||||
actionpack (= 4.1.0)
|
||||
activesupport (= 4.1.0)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (10.2.2)
|
||||
rdoc (3.12.2)
|
||||
json (~> 1.4)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rake (10.3.1)
|
||||
ref (1.0.5)
|
||||
rest-client (1.6.7)
|
||||
mime-types (>= 1.16)
|
||||
|
@ -227,13 +224,13 @@ GEM
|
|||
rufus-scheduler (3.0.7)
|
||||
tzinfo
|
||||
safe_yaml (1.0.2)
|
||||
sass (3.3.5)
|
||||
sass-rails (3.2.6)
|
||||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
tilt (~> 1.3)
|
||||
select2-rails (3.4.9)
|
||||
sass-rails
|
||||
sass (3.2.19)
|
||||
sass-rails (4.0.3)
|
||||
railties (>= 4.0.0, < 5.0)
|
||||
sass (~> 3.2.0)
|
||||
sprockets (~> 2.8, <= 2.11.0)
|
||||
sprockets-rails (~> 2.0)
|
||||
select2-rails (3.5.4)
|
||||
thor (~> 0.14)
|
||||
shoulda-matchers (2.6.0)
|
||||
activesupport (>= 3.0.0)
|
||||
|
@ -244,11 +241,15 @@ GEM
|
|||
simplecov-html (~> 0.8.0)
|
||||
simplecov-html (0.8.0)
|
||||
slop (3.5.0)
|
||||
sprockets (2.2.2)
|
||||
sprockets (2.11.0)
|
||||
hike (~> 1.2)
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
sprockets-rails (2.1.3)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (~> 2.8)
|
||||
systemu (2.6.4)
|
||||
term-ansicolor (1.3.0)
|
||||
tins (~> 1.0)
|
||||
|
@ -279,7 +280,8 @@ GEM
|
|||
simple_oauth (~> 0.2.0)
|
||||
typhoeus (0.6.8)
|
||||
ethon (>= 0.7.0)
|
||||
tzinfo (0.3.39)
|
||||
tzinfo (1.1.0)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (2.5.0)
|
||||
execjs (>= 0.3.0)
|
||||
json (>= 1.8.0)
|
||||
|
@ -295,7 +297,7 @@ GEM
|
|||
multi_json (~> 1)
|
||||
oauth2 (~> 0.9.1)
|
||||
rest-client (~> 1.6.7)
|
||||
wunderground (1.1.0)
|
||||
wunderground (1.2.0)
|
||||
addressable
|
||||
httparty (> 0.6.0)
|
||||
json (> 1.4.0)
|
||||
|
@ -308,43 +310,45 @@ DEPENDENCIES
|
|||
better_errors
|
||||
binding_of_caller
|
||||
bootstrap-kaminari-views (~> 0.0.2)
|
||||
coffee-rails (~> 3.2.1)
|
||||
coffee-rails (~> 4.0.0)
|
||||
coveralls
|
||||
daemons (~> 1.1.9)
|
||||
delayed_job (~> 4.0.0)
|
||||
delayed_job_active_record (~> 4.0.0)
|
||||
devise (~> 3.0.0)
|
||||
delorean
|
||||
devise (~> 3.2.4)
|
||||
dotenv-rails
|
||||
em-http-request (~> 1.1.2)
|
||||
forecast_io (~> 2.0.0)
|
||||
foreman (~> 0.63.0)
|
||||
geokit (~> 1.6.7)
|
||||
geokit-rails3 (~> 0.1.5)
|
||||
geokit (~> 1.8.4)
|
||||
geokit-rails (~> 2.0.1)
|
||||
hipchat (~> 1.1.0)
|
||||
jquery-rails (~> 3.0.4)
|
||||
json (>= 1.7.7)
|
||||
jquery-rails (~> 3.1.0)
|
||||
json (~> 1.8.1)
|
||||
jsonpath (~> 0.5.3)
|
||||
kaminari (~> 0.14.1)
|
||||
kramdown (~> 1.1.0)
|
||||
mysql2 (~> 0.3.13)
|
||||
nokogiri (~> 1.6.0)
|
||||
kaminari (~> 0.15.1)
|
||||
kramdown (~> 1.3.3)
|
||||
mysql2 (~> 0.3.15)
|
||||
nokogiri (~> 1.6.1)
|
||||
protected_attributes (~> 1.0.7)
|
||||
pry
|
||||
rails (= 3.2.17)
|
||||
rails (= 4.1.0)
|
||||
rr
|
||||
rspec
|
||||
rspec-rails
|
||||
rturk (~> 2.11.0)
|
||||
ruby-growl (~> 4.1.0)
|
||||
rufus-scheduler (~> 3.0.7)
|
||||
sass-rails (~> 3.2.3)
|
||||
select2-rails (~> 3.4.3)
|
||||
sass-rails (~> 4.0.0)
|
||||
select2-rails (~> 3.5.4)
|
||||
shoulda-matchers
|
||||
therubyracer (~> 0.12.1)
|
||||
twilio-ruby (~> 3.10.0)
|
||||
twitter (~> 5.7.1)
|
||||
twitter-stream!
|
||||
typhoeus (~> 0.6.3)
|
||||
uglifier (>= 1.0.3)
|
||||
uglifier (>= 1.3.0)
|
||||
webmock
|
||||
weibo_2 (~> 0.1.4)
|
||||
wunderground (~> 1.1.0)
|
||||
wunderground (~> 1.2.0)
|
||||
|
|
|
@ -104,5 +104,5 @@ Huginn is a work in progress and is hopefully just getting started. Please get
|
|||
|
||||
Please fork, add specs, and send pull requests!
|
||||
|
||||
[](https://travis-ci.org/cantino/huginn) [](https://coveralls.io/r/cantino/huginn) [](https://bitdeli.com/free "Bitdeli Badge")
|
||||
[](https://travis-ci.org/cantino/huginn) [](https://coveralls.io/r/cantino/huginn) [](https://bitdeli.com/free "Bitdeli Badge") [](https://gemnasium.com/cantino/huginn)
|
||||
|
||||
|
|
|
@ -39,10 +39,10 @@ class Agent < ActiveRecord::Base
|
|||
after_save :possibly_update_event_expirations
|
||||
|
||||
belongs_to :user, :inverse_of => :agents
|
||||
has_many :events, :dependent => :delete_all, :inverse_of => :agent, :order => "events.id desc"
|
||||
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_many :logs, :dependent => :delete_all, :inverse_of => :agent, :class_name => "AgentLog", :order => "agent_logs.id desc"
|
||||
has_many :received_events, :through => :sources, :class_name => "Event", :source => :events, :order => "events.id desc"
|
||||
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
|
||||
has_many :links_as_receiver, :dependent => :delete_all, :foreign_key => "receiver_id", :class_name => "Link", :inverse_of => :receiver
|
||||
has_many :sources, :through => :links_as_receiver, :class_name => "Agent", :inverse_of => :receivers
|
||||
|
|
|
@ -23,8 +23,8 @@ class User < ActiveRecord::Base
|
|||
validates_inclusion_of :invitation_code, :on => :create, :in => INVITATION_CODES, :message => "is not valid"
|
||||
|
||||
has_many :user_credentials, :dependent => :destroy, :inverse_of => :user
|
||||
has_many :events, :order => "events.created_at desc", :dependent => :delete_all, :inverse_of => :user
|
||||
has_many :agents, :order => "agents.created_at desc", :dependent => :destroy, :inverse_of => :user
|
||||
has_many :events, -> { order("events.created_at desc") }, :dependent => :delete_all, :inverse_of => :user
|
||||
has_many :agents, -> { order("agents.created_at desc") }, :dependent => :destroy, :inverse_of => :user
|
||||
has_many :logs, :through => :agents, :class_name => "AgentLog"
|
||||
|
||||
# Allow users to login via either email or username.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% if flash.keys.length > 0 %>
|
||||
<div class="flash">
|
||||
<% flash.each do |name, msg| %>
|
||||
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
|
||||
<div class="alert alert-<%= name.to_sym == :notice ? "success" : "error" %>">
|
||||
<a class="close" data-dismiss="alert">×</a>
|
||||
<%= content_tag :div, msg, :id => "flash_#{name}" if msg.is_a?(String) %>
|
||||
</div>
|
||||
|
|
3
bin/bundle
Executable file
3
bin/bundle
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env ruby
|
||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
||||
load Gem.bin_path('bundler', 'bundle')
|
4
bin/rails
Executable file
4
bin/rails
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env ruby
|
||||
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
||||
require_relative '../config/boot'
|
||||
require 'rails/commands'
|
4
bin/rake
Executable file
4
bin/rake
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env ruby
|
||||
require_relative '../config/boot'
|
||||
require 'rake'
|
||||
Rake.application.run
|
|
@ -2,12 +2,7 @@ require File.expand_path('../boot', __FILE__)
|
|||
|
||||
require 'rails/all'
|
||||
|
||||
if defined?(Bundler)
|
||||
# If you precompile assets before deploying to production, use this line
|
||||
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
||||
# If you want your assets lazily compiled in production, use this line
|
||||
# Bundler.require(:default, :assets, Rails.env)
|
||||
end
|
||||
Bundler.require(:default, Rails.env)
|
||||
|
||||
module Huginn
|
||||
class Application < Rails::Application
|
||||
|
@ -18,10 +13,6 @@ module Huginn
|
|||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
config.autoload_paths += %W(#{config.root}/lib)
|
||||
|
||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||
# :all can be used as a placeholder for all plugins not explicitly named.
|
||||
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
||||
|
||||
# Activate observers that should always be running.
|
||||
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
||||
|
||||
|
@ -56,8 +47,5 @@ module Huginn
|
|||
# Enable the asset pipeline
|
||||
config.assets.enabled = true
|
||||
config.assets.initialize_on_precompile = false
|
||||
|
||||
# Version of your assets, change this if you want to expire all your assets
|
||||
config.assets.version = '1.0'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,8 +8,11 @@ Huginn::Application.configure do
|
|||
# since you don't have to restart the web server when you make code changes.
|
||||
config.cache_classes = false
|
||||
|
||||
# Log error messages when you accidentally call methods on nil.
|
||||
config.whiny_nils = true
|
||||
# Eager load code on boot. This eager loads most of Rails and
|
||||
# your application in memory, allowing both threaded web servers
|
||||
# and those relying on copy on write to perform better.
|
||||
# Rake tasks automatically ignore this option for performance.
|
||||
config.eager_load = false
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
|
@ -24,12 +27,8 @@ Huginn::Application.configure do
|
|||
# Raise exception on mass assignment protection for Active Record models
|
||||
config.active_record.mass_assignment_sanitizer = :strict
|
||||
|
||||
# Log the query plan for queries taking more than this (works
|
||||
# with SQLite, MySQL, and PostgreSQL)
|
||||
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||
|
||||
# Do not compress assets
|
||||
config.assets.compress = false
|
||||
# Raise an error on page load if there are pending migrations.
|
||||
config.active_record.migration_error = :page_load
|
||||
|
||||
# Expands the lines which load the assets
|
||||
config.assets.debug = true
|
||||
|
|
|
@ -4,15 +4,27 @@ Huginn::Application.configure do
|
|||
# Code is not reloaded between requests
|
||||
config.cache_classes = true
|
||||
|
||||
# Eager load code on boot. This eager loads most of Rails and
|
||||
# your application in memory, allowing both threaded web servers
|
||||
# and those relying on copy on write to perform better.
|
||||
# Rake tasks automatically ignore this option for performance.
|
||||
config.eager_load = true
|
||||
|
||||
# Full error reports are disabled and caching is turned on
|
||||
config.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# 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.
|
||||
# config.action_dispatch.rack_cache = true
|
||||
|
||||
# Disable Rails's static asset server (Apache or nginx will already do this)
|
||||
config.serve_static_assets = false
|
||||
|
||||
# Compress JavaScripts and CSS
|
||||
config.assets.compress = true
|
||||
config.assets.js_compressor = :uglifier
|
||||
config.assets.css_compressor = :sass
|
||||
|
||||
# Don't fallback to assets pipeline if a precompiled asset is missed
|
||||
config.assets.compile = false
|
||||
|
@ -20,10 +32,7 @@ Huginn::Application.configure do
|
|||
# Generate digests for assets URLs
|
||||
config.assets.digest = true
|
||||
|
||||
# Defaults to nil and saved in location specified by config.assets.prefix
|
||||
# config.assets.manifest = YOUR_PATH
|
||||
|
||||
# Specifies the header that your server uses for sending files
|
||||
# Specifies the header that your server uses for sending files.
|
||||
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
||||
|
||||
|
@ -50,19 +59,25 @@ Huginn::Application.configure do
|
|||
# Precompile additional assets (application.js.coffee.erb, application.css, and all non-JS/CSS are already added)
|
||||
config.assets.precompile += %w( graphing.js user_credentials.js )
|
||||
|
||||
# Enable threaded mode
|
||||
# config.threadsafe!
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
# config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||
# the I18n.default_locale when a translation can not be found)
|
||||
# the I18n.default_locale when a translation cannot be found).
|
||||
config.i18n.fallbacks = true
|
||||
|
||||
# Send deprecation notices to registered listeners
|
||||
config.active_support.deprecation = :notify
|
||||
|
||||
# Log the query plan for queries taking more than this (works
|
||||
# with SQLite, MySQL, and PostgreSQL)
|
||||
# config.active_record.auto_explain_threshold_in_seconds = 0.5
|
||||
# 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
|
||||
|
||||
# Do not dump schema after migrations.
|
||||
config.active_record.dump_schema_after_migration = false
|
||||
|
||||
config.action_mailer.default_url_options = { :host => ENV['DOMAIN'] }
|
||||
config.action_mailer.asset_host = ENV['DOMAIN']
|
||||
|
|
|
@ -7,13 +7,15 @@ Huginn::Application.configure do
|
|||
# and recreated between test runs. Don't rely on the data there!
|
||||
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
|
||||
config.static_cache_control = "public, max-age=3600"
|
||||
|
||||
# Log error messages when you accidentally call methods on nil
|
||||
config.whiny_nils = true
|
||||
|
||||
# Show full error reports and disable caching
|
||||
config.consider_all_requests_local = true
|
||||
config.action_controller.perform_caching = false
|
||||
|
@ -22,7 +24,7 @@ Huginn::Application.configure do
|
|||
config.action_dispatch.show_exceptions = false
|
||||
|
||||
# Disable request forgery protection in test environment
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
Devise.setup do |config|
|
||||
# ==> Mailer Configuration
|
||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
||||
# note that it will be overwritten if you use your own mailer class
|
||||
# with default "from" parameter.
|
||||
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
|
||||
|
||||
# Configure the class responsible to send e-mails.
|
||||
|
@ -72,6 +73,12 @@ Devise.setup do |config|
|
|||
# passing :skip => :sessions to `devise_for` in your config/routes.rb
|
||||
config.skip_session_storage = [:http_auth]
|
||||
|
||||
# By default, Devise cleans up the CSRF token on authentication to
|
||||
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
||||
# requests for sign in and sign up, you need to get a new CSRF token
|
||||
# from the server. You can disable this option at your own risk.
|
||||
# config.clean_up_csrf_token_on_authentication = true
|
||||
|
||||
# ==> Configuration for :database_authenticatable
|
||||
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
||||
# using other encryptors, it sets how many times you want the password re-encrypted.
|
||||
|
@ -174,10 +181,6 @@ Devise.setup do |config|
|
|||
# REST_AUTH_SITE_KEY to pepper)
|
||||
# config.encryptor = :sha512
|
||||
|
||||
# ==> Configuration for :token_authenticatable
|
||||
# Defines name of the authentication token params key
|
||||
# config.token_authentication_key = :auth_token
|
||||
|
||||
# ==> Scopes configuration
|
||||
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
||||
# "users/sessions/new". It's turned off by default because it's slower if you
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
# If you change this key, all old signed cookies will become invalid!
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
Huginn::Application.config.secret_token = ENV['APP_SECRET_TOKEN']
|
||||
Huginn::Application.config.secret_key_base = ENV['APP_SECRET_TOKEN']
|
||||
|
|
|
@ -28,18 +28,18 @@ Huginn::Application.routes.draw do
|
|||
|
||||
resources :user_credentials, :except => :show
|
||||
|
||||
match "/worker_status" => "worker_status#show"
|
||||
get "/worker_status" => "worker_status#show"
|
||||
|
||||
post "/users/:user_id/update_location/:secret" => "user_location_updates#create"
|
||||
|
||||
match "/users/:user_id/web_requests/:agent_id/:secret" => "web_requests#handle_request", :as => :web_requests
|
||||
match "/users/:user_id/web_requests/:agent_id/:secret" => "web_requests#handle_request", :as => :web_requests, :via => [:get, :post, :put, :delete]
|
||||
post "/users/:user_id/webhooks/:agent_id/:secret" => "web_requests#handle_request" # legacy
|
||||
|
||||
# To enable DelayedJobWeb, see the 'Enable DelayedJobWeb' section of the README.
|
||||
# match "/delayed_job" => DelayedJobWeb, :anchor => false
|
||||
# get "/delayed_job" => DelayedJobWeb, :anchor => false
|
||||
|
||||
devise_for :users, :sign_out_via => [ :post, :delete ]
|
||||
|
||||
match "/about" => "home#about"
|
||||
get "/about" => "home#about"
|
||||
root :to => "home#index"
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
module RDBMSFunctions
|
||||
def rdbms_date_add(source, unit, amount)
|
||||
adapter_type = connection.adapter_name.downcase.to_sym
|
||||
adapter_type = ActiveRecord::Base.connection.adapter_name.downcase.to_sym
|
||||
case adapter_type
|
||||
when :mysql, :mysql2
|
||||
"DATE_ADD(`#{source}`, INTERVAL #{amount} #{unit})"
|
||||
when :postgresql
|
||||
when :postgresql
|
||||
"(#{source} + INTERVAL '#{amount} #{unit}')"
|
||||
else
|
||||
raise NotImplementedError, "Unknown adapter type '#{adapter_type}'"
|
||||
|
|
|
@ -97,7 +97,7 @@ describe Utils do
|
|||
it "escapes </script> tags in the output JSON" do
|
||||
cleaned_json = Utils.jsonify(:foo => "bar", :xss => "</script><script>alert('oh no!')</script>")
|
||||
cleaned_json.should_not include("</script>")
|
||||
cleaned_json.should include("<\\/script>")
|
||||
cleaned_json.should include('\\u003c/script\\u003e')
|
||||
end
|
||||
|
||||
it "html_safes the output unless :skip_safe is passed in" do
|
||||
|
|
|
@ -62,7 +62,7 @@ describe Agents::HipchatAgent do
|
|||
end
|
||||
|
||||
it "should merge all options" do
|
||||
@checker.send(:merge_options, @event).should == {
|
||||
@checker.send(:merge_options, @event).deep_symbolize_keys.should == {
|
||||
:room_name => "test",
|
||||
:username => "Huggin user",
|
||||
:message => "Looks like its going to rain",
|
||||
|
|
|
@ -19,7 +19,6 @@ describe Agents::PublicTransportAgent do
|
|||
stub_request(:get, "http://webservices.nextbus.com/service/publicXMLFeed?a=sf-muni&command=predictionsForMultiStops&stops=N%7C5215").
|
||||
with(:headers => {'User-Agent'=>'Typhoeus - https://github.com/typhoeus/typhoeus'}).
|
||||
to_return(:status => 200, :body => File.read(Rails.root.join("spec/data_fixtures/public_transport_agent.xml")), :headers => {})
|
||||
stub(Time).now {"2014-01-14 20:21:30 +0500".to_time}
|
||||
end
|
||||
|
||||
it "should create 4 events" do
|
||||
|
@ -27,15 +26,18 @@ describe Agents::PublicTransportAgent do
|
|||
end
|
||||
|
||||
it "should add 4 items to memory" do
|
||||
@agent.memory.should == {}
|
||||
@agent.check
|
||||
@agent.memory.should == {"existing_routes" => [
|
||||
{"stopTag"=>"5221", "tripTag"=>"5840324", "epochTime"=>"1389706393991", "currentTime"=>"2014-01-14 20:21:30 +0500"},
|
||||
{"stopTag"=>"5221", "tripTag"=>"5840083", "epochTime"=>"1389706512784", "currentTime"=>"2014-01-14 20:21:30 +0500"},
|
||||
{"stopTag"=>"5215", "tripTag"=>"5840324", "epochTime"=>"1389706282012", "currentTime"=>"2014-01-14 20:21:30 +0500"},
|
||||
{"stopTag"=>"5215", "tripTag"=>"5840083", "epochTime"=>"1389706400805", "currentTime"=>"2014-01-14 20:21:30 +0500"}
|
||||
]
|
||||
}
|
||||
time_travel_to Time.parse("2014-01-14 20:21:30 +0500") do
|
||||
@agent.memory.should == {}
|
||||
@agent.check
|
||||
@agent.save
|
||||
@agent.reload.memory.should == {"existing_routes" => [
|
||||
{"stopTag"=>"5221", "tripTag"=>"5840324", "epochTime"=>"1389706393991", "currentTime"=>Time.now.to_s},
|
||||
{"stopTag"=>"5221", "tripTag"=>"5840083", "epochTime"=>"1389706512784", "currentTime"=>Time.now.to_s},
|
||||
{"stopTag"=>"5215", "tripTag"=>"5840324", "epochTime"=>"1389706282012", "currentTime"=>Time.now.to_s},
|
||||
{"stopTag"=>"5215", "tripTag"=>"5840083", "epochTime"=>"1389706400805", "currentTime"=>Time.now.to_s}
|
||||
]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it "should not create events twice" do
|
||||
|
@ -44,10 +46,13 @@ describe Agents::PublicTransportAgent do
|
|||
end
|
||||
|
||||
it "should reset memory after 2 hours" do
|
||||
lambda { @agent.check }.should change {@agent.events.count}.by(4)
|
||||
stub(Time).now {"2014-01-14 20:21:30 +0500".to_time + 3.hours}
|
||||
@agent.cleanup_old_memory
|
||||
lambda { @agent.check }.should change {@agent.events.count}.by(4)
|
||||
time_travel_to Time.parse("2014-01-14 20:21:30 +0500") do
|
||||
lambda { @agent.check }.should change {@agent.events.count}.by(4)
|
||||
end
|
||||
time_travel_to "2014-01-14 23:21:30 +0500".to_time do
|
||||
@agent.cleanup_old_memory
|
||||
lambda { @agent.check }.should change {@agent.events.count}.by(4)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -42,4 +42,5 @@ RSpec.configure do |config|
|
|||
|
||||
config.include Devise::TestHelpers, :type => :controller
|
||||
config.include SpecHelpers
|
||||
config.include Delorean
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue