Merge pull request #47 from beardyjay/rails5 - warvox - VoIP based wardialing tool, forked from rapid7/warvox.
DIR Log
DIR Files
DIR Refs
DIR README
---
DIR commit 1ba5b2dcbb3af0cfcc15f09515149c3293fe753d
DIR parent a1f6730b831422fc51fb5af175d279f97452983c
HTML Author: HD Moore <x@hdm.io>
Date: Tue, 6 Sep 2016 14:29:00 -0500
Merge pull request #47 from beardyjay/rails5
Update to Rails 5
Diffstat:
M .gitignore | 7 +++++++
M .ruby-version | 2 +-
M Gemfile | 28 ++++++++++++++++------------
M Gemfile.lock | 234 ++++++++++++++++++-------------
M README.md | 39 ++++++++++++++++++++-----------
A app/assets/config/manifest.js | 3 +++
R config/initializers/bootstrap.rb -… | 0
M app/controllers/analyze_controller… | 22 +++++++++++-----------
M app/controllers/application_contro… | 8 ++++----
M app/controllers/calls_controller.rb | 70 +++++++++++++++----------------
R config/initializers/bootstrap.rb -… | 0
M app/controllers/home_controller.rb | 6 +++---
M app/controllers/jobs_controller.rb | 234 +++++++++++++++----------------
M app/controllers/projects_controlle… | 50 +++++++++++++++++--------------
M app/controllers/providers_controll… | 44 ++++++++++++++++++-------------
M app/controllers/user_sessions_cont… | 16 +++++++++++-----
M app/controllers/users_controller.rb | 20 +++++++++++++-------
M app/helpers/application_helper.rb | 14 +++++++-------
A app/models/application_record.rb | 3 +++
M app/models/call.rb | 22 +++++++++++-----------
M app/models/call_medium.rb | 2 +-
R config/initializers/bootstrap.rb -… | 0
M app/models/job.rb | 54 +++++++++++++------------------
M app/models/line.rb | 6 +++---
M app/models/line_attribute.rb | 2 +-
M app/models/project.rb | 14 ++++++--------
M app/models/provider.rb | 8 +++-----
M app/models/settings.rb | 4 ++--
M app/models/signature.rb | 2 +-
M app/models/signature_fp.rb | 2 +-
M app/models/user.rb | 6 +++---
M app/views/application/_nav.html.erb | 4 +++-
M app/views/home/about.html.erb | 2 +-
M app/views/layouts/login.html.erb | 4 +++-
M app/views/users/edit.html.erb | 2 +-
M bin/adduser | 2 +-
A bin/bundle | 3 +++
M bin/export_audio.rb | 2 +-
M bin/export_list.rb | 2 +-
M bin/iaxrecord.rb | 2 +-
M bin/import_audio.rb | 24 ++++++++++++------------
A bin/rails | 4 ++++
A bin/rake | 4 ++++
M bin/resetpw | 2 +-
A bin/setup | 34 +++++++++++++++++++++++++++++++
A bin/update | 29 +++++++++++++++++++++++++++++
M bin/warvox.rb | 2 +-
M bin/worker_manager.rb | 10 +++++-----
M config/application.rb | 65 ++++++++-----------------------
M config/boot.rb | 7 ++-----
A config/cable.yml | 9 +++++++++
M config/environment.rb | 9 ++++-----
M config/environments/development.rb | 56 ++++++++++++++++++++-----------
M config/environments/production.rb | 90 ++++++++++++++++++-------------
M config/environments/test.rb | 41 +++++++++++++++++--------------
A config/initializers/application_co… | 6 ++++++
A config/initializers/assets.rb | 16 ++++++++++++++++
A config/initializers/cookies_serial… | 5 +++++
A config/initializers/filter_paramet… | 4 ++++
M config/initializers/inflections.rb | 11 ++++++-----
M config/initializers/mime_types.rb | 1 -
A config/initializers/new_framework_… | 24 ++++++++++++++++++++++++
D config/initializers/secret_token.rb | 1 -
M config/initializers/session_store.… | 7 +------
M config/initializers/wrap_parameter… | 10 +++++-----
M config/locales/en.yml | 22 ++++++++++++++++++++--
M config/routes.rb | 5 ++---
A config/secrets.yml.example | 8 ++++++++
R config/initializers/bootstrap.rb -… | 0
M db/migrate/20121228171549_initial_… | 107 +++++++++++++++----------------
M db/migrate/20130113004653_create_r… | 31 +++++++++++++++----------------
M db/schema.rb | 101 ++++++++++++++-----------------
A db/seeds.rb | 7 +++++++
R config/initializers/bootstrap.rb -… | 0
R config/initializers/bootstrap.rb -… | 0
M lib/warvox/audio/raw.rb | 2 +-
M lib/warvox/jobs/analysis.rb | 32 ++++++++++++++++----------------
M lib/warvox/jobs/dialer.rb | 16 ++++++++--------
M lib/warvox/proto/iax2/client.rb | 8 ++++----
D script/rails | 6 ------
M spec/factories/settings.rb | 2 +-
M spec/rails_helper.rb | 12 ++++++++----
M spec/spec_helper.rb | 25 +++++++++++++++++--------
M spec/support/auth_logic_helpers.rb | 5 ++---
A spec/support/factory_girl.rb | 3 +++
85 files changed, 1019 insertions(+), 789 deletions(-)
---
DIR diff --git a/.gitignore b/.gitignore
@@ -24,3 +24,10 @@ config/secrets.yml
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
+
+# vagrant and ansible files
+.vagrant
+playbook.retry
+
+TODO.md
+/public/assets
DIR diff --git a/.ruby-version b/.ruby-version
@@ -1 +1 @@
-2.2.3
+2.2.5
DIR diff --git a/Gemfile b/Gemfile
@@ -1,26 +1,24 @@
source 'https://rubygems.org'
gem 'unicorn'
-gem 'rails', '>=4.1.9', '< 4.2.0'
-gem 'pg', '>=0.17'
+gem 'rails', '~> 5.0', '>= 5.0.0.1'
+gem 'pg', '~> 0.18'
-gem 'jquery-rails', '>= 3.1.2'
+gem 'jquery-rails'
gem 'jquery-datatables-rails', git: 'https://github.com/rweng/jquery-datatables-rails.git'
-#gem 'postgres_ext', :git => 'git://github.com/dockyard/postgres_ext.git'
gem 'kissfft'
gem 'rex', '~> 2.0.10'
gem 'bootstrap-sass', '>= 3.2.0'
-gem 'sass-rails', '~> 4.0.2'
-gem 'coffee-rails', '~> 4.0.1'
-gem 'uglifier', '>= 1.0.3'
-gem 'protected_attributes', '~> 1.0.7'
+gem 'sass-rails', '~> 5.0'
+gem 'coffee-rails', '~> 4.2'
+gem 'uglifier', '>= 1.3.0'
gem 'autoprefixer-rails'
-gem 'authlogic', '>= 3.4.0'
+gem 'authlogic', git: 'https://github.com/binarylogic/authlogic.git'
gem 'rails-settings-cached', '>= 0.4.1'
-gem "breadcrumbs_on_rails"
+gem 'breadcrumbs_on_rails'
gem 'formtastic', '>= 3.0.0'
gem 'formtastic-bootstrap', '>= 3.0.0'
@@ -28,7 +26,8 @@ gem 'therubyracer'
gem 'font-awesome-rails'
-gem 'reportable', :git => 'https://github.com/hdm/reportable.git', :require => 'saulabs/reportable'
+gem 'reportable', git: 'https://github.com/hdm/reportable.git',
+ require: 'saulabs/reportable'
gem 'will_paginate', '~> 3.0'
gem 'will_paginate-bootstrap'
@@ -43,16 +42,21 @@ group :development do
gem 'rails_layout'
gem 'guard-livereload', '~> 2.4', require: false
gem 'annotate'
+ gem 'web-console'
end
group :development, :test do
gem 'factory_girl_rails'
gem 'faker'
- gem 'rspec-rails'
+ gem 'rspec-rails', '~> 3.5'
+ gem 'byebug', platform: :mri
end
group :test do
gem 'capybara'
+ gem 'pry'
gem 'database_cleaner'
gem 'launchy'
gem 'selenium-webdriver'
gem 'shoulda-matchers', '2.8'
end
+
+gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
DIR diff --git a/Gemfile.lock b/Gemfile.lock
@@ -1,4 +1,14 @@
GIT
+ remote: https://github.com/binarylogic/authlogic.git
+ revision: 28b13154af7a4850b52316275bd40233280ca516
+ specs:
+ authlogic (3.5.0)
+ activerecord (>= 3.2, < 5.1)
+ activesupport (>= 3.2, < 5.1)
+ request_store (~> 1.0)
+ scrypt (>= 1.2, < 4.0)
+
+GIT
remote: https://github.com/hdm/reportable.git
revision: 073bc1657ee301f4c961f14247ef1a58cf38bd1f
specs:
@@ -19,50 +29,57 @@ GIT
GEM
remote: https://rubygems.org/
specs:
- actionmailer (4.1.15)
- actionpack (= 4.1.15)
- actionview (= 4.1.15)
+ actioncable (5.0.0.1)
+ actionpack (= 5.0.0.1)
+ nio4r (~> 1.2)
+ websocket-driver (~> 0.6.1)
+ actionmailer (5.0.0.1)
+ actionpack (= 5.0.0.1)
+ actionview (= 5.0.0.1)
+ activejob (= 5.0.0.1)
mail (~> 2.5, >= 2.5.4)
- actionpack (4.1.15)
- actionview (= 4.1.15)
- activesupport (= 4.1.15)
- rack (~> 1.5.2)
- rack-test (~> 0.6.2)
- actionview (4.1.15)
- activesupport (= 4.1.15)
+ rails-dom-testing (~> 2.0)
+ actionpack (5.0.0.1)
+ actionview (= 5.0.0.1)
+ activesupport (= 5.0.0.1)
+ rack (~> 2.0)
+ rack-test (~> 0.6.3)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ actionview (5.0.0.1)
+ activesupport (= 5.0.0.1)
builder (~> 3.1)
erubis (~> 2.7.0)
- activemodel (4.1.15)
- activesupport (= 4.1.15)
- builder (~> 3.1)
- activerecord (4.1.15)
- activemodel (= 4.1.15)
- activesupport (= 4.1.15)
- arel (~> 5.0.0)
- activesupport (4.1.15)
- i18n (~> 0.6, >= 0.6.9)
- json (~> 1.7, >= 1.7.7)
+ rails-dom-testing (~> 2.0)
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
+ activejob (5.0.0.1)
+ activesupport (= 5.0.0.1)
+ globalid (>= 0.3.6)
+ activemodel (5.0.0.1)
+ activesupport (= 5.0.0.1)
+ activerecord (5.0.0.1)
+ activemodel (= 5.0.0.1)
+ activesupport (= 5.0.0.1)
+ arel (~> 7.0)
+ activesupport (5.0.0.1)
+ concurrent-ruby (~> 1.0, >= 1.0.2)
+ i18n (~> 0.7)
minitest (~> 5.1)
- thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.4.0)
annotate (2.7.1)
activerecord (>= 3.2, < 6.0)
rake (>= 10.4, < 12.0)
- arel (5.0.1.20140414130214)
- authlogic (3.4.6)
- activerecord (>= 3.2)
- activesupport (>= 3.2)
- request_store (~> 1.0)
- scrypt (>= 1.2, < 3.0)
- autoprefixer-rails (6.3.6.2)
+ arel (7.1.1)
+ autoprefixer-rails (6.4.1)
execjs
- bootstrap-sass (3.3.5)
- autoprefixer-rails (>= 5.0.0.1)
- sass (>= 3.2.19)
- breadcrumbs_on_rails (2.3.1)
+ bootstrap-sass (3.3.7)
+ autoprefixer-rails (>= 5.2.1)
+ sass (>= 3.3.4)
+ breadcrumbs_on_rails (3.0.1)
builder (3.2.2)
- capybara (2.7.1)
+ byebug (9.0.5)
+ capybara (2.8.1)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
@@ -72,14 +89,16 @@ GEM
childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11)
coderay (1.1.1)
- coffee-rails (4.0.1)
+ coffee-rails (4.2.1)
coffee-script (>= 2.2.0)
- railties (>= 4.0.0, < 5.0)
+ railties (>= 4.0.0, < 5.2.x)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
+ concurrent-ruby (1.0.2)
database_cleaner (1.5.3)
+ debug_inspector (0.0.2)
diff-lcs (1.2.5)
dynamic_form (1.1.4)
em-websocket (0.5.1)
@@ -93,10 +112,10 @@ GEM
factory_girl_rails (4.7.0)
factory_girl (~> 4.7.0)
railties (>= 3.0.0)
- faker (1.6.3)
+ faker (1.6.6)
i18n (~> 0.5)
- ffi (1.9.10)
- ffi-compiler (0.1.3)
+ ffi (1.9.14)
+ ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
filesize (0.1.1)
@@ -107,6 +126,8 @@ GEM
actionpack (>= 3.2.13)
formtastic-bootstrap (3.1.1)
formtastic (>= 3.0)
+ globalid (0.3.7)
+ activesupport (>= 4.1.0)
guard (2.14.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
@@ -126,22 +147,22 @@ GEM
guard (~> 2.8)
guard-compat (~> 1.0)
multi_json (~> 1.8)
- guard-rails (0.7.2)
+ guard-rails (0.8.0)
guard (~> 2.11)
guard-compat (~> 1.0)
- guard-rspec (4.7.2)
+ guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
- hike (1.2.3)
http_parser.rb (0.6.0)
i18n (0.7.0)
- jquery-rails (3.1.4)
- railties (>= 3.0, < 5.0)
+ jquery-rails (4.2.1)
+ rails-dom-testing (>= 1, < 3)
+ railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
jsobfu (0.4.1)
rkelly-remix (= 0.0.6)
- json (1.8.3)
+ json (2.0.2)
kgio (2.10.0)
kissfft (0.0.2)
launchy (2.4.3)
@@ -151,6 +172,8 @@ GEM
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
+ loofah (2.0.3)
+ nokogiri (>= 1.5.9)
lumberjack (1.0.10)
mail (2.6.4)
mime-types (>= 1.16, < 4)
@@ -163,43 +186,50 @@ GEM
minitest (5.9.0)
multi_json (1.12.1)
nenv (0.3.0)
+ nio4r (1.2.1)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
- notiffany (0.1.0)
+ notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
pg (0.18.4)
pkg-config (1.1.7)
- protected_attributes (1.0.9)
- activemodel (>= 4.0.1, < 5.0)
- pry (0.10.3)
+ pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
psych_shield (0.0.4)
- rack (1.5.5)
+ rack (2.0.1)
rack-test (0.6.3)
rack (>= 1.0)
- rails (4.1.15)
- actionmailer (= 4.1.15)
- actionpack (= 4.1.15)
- actionview (= 4.1.15)
- activemodel (= 4.1.15)
- activerecord (= 4.1.15)
- activesupport (= 4.1.15)
+ rails (5.0.0.1)
+ actioncable (= 5.0.0.1)
+ actionmailer (= 5.0.0.1)
+ actionpack (= 5.0.0.1)
+ actionview (= 5.0.0.1)
+ activejob (= 5.0.0.1)
+ activemodel (= 5.0.0.1)
+ activerecord (= 5.0.0.1)
+ activesupport (= 5.0.0.1)
bundler (>= 1.3.0, < 2.0)
- railties (= 4.1.15)
- sprockets-rails (~> 2.0)
- rails-settings-cached (0.4.1)
- rails (>= 4.0.0)
- rails_layout (1.0.29)
- railties (4.1.15)
- actionpack (= 4.1.15)
- activesupport (= 4.1.15)
+ railties (= 5.0.0.1)
+ sprockets-rails (>= 2.0.0)
+ rails-dom-testing (2.0.1)
+ activesupport (>= 4.2.0, < 6.0)
+ nokogiri (~> 1.6.0)
+ rails-html-sanitizer (1.0.3)
+ loofah (~> 2.0)
+ rails-settings-cached (0.6.5)
+ rails (>= 4.2.0)
+ rails_layout (1.0.30)
+ railties (5.0.0.1)
+ actionpack (= 5.0.0.1)
+ activesupport (= 5.0.0.1)
+ method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
- raindrops (0.16.0)
+ raindrops (0.17.0)
rake (11.2.2)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
@@ -221,7 +251,7 @@ GEM
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
- rspec-core (3.5.0)
+ rspec-core (3.5.3)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
@@ -229,7 +259,7 @@ GEM
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
- rspec-rails (3.5.0)
+ rspec-rails (3.5.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
@@ -238,16 +268,17 @@ GEM
rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
- ruby_dep (1.3.1)
+ ruby_dep (1.4.0)
rubyzip (1.2.0)
- sass (3.2.19)
- sass-rails (4.0.5)
- railties (>= 4.0.0, < 5.0)
- sass (~> 3.2.2)
- sprockets (~> 2.8, < 3.0)
- sprockets-rails (~> 2.0)
- scrypt (2.1.1)
- ffi-compiler (>= 0.0.2)
+ sass (3.4.22)
+ sass-rails (5.0.6)
+ railties (>= 4.0.0, < 6)
+ sass (~> 3.1)
+ sprockets (>= 2.8, < 4.0)
+ sprockets-rails (>= 2.0, < 4.0)
+ tilt (>= 1.1, < 3)
+ scrypt (3.0.3)
+ ffi-compiler (>= 1.0.0)
rake
selenium-webdriver (2.53.4)
childprocess (~> 0.5)
@@ -257,29 +288,35 @@ GEM
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
slop (3.6.0)
- sprockets (2.12.4)
- hike (~> 1.2)
- multi_json (~> 1.0)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- sprockets-rails (2.3.3)
- actionpack (>= 3.0)
- activesupport (>= 3.0)
- sprockets (>= 2.8, < 4.0)
+ sprockets (3.7.0)
+ concurrent-ruby (~> 1.0)
+ rack (> 1, < 3)
+ sprockets-rails (3.2.0)
+ actionpack (>= 4.0)
+ activesupport (>= 4.0)
+ sprockets (>= 3.0.0)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
thor (0.19.1)
thread_safe (0.3.5)
- tilt (1.4.1)
+ tilt (2.0.5)
tzinfo (1.2.2)
thread_safe (~> 0.1)
- uglifier (3.0.0)
+ uglifier (3.0.2)
execjs (>= 0.3.0, < 3)
unicorn (5.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
+ web-console (3.3.1)
+ actionview (>= 5.0)
+ activemodel (>= 5.0)
+ debug_inspector
+ railties (>= 5.0)
websocket (1.2.3)
+ websocket-driver (0.6.4)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.2)
will_paginate (3.1.0)
will_paginate-bootstrap (1.0.1)
will_paginate (>= 3.0.3)
@@ -291,12 +328,13 @@ PLATFORMS
DEPENDENCIES
annotate
- authlogic (>= 3.4.0)
+ authlogic!
autoprefixer-rails
bootstrap-sass (>= 3.2.0)
breadcrumbs_on_rails
+ byebug
capybara
- coffee-rails (~> 4.0.1)
+ coffee-rails (~> 4.2)
database_cleaner
dynamic_form (>= 1.1.4)
factory_girl_rails
@@ -309,27 +347,29 @@ DEPENDENCIES
guard-rails
guard-rspec
jquery-datatables-rails!
- jquery-rails (>= 3.1.2)
+ jquery-rails
kissfft
launchy
- pg (>= 0.17)
- protected_attributes (~> 1.0.7)
+ pg (~> 0.18)
+ pry
psych_shield
- rails (>= 4.1.9, < 4.2.0)
+ rails (~> 5.0, >= 5.0.0.1)
rails-settings-cached (>= 0.4.1)
rails_layout
reportable!
rex (~> 2.0.10)
- rspec-rails
- sass-rails (~> 4.0.2)
+ rspec-rails (~> 3.5)
+ sass-rails (~> 5.0)
scrypt
selenium-webdriver
shoulda-matchers (= 2.8)
therubyracer
- uglifier (>= 1.0.3)
+ tzinfo-data
+ uglifier (>= 1.3.0)
unicorn
+ web-console
will_paginate (~> 3.0)
will_paginate-bootstrap
BUNDLED WITH
- 1.11.2
+ 1.12.5
DIR diff --git a/README.md b/README.md
@@ -1,5 +1,5 @@
-WarVOX
-==
+# WarVOX
+
WarVOX is released under a BSD-style license. See docs/LICENSE for more details.
The latest version of this software is available from http://github.com/rapid7/warvox/
@@ -7,22 +7,20 @@ The latest version of this software is available from http://github.com/rapid7/w
Questions and suggestions can be sent to:
x(at)hdm(dot)io
-Installing
---
-WarVOX 2.0.0 is still in development and the installation process is not ideal at the moment.
+ - [Installing](#installing)
-**DO NOT USE WARVOX 2.0.0-dev YET!**
+##installing
-WarVOX requires a Linux operating system, preferably Ubuntu or Debian, but Kali should work as well.
+WarVOX requires a Linux operating system, preferably Ubuntu or Debian.
WarVOX requires PostgreSQL 9.1 or newer with the "contrib" package installed for integer array support.
To get started, install the OS-level dependencies:
$ sudo apt-get install gnuplot lame build-essential libssl-dev libcurl4-openssl-dev \
- postgresql postgresql-contrib postgresql-common git-core curl libpq libpq-dev
+ postgresql postgresql-contrib postgresql-common git-core curl libpq-dev sox
-Install RVM to obtain Ruby 2.1.5 or later
+Install RVM to obtain Ruby 2.2.5 or later
$ \curl -L https://get.rvm.io | bash -s stable --autolibs=3 --rails
@@ -30,17 +28,17 @@ After RVM is installed you need to run the rvm script provided
$ source /usr/local/rvm/scripts/rvm
-In case you have not installed Ruby 1.9.3 or later by now, do so using RVM.
+In case you have not installed Ruby 2.2.5 or later by now, do so using RVM.
- $ rvm install ruby-2.1
+ $ rvm install ruby-2.2.5
Clone this repository to the location you want to install WarVOX:
- $ git clone git://github.com/rapid7/warvox.git /home/warvox
+ $ git clone git://github.com/rapid7/warvox.git /opt/warvox
Configure WarVOX:
- $ cd /home/warvox
+ $ cd /opt/warvox
$ bundle install
$ make
@@ -62,6 +60,14 @@ Copy the example database configuration to database.yml:
$ cp config/database.yml.example config/database.yml
+Copy the example secrets configuration to secrets.yml:
+
+ $ cp config/secrets.yml.example config/secrets.yml
+
+Create a new secrect token:
+
+ $ rake secret > config/session.key
+
Modify config/database.yml to include the password set previously
Initialize the WarVOX database:
@@ -70,12 +76,17 @@ Initialize the WarVOX database:
Add an admin account to WarVOX
- $ bin/adduser admin
+ $ bin/adduser admin randompass
Start the WarVOX daemons:
$ bin/warvox.rb
+or to bind WarVox to all interfaces:
+
+ $ bin/warvox.rb --address 0.0.0.0
+
Access the web interface at http://127.0.0.1:7777/
At this point you can configure a new IAX2 provider, create a project, and start making calls.
+
DIR diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js
@@ -0,0 +1,3 @@
+//= link_tree ../images
+//= link_directory ../javascripts .js
+//= link_directory ../stylesheets .css
DIR diff --git a/config/initializers/bootstrap.rb b/app/assets/images/.keep
DIR diff --git a/app/controllers/analyze_controller.rb b/app/controllers/analyze_controller.rb
@@ -2,8 +2,8 @@ class AnalyzeController < ApplicationController
def index
@jobs = Job.order('id DESC').paginate(
- :page => params[:page],
- :per_page => 30
+ page: params[:page],
+ per_page: 30
)
end
@@ -13,12 +13,12 @@ class AnalyzeController < ApplicationController
@shown = params[:show]
if request.format.html?
- ltypes = Call.select('DISTINCT line_type').where(:job_id => @job_id).map{|r| r.line_type}
+ ltypes = Call.select('DISTINCT line_type').where(job_id: @job_id).map{|r| r.line_type}
res_types = {}
ltypes.each do |k|
next if not k
- res_types[k.capitalize.to_sym] = Call.where(:job_id => @job_id, :line_type => k).count
+ res_types[k.capitalize.to_sym] = Call.where(job_id: @job_id, line_type: k).count
end
@lines_by_type = res_types
@@ -51,7 +51,7 @@ class AnalyzeController < ApplicationController
respond_to do |format|
format.html
format.json {
- render :content_type => 'application/json', :json => render_to_string(:partial => 'view', :results => @results, :lines_by_type => @lines_by_type )
+ render content_type: 'application/json', json: render_to_string(partial: 'view', results: @results, lines_by_type: @lines_by_type )
}
end
@@ -60,9 +60,9 @@ class AnalyzeController < ApplicationController
def view_matches
@result = Call.find(params[:call_id])
@match_scopes = [
- { :scope => 'job', :label => 'This Job' },
- { :scope => 'project', :label => 'This Project' },
- { :scope => 'global', :label => 'All Projects' }
+ { scope: 'job', label: 'This Job' },
+ { scope: 'project', label: 'This Project' },
+ { scope: 'global', label: 'All Projects' }
]
@job_id = params[:job_id]
@@ -111,7 +111,7 @@ class AnalyzeController < ApplicationController
respond_to do |format|
format.html
format.json {
- render :content_type => 'application/json', :json => render_to_string(:partial => 'index', :results => @results, :lines_by_type => @lines_by_type )
+ render content_type: 'application/json', json: render_to_string(partial: 'index', results: @results, lines_by_type: @lines_by_type )
}
end
@@ -122,7 +122,7 @@ class AnalyzeController < ApplicationController
cpath = nil
cdata = "File not found"
- res = CallMedium.where(:call_id => params[:result_id].to_i).first
+ res = CallMedium.where(call_id: params[:result_id].to_i).first
if res
case params[:rtype]
@@ -153,7 +153,7 @@ class AnalyzeController < ApplicationController
end
end
- send_data(cdata, :type => ctype, :disposition => 'inline')
+ send_data(cdata, type: ctype, disposition: 'inline')
end
#
DIR diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
@@ -1,9 +1,9 @@
class ApplicationController < ActionController::Base
- protect_from_forgery
+ protect_from_forgery with: :exception
helper :all
helper_method :current_user_session, :current_user
- before_filter :require_user, :load_project
+ before_action :require_user, :load_project
add_breadcrumb :projects, :root_path
include ActionView::Helpers::NumberHelper
@@ -52,9 +52,9 @@ private
return true unless current_user
if params[:project_id]
- @project = Project.where(:id => params[:project_id].to_i).first
+ @project = Project.where(id: params[:project_id].to_i).first
elsif session[:project_id]
- @project = Project.where(:id => session[:project_id].to_i).first
+ @project = Project.where(id: session[:project_id].to_i).first
end
if @project and @project.id and not (session[:project_id] and session[:project_id] == @project.id)
DIR diff --git a/app/controllers/calls_controller.rb b/app/controllers/calls_controller.rb
@@ -1,40 +1,40 @@
class CallsController < ApplicationController
-
# GET /calls
# GET /calls.xml
def index
@jobs = @project.jobs.order('id DESC').where('task = ? AND completed_at IS NOT NULL', 'dialer').paginate(
- :page => params[:page],
- :per_page => 30
- )
+ page: params[:page],
+ per_page: 30
+ )
respond_to do |format|
format.html # index.html.erb
- format.xml { render :xml => @calls }
+ format.xml { render xml: @calls }
end
end
# GET /calls/1/view
# GET /calls/1/view.xml
def view
- @calls = Call.order('id DESC').where(:job_id => params[:id]).paginate(
- :page => params[:page],
- :per_page => 30
- )
-
- unless @calls and @calls.length > 0
- redirect_to :action => :index
- return
- end
- @call_results = {
- :Timeout => Call.count(:conditions =>['job_id = ? and answered = ?', params[:id], false]),
- :Busy => Call.count(:conditions =>['job_id = ? and busy = ?', params[:id], true]),
- :Answered => Call.count(:conditions =>['job_id = ? and answered = ?', params[:id], true]),
- }
+ @calls = Call.order('id DESC').where(job_id: params[:id]).paginate(
+ page: params[:page],
+ per_page: 30
+ )
+
+ unless @calls && !@calls.empty?
+ redirect_to action: :index
+ return
+ end
- respond_to do |format|
+ @call_results = {
+ Timeout: Call.count(conditions: ['job_id = ? and answered = ?', params[:id], false]),
+ Busy: Call.count(conditions: ['job_id = ? and busy = ?', params[:id], true]),
+ Answered: Call.count(conditions: ['job_id = ? and answered = ?', params[:id], true])
+ }
+
+ respond_to do |format|
format.html # index.html.erb
- format.xml { render :xml => @calls }
+ format.xml { render xml: @calls }
end
end
@@ -43,14 +43,14 @@ class CallsController < ApplicationController
def show
@call = Call.find(params[:id])
- unless @call
- redirect_to :action => :index
- return
- end
+ unless @call
+ redirect_to action: :index
+ return
+ end
respond_to do |format|
format.html # show.html.erb
- format.xml { render :xml => @call }
+ format.xml { render xml: @call }
end
end
@@ -61,7 +61,7 @@ class CallsController < ApplicationController
respond_to do |format|
format.html # new.html.erb
- format.xml { render :xml => @call }
+ format.xml { render xml: @call }
end
end
@@ -79,10 +79,10 @@ class CallsController < ApplicationController
if @call.save
flash[:notice] = 'Call was successfully created.'
format.html { redirect_to(@call) }
- format.xml { render :xml => @call, :status => :created, :location => @call }
+ format.xml { render xml: @call, status: :created, location: @call }
else
- format.html { render :action => "new" }
- format.xml { render :xml => @call.errors, :status => :unprocessable_entity }
+ format.html { render action: 'new' }
+ format.xml { render xml: @call.errors, status: :unprocessable_entity }
end
end
end
@@ -98,8 +98,8 @@ class CallsController < ApplicationController
format.html { redirect_to(@call) }
format.xml { head :ok }
else
- format.html { render :action => "edit" }
- format.xml { render :xml => @call.errors, :status => :unprocessable_entity }
+ format.html { render action: 'edit' }
+ format.xml { render xml: @call.errors, status: :unprocessable_entity }
end
end
end
@@ -107,14 +107,12 @@ class CallsController < ApplicationController
# DELETE /calls/1
# DELETE /calls/1.xml
def destroy
-
@job = Job.find(params[:id])
- @job.destroy
+ @job.destroy
respond_to do |format|
- format.html { redirect_to :action => 'index' }
+ format.html { redirect_to action: 'index' }
format.xml { head :ok }
end
end
-
end
DIR diff --git a/config/initializers/bootstrap.rb b/app/controllers/concerns/.keep
DIR diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
@@ -18,9 +18,9 @@ class HomeController < ApplicationController
def check
@has_project = ( Project.count > 0 )
- @has_provider = ( Provider.where(:enabled => true).count > 0 )
- @has_job = ( Job.where(:task => 'dialer').count > 0 )
- @has_result = ( Call.where(:answered => true ).count > 0 )
+ @has_provider = ( Provider.where(enabled: true).count > 0 )
+ @has_job = ( Job.where(task: 'dialer').count > 0 )
+ @has_result = ( Call.where(answered: true ).count > 0 )
@has_analysis = ( Call.where('analysis_completed_at IS NOT NULL').count > 0 )
end
DIR diff --git a/app/controllers/jobs_controller.rb b/app/controllers/jobs_controller.rb
@@ -1,24 +1,19 @@
class JobsController < ApplicationController
-
require 'shellwords'
def index
- @reload_interval = 20000
+ @reload_interval = 20_000
- @submitted_jobs = Job.where(:status => ['submitted', 'scheduled'], :completed_at => nil)
- @active_jobs = Job.where(:status => 'running', :completed_at => nil)
- @inactive_jobs = Job.order('id DESC').where('status NOT IN (?)', ['submitted', 'scheduled', 'running']).paginate(
- :page => params[:page],
- :per_page => 30
+ @submitted_jobs = Job.where(status: %w(submitted scheduled), completed_at: nil)
+ @active_jobs = Job.where(status: 'running', completed_at: nil)
+ @inactive_jobs = Job.order('id DESC').where('status NOT IN (?)', %w(submitted scheduled running)).paginate(
+ page: params[:page],
+ per_page: 30
)
- if @active_jobs.length > 0
- @reload_interval = 5000
- end
+ @reload_interval = 5000 unless @active_jobs.empty?
- if @submitted_jobs.length > 0
- @reload_interval = 3000
- end
+ @reload_interval = 3000 unless @submitted_jobs.empty?
respond_to do |format|
format.html
@@ -27,8 +22,8 @@ class JobsController < ApplicationController
def results
@jobs = @project.jobs.order('id DESC').where('(task = ? OR task = ?) AND completed_at IS NOT NULL', 'dialer', 'import').paginate(
- :page => params[:page],
- :per_page => 30
+ page: params[:page],
+ per_page: 30
)
respond_to do |format|
@@ -40,16 +35,17 @@ class JobsController < ApplicationController
@job = Job.find(params[:id])
@call_results = {
- :Timeout => @job.calls.count(:conditions => { :answered => false }),
- :Busy => @job.calls.count(:conditions => { :busy => true }),
- :Answered => @job.calls.count(:conditions => { :answered => true }),
+ Timeout: @job.calls.where(answered: false ).count,
+ Busy: @job.calls.where(busy: true).count,
+ Answered: @job.calls.where(answered: true).count,
}
- sort_by = params[:sort_by] || 'number'
+
+ sort_by = params[:sort_by] || 'number'
sort_dir = params[:sort_dir] || 'asc'
@results = []
- @results_total_count = @job.calls.count()
+ @results_total_count = @job.calls.count
if request.format.json?
if params[:iDisplayLength] == '-1'
@@ -61,14 +57,14 @@ class JobsController < ApplicationController
calls_search
@results = @job.calls.includes(:provider).where(@search_conditions).limit(@results_per_page).offset(@results_offset).order(calls_sort_option)
- @results_total_display_count = @job.calls.includes(:provider).where(@search_conditions).count()
+ @results_total_display_count = @job.calls.includes(:provider).where(@search_conditions).count
end
respond_to do |format|
format.html
- format.json {
- render :content_type => 'application/json', :json => render_to_string(:partial => 'view_results', :results => @results, :call_results => @call_results )
- }
+ format.json do
+ render content_type: 'application/json', json: render_to_string(partial: 'view_results', results: @results, call_results: @call_results)
+ end
end
end
@@ -77,20 +73,20 @@ class JobsController < ApplicationController
# Returns the SQL String.
def calls_sort_option
column = case params[:iSortCol_0].to_s
- when '1'
- 'number'
- when '2'
- 'caller_id'
- when '3'
- 'providers.name'
- when '4'
- 'answered'
- when '5'
- 'busy'
- when '6'
- 'audio_length'
- when '7'
- 'ring_length'
+ when '1'
+ 'number'
+ when '2'
+ 'caller_id'
+ when '3'
+ 'providers.name'
+ when '4'
+ 'answered'
+ when '5'
+ 'busy'
+ when '6'
+ 'audio_length'
+ when '7'
+ 'ring_length'
end
column + ' ' + (params[:sSortDir_0] =~ /^A/i ? 'asc' : 'desc') if column
end
@@ -98,41 +94,45 @@ class JobsController < ApplicationController
def calls_search
@search_conditions = []
terms = params[:sSearch].to_s
- terms = Shellword.shellwords(terms) rescue terms.split(/\s+/)
- where = ""
+ terms = begin
+ Shellword.shellwords(terms)
+ rescue
+ terms.split(/\s+/)
+ end
+ where = ''
param = []
- glue = ""
+ glue = ''
terms.each do |w|
- next if w.downcase == 'undefined'
+ next if w.casecmp('undefined').zero?
where << glue
case w
- when 'answered'
- where << "answered = ? "
- param << true
- when 'busy'
- where << "busy = ? "
- param << true
- else
- where << "( number ILIKE ? OR caller_id ILIKE ? ) "
- param << "%#{w}%"
- param << "%#{w}%"
+ when 'answered'
+ where << 'answered = ? '
+ param << true
+ when 'busy'
+ where << 'busy = ? '
+ param << true
+ else
+ where << '( number ILIKE ? OR caller_id ILIKE ? ) '
+ param << "%#{w}%"
+ param << "%#{w}%"
end
- glue = "AND " if glue.empty?
- @search_conditions = [ where, *param ]
+ glue = 'AND ' if glue.empty?
+ @search_conditions = [where, *param]
end
end
def new_dialer
@job = Job.new
- if @project
- @job.project = @project
- else
- @job.project = Project.last
- end
+ @job.project = if @project
+ @project
+ else
+ Project.last
+ end
if params[:result_ids]
- nums = ""
- Call.find_each(:conditions => { :id => params[:result_ids] }) do |call|
+ nums = ''
+ Call.find_each(conditions: { id: params[:result_ids] }) do |call|
nums << call.number + "\n"
end
@job.range = nums
@@ -140,13 +140,16 @@ class JobsController < ApplicationController
respond_to do |format|
format.html
- end
+ end
end
def purge_calls
- Call.delete_all(:id => params[:result_ids])
- CallMedium.delete_all(:call_id => params[:result_ids])
- flash[:notice] = "Purged #{params[:result_ids].length} calls"
+ unless params[:result_ids].blank?
+ Call.delete_all(id: params[:result_ids])
+ CallMedium.delete_all(call_id: params[:result_ids])
+ flash[:notice] = "Purged #{params[:result_ids].length} calls"
+ end
+
if params[:id]
@job = Job.find(params[:id])
redirect_to view_results_path(@job.project_id, @job.id)
@@ -156,37 +159,37 @@ class JobsController < ApplicationController
end
def dialer
- @job = Job.new(params[:job])
+ @job = Job.new(job_params)
@job.created_by = @current_user.login
@job.task = 'dialer'
@job.range.to_s.gsub!(/[^0-9X:,\n]/, '')
- @job.cid_mask.to_s.gsub!(/[^0-9X]/, '') if @job.cid_mask != "SELF"
+ @job.cid_mask.to_s.gsub!(/[^0-9X]/, '') if @job.cid_mask != 'SELF'
- if @job.range_file.to_s != ""
+ if @job.range_file.to_s != ''
@job.range = @job.range_file.read.gsub(/[^0-9X:,\n]/, '')
end
respond_to do |format|
if @job.schedule
flash[:notice] = 'Job was successfully created.'
- format.html { redirect_to :action => :index }
+ format.html { redirect_to action: :index }
else
- format.html { render :action => "new_dialer" }
+ format.html { render action: 'new_dialer' }
end
end
end
def new_analyze
@job = Job.new
- if @project
- @job.project = @project
- else
- @job.project = Project.last
- end
+ @job.project = if @project
+ @project
+ else
+ Project.last
+ end
if params[:result_ids]
- nums = ""
- Call.find_each(:conditions => { :id => params[:result_ids] }) do |call|
+ nums = ''
+ Call.find_each(conditions: { id: params[:result_ids] }) do |call|
nums << call.number + "\n"
end
@job.range = nums
@@ -194,20 +197,20 @@ class JobsController < ApplicationController
respond_to do |format|
format.html
- end
+ end
end
def new_identify
@job = Job.new
- if @project
- @job.project = @project
- else
- @job.project = Project.last
- end
+ @job.project = if @project
+ @project
+ else
+ Project.last
+ end
if params[:result_ids]
- nums = ""
- Call.find_each(:conditions => { :id => params[:result_ids] }) do |call|
+ nums = ''
+ Call.find_each(conditions: { id: params[:result_ids] }) do |call|
nums << call.number + "\n"
end
@job.range = nums
@@ -215,15 +218,13 @@ class JobsController < ApplicationController
respond_to do |format|
format.html
- end
+ end
end
def reanalyze_job
@job = Job.find(params[:id])
- @new = Job.new({
- :task => 'analysis', :scope => 'job', :target_id => @job.id, :force => true,
- :project_id => @project.id, :status => 'submitted'
- })
+ @new = Job.new(task: 'analysis', scope: 'job', target_id: @job.id, force: true,
+ project_id: @project.id, status: 'submitted')
@new.created_by = @current_user.login
respond_to do |format|
if @new.schedule
@@ -241,16 +242,12 @@ class JobsController < ApplicationController
# Handle analysis of specific call IDs via checkbox submission
if params[:result_ids]
- @new = Job.new({
- :task => 'analysis', :scope => 'calls', :target_ids => params[:result_ids],
- :project_id => @project.id, :status => 'submitted'
- })
+ @new = Job.new(task: 'analysis', scope: 'calls', target_ids: params[:result_ids],
+ project_id: @project.id, status: 'submitted')
else
- # Otherwise analyze the entire Job
- @new = Job.new({
- :task => 'analysis', :scope => 'job', :target_id => @job.id,
- :project_id => @project.id, :status => 'submitted'
- })
+ # Otherwise analyze the entire Job
+ @new = Job.new(task: 'analysis', scope: 'job', target_id: @job.id,
+ project_id: @project.id, status: 'submitted')
end
@new.created_by = @current_user.login
@@ -266,21 +263,15 @@ class JobsController < ApplicationController
end
end
-
def analyze_project
-
# Handle analysis of specific call IDs via checkbox submission
if params[:result_ids]
- @new = Job.new({
- :task => 'analysis', :scope => 'calls', :target_ids => params[:result_ids],
- :project_id => @project.id, :status => 'submitted'
- })
+ @new = Job.new(task: 'analysis', scope: 'calls', target_ids: params[:result_ids],
+ project_id: @project.id, status: 'submitted')
else
- # Otherwise analyze the entire Project
- @new = Job.new({
- :task => 'analysis', :scope => 'project', :target_id => @project.id,
- :project_id => @project.id, :status => 'submitted'
- })
+ # Otherwise analyze the entire Project
+ @new = Job.new(task: 'analysis', scope: 'project', target_id: @project.id,
+ project_id: @project.id, status: 'submitted')
end
@new.created_by = @current_user.login
@@ -301,16 +292,12 @@ class JobsController < ApplicationController
# Handle identification of specific lines via checkbox submission
if params[:result_ids]
- @new = Job.new({
- :task => 'identify', :scope => 'calls', :target_ids => params[:result_ids],
- :project_id => @project.id, :status => 'submitted'
- })
+ @new = Job.new(task: 'identify', scope: 'calls', target_ids: params[:result_ids],
+ project_id: @project.id, status: 'submitted')
else
- # Otherwise analyze the entire Job
- @new = Job.new({
- :task => 'identify', :scope => 'job', :target_id => @job.id,
- :project_id => @project.id, :status => 'submitted'
- })
+ # Otherwise analyze the entire Job
+ @new = Job.new(task: 'identify', scope: 'job', target_id: @job.id,
+ project_id: @project.id, status: 'submitted')
end
@new.created_by = @current_user.login
@@ -329,8 +316,8 @@ class JobsController < ApplicationController
def stop
@job = Job.find(params[:id])
@job.stop
- flash[:notice] = "Job has been cancelled"
- redirect_to :action => 'index'
+ flash[:notice] = 'Job has been cancelled'
+ redirect_to action: 'index'
end
def destroy
@@ -343,4 +330,9 @@ class JobsController < ApplicationController
end
end
+ private
+
+ def job_params
+ params.require(:job).permit(:project_id, :range, :range_file, :seconds, :lines, :cid_mask)
+ end
end
DIR diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
@@ -2,34 +2,34 @@ class ProjectsController < ApplicationController
def index
@projects = Project.order('id DESC').paginate(
- :page => params[:page],
- :per_page => 10
+ page: params[:page],
+ per_page: 10
)
@new_project = Project.new
respond_to do |format|
format.html
- format.xml { render :xml => @projects }
+ format.xml { render xml: @projects }
end
end
def show
@project = Project.find(params[:id])
- @active_jobs = @project.jobs.where(:status => 'running', :completed_at => nil)
+ @active_jobs = @project.jobs.where(status: 'running', completed_at: nil)
@inactive_jobs = @project.jobs.order('id DESC').where('status NOT IN (?)', ['submitted', 'scheduled', 'running']).paginate(
- :page => params[:page],
- :per_page => 30
+ page: params[:page],
+ per_page: 30
)
@boxes = {
- :called => { :cnt => @project.calls.count },
- :answered => { :cnt => @project.calls.where(:answered => true).count },
- :analyzed => { :cnt => @project.calls.where('analysis_completed_at IS NOT NULL').count },
- :voice => { :cnt => @project.lines.where(:line_type => 'voice').count },
- :voicemail => { :cnt => @project.lines.where(:line_type => 'voicemail').count },
- :fax => { :cnt => @project.lines.where(:line_type => 'fax').count },
- :modem => { :cnt => @project.lines.where(:line_type => 'modem').count }
+ called: { cnt: @project.calls.count },
+ answered: { cnt: @project.calls.where(answered: true).count },
+ analyzed: { cnt: @project.calls.where('analysis_completed_at IS NOT NULL').count },
+ voice: { cnt: @project.lines.where(line_type: 'voice').count },
+ voicemail: { cnt: @project.lines.where(line_type: 'voicemail').count },
+ fax: { cnt: @project.lines.where(line_type: 'fax').count },
+ modem: { cnt: @project.lines.where(line_type: 'modem').count }
}
if @boxes[:called][:cnt] == 0
@@ -78,7 +78,7 @@ class ProjectsController < ApplicationController
respond_to do |format|
format.html
- format.xml { render :xml => @project }
+ format.xml { render xml: @project }
end
end
@@ -86,7 +86,7 @@ class ProjectsController < ApplicationController
@new_project = Project.new
respond_to do |format|
format.html
- format.xml { render :xml => @new_project }
+ format.xml { render xml: @new_project }
end
end
@@ -96,16 +96,16 @@ class ProjectsController < ApplicationController
end
def create
- @new_project = Project.new(params[:project])
+ @new_project = Project.new(project_params)
@new_project.created_by = current_user.login
respond_to do |format|
if @new_project.save
format.html { redirect_to(project_path(@new_project)) }
- format.xml { render :xml => @project, :status => :created, :location => @new_project }
+ format.xml { render xml: @project, status: :created, location: @new_project }
else
- format.html { render :action => "new" }
- format.xml { render :xml => @new_project.errors, :status => :unprocessable_entity }
+ format.html { render action: "new" }
+ format.xml { render xml: @new_project.errors, status: :unprocessable_entity }
end
end
end
@@ -114,12 +114,12 @@ class ProjectsController < ApplicationController
@project = Project.find(params[:id])
respond_to do |format|
- if @project.update_attributes(params[:project])
+ if @project.update_attributes(project_params)
format.html { redirect_to projects_path }
format.xml { head :ok }
else
- format.html { render :action => "edit" }
- format.xml { render :xml => @project.errors, :status => :unprocessable_entity }
+ format.html { render action: "edit" }
+ format.xml { render xml: @project.errors, status: :unprocessable_entity }
end
end
end
@@ -133,4 +133,10 @@ class ProjectsController < ApplicationController
format.xml { head :ok }
end
end
+
+ private
+
+ def project_params
+ params.require(:project).permit(:name, :description)
+ end
end
DIR diff --git a/app/controllers/providers_controller.rb b/app/controllers/providers_controller.rb
@@ -3,8 +3,8 @@ class ProvidersController < ApplicationController
def index
@providers = Provider.order('id DESC').paginate(
- :page => params[:page],
- :per_page => 10
+ page: params[:page],
+ per_page: 10
)
@new_provider = Provider.new
@@ -12,38 +12,38 @@ class ProvidersController < ApplicationController
respond_to do |format|
format.html # index.html.erb
- format.xml { render :xml => @providers }
+ format.xml { render xml: @providers }
end
end
def new
@provider = Provider.new
- @provider.enabled = true
- @provider.port = 4569
+ @provider.enabled = true
+ @provider.port = 4569
respond_to do |format|
format.html # new.html.erb
- format.xml { render :xml => @provider }
+ format.xml { render xml: @provider }
end
end
def edit
@provider = Provider.find(params[:id])
- @provider.pass = "********"
+ @provider.pass = "********"
end
def create
- @provider = Provider.new(params[:provider])
- @provider.enabled = true
+ @provider = Provider.new(provider_params)
+ @provider.enabled = true
respond_to do |format|
if @provider.save
flash[:notice] = 'Provider was successfully created.'
format.html { redirect_to providers_path }
- format.xml { render :xml => @provider, :status => :created, :location => providers_path }
+ format.xml { render xml: @provider, status: :created, location: providers_path }
else
- format.html { render :action => "new" }
- format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }
+ format.html { render action: "new" }
+ format.xml { render xml: @provider.errors, status: :unprocessable_entity }
end
end
end
@@ -52,19 +52,19 @@ class ProvidersController < ApplicationController
def update
@provider = Provider.find(params[:id])
- # Dont set the password if its the placeholder
- if params[:provider] and params[:provider][:pass] and params[:provider][:pass] == "********"
- params[:provider].delete(:pass)
- end
+ # Dont set the password if its the placeholder
+ if params[:provider] and params[:provider][:pass] and params[:provider][:pass] == "********"
+ params[:provider].delete(:pass)
+ end
respond_to do |format|
- if @provider.update_attributes(params[:provider])
+ if @provider.update_attributes(provider_params)
flash[:notice] = 'Provider was successfully updated.'
format.html { redirect_to providers_path }
format.xml { head :ok }
else
- format.html { render :action => "edit" }
- format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }
+ format.html { render action: "edit" }
+ format.xml { render xml: @provider.errors, status: :unprocessable_entity }
end
end
end
@@ -78,4 +78,10 @@ class ProvidersController < ApplicationController
format.xml { head :ok }
end
end
+
+ private
+
+ def provider_params
+ params.require(:provider).permit(:name, :host, :port, :user, :pass, :lines)
+ end
end
DIR diff --git a/app/controllers/user_sessions_controller.rb b/app/controllers/user_sessions_controller.rb
@@ -1,6 +1,6 @@
class UserSessionsController < ApplicationController
- before_filter :require_no_user, :only => [:new, :create]
- before_filter :require_user, :only => :destroy
+ before_action :require_no_user, only: [:new, :create]
+ before_action :require_user, only: :destroy
layout 'login'
def new
@@ -8,16 +8,22 @@ class UserSessionsController < ApplicationController
end
def create
- @user_session = UserSession.new(params[:user_session])
+ @user_session = UserSession.new(user_session_params)
if @user_session.save
redirect_back_or_default projects_path
else
- render :action => :new
+ render action: :new
end
end
def destroy
current_user_session.destroy
- redirect_back_or_default login_url
+ redirect_back_or_default login_path
+ end
+
+ private
+
+ def user_session_params
+ params.require(:user_session).permit(:login, :password)
end
end
DIR diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
@@ -1,18 +1,18 @@
class UsersController < ApplicationController
- before_filter :require_no_user, :only => [:new, :create]
- before_filter :require_user, :only => [:show, :edit, :update]
+ before_action :require_no_user, only: [:new, :create]
+ before_action :require_user, only: [:show, :edit, :update]
def new
@user = User.new
end
def create
- @user = User.new(params[:user])
+ @user = User.new(user_params)
if @user.save
flash[:notice] = "Account registered!"
redirect_back_or_default user_path(@user)
else
- render :action => :new
+ render action: :new
end
end
@@ -26,11 +26,17 @@ class UsersController < ApplicationController
def update
@user = @current_user # makes our views "cleaner" and more consistent
- if @user.update_attributes(params[:user])
+ if @user.update_attributes(user_params)
flash[:notice] = "Account updated!"
- redirect_to account_url
+ redirect_to user_path(@user)
else
- render :action => :edit
+ render action: :edit
end
end
+
+ private
+
+ def user_params
+ params.require(:user).permit(:login, :password, :password_confirmation)
+ end
end
DIR diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
@@ -2,7 +2,7 @@
module ApplicationHelper
def select_tag_for_filter(nvpairs, params)
- _url = ( url_for :overwrite_params => { }).split('?')[0]
+ _url = ( url_for overwrite_params: { }).split('?')[0]
_html = %{<span class="pull-left filter-label">Filter: </span> }
_html << %{<select name="show" class="filter-select" }
_html << %{onchange="window.location='#{_url}' + '?show=' + this.value"> }
@@ -19,7 +19,7 @@ module ApplicationHelper
end
def select_match_scope(nvpairs, params)
- _url = ( url_for :overwrite_params => { }).split('?')[0]
+ _url = ( url_for overwrite_params: { }).split('?')[0]
_html = %{<span class="pull-left filter-label">Matching Scope: </span> }
_html << %{<select name="match_scope" class="filter-select" }
_html << %{onchange="window.location='#{_url}' + '?match_scope=' + this.value"> }
@@ -45,8 +45,8 @@ module ApplicationHelper
ttip = raw("<div class='task_args_formatted'>")
info.each_pair do |k,v|
- ttip << raw("<div class='task_args_var'>") + h(truncate(k.to_s, :length => 20)) + raw(": </div> ")
- ttip << raw("<div class='task_args_val'>") + h(truncate((v.to_s), :length => 20)) + raw(" </div>")
+ ttip << raw("<div class='task_args_var'>") + h(truncate(k.to_s, length: 20)) + raw(": </div> ")
+ ttip << raw("<div class='task_args_val'>") + h(truncate((v.to_s), length: 20)) + raw(" </div>")
end
ttip << raw("</div>\n")
outp = raw("<span class='xpopover' rel='popover' data-title=\"#{job.task.capitalize} Task ##{job.id}\" data-content=\"#{ttip}\">#{h job.task.capitalize}</span>")
@@ -120,9 +120,9 @@ module ApplicationHelper
def submit_checkboxes_to(name, path, html={})
if html[:confirm]
confirm = html.delete(:confirm)
- link_to(name, "#", html.merge({:onclick => "if(confirm('#{h confirm}')){ submit_checkboxes_to('#{path}','#{form_authenticity_token}')}else{return false;}" }))
+ link_to(name, "#", html.merge({onclick: "if(confirm('#{h confirm}')){ submit_checkboxes_to('#{path}','#{form_authenticity_token}')}else{return false;}" }))
else
- link_to(name, "#", html.merge({:onclick => "submit_checkboxes_to('#{path}','#{form_authenticity_token}')" }))
+ link_to(name, "#", html.merge({onclick: "submit_checkboxes_to('#{path}','#{form_authenticity_token}')" }))
end
end
@@ -143,7 +143,7 @@ module ApplicationHelper
# Generate the markup for the call's row checkbox.
# Returns the String markup html, escaped for json.
def call_checkbox_tag(call)
- check_box_tag("result_ids[]", call.id, false, :id => nil).to_json.html_safe
+ check_box_tag("result_ids[]", call.id, false, id: nil).to_json.html_safe
end
def call_number_html(call)
DIR diff --git a/app/models/application_record.rb b/app/models/application_record.rb
@@ -0,0 +1,3 @@
+class ApplicationRecord < ActiveRecord::Base
+ self.abstract_class = true
+end
DIR diff --git a/app/models/call.rb b/app/models/call.rb
@@ -24,22 +24,22 @@
# fprint :integer is an Array
#
-class Call < ActiveRecord::Base
+class Call < ApplicationRecord
- reportable :hourly, :aggregation => :count, :grouping => :hour, :live_data => true, :cacheable => false, :limit => 24
- reportable :daily, :aggregation => :count, :grouping => :day, :live_data => true, :cacheable => false, :limit => 7
- reportable :weekly, :aggregation => :count, :grouping => :week, :live_data => true, :cacheable => false, :limit => 52
- reportable :monthly, :aggregation => :count, :grouping => :month, :live_data => true, :cacheable => false, :limit => 12
+ reportable :hourly, aggregation: :count, grouping: :hour, live_data: true, cacheable: false, limit: 24
+ reportable :daily, aggregation: :count, grouping: :day, live_data: true, cacheable: false, limit: 7
+ reportable :weekly, aggregation: :count, grouping: :week, live_data: true, cacheable: false, limit: 52
+ reportable :monthly, aggregation: :count, grouping: :month, live_data: true, cacheable: false, limit: 12
- reportable :analyzed_hourly, :aggregation => :count, :grouping => :hour, :date_column => :analysis_completed_at, :live_data => true, :cacheable => false, :limit => 24
- reportable :analyzed_daily, :aggregation => :count, :grouping => :day, :date_column => :analysis_completed_at, :live_data => true, :cacheable => false, :limit => 7
- reportable :analyzed_weekly, :aggregation => :count, :grouping => :week, :date_column => :analysis_completed_at, :live_data => true, :cacheable => false, :limit => 52
- reportable :analyzed_monthly, :aggregation => :count, :grouping => :month, :date_column => :analysis_completed_at, :live_data => true, :cacheable => false, :limit => 12
+ reportable :analyzed_hourly, aggregation: :count, grouping: :hour, date_column: :analysis_completed_at, live_data: true, cacheable: false, limit: 24
+ reportable :analyzed_daily, aggregation: :count, grouping: :day, date_column: :analysis_completed_at, live_data: true, cacheable: false, limit: 7
+ reportable :analyzed_weekly, aggregation: :count, grouping: :week, date_column: :analysis_completed_at, live_data: true, cacheable: false, limit: 52
+ reportable :analyzed_monthly, aggregation: :count, grouping: :month, date_column: :analysis_completed_at, live_data: true, cacheable: false, limit: 12
belongs_to :project
belongs_to :provider
belongs_to :job
- has_one :call_medium, :dependent => :delete
+ has_one :call_medium, dependent: :delete
def matches
# "AND (( icount(\'{#{fprint.map{|x| x.to_s}.join(",")}}\'::int[] & calls.fprint::int[]) / icount(\'{#{fprint.map{|x| x.to_s}.join(",")}}'::int[])::float ) * 100.0 ) > 10.0 " +
@@ -103,7 +103,7 @@ class Call < ActiveRecord::Base
args << min_match.to_f
query = [match_sql, *args]
- Call.paginate_by_sql(query, :page => page, :per_page => per_page)
+ Call.paginate_by_sql(query, page: page, per_page: per_page)
end
def media
DIR diff --git a/app/models/call_medium.rb b/app/models/call_medium.rb
@@ -14,7 +14,7 @@
# png_sig_freq :binary
#
-class CallMedium < ActiveRecord::Base
+class CallMedium < ApplicationRecord
belongs_to :call
belongs_to :project
end
DIR diff --git a/config/initializers/bootstrap.rb b/app/models/concerns/.keep
DIR diff --git a/app/models/job.rb b/app/models/job.rb
@@ -18,12 +18,12 @@
# progress :integer default(0)
#
-class Job < ActiveRecord::Base
+class Job < ApplicationRecord
- reportable :hourly, :aggregation => :count, :grouping => :hour, :date_column => :created_at, :cacheable => false
- reportable :daily, :aggregation => :count, :grouping => :day, :date_column => :created_at, :cacheable => false
- reportable :weeky, :aggregation => :count, :grouping => :week, :date_column => :created_at, :cacheable => false
- reportable :monthly, :aggregation => :count, :grouping => :month, :date_column => :created_at, :cacheable => false
+ reportable :hourly, aggregation: :count, grouping: :hour, date_column: :created_at, cacheable: false
+ reportable :daily, aggregation: :count, grouping: :day, date_column: :created_at, cacheable: false
+ reportable :weeky, aggregation: :count, grouping: :week, date_column: :created_at, cacheable: false
+ reportable :monthly, aggregation: :count, grouping: :month, date_column: :created_at, cacheable: false
class JobValidator < ActiveModel::Validator
def validate(record)
@@ -54,10 +54,10 @@ class Job < ActiveRecord::Base
unless ['calls', 'job', 'project', 'global'].include?(record.scope)
record.errors[:scope] << "Scope must be calls, job, project, or global"
end
- if record.scope == "job" and Job.where(:id => record.target_id.to_i, :task => ['import', 'dialer']).count == 0
+ if record.scope == "job" and Job.where(id: record.target_id.to_i, task: ['import', 'dialer']).count == 0
record.errors[:job_id] << "The job_id is not valid"
end
- if record.scope == "project" and Project.where(:id => record.target_id.to_i).count == 0
+ if record.scope == "project" and Project.where(id: record.target_id.to_i).count == 0
record.errors[:project_id] << "The project_id is not valid"
end
if record.scope == "calls" and (record.target_ids.nil? or record.target_ids.length == 0)
@@ -71,17 +71,12 @@ class Job < ActiveRecord::Base
end
# XXX: Purging a single job will be slow, but deleting the project is fast
- has_many :calls, :dependent => :destroy
+ has_many :calls, dependent: :destroy
belongs_to :project
- attr_accessible :task, :status, :progress
-
validates_presence_of :project_id
- attr_accessible :project_id
-
-
# Allow the base Job class to be used for Dial Jobs
attr_accessor :range
attr_accessor :range_file
@@ -89,16 +84,11 @@ class Job < ActiveRecord::Base
attr_accessor :seconds
attr_accessor :cid_mask
- attr_accessible :range, :seconds, :lines, :cid_mask, :range_file
-
attr_accessor :scope
attr_accessor :force
attr_accessor :target_id
attr_accessor :target_ids
- attr_accessible :scope, :force, :target_id, :target_ids
-
-
validates_with JobValidator
def stop
@@ -107,9 +97,9 @@ class Job < ActiveRecord::Base
def update_progress(pct)
if pct >= 100
- self.class.where(id: self.id).update_all(:progress => pct, :completed_at => Time.now, :status => 'completed')
+ self.class.where(id: self.id).update_all(progress: pct, completed_at: Time.now, status: 'completed')
else
- self.class.where(id: self.id).update_all(:progress => pct)
+ self.class.where(id: self.id).update_all(progress: pct)
end
end
@@ -122,10 +112,10 @@ class Job < ActiveRecord::Base
when 'dialer'
self.status = 'submitted'
self.args = Marshal.dump({
- :range => self.range,
- :lines => self.lines.to_i,
- :seconds => self.seconds.to_i,
- :cid_mask => self.cid_mask
+ range: self.range,
+ lines: self.lines.to_i,
+ seconds: self.seconds.to_i,
+ cid_mask: self.cid_mask
})
return self.save
@@ -133,18 +123,18 @@ class Job < ActiveRecord::Base
when 'analysis'
self.status = 'submitted'
d = {
- :scope => self.scope, # job / project/ global
- :force => !!(self.force), # true / false
- :target_id => self.target_id.to_i, # job_id or project_id or nil
- :target_ids => (self.target_ids || []).map{|x| x.to_i }
+ scope: self.scope, # job / project/ global
+ force: !!(self.force), # true / false
+ target_id: self.target_id.to_i, # job_id or project_id or nil
+ target_ids: (self.target_ids || []).map{|x| x.to_i }
}
$stderr.puts d.inspect
self.args = Marshal.dump({
- :scope => self.scope, # job / project/ global
- :force => !!(self.force), # true / false
- :target_id => self.target_id.to_i, # job_id or project_id or nil
- :target_ids => (self.target_ids || []).map{|x| x.to_i }
+ scope: self.scope, # job / project/ global
+ force: !!(self.force), # true / false
+ target_id: self.target_id.to_i, # job_id or project_id or nil
+ target_ids: (self.target_ids || []).map{|x| x.to_i }
})
return self.save
else
DIR diff --git a/app/models/line.rb b/app/models/line.rb
@@ -11,8 +11,8 @@
# notes :text
#
-class Line < ActiveRecord::Base
- has_many :line_attributes, :dependent => :delete_all
+class Line < ApplicationRecord
+ has_many :line_attributes, dependent: :delete_all
belongs_to :project
def set_attribute(name, value, ctype='text/plain')
@@ -24,6 +24,6 @@ class Line < ActiveRecord::Base
end
def get_attribute(name)
- LineAttribute.where(:line_id => self[:id], :name => name).first
+ LineAttribute.where(line_id: self[:id], name: name).first
end
end
DIR diff --git a/app/models/line_attribute.rb b/app/models/line_attribute.rb
@@ -12,7 +12,7 @@
# content_type :string(255) default("text")
#
-class LineAttribute < ActiveRecord::Base
+class LineAttribute < ApplicationRecord
belongs_to :line
belongs_to :project
end
DIR diff --git a/app/models/project.rb b/app/models/project.rb
@@ -12,17 +12,15 @@
# created_by :string(255)
#
-class Project < ActiveRecord::Base
+class Project < ApplicationRecord
validates_presence_of :name
validates_uniqueness_of :name
- attr_accessible :name, :description, :included, :excluded
-
# This is optimized for fast project deletion, even with thousands of calls/jobs/lines
- has_many :lines, :dependent => :delete_all
- has_many :line_attributes, :dependent => :delete_all
- has_many :calls, :dependent => :delete_all
- has_many :call_media, :dependent => :delete_all
- has_many :jobs, :dependent => :delete_all
+ has_many :lines, dependent: :delete_all
+ has_many :line_attributes, dependent: :delete_all
+ has_many :calls, dependent: :delete_all
+ has_many :call_media, dependent: :delete_all
+ has_many :jobs, dependent: :delete_all
end
DIR diff --git a/app/models/provider.rb b/app/models/provider.rb
@@ -14,12 +14,10 @@
# enabled :boolean default(TRUE)
#
-class Provider < ActiveRecord::Base
+class Provider < ApplicationRecord
has_many :dial_results
validates_presence_of :name, :host, :port, :user, :pass, :lines
- validates_numericality_of :port, :less_than => 65536, :greater_than => 0
- validates_numericality_of :lines, :less_than => 255, :greater_than => 0
-
- attr_accessible :enabled, :name, :host, :port, :user, :pass, :lines
+ validates_numericality_of :port, less_than: 65536, greater_than: 0
+ validates_numericality_of :lines, less_than: 255, greater_than: 0
end
DIR diff --git a/app/models/settings.rb b/app/models/settings.rb
@@ -11,6 +11,6 @@
# updated_at :datetime
#
-class Settings < RailsSettings::CachedSettings
- attr_accessible :var
+class Settings < RailsSettings::Base
+ # attr_accessible :var
end
DIR diff --git a/app/models/signature.rb b/app/models/signature.rb
@@ -13,7 +13,7 @@
# risk :integer
#
-class Signature < ActiveRecord::Base
+class Signature < ApplicationRecord
has_many :signature_fps
end
DIR diff --git a/app/models/signature_fp.rb b/app/models/signature_fp.rb
@@ -1,4 +1,4 @@
-class SignatureFp < ActiveRecord::Base
+class SignatureFp < ApplicationRecord
belongs_to :signature
end
DIR diff --git a/app/models/user.rb b/app/models/user.rb
@@ -23,12 +23,12 @@
# admin :boolean default(TRUE)
#
-class User < ActiveRecord::Base
+class User < ApplicationRecord
include RailsSettings::Extend
acts_as_authentic do |c|
c.validate_email_field = false
- c.merge_validates_length_of_password_field_options :minimum => 8
- c.merge_validates_length_of_password_confirmation_field_options :minimum => 8
+ c.merge_validates_length_of_password_field_options minimum: 8
+ c.merge_validates_length_of_password_confirmation_field_options minimum: 8
c.logged_in_timeout = 1.day
end
end
DIR diff --git a/app/views/application/_nav.html.erb b/app/views/application/_nav.html.erb
@@ -9,7 +9,9 @@
<span class="fa fa-bar"></span>
<span class="fa fa-bar"></span>
</button>
- <a class="navbar-brand" href="/"><img src="/assets/logo_light.png" border=0 alt="WarVOX"></a>
+ <a class="navbar-brand" href="/">
+ <%= image_tag "logo_light.png", border: 0, alt: "WarVOX" %>
+ </a>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
DIR diff --git a/app/views/home/about.html.erb b/app/views/home/about.html.erb
@@ -43,7 +43,7 @@ and research purposes only. The latest version of WarVOX can be found in <i clas
<td>
Active Jobs
</td>
- <td><%= Job.count(:conditions => { :completed_at => nil }) %></td>
+ <td><%= Job.where(:completed_at => nil).count %></td>
</tr>
<tr>
DIR diff --git a/app/views/layouts/login.html.erb b/app/views/layouts/login.html.erb
@@ -23,7 +23,9 @@
</head>
<body id="login">
<div id="login-panel">
- <div id="login-logo"><img src="/assets/logo_bigger.png" border=0 alt="WarVOX"></div>
+ <div id="login-logo">
+ <%= image_tag "logo_bigger.png", border: 0, alt: "WarVOX" %>
+ </div>
<div id="box">
<%= yield %>
</div>
DIR diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb
@@ -1,6 +1,6 @@
<h1>Edit My Account</h1>
-<% form_for @user, :url => user_path(@user) do |f| %>
+<%= form_for @user, :url => user_path(@user) do |f| %>
<%= f.error_messages %>
<%= render :partial => "form", :object => f %>
<%= f.submit "Update" %>
DIR diff --git a/bin/adduser b/bin/adduser
@@ -9,7 +9,7 @@ require 'bundler/setup'
# rails/all must be required explicitly to get the railties that pro/ui/config/application.rb uses
require 'rails/all'
# require all the gems in the current environment
-Bundler.require(*Rails.groups(:assets => %w(development test cucumber)))
+Bundler.require(*Rails.groups(assets: %w(development test cucumber)))
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
DIR diff --git a/bin/bundle b/bin/bundle
@@ -0,0 +1,3 @@
+#!/usr/bin/env ruby
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
+load Gem.bin_path('bundler', 'bundle')
DIR diff --git a/bin/export_audio.rb b/bin/export_audio.rb
@@ -49,7 +49,7 @@ end
FileUtils.mkdir_p(output)
begin
- cond = { :project_id => project_id.to_i, :answered => true, :busy => false }
+ cond = { project_id: project_id.to_i, answered: true, busy: false }
if line_type
cond[:line_type] = line_type.downcase
end
DIR diff --git a/bin/export_list.rb b/bin/export_list.rb
@@ -51,7 +51,7 @@ end
fields = %W{ number line_type caller_id answered busy audio_length ring_length peak_freq }
begin
$stdout.puts fields.to_csv
- cond = { :project_id => project_id.to_i }
+ cond = { project_id: project_id.to_i }
if line_type
cond[:line_type] = line_type.downcase
end
DIR diff --git a/bin/iaxrecord.rb b/bin/iaxrecord.rb
@@ -16,7 +16,7 @@ require "optparse"
parser = OptionParser.new
opts = {
- :recording_time => 52
+ recording_time: 52
}
parser.banner = "Usage: #{$0} [options]"
DIR diff --git a/bin/import_audio.rb b/bin/import_audio.rb
@@ -49,7 +49,7 @@ project = nil
provider = nil
if project_id
- project = Project.where(:id => project_id).first
+ project = Project.where(id: project_id).first
unless project
$stderr.puts "Error: Specified Project ID not found"
exit(1)
@@ -57,7 +57,7 @@ if project_id
end
if provider_id
- provider = Provider.where(:id => provider_id).first
+ provider = Provider.where(id: provider_id).first
unless provider
$stderr.puts "Error: Specified Provider ID not found"
exit(1)
@@ -66,21 +66,21 @@ end
unless project
project = Project.create(
- :name => "Import from #{dir} at #{Time.now.utc.to_s}",
- :created_by => "importer"
+ name: "Import from #{dir} at #{Time.now.utc.to_s}",
+ created_by: "importer"
)
end
provider = Provider.first
unless provider
provider = Provider.create(
- :name => 'Import Provider',
- :host => 'localhost',
- :port => 4369,
- :user => "null",
- :pass => "null",
- :lines => 1,
- :enabled => false
+ name: 'Import Provider',
+ host: 'localhost',
+ port: 4369,
+ user: "null",
+ pass: "null",
+ lines: 1,
+ enabled: false
)
end
@@ -92,7 +92,7 @@ job.locked_at = Time.now.utc
job.started_at = Time.now.utc
job.created_by = "importer"
job.task = "import"
-job.args = Marshal.dump({ :directory => dir, :project_id => project.id, :provider_id => provider.id })
+job.args = Marshal.dump({ directory: dir, project_id: project.id, provider_id: provider.id })
job.status = "running"
job.save!
DIR diff --git a/bin/rails b/bin/rails
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+APP_PATH = File.expand_path('../config/application', __dir__)
+require_relative '../config/boot'
+require 'rails/commands'
DIR diff --git a/bin/rake b/bin/rake
@@ -0,0 +1,4 @@
+#!/usr/bin/env ruby
+require_relative '../config/boot'
+require 'rake'
+Rake.application.run
DIR diff --git a/bin/resetpw b/bin/resetpw
@@ -9,7 +9,7 @@ require 'bundler/setup'
# rails/all must be required explicitly to get the railties that pro/ui/config/application.rb uses
require 'rails/all'
# require all the gems in the current environment
-Bundler.require(*Rails.groups(:assets => %w(development test cucumber)))
+Bundler.require(*Rails.groups(assets: %w(development test cucumber)))
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
DIR diff --git a/bin/setup b/bin/setup
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+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') || system!('bundle install')
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?('config/database.yml')
+ # cp 'config/database.yml.sample', 'config/database.yml'
+ # end
+
+ puts "\n== Preparing database =="
+ system! 'bin/rails db:setup'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
DIR diff --git a/bin/update b/bin/update
@@ -0,0 +1,29 @@
+#!/usr/bin/env ruby
+require 'pathname'
+require 'fileutils'
+include FileUtils
+
+# path to your application root.
+APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+
+def system!(*args)
+ system(*args) || abort("\n== Command #{args} failed ==")
+end
+
+chdir APP_ROOT do
+ # This script is a way to update your development environment automatically.
+ # Add necessary update steps to this file.
+
+ puts '== Installing dependencies =='
+ system! 'gem install bundler --conservative'
+ system('bundle check') || system!('bundle install')
+
+ puts "\n== Updating database =="
+ system! 'bin/rails db:migrate'
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! 'bin/rails log:clear tmp:clear'
+
+ puts "\n== Restarting application server =="
+ system! 'bin/rails restart'
+end
DIR diff --git a/bin/warvox.rb b/bin/warvox.rb
@@ -15,7 +15,7 @@ end
$:.unshift(File.join(File.expand_path(File.dirname(base)), '..', 'lib'))
voxroot = File.expand_path(File.join(File.dirname(base), '..'))
-voxserv = File.expand_path(File.join(File.expand_path(voxroot), 'script', 'rails'))
+voxserv = File.expand_path(File.join(File.expand_path(voxroot), 'bin', 'rails'))
manager = File.expand_path(File.join(File.dirname(base), 'worker_manager.rb'))
require 'warvox'
DIR diff --git a/bin/worker_manager.rb b/bin/worker_manager.rb
@@ -32,7 +32,7 @@ def stop
end
# Update the database
- Job.update_all({ :status => "stopped", :completed_at => Time.now.utc}, { :id => @jobs.map{|j| j[:id] } })
+ Job.update_all({ status: "stopped", completed_at: Time.now.utc}, { id: @jobs.map{|j| j[:id] } })
# Signal running jobs to shut down
@jobs.map{|j| Process.kill("TERM", j[:pid]) rescue nil }
@@ -55,8 +55,8 @@ end
def schedule_job(j)
WarVOX::Log.debug("Worker Manager is launching job #{j.id}")
@jobs << {
- :id => j.id,
- :pid => Process.fork { exec("#{@worker_path} #{j.id}") }
+ id: j.id,
+ pid: Process.fork { exec("#{@worker_path} #{j.id}") }
}
end
@@ -67,7 +67,7 @@ def stop_cancelled_jobs
end
return if jids.length == 0
- Job.where(:status => 'cancelled', :id => jids).find_each do |j|
+ Job.where(status: 'cancelled', id: jids).find_each do |j|
job = @jobs.select{ |o| o[:id] == j.id }.first
next unless job and job[:pid]
pid = job[:pid]
@@ -131,7 +131,7 @@ def clear_stale_jobs
# Mark these jobs as abandoned
if dead.length > 0
WarVOX::Log.debug("Worker Manager is marking #{dead.length} jobs as abandoned")
- Job.where(:id => dead).update_all({locked_by: nil, status: 'abandoned'})
+ Job.where(id: dead).update_all({locked_by: nil, status: 'abandoned'})
end
end
DIR diff --git a/config/application.rb b/config/application.rb
@@ -1,16 +1,17 @@
-require File.expand_path('../boot', __FILE__)
-require 'rails/all'
+require_relative 'boot'
-# Bootstrap the WarVOX code base
-$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
-require 'warvox'
+require "rails"
+# Pick the frameworks you want:
+require "active_model/railtie"
+require "active_record/railtie"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "action_view/railtie"
+require "sprockets/railtie"
-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
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
module Web
class Application < Rails::Application
@@ -18,16 +19,6 @@ module Web
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
- # Custom directories with classes and modules you want to be autoloadable.
- # config.autoload_paths += %W(#{config.root}/extras)
-
- # 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
-
# 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)'
@@ -36,37 +27,13 @@ module Web
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
- # Configure the default encoding used in templates for Ruby 1.9.
- config.encoding = "utf-8"
+ # Bootstrap the WarVOX code base
+ config.autoload_paths << "#{Rails.root}/lib"
+ require 'warvox'
- # Configure sensitive parameters which will be filtered from the log file.
- config.filter_parameters += [:password, :pass, :password, :password_confirmation]
+ config.encoding = "utf-8"
# Enable escaping HTML in JSON.
config.active_support.escape_html_entities_in_json = true
-
- # Use SQL instead of Active Record's schema dumper when creating the database.
- # 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
-
- # Enforce whitelist mode for mass assignment.
- # This will create an empty whitelist of attributes available for mass-assignment for all models
- # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
- # parameters by using an attr_accessible or attr_protected declaration.
- config.active_record.whitelist_attributes = true
-
- # Enable the asset pipeline
- config.assets.enabled = true
-
- # Version of your assets, change this if you want to expire all your assets
- config.assets.version = '1.0'
-
- # Config I8n
- I18n.enforce_available_locales = false
-
- # Configure sensitive parameters which will be filtered from the log file.
- config.session_store :cookie_store, :key => "_warvox"
- config.secret_token = WarVOX::Config.load_session_key
end
end
DIR diff --git a/config/boot.rb b/config/boot.rb
@@ -1,6 +1,3 @@
-require 'rubygems'
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
-# 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' # Set up gems listed in the Gemfile.
DIR diff --git a/config/cable.yml b/config/cable.yml
@@ -0,0 +1,9 @@
+development:
+ adapter: async
+
+test:
+ adapter: async
+
+production:
+ adapter: redis
+ url: redis://localhost:6379/1
DIR diff --git a/config/environment.rb b/config/environment.rb
@@ -1,6 +1,5 @@
-# Load the rails application
-require File.expand_path('../application', __FILE__)
-
-# Initialize the rails application
-Web::Application.initialize!
+# Load the Rails application.
+require_relative 'application'
+# Initialize the Rails application.
+Rails.application.initialize!
DIR diff --git a/config/environments/development.rb b/config/environments/development.rb
@@ -1,40 +1,56 @@
-Web::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
+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
# every request. This slows down response time but is perfect for development
# 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
+ # Do not eager load code on boot.
+ config.eager_load = false
- # Show full error reports and disable caching
+ # Show full error reports and disable caching.
config.consider_all_requests_local = true
- config.action_controller.perform_caching = false
- # Don't care if the mailer can't send
+ # Enable/disable caching. By default caching is disabled.
+ if Rails.root.join('tmp/caching-dev.txt').exist?
+ config.action_controller.perform_caching = true
+
+ config.cache_store = :memory_store
+ config.public_file_server.headers = {
+ 'Cache-Control' => 'public, max-age=172800'
+ }
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
+ end
+
+ # 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
+ config.action_mailer.perform_caching = false
- # Only use best-standards-support built into browsers
- config.action_dispatch.best_standards_support = :builtin
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
- # Raise exception on mass assignment protection for Active Record models
- config.active_record.mass_assignment_sanitizer = :strict
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
config.log_level = :debug
- # Do not compress assets
- config.assets.compress = false
-
- # Expands the lines which load the assets
+ # 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 = false
- # Eager load
- config.eager_load = false
+ # Suppress logger output for asset requests.
+ config.assets.quiet = true
+
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
- config.serve_static_assets = true
+ # Use an evented file watcher to asynchronously detect changes in source code,
+ # routes, locales, etc. This feature depends on the listen gem.
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
DIR diff --git a/config/environments/production.rb b/config/environments/production.rb
@@ -1,67 +1,81 @@
-Web::Application.configure do
- # Settings specified here will take precedence over those in config/application.rb
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
- # Code is not reloaded between requests
+ # Code is not reloaded between requests.
config.cache_classes = true
- # Full error reports are disabled and caching is turned on
+ # 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
- # Disable Rails's static asset server (Apache or nginx will already do this)
- config.serve_static_files = true
+ # Disable serving static files from the `/public` folder by default since
+ # Apache or NGINX already handles this.
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
- # Compress JavaScripts and CSS
- config.assets.compress = false
+ # Compress JavaScripts and CSS.
+ 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 = true
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
- # Generate digests for assets URLs
- config.assets.digest = true
+ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
- # Defaults to nil and saved in location specified by config.assets.prefix
- # config.assets.manifest = YOUR_PATH
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.action_controller.asset_host = 'http://assets.example.com'
- # 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
+ # 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
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
- # See everything in the log (default is :info)
- config.log_level = :warn
+ # Use the lowest log level to ensure availability of diagnostic information
+ # when problems arise.
+ config.log_level = :debug
- # Prepend all log lines with the following tags
- # config.log_tags = [ :subdomain, :uuid ]
+ # Prepend all log lines with the following tags.
+ config.log_tags = [ :request_id ]
- # 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 = :mem_cache_store
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
- # config.action_controller.asset_host = "http://assets.example.com"
-
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
- config.assets.precompile += %w( jquery.js )
+ # Use a real queuing backend for Active Job (and separate queues per environment)
+ # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_name_prefix = "barerails5app_#{Rails.env}"
+ config.action_mailer.perform_caching = false
- # Disable delivery errors, bad email addresses will be ignored
+ # 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 threaded mode
- # config.threadsafe!
-
# 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
+ # Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
- # Eager load
- config.eager_load = true
+ # Use default logging formatter so that PID and timestamp are not suppressed.
+ config.log_formatter = ::Logger::Formatter.new
+
+ # Use a different logger for distributed setups.
+ # require 'syslog/logger'
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
+
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
+ logger = ActiveSupport::Logger.new(STDOUT)
+ logger.formatter = config.log_formatter
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
+ end
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
end
DIR diff --git a/config/environments/test.rb b/config/environments/test.rb
@@ -1,39 +1,42 @@
-Web::Application.configure do
- # Settings specified here will take precedence over those in config/environment.rb
+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
- # 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
- # 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 = true
- # Log error messages when you accidentally call methods on nil.
- config.whiny_nils = 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 public file server for tests with Cache-Control for performance.
+ config.public_file_server.enabled = true
+ config.public_file_server.headers = {
+ 'Cache-Control' => 'public, max-age=3600'
+ }
- # Show full error reports and disable caching
+ # Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
- # Raise exceptions instead of rendering exception templates
+ # Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
- # Disable request forgery protection in test environment
- config.action_controller.allow_forgery_protection = false
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+ config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
- # Use SQL instead of Active Record's schema dumper when creating the test database.
- # 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
-
- # Print deprecation notices to the stderr
+ # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
- # Eager load
- config.eager_load = false
-
+ # Raises error for missing translations
+ # config.action_view.raise_on_missing_translations = true
end
DIR diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb
@@ -0,0 +1,6 @@
+# Be sure to restart your server when you modify this file.
+
+# ApplicationController.renderer.defaults.merge!(
+# http_host: 'example.org',
+# https: false
+# )
DIR diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
@@ -0,0 +1,16 @@
+# Be sure to restart your server when you modify this file.
+
+# 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 )
+
+# Rails.application.config.assets.precompile += %w( jquery.js )
+
+Rails.application.config.assets.precompile += %w( html5.js )
+Rails.application.config.assets.precompile += %w(analyze/_index.coffee analyze/view.coffee jobs/view_results.coffee)
DIR diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
@@ -0,0 +1,5 @@
+# Be sure to restart your server when you modify this file.
+
+# Specify a serializer for the signed and encrypted cookie jars.
+# Valid options are :json, :marshal, and :hybrid.
+Rails.application.config.action_dispatch.cookies_serializer = :marshal
DIR diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,4 @@
+# Be sure to restart your server when you modify this file.
+
+# Configure sensitive parameters which will be filtered from the log file.
+Rails.application.config.filter_parameters += [:password, :pass, :password, :password_confirmation]
DIR diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
@@ -1,15 +1,16 @@
# Be sure to restart your server when you modify this file.
-# Add new inflection rules using the following format
-# (all these examples are active by default):
-# ActiveSupport::Inflector.inflections do |inflect|
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
-#
+
# These inflection rules are supported but not enabled by default:
-# ActiveSupport::Inflector.inflections do |inflect|
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
DIR diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
@@ -2,4 +2,3 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
-# Mime::Type.register_alias "text/html", :iphone
DIR diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb
@@ -0,0 +1,24 @@
+# Be sure to restart your server when you modify this file.
+#
+# This file contains migration options to ease your Rails 5.0 upgrade.
+#
+# Read the Rails 5.0 release notes for more info on each option.
+
+# Enable per-form CSRF tokens. Previous versions had false.
+Rails.application.config.action_controller.per_form_csrf_tokens = true
+
+# Enable origin-checking CSRF mitigation. Previous versions had false.
+Rails.application.config.action_controller.forgery_protection_origin_check = true
+
+# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
+# Previous versions had false.
+ActiveSupport.to_time_preserves_timezone = true
+
+# Require `belongs_to` associations by default. Previous versions had false.
+Rails.application.config.active_record.belongs_to_required_by_default = true
+
+# Do not halt callback chains when a callback returns false. Previous versions had true.
+ActiveSupport.halt_callback_chains_on_return_false = false
+
+# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
+Rails.application.config.ssl_options = { hsts: { subdomains: true } }
DIR diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb
@@ -1 +0,0 @@
-Web::Application.config.secret_token = WarVOX::Config.load_session_key
DIR diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
@@ -1,8 +1,3 @@
# Be sure to restart your server when you modify this file.
-Web::Application.config.session_store :cookie_store, key: '_warvox_session'
-
-# Use the database for sessions instead of the cookie-based default,
-# which shouldn't be used to store highly confidential information
-# (create the session table with "rails generate session_migration")
-# Ttt::Application.config.session_store :active_record_store
+Rails.application.config.session_store :cookie_store, key: '_warvox_session'
DIR diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
@@ -1,5 +1,5 @@
# Be sure to restart your server when you modify this file.
-#
+
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
@@ -8,7 +8,7 @@ ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json]
end
-# Disable root element in JSON by default.
-ActiveSupport.on_load(:active_record) do
- self.include_root_in_json = false
-end
+# To enable root element in JSON for ActiveRecord objects.
+# ActiveSupport.on_load(:active_record) do
+# self.include_root_in_json = true
+# end
DIR diff --git a/config/locales/en.yml b/config/locales/en.yml
@@ -1,5 +1,23 @@
-# Sample localization file for English. Add more files in this directory for other locales.
-# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
+# Files in the config/locales directory are used for internationalization
+# and are automatically loaded by Rails. If you want to use locales other
+# than English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t 'hello'
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t('hello') %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more, please read the Rails Internationalization guide
+# available at http://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"
DIR diff --git a/config/routes.rb b/config/routes.rb
@@ -1,5 +1,4 @@
-Web::Application.routes.draw do
-
+Rails.application.routes.draw do
get "login" => "user_sessions#new", :as => "login"
get "logout" => "user_sessions#destroy", :as => "logout"
@@ -51,5 +50,5 @@ Web::Application.routes.draw do
get '/help' => 'home#help', :as => :help
get '/check' => 'home#check', :as => :check
- root :to => "projects#index"
+ root to: "projects#index"
end
DIR diff --git a/config/secrets.yml.example b/config/secrets.yml.example
@@ -0,0 +1,8 @@
+development:
+ secret_key_base: <%= WarVOX::Config.load_session_key %>
+
+test:
+ secret_key_base: <%= WarVOX::Config.load_session_key %>
+
+production:
+ secret_key_base: <%= WarVOX::Config.load_session_key %
DIR diff --git a/config/initializers/bootstrap.rb b/config/unicorn.rb
DIR diff --git a/db/migrate/20121228171549_initial_schema.rb b/db/migrate/20121228171549_initial_schema.rb
@@ -1,45 +1,45 @@
-class InitialSchema < ActiveRecord::Migration
+# class InitialSchema < ActiveRecord::Migration
+class InitialSchema < ActiveRecord::Migration[5.0]
def up
-
# Require the intarray extension
execute("CREATE EXTENSION IF NOT EXISTS intarray")
create_table :settings do |t|
- t.string :var, :null => false
- t.text :value, :null => true
- t.integer :thing_id, :null => true
- t.string :thing_type, :limit => 30, :null => true
- t.timestamps
+ t.string :var, null: false
+ t.text :value, null: true
+ t.integer :thing_id, null: true
+ t.string :thing_type, limit: 30, null: true
+ t.timestamps null: false
end
- add_index :settings, [ :thing_type, :thing_id, :var ], :unique => true
+ add_index :settings, [ :thing_type, :thing_id, :var ], unique: true
create_table 'users' do |t|
- t.string :login, :null => false # optional, you can use email instead, or both
- t.string :email, :null => true # optional, you can use login instead, or both
- t.string :crypted_password, :null => false # optional, see below
- t.string :password_salt, :null => false # optional, but highly recommended
- t.string :persistence_token, :null => false # required
- t.string :single_access_token, :null => false # optional, see Authlogic::Session::Params
- t.string :perishable_token, :null => false # optional, see Authlogic::Session::Perishability
+ t.string :login, null: false # optional, you can use email instead, or both
+ t.string :email, null: true # optional, you can use login instead, or both
+ t.string :crypted_password, null: false # optional, see below
+ t.string :password_salt, null: false # optional, but highly recommended
+ t.string :persistence_token, null: false # required
+ t.string :single_access_token, null: false # optional, see Authlogic::Session::Params
+ t.string :perishable_token, null: false # optional, see Authlogic::Session::Perishability
# Magic columns, just like ActiveRecord's created_at and updated_at. These are automatically maintained by Authlogic if they are present.
- t.integer :login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
- t.integer :failed_login_count, :null => false, :default => 0 # optional, see Authlogic::Session::MagicColumns
+ t.integer :login_count, null: false, default: 0 # optional, see Authlogic::Session::MagicColumns
+ t.integer :failed_login_count, null: false, default: 0 # optional, see Authlogic::Session::MagicColumns
t.datetime :last_request_at # optional, see Authlogic::Session::MagicColumns
t.datetime :current_login_at # optional, see Authlogic::Session::MagicColumns
t.datetime :last_login_at # optional, see Authlogic::Session::MagicColumns
t.string :current_login_ip # optional, see Authlogic::Session::MagicColumns
t.string :last_login_ip # optional, see Authlogic::Session::MagicColumns
- t.timestamps
- t.boolean "enabled", :default => true
- t.boolean "admin", :default => true
+ t.timestamps null: false
+ t.boolean "enabled", default: true
+ t.boolean "admin", default: true
end
create_table 'projects' do |t|
- t.timestamps
- t.text "name", :null => false
+ t.timestamps null: false
+ t.text "name", null: false
t.text "description"
t.text "included"
t.text "excluded"
@@ -47,44 +47,44 @@ class InitialSchema < ActiveRecord::Migration
end
create_table "jobs" do |t|
- t.timestamps
- t.integer "project_id", :null => false
+ t.timestamps null: false
+ t.integer "project_id", null: false
t.string "locked_by"
t.timestamp "locked_at"
t.timestamp "started_at"
t.timestamp "completed_at"
t.string "created_by"
- t.string "task", :null => false
+ t.string "task", null: false
t.binary "args"
t.string "status"
t.text "error"
- t.integer "progress", :default => 0
+ t.integer "progress", default: 0
end
create_table "lines" do |t|
- t.timestamps
- t.text "number", :null => false
- t.integer "project_id", :null => false
+ t.timestamps null: false
+ t.text "number", null: false
+ t.integer "project_id", null: false
t.text "line_type"
t.text "notes"
end
create_table "line_attributes" do |t|
- t.timestamps
- t.integer "line_id", :null => false
- t.integer "project_id", :null => false
- t.text "name", :null => false
- t.binary "value", :null => false
- t.string "content_type", :default => "text"
+ t.timestamps null: false
+ t.integer "line_id", null: false
+ t.integer "project_id", null: false
+ t.text "name", null: false
+ t.binary "value", null: false
+ t.string "content_type", default: "text"
end
create_table "calls" do |t|
# Created by the dialer job
- t.timestamps
- t.text "number", :null => false
- t.integer "project_id", :null => false
- t.integer "job_id", :null => false
- t.integer "provider_id", :null => false
+ t.timestamps null: false
+ t.text "number", null: false
+ t.integer "project_id", null: false
+ t.integer "job_id", null: false
+ t.integer "provider_id", null: false
t.boolean "answered"
t.boolean "busy"
t.text "error"
@@ -99,12 +99,12 @@ class InitialSchema < ActiveRecord::Migration
t.float "peak_freq"
t.text "peak_freq_data"
t.text "line_type"
- t.integer "fprint", :array => true
+ t.integer "fprint", array: true
end
create_table "call_media" do |t|
- t.integer "call_id", :null => false
- t.integer "project_id", :null => false
+ t.integer "call_id", null: false
+ t.integer "project_id", null: false
t.binary "audio"
t.binary "mp3"
t.binary "png_big"
@@ -115,8 +115,8 @@ class InitialSchema < ActiveRecord::Migration
end
create_table "signatures" do |t|
- t.timestamps
- t.text "name", :null => false
+ t.timestamps null: false
+ t.text "name", null: false
t.string "source"
t.text "description"
t.string "category"
@@ -125,19 +125,19 @@ class InitialSchema < ActiveRecord::Migration
end
create_table "signature_fp" do |t|
- t.integer "signature_id", :null => false
- t.integer "fprint", :array => true
+ t.integer "signature_id", null: false
+ t.integer "fprint", array: true
end
create_table "providers" do |t|
- t.timestamps
- t.text "name", :null => false
- t.text "host", :null => false
- t.integer "port", :null => false
+ t.timestamps null: false
+ t.text "name", null: false
+ t.text "host", null: false
+ t.integer "port", null: false
t.text "user"
t.text "pass"
- t.integer "lines", :null => false, :default => 1
- t.boolean "enabled", :default => true
+ t.integer "lines", null: false, default: 1
+ t.boolean "enabled", default: true
end
add_index :jobs, :project_id
@@ -151,7 +151,6 @@ class InitialSchema < ActiveRecord::Migration
add_index :call_media, :call_id
add_index :call_media, :project_id
add_index :signature_fp, :signature_id
-
end
def down
DIR diff --git a/db/migrate/20130113004653_create_reportable_cache.rb b/db/migrate/20130113004653_create_reportable_cache.rb
@@ -1,16 +1,15 @@
-class CreateReportableCache < ActiveRecord::Migration
+class CreateReportableCache < ActiveRecord::Migration[5.0]
+ def up
+ create_table :reportable_cache, force: true do |t|
+ t.string :model_name, null: false, limit: 100
+ t.string :report_name, null: false, limit: 100
+ t.string :grouping, null: false, limit: 10
+ t.string :aggregation, null: false, limit: 10
+ t.string :conditions, null: false, limit: 100
+ t.float :value, null: false, default: 0
+ t.datetime :reporting_period, null: false
- def self.up
- create_table :reportable_cache, :force => true do |t|
- t.string :model_name, :null => false, :limit => 100
- t.string :report_name, :null => false, :limit => 100
- t.string :grouping, :null => false, :limit => 10
- t.string :aggregation, :null => false, :limit => 10
- t.string :conditions, :null => false, :limit => 100
- t.float :value, :null => false, :default => 0
- t.datetime :reporting_period, :null => false
-
- t.timestamps
+ t.timestamps null: false
end
add_index :reportable_cache, [
@@ -19,7 +18,7 @@ class CreateReportableCache < ActiveRecord::Migration
:grouping,
:aggregation,
:conditions
- ], :name => :name_model_grouping_agregation
+ ], name: :name_model_grouping_agregation
add_index :reportable_cache, [
:model_name,
:report_name,
@@ -27,12 +26,12 @@ class CreateReportableCache < ActiveRecord::Migration
:aggregation,
:conditions,
:reporting_period
- ], :unique => true, :name => :name_model_grouping_aggregation_period
+ ], unique: true, name: :name_model_grouping_aggregation_period
end
def self.down
- remove_index :reportable_cache, :name => :name_model_grouping_agregation
- remove_index :reportable_cache, :name => :name_model_grouping_aggregation_period
+ remove_index :reportable_cache, name: :name_model_grouping_agregation
+ remove_index :reportable_cache, name: :name_model_grouping_aggregation_period
drop_table :reportable_cache
end
DIR diff --git a/db/schema.rb b/db/schema.rb
@@ -1,4 +1,3 @@
-# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
@@ -17,7 +16,7 @@ ActiveRecord::Schema.define(version: 20130113004653) do
enable_extension "plpgsql"
enable_extension "intarray"
- create_table "call_media", force: true do |t|
+ create_table "call_media", force: :cascade do |t|
t.integer "call_id", null: false
t.integer "project_id", null: false
t.binary "audio"
@@ -27,14 +26,13 @@ ActiveRecord::Schema.define(version: 20130113004653) do
t.binary "png_big_freq"
t.binary "png_sig"
t.binary "png_sig_freq"
+ t.index ["call_id"], name: "index_call_media_on_call_id", using: :btree
+ t.index ["project_id"], name: "index_call_media_on_project_id", using: :btree
end
- add_index "call_media", ["call_id"], name: "index_call_media_on_call_id", using: :btree
- add_index "call_media", ["project_id"], name: "index_call_media_on_project_id", using: :btree
-
- create_table "calls", force: true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ create_table "calls", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.text "number", null: false
t.integer "project_id", null: false
t.integer "job_id", null: false
@@ -52,15 +50,14 @@ ActiveRecord::Schema.define(version: 20130113004653) do
t.text "peak_freq_data"
t.text "line_type"
t.integer "fprint", array: true
+ t.index ["job_id"], name: "index_calls_on_job_id", using: :btree
+ t.index ["number"], name: "index_calls_on_number", using: :btree
+ t.index ["provider_id"], name: "index_calls_on_provider_id", using: :btree
end
- add_index "calls", ["job_id"], name: "index_calls_on_job_id", using: :btree
- add_index "calls", ["number"], name: "index_calls_on_number", using: :btree
- add_index "calls", ["provider_id"], name: "index_calls_on_provider_id", using: :btree
-
- create_table "jobs", force: true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ create_table "jobs", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.integer "project_id", null: false
t.string "locked_by"
t.datetime "locked_at"
@@ -72,38 +69,35 @@ ActiveRecord::Schema.define(version: 20130113004653) do
t.string "status"
t.text "error"
t.integer "progress", default: 0
+ t.index ["project_id"], name: "index_jobs_on_project_id", using: :btree
end
- add_index "jobs", ["project_id"], name: "index_jobs_on_project_id", using: :btree
-
- create_table "line_attributes", force: true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ create_table "line_attributes", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.integer "line_id", null: false
t.integer "project_id", null: false
t.text "name", null: false
t.binary "value", null: false
t.string "content_type", default: "text"
+ t.index ["line_id"], name: "index_line_attributes_on_line_id", using: :btree
+ t.index ["project_id"], name: "index_line_attributes_on_project_id", using: :btree
end
- add_index "line_attributes", ["line_id"], name: "index_line_attributes_on_line_id", using: :btree
- add_index "line_attributes", ["project_id"], name: "index_line_attributes_on_project_id", using: :btree
-
- create_table "lines", force: true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ create_table "lines", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.text "number", null: false
t.integer "project_id", null: false
t.text "line_type"
t.text "notes"
+ t.index ["number"], name: "index_lines_on_number", using: :btree
+ t.index ["project_id"], name: "index_lines_on_project_id", using: :btree
end
- add_index "lines", ["number"], name: "index_lines_on_number", using: :btree
- add_index "lines", ["project_id"], name: "index_lines_on_project_id", using: :btree
-
- create_table "projects", force: true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ create_table "projects", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.text "name", null: false
t.text "description"
t.text "included"
@@ -111,9 +105,9 @@ ActiveRecord::Schema.define(version: 20130113004653) do
t.string "created_by"
end
- create_table "providers", force: true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ create_table "providers", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.text "name", null: false
t.text "host", null: false
t.integer "port", null: false
@@ -123,7 +117,7 @@ ActiveRecord::Schema.define(version: 20130113004653) do
t.boolean "enabled", default: true
end
- create_table "reportable_cache", force: true do |t|
+ create_table "reportable_cache", force: :cascade do |t|
t.string "model_name", limit: 100, null: false
t.string "report_name", limit: 100, null: false
t.string "grouping", limit: 10, null: false
@@ -131,34 +125,31 @@ ActiveRecord::Schema.define(version: 20130113004653) do
t.string "conditions", limit: 100, null: false
t.float "value", default: 0.0, null: false
t.datetime "reporting_period", null: false
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["model_name", "report_name", "grouping", "aggregation", "conditions", "reporting_period"], name: "name_model_grouping_aggregation_period", unique: true, using: :btree
+ t.index ["model_name", "report_name", "grouping", "aggregation", "conditions"], name: "name_model_grouping_agregation", using: :btree
end
- add_index "reportable_cache", ["model_name", "report_name", "grouping", "aggregation", "conditions", "reporting_period"], name: "name_model_grouping_aggregation_period", unique: true, using: :btree
- add_index "reportable_cache", ["model_name", "report_name", "grouping", "aggregation", "conditions"], name: "name_model_grouping_agregation", using: :btree
-
- create_table "settings", force: true do |t|
+ create_table "settings", force: :cascade do |t|
t.string "var", null: false
t.text "value"
t.integer "thing_id"
t.string "thing_type", limit: 30
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true, using: :btree
end
- add_index "settings", ["thing_type", "thing_id", "var"], name: "index_settings_on_thing_type_and_thing_id_and_var", unique: true, using: :btree
-
- create_table "signature_fp", force: true do |t|
+ create_table "signature_fp", force: :cascade do |t|
t.integer "signature_id", null: false
t.integer "fprint", array: true
+ t.index ["signature_id"], name: "index_signature_fp_on_signature_id", using: :btree
end
- add_index "signature_fp", ["signature_id"], name: "index_signature_fp_on_signature_id", using: :btree
-
- create_table "signatures", force: true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ create_table "signatures", force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.text "name", null: false
t.string "source"
t.text "description"
@@ -167,7 +158,7 @@ ActiveRecord::Schema.define(version: 20130113004653) do
t.integer "risk"
end
- create_table "users", force: true do |t|
+ create_table "users", force: :cascade do |t|
t.string "login", null: false
t.string "email"
t.string "crypted_password", null: false
@@ -182,8 +173,8 @@ ActiveRecord::Schema.define(version: 20130113004653) do
t.datetime "last_login_at"
t.string "current_login_ip"
t.string "last_login_ip"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.boolean "enabled", default: true
t.boolean "admin", default: true
end
DIR diff --git a/db/seeds.rb b/db/seeds.rb
@@ -0,0 +1,7 @@
+# This file should contain all the record creation needed to seed the database with its default values.
+# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
+#
+# Examples:
+#
+# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
+# Character.create(name: 'Luke', movie: movies.first)
DIR diff --git a/config/initializers/bootstrap.rb b/lib/assets/.keep
DIR diff --git a/config/initializers/bootstrap.rb b/lib/tasks/.keep
DIR diff --git a/lib/warvox/audio/raw.rb b/lib/warvox/audio/raw.rb
@@ -88,7 +88,7 @@ class Raw
raise RuntimeError, "The sox binary could not be find, make sure it is installed"
end
- o, s = Open3.capture2("#{sox} -t raw -b 16 -e signed-integer -r 8000 - -t flac -r 16000 -", :binmode => true, :stdin_data => self.to_raw)
+ o, s = Open3.capture2("#{sox} -t raw -b 16 -e signed-integer -r 8000 - -t flac -r 16000 -", binmode: true, stdin_data: self.to_raw)
o
end
DIR diff --git a/lib/warvox/jobs/analysis.rb b/lib/warvox/jobs/analysis.rb
@@ -72,27 +72,27 @@ class Analysis < Base
case @conf[:scope]
when 'calls'
if @conf[:force]
- query = {:id => @conf[:target_ids], :answered => true, :busy => false}
+ query = {id: @conf[:target_ids], answered: true, busy: false}
else
- query = {:id => @conf[:target_ids], :answered => true, :busy => false, :analysis_started_at => nil}
+ query = {id: @conf[:target_ids], answered: true, busy: false, analysis_started_at: nil}
end
when 'job'
if @conf[:force]
- query = {:job_id => @conf[:target_id], :answered => true, :busy => false}
+ query = {job_id: @conf[:target_id], answered: true, busy: false}
else
- query = {:job_id => @conf[:target_id], :answered => true, :busy => false, :analysis_started_at => nil}
+ query = {job_id: @conf[:target_id], answered: true, busy: false, analysis_started_at: nil}
end
when 'project'
if @conf[:force]
- query = {:project_id => @conf[:target_id], :answered => true, :busy => false}
+ query = {project_id: @conf[:target_id], answered: true, busy: false}
else
- query = {:project_id => @conf[:target_id], :answered => true, :busy => false, :analysis_started_at => nil}
+ query = {project_id: @conf[:target_id], answered: true, busy: false, analysis_started_at: nil}
end
when 'global'
if @conf[:force]
- query = {:answered => true, :busy => false}
+ query = {answered: true, busy: false}
else
- query = {:answered => true, :busy => false, :analysis_started_at => nil}
+ query = {answered: true, busy: false, analysis_started_at: nil}
end
else
# Bail if we don't have a valid scope
@@ -295,14 +295,14 @@ class Analysis < Base
sproc = Classifier.new
sproc.data =
{
- :raw => raw,
- :freq => freq,
- :fcnt => fcnt,
- :fft => fft,
- :pks => pks,
- :pkz => pkz,
- :maxf => maxf,
- :maxp => maxp
+ raw: raw,
+ freq: freq,
+ fcnt: fcnt,
+ fft: fft,
+ pks: pks,
+ pkz: pkz,
+ maxf: maxf,
+ maxp: maxp
}
WarVOX::Config.classifiers_load.each do |sigfile|
DIR diff --git a/lib/warvox/jobs/dialer.rb b/lib/warvox/jobs/dialer.rb
@@ -48,15 +48,15 @@ class Dialer < Base
res = []
::ActiveRecord::Base.connection_pool.with_connection {
- ::Provider.where(:enabled => true).all.each do |prov|
+ ::Provider.where(enabled: true).all.each do |prov|
info = {
- :name => prov.name,
- :id => prov.id,
- :port => prov.port,
- :host => prov.host,
- :user => prov.user,
- :pass => prov.pass,
- :lines => prov.lines
+ name: prov.name,
+ id: prov.id,
+ port: prov.port,
+ host: prov.host,
+ user: prov.user,
+ pass: prov.pass,
+ lines: prov.lines
}
1.upto(prov.lines) {|i| res.push(info) }
end
DIR diff --git a/lib/warvox/proto/iax2/client.rb b/lib/warvox/proto/iax2/client.rb
@@ -22,10 +22,10 @@ class Client
def initialize(uopts={})
opts = {
- :caller_number => '15555555555',
- :caller_name => '',
- :server_port => IAX2_DEFAULT_PORT,
- :context => { }
+ caller_number: '15555555555',
+ caller_name: '',
+ server_port: IAX2_DEFAULT_PORT,
+ context: { }
}.merge(uopts)
self.caller_name = opts[:caller_name]
DIR diff --git a/script/rails b/script/rails
@@ -1,6 +0,0 @@
-#!/usr/bin/env ruby
-# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
-
-APP_PATH = File.expand_path('../../config/application', __FILE__)
-require File.expand_path('../../config/boot', __FILE__)
-require 'rails/commands'
DIR diff --git a/spec/factories/settings.rb b/spec/factories/settings.rb
@@ -12,7 +12,7 @@
#
FactoryGirl.define do
- factory :setting, :class => 'Settings' do
+ factory :setting, class: 'Settings' do
var "CachedStuff"
end
DIR diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
@@ -7,6 +7,8 @@ require 'spec_helper'
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
+require 'capybara/rails'
+
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
@@ -22,14 +24,11 @@ require 'rspec/rails'
#
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
-# Checks for pending migrations before tests are run.
+# Checks for pending migration and applies them before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
- # FactoryGirl Syntax
- config.include FactoryGirl::Syntax::Methods
-
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
@@ -52,4 +51,9 @@ RSpec.configure do |config|
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
+
+ # Filter lines from Rails gems in backtraces.
+ config.filter_rails_from_backtrace!
+ # arbitrary gems may also be filtered via:
+ # config.filter_gems_from_backtrace("gem name")
end
DIR diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
@@ -1,3 +1,5 @@
+require 'capybara/rspec'
+
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
@@ -40,15 +42,22 @@ RSpec.configure do |config|
mocks.verify_partial_doubles = true
end
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
+ # have no way to turn it off -- the option exists only for backwards
+ # compatibility in RSpec 3). It causes shared context metadata to be
+ # inherited by the metadata hash of host groups and examples, rather than
+ # triggering implicit auto-inclusion in groups with matching metadata.
+ config.shared_context_metadata_behavior = :apply_to_host_groups
+
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
- # These two settings work together to allow you to limit a spec run
- # to individual examples or groups you care about by tagging them with
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
- # get run.
- config.filter_run :focus
- config.run_all_when_everything_filtered = true
+ # This allows you to limit a spec run to individual examples or groups
+ # you care about by tagging them with `:focus` metadata. When nothing
+ # is tagged with `:focus`, all examples get run. RSpec also provides
+ # aliases for `it`, `describe`, and `context` that include `:focus`
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
+ config.filter_run_when_matching :focus
# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
@@ -57,9 +66,9 @@ RSpec.configure do |config|
# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
config.disable_monkey_patching!
# Many RSpec users commonly either run the entire suite or an individual
DIR diff --git a/spec/support/auth_logic_helpers.rb b/spec/support/auth_logic_helpers.rb
@@ -2,7 +2,7 @@ module Authlogic
module TestHelper
def create_user_session(user)
visit login_path
- within "#new_user_session" do
+ within "form#new_user_session" do
expect(page).to have_content "Username"
expect(page).to have_content "Password"
fill_in "user_session_login", with: user.login
@@ -17,4 +17,4 @@ end
RSpec.configure do |config|
config.include Authlogic::TestHelper, type: :request
config.include Authlogic::TestHelper, type: :feature
-end
-\ No newline at end of file
+end
DIR diff --git a/spec/support/factory_girl.rb b/spec/support/factory_girl.rb
@@ -0,0 +1,3 @@
+RSpec.configure do |config|
+ config.include FactoryGirl::Syntax::Methods
+end