├── app ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── concerns │ │ └── .keep │ ├── baseline.rb │ ├── project.rb │ ├── spec_scan.rb │ └── scan_item.rb ├── assets │ ├── images │ │ └── .keep │ ├── stylesheets │ │ ├── baselines.css.scss │ │ ├── projects.css.scss │ │ ├── scan_items.css.scss │ │ ├── spec_scans.css.scss │ │ ├── application.css.scss │ │ ├── 1st_load_framework.css.scss │ │ ├── scaffolds.css.scss │ │ └── simple-sidebar.css │ └── javascripts │ │ ├── baselines.js.coffee │ │ ├── projects.js.coffee │ │ ├── scan_items.js.coffee │ │ ├── spec_scans.js.coffee │ │ └── application.js ├── controllers │ ├── concerns │ │ └── .keep │ ├── application_controller.rb │ └── projects_controller.rb ├── helpers │ ├── baselines_helper.rb │ ├── projects_helper.rb │ ├── scan_items_helper.rb │ ├── spec_scans_helper.rb │ └── application_helper.rb ├── views │ ├── projects │ │ ├── show.json.jbuilder │ │ ├── index.json.jbuilder │ │ ├── new.html.haml │ │ ├── edit.html.haml │ │ ├── _project.json.jbuilder │ │ ├── _form.html.haml │ │ ├── index.html.haml │ │ └── show.html.haml │ ├── layouts │ │ ├── _navigation_links.html.erb │ │ ├── _messages.html.haml │ │ ├── _navigation.html.haml │ │ └── application.html.haml │ └── visitors │ │ └── index.html.erb └── workers │ └── scan_worker.rb ├── lib ├── assets │ └── .keep ├── tasks │ └── .keep └── templates │ └── haml │ └── scaffold │ └── _form.html.haml ├── public ├── favicon.ico ├── robots.txt ├── humans.txt ├── 500.html ├── 422.html └── 404.html ├── test ├── helpers │ ├── .keep │ ├── projects_helper_test.rb │ ├── baselines_helper_test.rb │ ├── scan_items_helper_test.rb │ └── spec_scans_helper_test.rb ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── baseline_test.rb │ ├── project_test.rb │ ├── scan_item_test.rb │ └── spec_scan_test.rb ├── controllers │ ├── .keep │ ├── baselines_controller_test.rb │ ├── spec_scans_controller_test.rb │ ├── projects_controller_test.rb │ └── scan_items_controller_test.rb ├── fixtures │ ├── .keep │ ├── baselines.yml │ ├── spec_scans.yml │ ├── scan_items.yml │ └── projects.yml ├── integration │ └── .keep └── test_helper.rb ├── vendor └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep ├── bin ├── bundle ├── rake ├── rails └── spring ├── config ├── initializers │ ├── cookies_serializer.rb │ ├── session_store.rb │ ├── mime_types.rb │ ├── filter_parameter_logging.rb │ ├── backtrace_silencers.rb │ ├── wrap_parameters.rb │ ├── inflections.rb │ ├── simple_form_bootstrap.rb │ └── simple_form.rb ├── environment.rb ├── boot.rb ├── routes.rb ├── database.yml ├── locales │ ├── en.yml │ └── simple_form.en.yml ├── secrets.yml ├── application.rb └── environments │ ├── development.rb │ ├── test.rb │ └── production.rb ├── config.ru ├── db ├── migrate │ ├── 20160817080149_add_project_id_to_baselines.rb │ ├── 20160817080154_add_project_id_to_spec_scans.rb │ ├── 20160817065946_create_baselines.rb │ ├── 20160817070004_create_spec_scans.rb │ ├── 20160817065904_create_projects.rb │ └── 20160817070056_create_scan_items.rb ├── seeds.rb └── schema.rb ├── Rakefile ├── Gemfile ├── README.md ├── .gitignore ├── README └── Gemfile.lock /app/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/helpers/baselines_helper.rb: -------------------------------------------------------------------------------- 1 | module BaselinesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/projects_helper.rb: -------------------------------------------------------------------------------- 1 | module ProjectsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/scan_items_helper.rb: -------------------------------------------------------------------------------- 1 | module ScanItemsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/spec_scans_helper.rb: -------------------------------------------------------------------------------- 1 | module SpecScansHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/views/projects/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.partial! "projects/project", project: @project -------------------------------------------------------------------------------- /app/views/layouts/_navigation_links.html.erb: -------------------------------------------------------------------------------- 1 | <%# add navigation links to this file %> 2 | -------------------------------------------------------------------------------- /app/views/projects/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array! @projects, partial: 'projects/project', as: :project -------------------------------------------------------------------------------- /app/views/projects/new.html.haml: -------------------------------------------------------------------------------- 1 | %h1 New project 2 | 3 | = render 'form' 4 | 5 | = link_to 'Back', projects_path 6 | -------------------------------------------------------------------------------- /app/models/baseline.rb: -------------------------------------------------------------------------------- 1 | class Baseline < ActiveRecord::Base 2 | belongs_to :project 3 | has_many :scan_items 4 | end 5 | -------------------------------------------------------------------------------- /app/models/project.rb: -------------------------------------------------------------------------------- 1 | class Project < ActiveRecord::Base 2 | has_many :spec_scans 3 | has_one :baseline 4 | 5 | end 6 | -------------------------------------------------------------------------------- /app/models/spec_scan.rb: -------------------------------------------------------------------------------- 1 | class SpecScan < ActiveRecord::Base 2 | belongs_to :project 3 | has_many :scan_items 4 | end 5 | -------------------------------------------------------------------------------- /app/models/scan_item.rb: -------------------------------------------------------------------------------- 1 | class ScanItem < ActiveRecord::Base 2 | belongs_to :spec_scan 3 | belongs_to :baseline 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/projects_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ProjectsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/baselines_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class BaselinesHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/scan_items_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ScanItemsHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /test/helpers/spec_scans_helper_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class SpecScansHelperTest < ActionView::TestCase 4 | end 5 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /app/views/projects/edit.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Editing project 2 | 3 | = render 'form' 4 | 5 | = link_to 'Show', @project 6 | \| 7 | = link_to 'Back', projects_path 8 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json -------------------------------------------------------------------------------- /test/models/baseline_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class BaselineTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/project_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ProjectTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /test/models/scan_item_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ScanItemTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/spec_scan_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class SpecScanTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_spectre_session' 4 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /app/views/projects/_project.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! project, :id, :name, :min_freq, :max_freq, :device, :bin_size, :notes, :created_at, :updated_at 2 | json.url project_url(project, format: :json) -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | # Set up gems listed in the Gemfile. 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | 4 | require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) 5 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /db/migrate/20160817080149_add_project_id_to_baselines.rb: -------------------------------------------------------------------------------- 1 | class AddProjectIdToBaselines < ActiveRecord::Migration 2 | def change 3 | add_column :baselines, :project_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160817080154_add_project_id_to_spec_scans.rb: -------------------------------------------------------------------------------- 1 | class AddProjectIdToSpecScans < ActiveRecord::Migration 2 | def change 3 | add_column :spec_scans, :project_id, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/assets/stylesheets/baselines.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the baselines controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/projects.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the projects controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/scan_items.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the scan_items controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/spec_scans.css.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the spec_scans controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | Disallow: / 6 | -------------------------------------------------------------------------------- /test/fixtures/baselines.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | status: MyString 5 | job_id: MyString 6 | 7 | two: 8 | status: MyString 9 | job_id: MyString 10 | -------------------------------------------------------------------------------- /test/fixtures/spec_scans.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | status: MyString 5 | job_id: MyString 6 | 7 | two: 8 | status: MyString 9 | job_id: MyString 10 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | require 'sidekiq/web' 2 | Rails.application.routes.draw do 3 | 4 | resources :projects do 5 | get :baseline 6 | get :scan 7 | end 8 | 9 | mount Sidekiq::Web => '/sidekiq' 10 | root to: 'projects#index' 11 | end 12 | -------------------------------------------------------------------------------- /app/assets/javascripts/baselines.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/projects.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/scan_items.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/spec_scans.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://coffeescript.org/ 4 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /db/migrate/20160817065946_create_baselines.rb: -------------------------------------------------------------------------------- 1 | class CreateBaselines < ActiveRecord::Migration 2 | def change 3 | create_table :baselines do |t| 4 | t.string :status 5 | t.string :job_id 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20160817070004_create_spec_scans.rb: -------------------------------------------------------------------------------- 1 | class CreateSpecScans < ActiveRecord::Migration 2 | def change 3 | create_table :spec_scans do |t| 4 | t.string :status 5 | t.string :job_id 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../../config/application', __FILE__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /lib/templates/haml/scaffold/_form.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for(@<%= singular_table_name %>) do |f| 2 | = f.error_notification 3 | 4 | .form-inputs 5 | <%- attributes.each do |attribute| -%> 6 | = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> 7 | <%- end -%> 8 | 9 | .form-actions 10 | = f.button :submit 11 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /db/migrate/20160817065904_create_projects.rb: -------------------------------------------------------------------------------- 1 | class CreateProjects < ActiveRecord::Migration 2 | def change 3 | create_table :projects do |t| 4 | t.string :name 5 | t.string :min_freq 6 | t.string :max_freq 7 | t.string :device 8 | t.string :bin_size 9 | t.text :notes 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/views/layouts/_messages.html.haml: -------------------------------------------------------------------------------- 1 | -# Rails flash messages styled for Bootstrap 3.0 2 | - flash.each do |name, msg| 3 | - if msg.is_a?(String) 4 | %div{:class => "alert alert-#{name.to_s == 'notice' ? 'success' : 'danger'}"} 5 | %button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} × 6 | = content_tag :div, msg, :id => "flash_#{name}" 7 | -------------------------------------------------------------------------------- /db/migrate/20160817070056_create_scan_items.rb: -------------------------------------------------------------------------------- 1 | class CreateScanItems < ActiveRecord::Migration 2 | def change 3 | create_table :scan_items do |t| 4 | t.integer :spec_scan_id 5 | t.integer :baseline_id 6 | t.string :upper 7 | t.string :lower 8 | t.string :time 9 | t.float :power 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /test/fixtures/scan_items.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | spec_scan_id: 1 5 | baseline_id: 1 6 | upper: MyString 7 | lower: MyString 8 | time: MyString 9 | power: 1.5 10 | 11 | two: 12 | spec_scan_id: 1 13 | baseline_id: 1 14 | upper: MyString 15 | lower: MyString 16 | time: MyString 17 | power: 1.5 18 | -------------------------------------------------------------------------------- /test/fixtures/projects.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | name: MyString 5 | min_freq: MyString 6 | max_freq: MyString 7 | device: MyString 8 | bin_size: MyString 9 | notes: MyText 10 | 11 | two: 12 | name: MyString 13 | min_freq: MyString 14 | max_freq: MyString 15 | device: MyString 16 | bin_size: MyString 17 | notes: MyText 18 | -------------------------------------------------------------------------------- /app/views/projects/_form.html.haml: -------------------------------------------------------------------------------- 1 | = simple_form_for(@project) do |f| 2 | = f.error_notification 3 | 4 | .form-inputs 5 | = f.input :name 6 | = f.input :min_freq, input_html: {value: "300M"} 7 | = f.input :max_freq, input_html: {value: "500M"} 8 | = f.input :device, input_html: {value: "hackrf"} 9 | = f.input :bin_size, input_html: {value: "1M"} 10 | = f.input :notes 11 | 12 | .form-actions 13 | = f.button :submit 14 | -------------------------------------------------------------------------------- /public/humans.txt: -------------------------------------------------------------------------------- 1 | /* the humans responsible & colophon */ 2 | /* humanstxt.org */ 3 | 4 | 5 | /* TEAM */ 6 | : 7 | Site: 8 | Twitter: 9 | Location: 10 | 11 | /* THANKS */ 12 | Daniel Kehoe (@rails_apps) for the RailsApps project 13 | 14 | /* SITE */ 15 | Standards: HTML5, CSS3 16 | Components: jQuery 17 | Software: Ruby on Rails 18 | 19 | /* GENERATED BY */ 20 | Rails Composer: http://railscomposer.com/ 21 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | # 8 | # Note: You'll currently still have to declare fixtures explicitly in integration tests 9 | # -- they do not yet inherit this setting 10 | fixtures :all 11 | 12 | # Add more helper methods to be used by all tests here... 13 | end 14 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) 11 | Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) } 12 | gem 'spring', match[1] 13 | require 'spring/binstub' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/views/layouts/_navigation.html.haml: -------------------------------------------------------------------------------- 1 | -# navigation styled for Bootstrap 3.0 2 | %nav.navbar.navbar-default.navbar-fixed-top 3 | .container 4 | .navbar-header 5 | %button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", :type => "button"} 6 | %span.sr-only Toggle navigation 7 | %span.icon-bar 8 | %span.icon-bar 9 | %span.icon-bar 10 | = link_to 'Home', root_path, class: 'navbar-brand' 11 | .collapse.navbar-collapse 12 | %ul.nav.navbar-nav 13 | = render 'layouts/navigation_links' 14 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.haml: -------------------------------------------------------------------------------- 1 | !!! 2 | %html 3 | %head 4 | %meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"} 5 | %title= content_for?(:title) ? yield(:title) : 'Spectre' 6 | %meta{:name => "description", :content => "#{content_for?(:description) ? yield(:description) : 'Spectre'}"} 7 | = stylesheet_link_tag 'application', media: 'all' 8 | = javascript_include_tag 'application' 9 | = csrf_meta_tags 10 | %body 11 | %header 12 | = render 'layouts/navigation' 13 | %main{:role => "main"} 14 | = render 'layouts/messages' 15 | = yield 16 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | ruby '2.3.1' 3 | gem 'rails', '4.1.0' 4 | gem 'sqlite3' 5 | gem 'sass-rails', '~> 4.0.3' 6 | gem 'uglifier', '>= 1.3.0' 7 | gem 'coffee-rails', '~> 4.0.0' 8 | gem 'jquery-rails' 9 | gem 'jbuilder', '~> 2.0' 10 | gem 'sdoc', '~> 0.4.0', group: :doc 11 | gem 'spring', group: :development 12 | gem 'bootstrap-sass' 13 | gem 'haml-rails' 14 | gem 'high_voltage' 15 | gem 'simple_form' 16 | gem 'therubyracer', :platform=>:ruby 17 | gem 'unicorn' 18 | gem 'unicorn-rails' 19 | 20 | gem 'sidekiq' 21 | 22 | gem "chartkick" 23 | 24 | group :development do 25 | gem 'better_errors' 26 | gem 'html2haml' 27 | gem 'rails_layout' 28 | end 29 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require bootstrap-sprockets 16 | //= require_tree . 17 | //= require chartkick -------------------------------------------------------------------------------- /app/views/projects/index.html.haml: -------------------------------------------------------------------------------- 1 | %h1 Listing projects 2 | 3 | %table.table.table-bordered.table-hover 4 | %thead 5 | %tr 6 | %th Name 7 | %th Min freq 8 | %th Max freq 9 | %th Device 10 | %th Bin size 11 | %th Notes 12 | %th 13 | %th 14 | %th 15 | 16 | %tbody 17 | - @projects.each do |project| 18 | %tr 19 | %td= project.name 20 | %td= project.min_freq 21 | %td= project.max_freq 22 | %td= project.device 23 | %td= project.bin_size 24 | %td= project.notes 25 | %td= link_to 'Show', project 26 | %td= link_to 'Edit', edit_project_path(project) 27 | %td= link_to 'Destroy', project, :method => :delete, :data => { :confirm => 'Are you sure?' } 28 | 29 | %br 30 | 31 | = link_to 'New Project', new_project_path 32 | -------------------------------------------------------------------------------- /config/locales/simple_form.en.yml: -------------------------------------------------------------------------------- 1 | en: 2 | simple_form: 3 | "yes": 'Yes' 4 | "no": 'No' 5 | required: 6 | text: 'required' 7 | mark: '*' 8 | # You can uncomment the line below if you need to overwrite the whole required html. 9 | # When using html, text and mark won't be used. 10 | # html: '*' 11 | error_notification: 12 | default_message: "Please review the problems below:" 13 | # Examples 14 | # labels: 15 | # defaults: 16 | # password: 'Password' 17 | # user: 18 | # new: 19 | # email: 'E-mail to sign in.' 20 | # edit: 21 | # email: 'E-mail.' 22 | # hints: 23 | # defaults: 24 | # username: 'User name to sign in.' 25 | # password: 'No special characters, please.' 26 | # include_blanks: 27 | # defaults: 28 | # age: 'Rather not say' 29 | # prompts: 30 | # defaults: 31 | # age: 'Select your age' 32 | -------------------------------------------------------------------------------- /app/views/projects/show.html.haml: -------------------------------------------------------------------------------- 1 | .wrapper 2 | .container-fluid 3 | 4 | %p#notice= notice 5 | 6 | %p 7 | %b Name: 8 | = @project.name 9 | %p 10 | %b Min freq: 11 | = @project.min_freq 12 | %p 13 | %b Max freq: 14 | = @project.max_freq 15 | %p 16 | %b Bin size: 17 | = @project.bin_size 18 | %p 19 | %b Device: 20 | = @project.device 21 | %p 22 | %b Notes: 23 | = @project.notes 24 | 25 | %hr 26 | 27 | %h4 Baseline 28 | - if @project.baseline 29 | = link_to "Visualise Baseline", @project.baseline 30 | - else 31 | = link_to "Get a Baseline", project_baseline_path(@project.id) 32 | 33 | %br 34 | %br 35 | 36 | 37 | %h4 Scans 38 | - @project.spec_scans.each do |scan| 39 | = link_to "Visualise Scan - #{scan.id}", scan 40 | %br 41 | = link_to "Run a Scan", project_scan_path(@project.id) 42 | 43 | 44 | %hr 45 | 46 | = link_to 'Edit', edit_project_path(@project) 47 | \| 48 | = link_to 'Back', projects_path 49 | -------------------------------------------------------------------------------- /app/assets/stylesheets/1st_load_framework.css.scss: -------------------------------------------------------------------------------- 1 | // import the CSS framework 2 | @import "bootstrap-sprockets"; 3 | @import "bootstrap"; 4 | 5 | // make all images responsive by default 6 | img { 7 | @extend .img-responsive; 8 | margin: 0 auto; 9 | } 10 | // override for the 'Home' navigation link 11 | .navbar-brand { 12 | font-size: inherit; 13 | } 14 | 15 | // THESE ARE EXAMPLES YOU CAN MODIFY 16 | // create your own classes 17 | // to make views framework-neutral 18 | .column { 19 | @extend .col-md-6; 20 | @extend .text-center; 21 | } 22 | .form { 23 | @extend .col-md-6; 24 | } 25 | .form-centered { 26 | @extend .col-md-6; 27 | @extend .text-center; 28 | } 29 | .submit { 30 | @extend .btn; 31 | @extend .btn-primary; 32 | @extend .btn-lg; 33 | } 34 | // apply styles to HTML elements 35 | // to make views framework-neutral 36 | main { 37 | @extend .container; 38 | background-color: #eee; 39 | padding-bottom: 80px; 40 | width: 100%; 41 | margin-top: 51px; // accommodate the navbar 42 | } 43 | section { 44 | @extend .row; 45 | margin-top: 20px; 46 | } 47 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | domain_name: example.com 15 | secret_key_base: e3e5e1e10a6aa1109fd0d4452518d1ffcc3fb49299379ddbb610d486475f22b5cefd7354ea50637e2db1c76520ec9be2b2c650e96df5e443051a190b9db196d9 16 | 17 | test: 18 | secret_key_base: 72d8ad89db592d7085dd10a65c0cf6d7a7bbf9b4934fe1f3515d50e237c08da59077cd29d90925d1b13a9fa119cd5facfaa9d8f066861712346c3360aae4a439 19 | 20 | # Do not keep production secrets in the repository, 21 | # instead read values from the environment. 22 | production: 23 | domain_name: <%= ENV["DOMAIN_NAME"] %> 24 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 25 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module Spectre 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | 15 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 16 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 17 | # config.time_zone = 'Central Time (US & Canada)' 18 | 19 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 20 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 21 | # config.i18n.default_locale = :de 22 | config.autoload_paths += %W(#{config.root}/app/workers) 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Spectre 2 | ================ 3 | 4 | This application is intended to be an easy to use interface for visualising, and storing, data for RF Spectrum Scanning. 5 | 6 | It was tested with a HackRF, however, it should work for any other devices that are supported by Soapy SDR. 7 | 8 | ----------- 9 | 10 | Dependencies 11 | ------------- 12 | 13 | This application requires: 14 | 15 | - Ruby 2.3.1 16 | - Rails 4.1.0 (any version up until 5.x.x should work) 17 | - Linux or Mac OSX (tested on Mac OSX, and Kali) 18 | - Soapy SDR 19 | - Soapy SDR HackRF Module (if using HackRF, this is a dependancy of RX Tools) 20 | - RX Tools(https://github.com/rxseger/rx_tools) 21 | 22 | Learn more about [Installing Rails](http://railsapps.github.io/installing-rails.html) here. 23 | 24 | Getting Started 25 | --------------- 26 | WIP 27 | 28 | Installation 29 | --------------- 30 | WIP 31 | 32 | Usage 33 | --------------- 34 | WIP 35 | 36 | Documentation and Support 37 | ------------------------- 38 | 39 | Issues 40 | ------------- 41 | 42 | Similar Projects 43 | ---------------- 44 | 45 | Contributing 46 | ------------ 47 | 48 | Credits 49 | ------- 50 | 51 | License 52 | ------- 53 | # spectre-scan 54 | -------------------------------------------------------------------------------- /app/assets/stylesheets/scaffolds.css.scss: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | color: #333; 4 | font-family: verdana, arial, helvetica, sans-serif; 5 | font-size: 13px; 6 | line-height: 18px; 7 | } 8 | 9 | p, ol, ul, td { 10 | font-family: verdana, arial, helvetica, sans-serif; 11 | font-size: 13px; 12 | line-height: 18px; 13 | } 14 | 15 | pre { 16 | background-color: #eee; 17 | padding: 10px; 18 | font-size: 11px; 19 | } 20 | 21 | a { 22 | color: #000; 23 | &:visited { 24 | color: #666; 25 | } 26 | &:hover { 27 | color: #fff; 28 | background-color: #000; 29 | } 30 | } 31 | 32 | div { 33 | &.field, &.actions { 34 | margin-bottom: 10px; 35 | } 36 | } 37 | 38 | #notice { 39 | color: green; 40 | } 41 | 42 | .field_with_errors { 43 | padding: 2px; 44 | background-color: red; 45 | display: table; 46 | } 47 | 48 | #error_explanation { 49 | width: 450px; 50 | border: 2px solid red; 51 | padding: 7px; 52 | padding-bottom: 0; 53 | margin-bottom: 20px; 54 | background-color: #f0f0f0; 55 | h2 { 56 | text-align: left; 57 | font-weight: bold; 58 | padding: 5px 5px 5px 15px; 59 | font-size: 12px; 60 | margin: -7px; 61 | margin-bottom: 0px; 62 | background-color: #c00; 63 | color: #fff; 64 | } 65 | ul li { 66 | font-size: 12px; 67 | list-style: square; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /test/controllers/baselines_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class BaselinesControllerTest < ActionController::TestCase 4 | setup do 5 | @baseline = baselines(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:baselines) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create baseline" do 20 | assert_difference('Baseline.count') do 21 | post :create, baseline: { job_id: @baseline.job_id, status: @baseline.status } 22 | end 23 | 24 | assert_redirected_to baseline_path(assigns(:baseline)) 25 | end 26 | 27 | test "should show baseline" do 28 | get :show, id: @baseline 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @baseline 34 | assert_response :success 35 | end 36 | 37 | test "should update baseline" do 38 | patch :update, id: @baseline, baseline: { job_id: @baseline.job_id, status: @baseline.status } 39 | assert_redirected_to baseline_path(assigns(:baseline)) 40 | end 41 | 42 | test "should destroy baseline" do 43 | assert_difference('Baseline.count', -1) do 44 | delete :destroy, id: @baseline 45 | end 46 | 47 | assert_redirected_to baselines_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/controllers/spec_scans_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class SpecScansControllerTest < ActionController::TestCase 4 | setup do 5 | @spec_scan = spec_scans(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:spec_scans) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create spec_scan" do 20 | assert_difference('SpecScan.count') do 21 | post :create, spec_scan: { job_id: @spec_scan.job_id, status: @spec_scan.status } 22 | end 23 | 24 | assert_redirected_to spec_scan_path(assigns(:spec_scan)) 25 | end 26 | 27 | test "should show spec_scan" do 28 | get :show, id: @spec_scan 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @spec_scan 34 | assert_response :success 35 | end 36 | 37 | test "should update spec_scan" do 38 | patch :update, id: @spec_scan, spec_scan: { job_id: @spec_scan.job_id, status: @spec_scan.status } 39 | assert_redirected_to spec_scan_path(assigns(:spec_scan)) 40 | end 41 | 42 | test "should destroy spec_scan" do 43 | assert_difference('SpecScan.count', -1) do 44 | delete :destroy, id: @spec_scan 45 | end 46 | 47 | assert_redirected_to spec_scans_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/controllers/projects_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ProjectsControllerTest < ActionController::TestCase 4 | setup do 5 | @project = projects(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:projects) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create project" do 20 | assert_difference('Project.count') do 21 | post :create, project: { bin_size: @project.bin_size, device: @project.device, max_freq: @project.max_freq, min_freq: @project.min_freq, name: @project.name, notes: @project.notes } 22 | end 23 | 24 | assert_redirected_to project_path(assigns(:project)) 25 | end 26 | 27 | test "should show project" do 28 | get :show, id: @project 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @project 34 | assert_response :success 35 | end 36 | 37 | test "should update project" do 38 | patch :update, id: @project, project: { bin_size: @project.bin_size, device: @project.device, max_freq: @project.max_freq, min_freq: @project.min_freq, name: @project.name, notes: @project.notes } 39 | assert_redirected_to project_path(assigns(:project)) 40 | end 41 | 42 | test "should destroy project" do 43 | assert_difference('Project.count', -1) do 44 | delete :destroy, id: @project 45 | end 46 | 47 | assert_redirected_to projects_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Adds additional error checking when serving assets at runtime. 31 | # Checks for improperly declared sprockets dependencies. 32 | # Raises helpful error messages. 33 | config.assets.raise_runtime_errors = true 34 | 35 | # Raises error for missing translations 36 | # config.action_view.raise_on_missing_translations = true 37 | end 38 | -------------------------------------------------------------------------------- /test/controllers/scan_items_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class ScanItemsControllerTest < ActionController::TestCase 4 | setup do 5 | @scan_item = scan_items(:one) 6 | end 7 | 8 | test "should get index" do 9 | get :index 10 | assert_response :success 11 | assert_not_nil assigns(:scan_items) 12 | end 13 | 14 | test "should get new" do 15 | get :new 16 | assert_response :success 17 | end 18 | 19 | test "should create scan_item" do 20 | assert_difference('ScanItem.count') do 21 | post :create, scan_item: { baseline_id: @scan_item.baseline_id, lower: @scan_item.lower, power: @scan_item.power, spec_scan_id: @scan_item.spec_scan_id, time: @scan_item.time, upper: @scan_item.upper } 22 | end 23 | 24 | assert_redirected_to scan_item_path(assigns(:scan_item)) 25 | end 26 | 27 | test "should show scan_item" do 28 | get :show, id: @scan_item 29 | assert_response :success 30 | end 31 | 32 | test "should get edit" do 33 | get :edit, id: @scan_item 34 | assert_response :success 35 | end 36 | 37 | test "should update scan_item" do 38 | patch :update, id: @scan_item, scan_item: { baseline_id: @scan_item.baseline_id, lower: @scan_item.lower, power: @scan_item.power, spec_scan_id: @scan_item.spec_scan_id, time: @scan_item.time, upper: @scan_item.upper } 39 | assert_redirected_to scan_item_path(assigns(:scan_item)) 40 | end 41 | 42 | test "should destroy scan_item" do 43 | assert_difference('ScanItem.count', -1) do 44 | delete :destroy, id: @scan_item 45 | end 46 | 47 | assert_redirected_to scan_items_path 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /app/workers/scan_worker.rb: -------------------------------------------------------------------------------- 1 | class ScanWorker 2 | include Sidekiq::Worker 3 | require 'csv' 4 | 5 | def perform(spec_scan_id, baseline_id, driver, lower, upper, bin_size) 6 | 7 | 8 | # Start scanning with rx_power 9 | 10 | if spec_scan_id.present? 11 | SpecScan.find(spec_scan_id).update_attribute(:status, "pending") 12 | elsif baseline_id.present? 13 | Baseline.find(baseline_id).update_attribute(:status, "pending") 14 | end 15 | 16 | 17 | filename = "#{Rails.root}/#{baseline_id}#{spec_scan_id}survey_single_shot.csv" 18 | cmd = "rx_power -d driver=#{driver} -f #{lower}:#{upper}:#{bin_size} -1 #{filename}" 19 | puts filename 20 | puts cmd 21 | x=system(cmd) 22 | # Parse file and add records to database 23 | puts x 24 | puts "CMD ^^^^^" 25 | csv_text = File.read(filename) 26 | csv = CSV.parse(csv_text, :headers => true) 27 | csv.each do |row| 28 | puts row 29 | 30 | 31 | item = ScanItem.new 32 | item.time = row[1] 33 | item.lower = row[2] 34 | item.upper = row[3] 35 | item.power = row[7].to_f 36 | 37 | if spec_scan_id.present? 38 | item.spec_scan_id = spec_scan_id 39 | elsif baseline_id.present? 40 | item.baseline_id = baseline_id 41 | end 42 | 43 | item.save 44 | 45 | 46 | end 47 | 48 | # Destroy file, it's no longer required 49 | 50 | 51 | `rm #{filename}` 52 | 53 | if spec_scan_id.present? 54 | SpecScan.find(spec_scan_id).update_attribute(:status, "complete") 55 | elsif baseline_id.present? 56 | Baseline.find(baseline_id).update_attribute(:status, "complete") 57 | end 58 | 59 | end 60 | end -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static asset server for tests with Cache-Control for performance. 16 | config.serve_static_assets = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Print deprecation notices to the stderr. 35 | config.active_support.deprecation = :stderr 36 | 37 | # Raises error for missing translations 38 | # config.action_view.raise_on_missing_translations = true 39 | end 40 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # This file is auto-generated from the current state of the database. Instead 3 | # of editing this file, please use the migrations feature of Active Record to 4 | # incrementally modify your database, and then regenerate this schema definition. 5 | # 6 | # Note that this schema.rb definition is the authoritative source for your 7 | # database schema. If you need to create the application database on another 8 | # system, you should be using db:schema:load, not running all the migrations 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). 11 | # 12 | # It's strongly recommended that you check this file into your version control system. 13 | 14 | ActiveRecord::Schema.define(version: 20160817080154) do 15 | 16 | create_table "baselines", force: true do |t| 17 | t.string "status" 18 | t.string "job_id" 19 | t.datetime "created_at" 20 | t.datetime "updated_at" 21 | t.integer "project_id" 22 | end 23 | 24 | create_table "projects", force: true do |t| 25 | t.string "name" 26 | t.string "min_freq" 27 | t.string "max_freq" 28 | t.string "device" 29 | t.string "bin_size" 30 | t.text "notes" 31 | t.datetime "created_at" 32 | t.datetime "updated_at" 33 | end 34 | 35 | create_table "scan_items", force: true do |t| 36 | t.integer "spec_scan_id" 37 | t.integer "baseline_id" 38 | t.string "upper" 39 | t.string "lower" 40 | t.string "time" 41 | t.float "power" 42 | t.datetime "created_at" 43 | t.datetime "updated_at" 44 | end 45 | 46 | create_table "spec_scans", force: true do |t| 47 | t.string "status" 48 | t.string "job_id" 49 | t.datetime "created_at" 50 | t.datetime "updated_at" 51 | t.integer "project_id" 52 | end 53 | 54 | end 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Ignore these files when commiting to a git repository. 3 | # 4 | # See http://help.github.com/ignore-files/ for more about ignoring files. 5 | # 6 | # The original version of this file is found here: 7 | # https://github.com/RailsApps/rails-composer/blob/master/files/gitignore.txt 8 | # 9 | # Corrections? Improvements? Create a GitHub issue: 10 | # http://github.com/RailsApps/rails-composer/issues 11 | #---------------------------------------------------------------------------- 12 | 13 | # bundler state 14 | /.bundle 15 | /vendor/bundle/ 16 | /vendor/ruby/ 17 | 18 | # minimal Rails specific artifacts 19 | db/*.sqlite3 20 | /db/*.sqlite3-journal 21 | /log/* 22 | /tmp/* 23 | 24 | # add /config/database.yml if it contains passwords 25 | # /config/database.yml 26 | 27 | # various artifacts 28 | **.war 29 | *.rbc 30 | *.sassc 31 | .redcar/ 32 | .sass-cache 33 | /config/config.yml 34 | /coverage.data 35 | /coverage/ 36 | /db/*.javadb/ 37 | /db/*.sqlite3 38 | /doc/api/ 39 | /doc/app/ 40 | /doc/features.html 41 | /doc/specs.html 42 | /public/cache 43 | /public/stylesheets/compiled 44 | /public/system/* 45 | /spec/tmp/* 46 | /cache 47 | /capybara* 48 | /capybara-*.html 49 | /gems 50 | /specifications 51 | rerun.txt 52 | pickle-email-*.html 53 | .zeus.sock 54 | 55 | # If you find yourself ignoring temporary files generated by your text editor 56 | # or operating system, you probably want to add a global ignore instead: 57 | # git config --global core.excludesfile ~/.gitignore_global 58 | # 59 | # Here are some files you may want to ignore globally: 60 | 61 | # scm revert files 62 | **.orig 63 | 64 | # Mac finder artifacts 65 | .DS_Store 66 | 67 | # Netbeans project directory 68 | /nbproject/ 69 | 70 | # RubyMine project files 71 | .idea 72 | 73 | # Textmate project files 74 | /*.tmproj 75 | 76 | # vim artifacts 77 | **.swp 78 | 79 | # Environment files that may contain sensitive data 80 | .env 81 | .powenv 82 | 83 | # tilde files are usually backup files from a text editor 84 | *~ 85 | -------------------------------------------------------------------------------- /app/views/visitors/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 34 | 35 | 36 | 37 |
38 |
39 |
40 |
41 |

Simple Sidebar

42 |

This template has a responsive menu toggling system. The menu will appear collapsed on smaller screens, and will appear non-collapsed on larger screens. When toggled using the button below, the menu will appear/disappear. On small screens, the page content will be pushed off canvas.

43 |

Make sure to keep all page content within the #page-content-wrapper.

44 | Toggle Menu 45 |
46 |
47 |
48 |
49 | 50 | 51 |
52 | 53 | 54 | 55 | 61 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Spectre 2 | ================ 3 | 4 | Rails Composer is supported by developers who purchase our RailsApps tutorials. 5 | Need help? Ask on Stack Overflow with the tag 'railsapps.' 6 | Problems? Submit an issue: https://github.com/RailsApps/rails_apps_composer/issues 7 | Your application contains diagnostics in this README file. 8 | Please provide a copy of this README file when reporting any issues. 9 | 10 | 11 | option Build a starter application? 12 | choose Enter your selection: [rails-bootstrap] 13 | option Get on the mailing list for Rails Composer news? 14 | choose Enter your selection: [none] 15 | option Web server for development? 16 | choose Enter your selection: [unicorn] 17 | option Web server for production? 18 | choose Enter your selection: [unicorn] 19 | option Database used in development? 20 | choose Enter your selection: [sqlite] 21 | option Template engine? 22 | choose Enter your selection: [haml] 23 | option Test framework? 24 | choose Enter your selection: [none] 25 | option Continuous testing? 26 | choose Enter your selection: [] 27 | option Front-end framework? 28 | choose Enter your selection: [bootstrap3] 29 | option Add support for sending email? 30 | choose Enter your selection: [none] 31 | option Authentication? 32 | choose Enter your selection: [false] 33 | option Devise modules? 34 | choose Enter your selection: [false] 35 | option OmniAuth provider? 36 | choose Enter your selection: [] 37 | option Authorization? 38 | choose Enter your selection: [false] 39 | option Use a form builder gem? 40 | choose Enter your selection: [simple_form] 41 | option Add pages? 42 | choose Enter your selection: [about] 43 | option Set a locale? 44 | choose Enter your selection: [none] 45 | option Install page-view analytics? 46 | choose Enter your selection: [none] 47 | option Add a deployment mechanism? 48 | choose Enter your selection: [none] 49 | option Set a robots.txt file to ban spiders? 50 | choose Enter your selection: [true] 51 | option Create a GitHub repository? (y/n) 52 | choose Enter your selection: [] 53 | option Add gem and file for environment variables? 54 | choose Enter your selection: [] 55 | option Improve error reporting with 'better_errors' during development? 56 | choose Enter your selection: [true] 57 | option Use 'pry' as console replacement during development and test? 58 | choose Enter your selection: [false] 59 | option Use or create a project-specific rvm gemset? 60 | choose Enter your selection: [] 61 | -------------------------------------------------------------------------------- /app/assets/stylesheets/simple-sidebar.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - Simple Sidebar HTML Template (http://startbootstrap.com) 3 | * Code licensed under the Apache License v2.0. 4 | * For details, see http://www.apache.org/licenses/LICENSE-2.0. 5 | */ 6 | 7 | /* Toggle Styles */ 8 | 9 | #wrapper { 10 | padding-left: 0; 11 | -webkit-transition: all 0.5s ease; 12 | -moz-transition: all 0.5s ease; 13 | -o-transition: all 0.5s ease; 14 | transition: all 0.5s ease; 15 | } 16 | 17 | #wrapper.toggled { 18 | padding-left: 250px; 19 | } 20 | 21 | #sidebar-wrapper { 22 | z-index: 1000; 23 | position: fixed; 24 | left: 250px; 25 | width: 0; 26 | height: 100%; 27 | margin-left: -250px; 28 | overflow-y: auto; 29 | background: #000; 30 | -webkit-transition: all 0.5s ease; 31 | -moz-transition: all 0.5s ease; 32 | -o-transition: all 0.5s ease; 33 | transition: all 0.5s ease; 34 | } 35 | 36 | #wrapper.toggled #sidebar-wrapper { 37 | width: 250px; 38 | } 39 | 40 | #page-content-wrapper { 41 | width: 100%; 42 | position: absolute; 43 | padding: 15px; 44 | } 45 | 46 | #wrapper.toggled #page-content-wrapper { 47 | position: absolute; 48 | margin-right: -250px; 49 | } 50 | 51 | /* Sidebar Styles */ 52 | 53 | .sidebar-nav { 54 | position: absolute; 55 | top: 0; 56 | width: 250px; 57 | margin: 0; 58 | padding: 0; 59 | list-style: none; 60 | } 61 | 62 | .sidebar-nav li { 63 | text-indent: 20px; 64 | line-height: 40px; 65 | } 66 | 67 | .sidebar-nav li a { 68 | display: block; 69 | text-decoration: none; 70 | color: #999999; 71 | } 72 | 73 | .sidebar-nav li a:hover { 74 | text-decoration: none; 75 | color: #fff; 76 | background: rgba(255,255,255,0.2); 77 | } 78 | 79 | .sidebar-nav li a:active, 80 | .sidebar-nav li a:focus { 81 | text-decoration: none; 82 | } 83 | 84 | .sidebar-nav > .sidebar-brand { 85 | height: 65px; 86 | font-size: 18px; 87 | line-height: 60px; 88 | } 89 | 90 | .sidebar-nav > .sidebar-brand a { 91 | color: #999999; 92 | } 93 | 94 | .sidebar-nav > .sidebar-brand a:hover { 95 | color: #fff; 96 | background: none; 97 | } 98 | 99 | @media(min-width:768px) { 100 | #wrapper { 101 | padding-left: 250px; 102 | } 103 | 104 | #wrapper.toggled { 105 | padding-left: 0; 106 | } 107 | 108 | #sidebar-wrapper { 109 | width: 250px; 110 | } 111 | 112 | #wrapper.toggled #sidebar-wrapper { 113 | width: 0; 114 | } 115 | 116 | #page-content-wrapper { 117 | padding: 20px; 118 | position: relative; 119 | } 120 | 121 | #wrapper.toggled #page-content-wrapper { 122 | position: relative; 123 | margin-right: 0; 124 | } 125 | } -------------------------------------------------------------------------------- /app/controllers/projects_controller.rb: -------------------------------------------------------------------------------- 1 | class ProjectsController < ApplicationController 2 | before_action :set_project, only: [:baseline, :scan, :show, :edit, :update, :destroy] 3 | 4 | 5 | 6 | 7 | def baseline 8 | b = Baseline.create!(:project_id => @project.id) 9 | ScanWorker.perform_async("", b.id, "hackrf", "300M", "450M", "1M") 10 | redirect_to b, notice: "Wait a minute or so, and refresh the page" 11 | end 12 | 13 | def scan 14 | s = SpecScan.create!(:project_id => @project.id) 15 | ScanWorker.perform_async(s.id, "", "hackrf", "300M", "450M", "1M") 16 | redirect_to s, notice: "Wait a minute or so, and refresh the page" 17 | end 18 | 19 | 20 | # GET /projects 21 | # GET /projects.json 22 | def index 23 | @projects = Project.all 24 | end 25 | 26 | # GET /projects/1 27 | # GET /projects/1.json 28 | def show 29 | end 30 | 31 | # GET /projects/new 32 | def new 33 | @project = Project.new 34 | end 35 | 36 | # GET /projects/1/edit 37 | def edit 38 | end 39 | 40 | # POST /projects 41 | # POST /projects.json 42 | def create 43 | @project = Project.new(project_params) 44 | 45 | respond_to do |format| 46 | if @project.save 47 | format.html { redirect_to @project, notice: 'Project was successfully created.' } 48 | format.json { render :show, status: :created, location: @project } 49 | else 50 | format.html { render :new } 51 | format.json { render json: @project.errors, status: :unprocessable_entity } 52 | end 53 | end 54 | end 55 | 56 | # PATCH/PUT /projects/1 57 | # PATCH/PUT /projects/1.json 58 | def update 59 | respond_to do |format| 60 | if @project.update(project_params) 61 | format.html { redirect_to @project, notice: 'Project was successfully updated.' } 62 | format.json { render :show, status: :ok, location: @project } 63 | else 64 | format.html { render :edit } 65 | format.json { render json: @project.errors, status: :unprocessable_entity } 66 | end 67 | end 68 | end 69 | 70 | # DELETE /projects/1 71 | # DELETE /projects/1.json 72 | def destroy 73 | @project.destroy 74 | respond_to do |format| 75 | format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' } 76 | format.json { head :no_content } 77 | end 78 | end 79 | 80 | private 81 | # Use callbacks to share common setup or constraints between actions. 82 | def set_project 83 | if params[:id].present? 84 | @project = Project.find(params[:id]) 85 | else 86 | @project = Project.find(params[:project_id]) 87 | end 88 | end 89 | 90 | # Never trust parameters from the scary internet, only allow the white list through. 91 | def project_params 92 | params.require(:project).permit(:name, :min_freq, :max_freq, :device, :bin_size, :notes) 93 | end 94 | end 95 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. 20 | # config.action_dispatch.rack_cache = true 21 | 22 | # Disable Rails's static asset server (Apache or nginx will already do this). 23 | config.serve_static_assets = false 24 | 25 | # Compress JavaScripts and CSS. 26 | config.assets.js_compressor = :uglifier 27 | # config.assets.css_compressor = :sass 28 | 29 | # Do not fallback to assets pipeline if a precompiled asset is missed. 30 | config.assets.compile = false 31 | 32 | # Generate digests for assets URLs. 33 | config.assets.digest = true 34 | 35 | # Version of your assets, change this if you want to expire all your assets. 36 | config.assets.version = '1.0' 37 | 38 | # Specifies the header that your server uses for sending files. 39 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache 40 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx 41 | 42 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 43 | # config.force_ssl = true 44 | 45 | # Set to :debug to see everything in the log. 46 | config.log_level = :info 47 | 48 | # Prepend all log lines with the following tags. 49 | # config.log_tags = [ :subdomain, :uuid ] 50 | 51 | # Use a different logger for distributed setups. 52 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 53 | 54 | # Use a different cache store in production. 55 | # config.cache_store = :mem_cache_store 56 | 57 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 58 | # config.action_controller.asset_host = "http://assets.example.com" 59 | 60 | # Precompile additional assets. 61 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 62 | # config.assets.precompile += %w( search.js ) 63 | 64 | # Ignore bad email addresses and do not raise email delivery errors. 65 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 66 | # config.action_mailer.raise_delivery_errors = false 67 | 68 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 69 | # the I18n.default_locale when a translation cannot be found). 70 | config.i18n.fallbacks = true 71 | 72 | # Send deprecation notices to registered listeners. 73 | config.active_support.deprecation = :notify 74 | 75 | # Disable automatic flushing of the log to improve performance. 76 | # config.autoflush_log = false 77 | 78 | # Use default logging formatter so that PID and timestamp are not suppressed. 79 | config.log_formatter = ::Logger::Formatter.new 80 | 81 | # Do not dump schema after migrations. 82 | config.active_record.dump_schema_after_migration = false 83 | end 84 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actionmailer (4.1.0) 5 | actionpack (= 4.1.0) 6 | actionview (= 4.1.0) 7 | mail (~> 2.5.4) 8 | actionpack (4.1.0) 9 | actionview (= 4.1.0) 10 | activesupport (= 4.1.0) 11 | rack (~> 1.5.2) 12 | rack-test (~> 0.6.2) 13 | actionview (4.1.0) 14 | activesupport (= 4.1.0) 15 | builder (~> 3.1) 16 | erubis (~> 2.7.0) 17 | activemodel (4.1.0) 18 | activesupport (= 4.1.0) 19 | builder (~> 3.1) 20 | activerecord (4.1.0) 21 | activemodel (= 4.1.0) 22 | activesupport (= 4.1.0) 23 | arel (~> 5.0.0) 24 | activesupport (4.1.0) 25 | i18n (~> 0.6, >= 0.6.9) 26 | json (~> 1.7, >= 1.7.7) 27 | minitest (~> 5.1) 28 | thread_safe (~> 0.1) 29 | tzinfo (~> 1.1) 30 | arel (5.0.1.20140414130214) 31 | autoprefixer-rails (6.4.0.2) 32 | execjs 33 | better_errors (2.1.1) 34 | coderay (>= 1.0.0) 35 | erubis (>= 2.6.6) 36 | rack (>= 0.9.0) 37 | bootstrap-sass (3.3.5) 38 | autoprefixer-rails (>= 5.0.0.1) 39 | sass (>= 3.2.19) 40 | builder (3.2.2) 41 | chartkick (2.0.2) 42 | coderay (1.1.1) 43 | coffee-rails (4.0.1) 44 | coffee-script (>= 2.2.0) 45 | railties (>= 4.0.0, < 5.0) 46 | coffee-script (2.4.1) 47 | coffee-script-source 48 | execjs 49 | coffee-script-source (1.10.0) 50 | concurrent-ruby (1.0.2) 51 | connection_pool (2.2.0) 52 | erubis (2.7.0) 53 | execjs (2.7.0) 54 | haml (4.0.7) 55 | tilt 56 | haml-rails (0.9.0) 57 | actionpack (>= 4.0.1) 58 | activesupport (>= 4.0.1) 59 | haml (>= 4.0.6, < 5.0) 60 | html2haml (>= 1.0.1) 61 | railties (>= 4.0.1) 62 | high_voltage (3.0.0) 63 | hike (1.2.3) 64 | html2haml (2.0.0) 65 | erubis (~> 2.7.0) 66 | haml (~> 4.0.0) 67 | nokogiri (~> 1.6.0) 68 | ruby_parser (~> 3.5) 69 | i18n (0.7.0) 70 | jbuilder (2.6.0) 71 | activesupport (>= 3.0.0, < 5.1) 72 | multi_json (~> 1.2) 73 | jquery-rails (3.1.4) 74 | railties (>= 3.0, < 5.0) 75 | thor (>= 0.14, < 2.0) 76 | json (1.8.3) 77 | kgio (2.10.0) 78 | libv8 (3.16.14.15) 79 | mail (2.5.4) 80 | mime-types (~> 1.16) 81 | treetop (~> 1.4.8) 82 | mime-types (1.25.1) 83 | mini_portile2 (2.1.0) 84 | minitest (5.9.0) 85 | multi_json (1.12.1) 86 | nokogiri (1.6.8) 87 | mini_portile2 (~> 2.1.0) 88 | pkg-config (~> 1.1.7) 89 | pkg-config (1.1.7) 90 | polyglot (0.3.5) 91 | rack (1.5.5) 92 | rack-protection (1.5.3) 93 | rack 94 | rack-test (0.6.3) 95 | rack (>= 1.0) 96 | rails (4.1.0) 97 | actionmailer (= 4.1.0) 98 | actionpack (= 4.1.0) 99 | actionview (= 4.1.0) 100 | activemodel (= 4.1.0) 101 | activerecord (= 4.1.0) 102 | activesupport (= 4.1.0) 103 | bundler (>= 1.3.0, < 2.0) 104 | railties (= 4.1.0) 105 | sprockets-rails (~> 2.0) 106 | rails_layout (1.0.29) 107 | railties (4.1.0) 108 | actionpack (= 4.1.0) 109 | activesupport (= 4.1.0) 110 | rake (>= 0.8.7) 111 | thor (>= 0.18.1, < 2.0) 112 | raindrops (0.17.0) 113 | rake (11.2.2) 114 | rdoc (4.2.2) 115 | json (~> 1.4) 116 | redis (3.3.1) 117 | ref (2.0.0) 118 | ruby_parser (3.8.2) 119 | sexp_processor (~> 4.1) 120 | sass (3.2.19) 121 | sass-rails (4.0.5) 122 | railties (>= 4.0.0, < 5.0) 123 | sass (~> 3.2.2) 124 | sprockets (~> 2.8, < 3.0) 125 | sprockets-rails (~> 2.0) 126 | sdoc (0.4.1) 127 | json (~> 1.7, >= 1.7.7) 128 | rdoc (~> 4.0) 129 | sexp_processor (4.7.0) 130 | sidekiq (4.1.4) 131 | concurrent-ruby (~> 1.0) 132 | connection_pool (~> 2.2, >= 2.2.0) 133 | redis (~> 3.2, >= 3.2.1) 134 | sinatra (>= 1.4.7) 135 | simple_form (3.2.1) 136 | actionpack (> 4, < 5.1) 137 | activemodel (> 4, < 5.1) 138 | sinatra (1.4.7) 139 | rack (~> 1.5) 140 | rack-protection (~> 1.4) 141 | tilt (>= 1.3, < 3) 142 | spring (1.7.2) 143 | sprockets (2.12.4) 144 | hike (~> 1.2) 145 | multi_json (~> 1.0) 146 | rack (~> 1.0) 147 | tilt (~> 1.1, != 1.3.0) 148 | sprockets-rails (2.3.3) 149 | actionpack (>= 3.0) 150 | activesupport (>= 3.0) 151 | sprockets (>= 2.8, < 4.0) 152 | sqlite3 (1.3.11) 153 | therubyracer (0.12.2) 154 | libv8 (~> 3.16.14.0) 155 | ref 156 | thor (0.19.1) 157 | thread_safe (0.3.5) 158 | tilt (1.4.1) 159 | treetop (1.4.15) 160 | polyglot 161 | polyglot (>= 0.3.1) 162 | tzinfo (1.2.2) 163 | thread_safe (~> 0.1) 164 | uglifier (3.0.1) 165 | execjs (>= 0.3.0, < 3) 166 | unicorn (5.1.0) 167 | kgio (~> 2.6) 168 | raindrops (~> 0.7) 169 | unicorn-rails (2.2.1) 170 | rack 171 | unicorn 172 | 173 | PLATFORMS 174 | ruby 175 | 176 | DEPENDENCIES 177 | better_errors 178 | bootstrap-sass 179 | chartkick 180 | coffee-rails (~> 4.0.0) 181 | haml-rails 182 | high_voltage 183 | html2haml 184 | jbuilder (~> 2.0) 185 | jquery-rails 186 | rails (= 4.1.0) 187 | rails_layout 188 | sass-rails (~> 4.0.3) 189 | sdoc (~> 0.4.0) 190 | sidekiq 191 | simple_form 192 | spring 193 | sqlite3 194 | therubyracer 195 | uglifier (>= 1.3.0) 196 | unicorn 197 | unicorn-rails 198 | 199 | RUBY VERSION 200 | ruby 2.3.1p112 201 | 202 | BUNDLED WITH 203 | 1.12.5 204 | -------------------------------------------------------------------------------- /config/initializers/simple_form_bootstrap.rb: -------------------------------------------------------------------------------- 1 | # Use this setup block to configure all options available in SimpleForm. 2 | SimpleForm.setup do |config| 3 | config.error_notification_class = 'alert alert-danger' 4 | config.button_class = 'btn btn-default' 5 | config.boolean_label_class = nil 6 | 7 | config.wrappers :vertical_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 8 | b.use :html5 9 | b.use :placeholder 10 | b.optional :maxlength 11 | b.optional :pattern 12 | b.optional :min_max 13 | b.optional :readonly 14 | b.use :label, class: 'control-label' 15 | 16 | b.use :input, class: 'form-control' 17 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 18 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 19 | end 20 | 21 | config.wrappers :vertical_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 22 | b.use :html5 23 | b.use :placeholder 24 | b.optional :maxlength 25 | b.optional :readonly 26 | b.use :label, class: 'control-label' 27 | 28 | b.use :input 29 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 30 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 31 | end 32 | 33 | config.wrappers :vertical_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 34 | b.use :html5 35 | b.optional :readonly 36 | 37 | b.wrapper tag: 'div', class: 'checkbox' do |ba| 38 | ba.use :label_input 39 | end 40 | 41 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 42 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 43 | end 44 | 45 | config.wrappers :vertical_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 46 | b.use :html5 47 | b.optional :readonly 48 | b.use :label, class: 'control-label' 49 | b.use :input 50 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 51 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 52 | end 53 | 54 | config.wrappers :horizontal_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 55 | b.use :html5 56 | b.use :placeholder 57 | b.optional :maxlength 58 | b.optional :pattern 59 | b.optional :min_max 60 | b.optional :readonly 61 | b.use :label, class: 'col-sm-3 control-label' 62 | 63 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 64 | ba.use :input, class: 'form-control' 65 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 66 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 67 | end 68 | end 69 | 70 | config.wrappers :horizontal_file_input, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 71 | b.use :html5 72 | b.use :placeholder 73 | b.optional :maxlength 74 | b.optional :readonly 75 | b.use :label, class: 'col-sm-3 control-label' 76 | 77 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 78 | ba.use :input 79 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 80 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 81 | end 82 | end 83 | 84 | config.wrappers :horizontal_boolean, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 85 | b.use :html5 86 | b.optional :readonly 87 | 88 | b.wrapper tag: 'div', class: 'col-sm-offset-3 col-sm-9' do |wr| 89 | wr.wrapper tag: 'div', class: 'checkbox' do |ba| 90 | ba.use :label_input 91 | end 92 | 93 | wr.use :error, wrap_with: { tag: 'span', class: 'help-block' } 94 | wr.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 95 | end 96 | end 97 | 98 | config.wrappers :horizontal_radio_and_checkboxes, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 99 | b.use :html5 100 | b.optional :readonly 101 | 102 | b.use :label, class: 'col-sm-3 control-label' 103 | 104 | b.wrapper tag: 'div', class: 'col-sm-9' do |ba| 105 | ba.use :input 106 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 107 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 108 | end 109 | end 110 | 111 | config.wrappers :inline_form, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 112 | b.use :html5 113 | b.use :placeholder 114 | b.optional :maxlength 115 | b.optional :pattern 116 | b.optional :min_max 117 | b.optional :readonly 118 | b.use :label, class: 'sr-only' 119 | 120 | b.use :input, class: 'form-control' 121 | b.use :error, wrap_with: { tag: 'span', class: 'help-block' } 122 | b.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 123 | end 124 | 125 | config.wrappers :multi_select, tag: 'div', class: 'form-group', error_class: 'has-error' do |b| 126 | b.use :html5 127 | b.optional :readonly 128 | b.use :label, class: 'control-label' 129 | b.wrapper tag: 'div', class: 'form-inline' do |ba| 130 | ba.use :input, class: 'form-control' 131 | ba.use :error, wrap_with: { tag: 'span', class: 'help-block' } 132 | ba.use :hint, wrap_with: { tag: 'p', class: 'help-block' } 133 | end 134 | end 135 | # Wrappers for forms and inputs using the Bootstrap toolkit. 136 | # Check the Bootstrap docs (http://getbootstrap.com) 137 | # to learn about the different styles for forms and inputs, 138 | # buttons and other elements. 139 | config.default_wrapper = :vertical_form 140 | config.wrapper_mappings = { 141 | check_boxes: :vertical_radio_and_checkboxes, 142 | radio_buttons: :vertical_radio_and_checkboxes, 143 | file: :vertical_file_input, 144 | boolean: :vertical_boolean, 145 | datetime: :multi_select, 146 | date: :multi_select, 147 | time: :multi_select 148 | } 149 | end 150 | -------------------------------------------------------------------------------- /config/initializers/simple_form.rb: -------------------------------------------------------------------------------- 1 | # Use this setup block to configure all options available in SimpleForm. 2 | SimpleForm.setup do |config| 3 | # Wrappers are used by the form builder to generate a 4 | # complete input. You can remove any component from the 5 | # wrapper, change the order or even add your own to the 6 | # stack. The options given below are used to wrap the 7 | # whole input. 8 | config.wrappers :default, class: :input, 9 | hint_class: :field_with_hint, error_class: :field_with_errors do |b| 10 | ## Extensions enabled by default 11 | # Any of these extensions can be disabled for a 12 | # given input by passing: `f.input EXTENSION_NAME => false`. 13 | # You can make any of these extensions optional by 14 | # renaming `b.use` to `b.optional`. 15 | 16 | # Determines whether to use HTML5 (:email, :url, ...) 17 | # and required attributes 18 | b.use :html5 19 | 20 | # Calculates placeholders automatically from I18n 21 | # You can also pass a string as f.input placeholder: "Placeholder" 22 | b.use :placeholder 23 | 24 | ## Optional extensions 25 | # They are disabled unless you pass `f.input EXTENSION_NAME => true` 26 | # to the input. If so, they will retrieve the values from the model 27 | # if any exists. If you want to enable any of those 28 | # extensions by default, you can change `b.optional` to `b.use`. 29 | 30 | # Calculates maxlength from length validations for string inputs 31 | b.optional :maxlength 32 | 33 | # Calculates pattern from format validations for string inputs 34 | b.optional :pattern 35 | 36 | # Calculates min and max from length validations for numeric inputs 37 | b.optional :min_max 38 | 39 | # Calculates readonly automatically from readonly attributes 40 | b.optional :readonly 41 | 42 | ## Inputs 43 | b.use :label_input 44 | b.use :hint, wrap_with: { tag: :span, class: :hint } 45 | b.use :error, wrap_with: { tag: :span, class: :error } 46 | 47 | ## full_messages_for 48 | # If you want to display the full error message for the attribute, you can 49 | # use the component :full_error, like: 50 | # 51 | # b.use :full_error, wrap_with: { tag: :span, class: :error } 52 | end 53 | 54 | # The default wrapper to be used by the FormBuilder. 55 | config.default_wrapper = :default 56 | 57 | # Define the way to render check boxes / radio buttons with labels. 58 | # Defaults to :nested for bootstrap config. 59 | # inline: input + label 60 | # nested: label > input 61 | config.boolean_style = :nested 62 | 63 | # Default class for buttons 64 | config.button_class = 'btn' 65 | 66 | # Method used to tidy up errors. Specify any Rails Array method. 67 | # :first lists the first message for each field. 68 | # Use :to_sentence to list all errors for each field. 69 | # config.error_method = :first 70 | 71 | # Default tag used for error notification helper. 72 | config.error_notification_tag = :div 73 | 74 | # CSS class to add for error notification helper. 75 | config.error_notification_class = 'error_notification' 76 | 77 | # ID to add for error notification helper. 78 | # config.error_notification_id = nil 79 | 80 | # Series of attempts to detect a default label method for collection. 81 | # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] 82 | 83 | # Series of attempts to detect a default value method for collection. 84 | # config.collection_value_methods = [ :id, :to_s ] 85 | 86 | # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. 87 | # config.collection_wrapper_tag = nil 88 | 89 | # You can define the class to use on all collection wrappers. Defaulting to none. 90 | # config.collection_wrapper_class = nil 91 | 92 | # You can wrap each item in a collection of radio/check boxes with a tag, 93 | # defaulting to :span. 94 | # config.item_wrapper_tag = :span 95 | 96 | # You can define a class to use in all item wrappers. Defaulting to none. 97 | # config.item_wrapper_class = nil 98 | 99 | # How the label text should be generated altogether with the required text. 100 | # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } 101 | 102 | # You can define the class to use on all labels. Default is nil. 103 | # config.label_class = nil 104 | 105 | # You can define the default class to be used on forms. Can be overriden 106 | # with `html: { :class }`. Defaulting to none. 107 | # config.default_form_class = nil 108 | 109 | # You can define which elements should obtain additional classes 110 | # config.generate_additional_classes_for = [:wrapper, :label, :input] 111 | 112 | # Whether attributes are required by default (or not). Default is true. 113 | # config.required_by_default = true 114 | 115 | # Tell browsers whether to use the native HTML5 validations (novalidate form option). 116 | # These validations are enabled in SimpleForm's internal config but disabled by default 117 | # in this configuration, which is recommended due to some quirks from different browsers. 118 | # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, 119 | # change this configuration to true. 120 | config.browser_validations = false 121 | 122 | # Collection of methods to detect if a file type was given. 123 | # config.file_methods = [ :mounted_as, :file?, :public_filename ] 124 | 125 | # Custom mappings for input types. This should be a hash containing a regexp 126 | # to match as key, and the input type that will be used when the field name 127 | # matches the regexp as value. 128 | # config.input_mappings = { /count/ => :integer } 129 | 130 | # Custom wrappers for input types. This should be a hash containing an input 131 | # type as key and the wrapper that will be used for all inputs with specified type. 132 | # config.wrapper_mappings = { string: :prepend } 133 | 134 | # Namespaces where SimpleForm should look for custom input classes that 135 | # override default inputs. 136 | # config.custom_inputs_namespaces << "CustomInputs" 137 | 138 | # Default priority for time_zone inputs. 139 | # config.time_zone_priority = nil 140 | 141 | # Default priority for country inputs. 142 | # config.country_priority = nil 143 | 144 | # When false, do not use translations for labels. 145 | # config.translate_labels = true 146 | 147 | # Automatically discover new inputs in Rails' autoload path. 148 | # config.inputs_discovery = true 149 | 150 | # Cache SimpleForm inputs discovery 151 | # config.cache_discovery = !Rails.env.development? 152 | 153 | # Default class for inputs 154 | # config.input_class = nil 155 | 156 | # Define the default class of the input wrapper of the boolean input. 157 | config.boolean_label_class = 'checkbox' 158 | 159 | # Defines if the default input wrapper class should be included in radio 160 | # collection wrappers. 161 | # config.include_default_input_wrapper_class = true 162 | 163 | # Defines which i18n scope will be used in Simple Form. 164 | # config.i18n_scope = 'simple_form' 165 | end 166 | --------------------------------------------------------------------------------