Currently waiting confirmation for: <%= resource.unconfirmed_email %>
<% end %>
<%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %>
<%= f.input :password_confirmation, required: false %>
<%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %>
<%= f.button :submit, "Update" %>
<% end %>
Cancel my account
Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>
<%= link_to "Back", :back %>
================================================
FILE: app/views/devise/registrations/new.html.haml
================================================
%h3 Sign Up
%div.row
%div.col-lg-8
= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
= f.error_notification
= devise_error_messages!
%table.table.table-bordered{style:'width:57%;'}
%tbody
%tr{style:''}
%th{style:"width:30%;padding-top:10px;padding-left:10px;padding-bottom:10px;"} Name
%td{style:"color:black;width:20%;padding:10px;"}
= f.text_field :full_name, required: true, autofocus: true, label: false, size: 40
%tr
%th{style:"width:30%;padding-top:10px;padding-left:10px;padding-bottom:10px;"} Email
%td{style:"color:black;padding:10px;"}= f.text_field :email, required: true, label: false, size: 40
%tr
%th{style:"width:30%;padding-top:10px;padding-left:10px;padding-bottom:10px;"} Password
%td{style:"color:black;padding:10px;"}= f.password_field :password, required: true, label: false, autocomplete: false, size: 40
%tr
%th{style:"width:30%;padding-top:10px;padding-left:10px;padding-bottom:10px;"} Password Confirmation
%td{style:"color:black;padding:10px;"}= f.password_field :password_confirmation, label: false, required: true, size: 40
%div.row{style:'padding-top:20px;'}
%div.col-lg-6
= f.button :submit, "Submit", :class => "btn btn-primary"
%div.col-lg-3.form-action{style:'padding-top:5px;'}
= render "devise/shared/links"
%div.col-lg-4{style:'padding-top:5px;'}
%div.col-lg-4
%strong Things you need to know:
%ul
%li Registration is required to access challenge information and to allow you to check your challenge solutions.
%li We won't email you or give your email address to others. Other participants will not see your email address in the application interface. If you're super concerned, use a fake email address (just make sure you remember it for today).
%li This app is hosted in a VM, which will be reset at the end of today. So the data within will be destroyed or de-anonymised.
%li{:style => "color:red;"} OBLIGATORY DISCLAIMER: Neither myself (Très Acton), or the Platypus hosts, condone criminal activity. By registering, you agree that you will not interpret the simulation challenges as instructions or suggestions to break any state or federal laws. I'm no legal expert, but "I learned it at a hacker con" is probably not going to be a suitable defence if you break into someone's garage without the proper owner's consent...
================================================
FILE: app/views/devise/sessions/new.html.haml
================================================
%h3 Authenticate
= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
%table.table.table-bordered{style:'width:57%;'}
%tr
%th{style:"width:30%;padding:10px;"} Email
%td{style:"color:black;width:60px;padding:10px;"}= f.text_field :email, required: true, autofocus: true, label: false, size: 40
%tr
%th{style:"width:30%;padding-top:10px;padding-left:10px;padding-bottom:10px;"} Password
%td{style:"color:black;padding:10px;"}=f.password_field :password, required: true, label: false, autocomplete: false, size: 40
%div.row{style:'padding-top:20px;'}
%div.col-lg-4
= f.button :submit, "Submit", :class => "btn btn-primary"
%div.col-lg-3.form-action{style:'padding-top:5px;'}
= render "devise/shared/links"
%div.col-lg-5{style:'padding-top:5px;'}
================================================
FILE: app/views/devise/shared/_links.html.erb
================================================
<%- if controller_name != 'sessions' %>
<%= link_to "Log in", new_session_path(resource_name) %>
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %>
<% end -%>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %>
<% end -%>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
<% end -%>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
<% end -%>
<%- if devise_mapping.omniauthable? %>
<%- resource_class.omniauth_providers.each do |provider| %>
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
<% end -%>
<% end -%>
================================================
FILE: app/views/layouts/_messages.html.haml
================================================
-# Rails flash messages styled for Bootstrap 3.0
- flash.each do |name, msg|
- if msg.is_a?(String)
%div{:class => "alert alert-#{name.to_s == 'notice' ? 'success' : 'danger'}"}
%button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} ×
= content_tag :div, msg, :id => "flash_#{name}"
================================================
FILE: app/views/layouts/_navigation.html.haml
================================================
-# navigation styled for Bootstrap 3.0
%nav.navbar.navbar-default.navbar-fixed-top
%a.nounderline{:href => "/",style:'float:left;padding-right:20px;padding-left:15px;'}
%div{style:'float:left;padding-right:20px;padding-left:15px;'}
%h3.neuro /dspectrum/
%span.right by nullwolf
%button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", :type => "button"}
%span.sr-only Toggle navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
/ %a.navbar-brand{:href => "/", :rel => "/", :title => ""}
%div{style:'float:right;'}
================================================
FILE: app/views/layouts/_navigation_links.html.erb
================================================
<%# add navigation links to this file %>
================================================
FILE: app/views/layouts/application.html.haml
================================================
!!!
%html
%head
= render 'favicon'
%meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"}
%title= content_for?(:title) ? yield(:title) : '/dspectrum/'
= stylesheet_link_tag 'application', media: 'all'
= javascript_include_tag 'bootstrap.min'
= javascript_include_tag 'application'
= csrf_meta_tags
%body
%header
= render 'layouts/navigation'
%main{:role => "main",style:"padding-top:35px;"}
#banner.page-header
.row
.col-lg-4
%br
%br
%br
.col-sm-2
.list-group.table-of-contents.navbar-collapse
-if current_user.present?
%a.list-group-item{:style => "background-color:black;color:white;"}= "Welcome, #{current_user.full_name}"
=link_to("Devices", devices_path, :class => "a list-group-item", :style => "background-color:black;")
=link_to("About", '/about', :class => "a list-group-item", :style => "background-color:black;")
-else
%a.list-group-item{:style => "background-color:black;",:href => new_user_registration_path, :style => "background-color:black;"} Create an account
%a.list-group-item{:style => "background-color:black;",:href => new_session_path('user'), :style => "background-color:black;"} Log in
- if @current_user.present? || current_user.present?
=link_to("Logout", destroy_user_session_path, :method => :delete, :class => "a list-group-item", :style => "background-color:black;")
.col-lg-8.col-md-7.col-sm-6
= render 'layouts/messages'
= yield
================================================
FILE: app/views/layouts/mailer.html.haml
================================================
%hmtl
%body
= yield
================================================
FILE: app/views/layouts/mailer.text.haml
================================================
= yield
================================================
FILE: app/views/profile/edit.html.haml
================================================
%h1 Profile#edit
%p Find me in app/views/profile/edit.html.haml
================================================
FILE: app/views/profile/index.html.haml
================================================
%h1 Profile#index
%p Find me in app/views/profile/index.html.haml
================================================
FILE: app/views/profile/show.html.haml
================================================
- if @myprofile
%table.table.table-bordered.table-hover
%tr
%th{style:'width:20%;'} Name
%td= @profile.full_name
%tr
%th Email Address
%td= "#{@profile.email} - (this is not visible to other users)"
%tr
%th Became a Member
%td= "#{time_ago_in_words(@profile.created_at)} ago"
%tr
%th Sharing your Profile
- my_url = root_url + 'profile/' + @profile.id.to_s
- link = link_to my_url, my_url
%td= "Your profile can be accessed by others at: #{link}".html_safe
%br
%hr
%h4 Submissions - (this is not visible to other users)
- if @submissions.any?
%table.table.table-bordered.table-hover
%tr
%th{style:'width:20%;'} ADB ID
%th.visible-lg.visible-md Title
%th.visible-lg.visible-md Description
%th Status
%th Submitted
%th Interactions
%tr
-@submissions.each do |s|
%tr
%td= s.adb_id
%td.visible-lg.visible-md= s.title
%td.visible-lg.visible-md= s.description
%td= s.status.titleize
%td= "#{time_ago_in_words(s.created_at)} ago"
-if s.advisory_comments.count > 0
%td
= "#{s.advisory_comments.count} - "
= link_to 'View', "/submission/#{s.adb_id}/interactions"
-else
%td= "#{s.advisory_comments.count}"
-else
None
%hr
%h4
Published Advisories
%span.badge{style:"float:right;font-size:16px;"}= @advisories.count
- if @advisories.any?
%table.table.table-striped.table-bordered
%thead
%tr
%th ADB ID
%th Submitted
%th.visible-lg.visible-md Category
%th Title
%th{style:'text-align:center;'} ADBS
%tbody
- @advisories.each do |advisory|
%tr
%td{style:'width:170px;'}= link_to advisory.adb_id,advisory
%td= "#{time_ago_in_words(advisory.created_at)} ago"
%td.visible-lg.visible-md= advisory.category.try(:name)
%td= advisory.title
%td{style:'text-align:center;'}
%p
- if advisory.score
- if advisory.score < 5
%span.label.label-success{style:'font-size:100%;'}= "ADBS: #{advisory.score}"
- if advisory.score >= 5 && advisory.score < 7
%span.label.label-warning{style:'font-size:100%;'}= "ADBS: #{advisory.score}"
- if advisory.score >= 7
%span.label.label-danger{style:'font-size:100%;'}= "ADBS: #{advisory.score}"
/ ADD CVE to model also add notion of production category
- else
None
- else
%h3= @profile.full_name
%table.table.table-bordered.table-hover
%tr
%th{style:'width:20%;'} Name
%td= @profile.full_name
%tr
%th Became a Member
%td= "#{time_ago_in_words(@profile.created_at)} ago"
%hr
%h4
Published Advisories
%span.badge{style:"float:right;font-size:16px;"}= @advisories.count
- if @advisories.any?
%table.table.table-striped.table-bordered
%thead
%tr
%th ADB ID
%th Submitted
%th.visible-lg.visible-md Category
%th Title
%th{style:'text-align:center;'} ADBS
%tbody
- @advisories.each do |advisory|
%tr
%td{style:'width:170px;'}= link_to advisory.adb_id,advisory
%td= "#{time_ago_in_words(advisory.created_at)} ago"
%td.visible-lg.visible-md= advisory.category.try(:name)
%td= advisory.title
%td{style:'text-align:center;'}
%p
- if advisory.score
- if advisory.score < 5
%span.label.label-success{style:'font-size:100%;'}= "ADBS: #{advisory.score}"
- if advisory.score >= 5 && advisory.score < 7
%span.label.label-warning{style:'font-size:100%;'}= "ADBS: #{advisory.score}"
- if advisory.score >= 7
%span.label.label-danger{style:'font-size:100%;'}= "ADBS: #{advisory.score}"
/ ADD CVE to model also add notion of production category
- else
None
================================================
FILE: app/views/section_templates/index.html.haml
================================================
%h1 Listing section_templates
%table
%thead
%tr
%th Name
%th Sections
%th Added by
%th
%th
%th
%tbody
- @section_templates.each do |section_template|
%tr
%td= section_template.name
%td= section_template.sections
%td= section_template.added_by
%td= link_to 'Show', section_template
%td= link_to 'Edit', edit_section_template_path(section_template)
%td= link_to 'Destroy', section_template, :method => :delete, :data => { :confirm => 'Are you sure?' }
%br
= link_to 'New Section template', new_section_template_path
================================================
FILE: app/views/section_templates/show.html.haml
================================================
%p#notice= notice
%p
%b Name:
= @section_template.name
%p
%b Sections:
= @section_template.sections
%p
%b Added by:
= @section_template.added_by
= link_to 'Edit', edit_section_template_path(@section_template)
\|
= link_to 'Back', section_templates_path
================================================
FILE: app/views/sections/_form.html.haml
================================================
= simple_form_for(@section) do |f|
= f.error_notification
/ .form-inputs
/ = f.input :device_id
/ = f.input :name
/ = f.input :notes
/ = f.input :start_pos
/ = f.input :end_pos
/ = f.input :colour
/ .form-actions
/ = f.button :submit
= f.hidden_field :device_id
.form-group
%label.col-lg-2.control-label{:for => "name"} Name
.col-lg-10
= f.input :name, label: false, input_html: { class: 'form-control' }
%br
.form-group
%label.col-lg-2.control-label{:for => "start_pos"} Start Position (bit)
.col-lg-10
= f.input :start_pos, label: false, input_html: { class: 'form-control' }
%br
.form-group
%label.col-lg-2.control-label{:for => "end_pos"} End Position (bit)
.col-lg-10
= f.input :end_pos, label: false, input_html: { class: 'form-control' }
%br
.form-group
%label.col-lg-2.control-label{:for => "notes"} Notes
.col-lg-10
= f.input :notes, label: false, type: 'text-area', input_html: { class: 'form-control textArea', rows: 10 }
%br
.form-group
%label.col-lg-2.control-label{:for => "colour"} Colour
.col-lg-10
- the_options = options_for_select([['gray', 'gray'], ['blue', 'blue'], ['aqua', 'aqua'], ['cadetblue', 'cadetblue'], ['darkblue', 'darkblue'], ['green', 'green'], ['darkgreen', 'darkgreen'], ['red', 'red'], ['darkred', 'darkred'], ['deeppink', 'deeppink'], ['fuchsia', 'fuchsia'], ['indigo', 'indigo'], ['goldenrod', 'goldenrod']],@section.colour)
= f.select :colour, the_options, label: false, input_html: { class: 'form-control' }
%br
%br
.form-group
.col-lg-10.col-lg-offset-2
/-#%button.btn.btn-default{:type => "reset"} Cancel
%button.btn.btn-primary{:type => "submit"} Submit Definition
%br
%br
================================================
FILE: app/views/sections/_manchester_analysis.html.haml
================================================
- if device.units.map(&:captures).flatten.present?
- if device.could_be_manchester?
%div.col-lg-12
%hr
%h4 Manchester Bit Position Analysis Tool
%p The longest binary string is used as the comparison baseline (B) below
%br
/ -`inspectrum`
%table.table.table-hover.table-bordered{style:'background-color:black;'}
- x1 = device.units.map(&:captures).flatten.each
- x = x1.sort_by {|y|y.manchester_decode.scan(/\w/).count}
- baseline = x.last.manchester_decode.scan(/\w/)
- x.each do |xx|
- diff = baseline.count - xx.manchester_decode.scan(/\w/).count
- if diff > 0
- diff.times do |i|
- xx.binary = xx.manchester_decode << 'p'
%thead
%tr
%th
-baseline.flatten.each_with_index do |it,index|
- section_bits = []
- device.sections.each do |section|
-if section.section_range.member? index
- section_bits << index
%th{:style => "color:white;background:#{section.colour}"}= index
-if section_bits.exclude? index
%th{:style => "color:white;"}= index
%tbody
- x.each do |barray|
%tr
%td
= link_to "#{barray.unit.name}: ",barray.unit, :style => "color:#2a9fd6;"
%br
= barray.name
- barray.manchester_decode.scan(/\w/).each_with_index do |b, index|
- if b == baseline[index]
- if b != 'p'
%td.text-success= b
- else
%td
-else
- if b != 'p'
%td.text-danger= b
- else
%td
%td{style:"text-align:center;"} B
-baseline.each do |b|
- if b != 'p'
%td.text-primary= b
- else
%td
%br
/ Taken from line 13 under flatten
/ - device.units.map(&:captures).flatten.each do |c|
/ - c.update_attribute(:binary, c.manchester_decode) if c.binary.blank?
================================================
FILE: app/views/sections/_no_sections.html.haml
================================================
- unless @sections.present?
%div.col-lg-12
%hr
%h4 Sections Defined
/# %p The longest binary string is used as the comparison baseline (B) below
%p No sections have been defined. You can either define your own in the "Define New Section" form (scroll down), or import a section template from the library.
= simple_form_for(:template, url: device_apply_template_path(:deivce_id => @device_id)) do |f|
/-#%button.btn.btn-default{:type => "reset"} Cancel
.col-lg-10
= f.input :template_id, collection: SectionTemplate.all, label: false, input_html: { class: 'form-control' }
%br
.form-group
.col-lg-10.col-lg-offset-0
%button.btn.btn-primary{:type => "submit"} Add sections from template
%br
================================================
FILE: app/views/sections/_pwm_analysis.html.haml
================================================
- if device.units.map(&:captures).flatten.present?
- if device.could_be_pwm?
%div.col-lg-12
%hr
%h4 PWM Bit Position Analysis Tool (66/33) - with Sections
%p The longest binary string is used as the comparison baseline (B) below
%br
/ -`inspectrum`
%table.table.table-hover.table-bordered{style:'background-color:black;'}
- x1 = device.units.map(&:captures).flatten.each
- x = x1.sort_by {|y|y.pwm_decode.scan(/\w/).count}
- baseline = x.last.pwm_decode.scan(/\w/)
- x.each do |xx|
- diff = baseline.count - xx.pwm_decode.scan(/\w/).count
- if diff > 0
- diff.times do |i|
- xx.binary = xx.pwm_decode << 'p'
%thead
%tr
%th
-baseline.flatten.each_with_index do |it,index|
- section_bits = []
- device.sections.each do |section|
-if section.section_range.member? index
- section_bits << index
%th{:style => "color:white;background:#{section.colour}"}= index
-if section_bits.exclude? index
%th{:style => "color:white;"}= index
%tbody
- x.each do |barray|
%tr
%td
= barray.class
%br
= barray.name
- barray.pwm_decode.scan(/\w/).each_with_index do |b, index|
- if b == baseline[index]
- if b != 'p'
%td.text-success= b
- else
%td
-else
- if b != 'p'
%td.text-danger= b
- else
%td
%td{style:"text-align:center;"} B
-baseline.each do |b|
- if b != 'p'
%td.text-primary= b
- else
%td
%br
- if device.could_be_pwm_7525?
%div.col-lg-12
%hr
%h4 PWM Bit Position Analysis Tool (75/25) - with Sections
%p The longest binary string is used as the comparison baseline (B) below
%br
/ -`inspectrum`
%table.table.table-hover.table-bordered{style:'background-color:black;'}
- x1 = device.units.map(&:captures).flatten.each
- x = x1.sort_by {|y|y.pwm_decode_7525.scan(/\w/).count}
- baseline = x.last.pwm_decode_7525.scan(/\w/)
- x.each do |xx|
- diff = baseline.count - xx.pwm_decode_7525.scan(/\w/).count
- if diff > 0
- diff.times do |i|
- xx.binary = xx.pwm_decode_7525 << 'p'
%thead
%tr
%th
-baseline.flatten.each_with_index do |it,index|
- section_bits = []
- device.sections.each do |section|
-if section.section_range.member? index
- section_bits << index
%th{:style => "color:white;background:#{section.colour}"}= index
-if section_bits.exclude? index
%th{:style => "color:white;"}= index
%tbody
- x.each do |barray|
%tr
%td
= barray.unit.name
%br
= barray.name
%br
= "id: #{barray.id}"
- barray.pwm_decode_7525.scan(/\w/).each_with_index do |b, index|
- if b == baseline[index]
- if b != 'p'
%td.text-success= b
- else
%td
-else
- if b != 'p'
%td.text-danger= b
- else
%td
%td{style:"text-align:center;"} B
-baseline.each do |b|
- if b != 'p'
%td.text-primary= b
- else
%td
%br
================================================
FILE: app/views/sections/_raw_analysis.html.haml
================================================
- if device.units.map(&:captures).flatten.any?
- vanilla = true
- if device.could_be_pwm? || device.could_be_pwm_7525? || device.could_be_manchester?
- vanilla = false
- if vanilla
%div.col-lg-12
%hr
%h4 Analysis Helper
%p The longest binary string is used as the comparison baseline (B)
%br
/ -`inspectrum`
%table.table.table-hover.table-bordered{style:'background-color:black;'}
- x1 = device.units.map(&:captures).flatten.each
- device.units.map(&:captures).flatten.each do |c|
- c.update_attribute(:binary, c.original_binary) if c.binary.blank?
- x = x1.sort_by {|y|y.original_binary.scan(/\w/).count}
- baseline = x.last.original_binary.scan(/\w/)
- x.each do |xx|
- diff = baseline.count - xx.original_binary.scan(/\w/).count
- xx.binary = xx.original_binary
- if diff > 0
- diff.times do |i|
- xx.binary = xx.binary << 'p'
%thead
%tr
%th
-baseline.flatten.each_with_index do |it,index|
- section_bits = []
- device.sections.each do |section|
-if section.section_range.member? index
- section_bits << index
%th{:style => "color:white;background:#{section.colour}"}= index
-if section_bits.exclude? index
%th{:style => "color:white;"}= index
%tbody
- x.each do |barray|
%tr
%td
= link_to "#{barray.unit.name}: ",barray.unit, :style => "color:#2a9fd6;"
= barray.name
- barray.binary.scan(/\w/).each_with_index do |b, index|
- if b == baseline[index]
- if b != 'p'
%td.text-success= b
- else
%td
-else
- if b != 'p'
%td.text-danger= b
- else
%td
%td{style:"text-align:center;"} B
-baseline.each do |b|
- if b != 'p'
%td.text-primary= b
- else
%td
%br
================================================
FILE: app/views/sections/_rfcat_config.html.haml
================================================
%p="d.setFreq(#{device.format_frequency})"
%p="d.setMdmDRate(#{device.baudrate})"
%p="d.setMdmModulation(MOD_ASK_OOK)"
%p="d.setMdmSyncMode(0)"
/%p="d.setMaxPower(0)"
%p
================================================
FILE: app/views/sections/_section_transformations.html.haml
================================================
%div.col-lg-12
%hr
%h4 Transformation Scratchpad
/# %p The longest binary string is used as the comparison baseline (B) below
%br
/ -`inspectrum`
- @sections.each do |section|
%h5= section.name
%table.table.table-hover.table-bordered{style:'background-color:black;'}
%thead
%tr
%th{:style => "color:grey;"} Capture
%th{:style => "color:grey;"} Binary
%th{:style => "color:grey;"} Decimal
%th{:style => "color:grey;"} Flipped Decimal
%tbody
- captures.each do |capture|
%tr
%th{style:"background-color:#{section.colour};"}
= capture.unit.name
%br
= capture.name
%br
= "id: #{capture.id}"
%td{:style=>"min-width:200px;"}
- if device.could_be_pwm_7525?
- b=capture.pwm_decode_7525
- elsif device.could_be_pwm?
- b=capture.pwm_decode
- elsif device.could_be_manchester?
- b=capture.manchester_decode
- else
- b=capture.original_binary
- section_binary = b[section.start_pos..section.end_pos]
= section_binary
%td
= section_binary.to_i(2)
%td
= section_binary.gsub("1","one").gsub("0","zero").gsub("zero","1").gsub("one",'0').to_i(2)
%br
================================================
FILE: app/views/sections/_sections.html.haml
================================================
- if @sections.present?
%div.col-lg-12
%hr
%h4
Sections Defined
/# %p The longest binary string is used as the comparison baseline (B) below
%br
/ -`inspectrum`
%table.table.table-hover.table-bordered{style:'background-color:black;'}
%thead
%tr
%th{:style => "color:grey;"} Name
%th{:style => "color:grey;"} Start Position
%th{:style => "color:grey;"} End Position
%th{:style => "color:grey;"} Colour
%th{:style => "color:grey;"} Notes
%th{:style => "color:grey;"}
%tbody
- @sections.each do |section|
%tr
%th{style:"background-color:#{section.colour};"}
= section.name
%td
= section.start_pos
%td
= section.end_pos
%td
= section.colour
%td
= section.notes
%td
= link_to 'Edit', edit_section_path(section), :style => "color:#2a9fd6;"
%br
= link_to 'Destroy', section, :method => :delete, :data => { :confirm => 'Are you sure?' }, :style => "color:red;"
%br
================================================
FILE: app/views/sections/edit.html.haml
================================================
%h1 Editing section
= render 'form'
= link_to 'Show', @section
\|
= link_to 'Back', sections_path
================================================
FILE: app/views/sections/generate.html.haml
================================================
%div.container-fluid
%div.row
%div.col-lg-12
%div.col-lg-12{:style=>" max-width:700px;"}
%h3{:style => "padding-left:3px;"}
Generated Binary
%br
-device = nil
.well.well-lg{:style=>" max-width:700px;"}
%h5 Generation Configuration
- params.to_a.each do |p|
- if p[0].include? "section"
- sect_id = p[0].gsub("section_","")
- s = Section.find(sect_id)
- c = Capture.find(p[1])
- d = device = c.unit.device
%p{:style=>" max-width:500px; word-wrap:break-word;"}
%span= "Section: "
%span{:style=>" color:white;"}= "#{s.name} "
%span= "(bits #{s.start_pos} to #{s.end_pos})"
%span= "from: "
%span{:style=>" color:white;"}= "#{c.unit.name}"
%span= " - "
%span{:style=>" color:white;"}= "#{c.name}"
%br
.well.well-lg{:style=>" max-width:700px;"}
%h4 Original Format
%br
%h5 Binary
-bin = ""
-type = ""
- params.to_a.each do |p|
- if p[0].include? "section"
- sect_id = p[0].gsub("section_","")
- s = Section.find(sect_id)
- c = Capture.find(p[1])
- d = c.unit.device
- device = d
// CHECK MODULATION
- if d.could_be_pwm_7525?
- type = "pwm7525"
- b = c.pwm_decode_7525
- bin << b[s.start_pos..s.end_pos]
- elsif d.could_be_pwm?
- type = "pwm"
- b = c.pwm_decode
- bin << b[s.start_pos..s.end_pos]
- elsif d.could_be_manchester?
- type = "manchester"
- b = c.manchester_decode
- bin << b[s.start_pos..s.end_pos]
- else
- type = "ook"
- b = c.original_binary
- bin << b[s.start_pos..s.end_pos]
%p{:style=>" max-width:500px; word-wrap:break-word;"}=bin
%br
%span="Size: "
%span= bin.size
%span="bits "
%br
%br
.well.well-lg{:style=>" max-width:700px;"}
%h4 OOK Format
%br
%h5 Binary
- ook_bin = ""
// CHECK MODULATION
- if device.flip_pwm
- if type == "pwm7525"
-bin.scan(/./).each do |bit|
- ook_bin << "1000" if bit.to_s == '1'
- ook_bin << "1110" if bit.to_s == '0'
- elsif type == "pwm"
-bin.scan(/./).each do |bit|
- ook_bin << "100" if bit.to_s == '1'
- ook_bin << "110" if bit.to_s == '0'
- elsif type == "manchester"
-bin.scan(/./).each do |bit|
- ook_bin << "01" if bit.to_s == '1'
- ook_bin << "10" if bit.to_s == '0'
- elsif type == "ook"
-ook_bin << bin
- else
- if type == "pwm7525"
-bin.scan(/./).each do |bit|
- ook_bin << "1110" if bit.to_s == '1'
- ook_bin << "1000" if bit.to_s == '0'
- elsif type == "pwm"
-bin.scan(/./).each do |bit|
- ook_bin << "110" if bit.to_s == '1'
- ook_bin << "100" if bit.to_s == '0'
- elsif type == "manchester"
-bin.scan(/./).each do |bit|
- ook_bin << "10" if bit.to_s == '1'
- ook_bin << "01" if bit.to_s == '0'
- elsif type == "ook"
-ook_bin << bin
%p{:style=>" max-width:500px; word-wrap:break-word;"}= ook_bin
%br
%span="Size: "
%span= ook_bin.size
%span="bits "
%br
%br
%hr
%h5 RFCat
=render "rfcat_config", device: device
%p{:style=>" max-width:500px; word-wrap:break-word;"}= "d.RFxmit(\"#{Capture.to_hexcode ook_bin}\")"
%br
%p="# or if you need to repeat the packet:"
%p{:style=>" max-width:500px; word-wrap:break-word;"}= "d.RFxmit(\"\\x00\\x00\\x00\\x00#{Capture.to_hexcode ook_bin}\" * 5)"
%br
-#Vertical text style for TH
-#%th{:style => "color:grey;-webkit-transform: rotate(-90deg);-moz-transform: rotate(-90deg);-ms-transform: rotate(-90deg);-o-transform: rotate(-90deg);filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);color: #FFF;text-transform: uppercase;"} 0
================================================
FILE: app/views/sections/index.html.haml
================================================
%div.container-fluid
%div.row
%div.col-lg-12
%h3
Reverse Engineering Worksheet:
= @device.name
%p A Reverse Engineering Worksheet is built around the concept of sections. A section if portion of the binary that you define to have a particular meaning. E.g. if bits 0-7 represent the "Device ID" then you can define a section to reflect that. The worksheet the binary generates below is based on the modulation and encoding type saved for the device.
%br
%div.col-lg-8
%table.table.table-bordered
%tr
%th.bg-primary{style:"width:15%;"} Name
%td= @device.name
%tr
%th.bg-primary FCC ID
%td= @device.fcc_id
%tr
%th.bg-primary Modulation
%td
= @device.modulation
%tr
%th.bg-primary Encoding
%td= @device.encoding
%tr
%th.bg-primary Frequency
%td
= @device.frequency
= ' Mhz'
%tr
%th.bg-primary Baudrate
%td= @device.baudrate
%tr
%th.bg-primary Decoding Rules
%td= @device.flip_pwm == true ? "Bits flipped after demodulation" : "Bits not flipped (Default State)"
%tr
%th.bg-primary Notes
%td= @device.notes
%div.col-lg-3
.well.well-lg
%h5 Actions
= link_to 'Go Back to Device View', @device, :style => "color:#2a9fd6;"
%br
= link_to 'Edit Device', edit_device_path(@device), :style => "color:#2a9fd6;"
=render "sections", sections: @sections
=render "no_sections", sections: @sections, device: @device
=render "pwm_analysis", device: @device, without_baseline: @without_baseline
=render "manchester_analysis", device: @device, without_baseline: @without_baseline
=render "raw_analysis", device: @device, without_baseline: @without_baseline
%div.col-lg-12
%hr
%h4 Define new section
%p Pick and choose which capture to use as a template for each section and generate the binary. Note for this to work as intended, each bit you want to send should be included in a section definition.
%br
= render 'form'
%div.col-lg-12
%hr
%h4 Generate Binary
%p Pick and choose which captures to use as a template for each defined section and generate the binary for RFCat transmission. Note for this to work as intended, each bit in the table above should be included in a section definition or it won't be represented in the generated string.
%br
= form_tag(generate_path, method: "post") do
- @sections.each_with_index do |section|
.form-group
%label.col-lg-6.control-label{:for => "colour"}= "#{section.name} from:"
.col-lg-10
- captures = []
- @device.captures.each do |c|
- captures << ["#{c.unit.name} - #{c.name}",c.id]
- the_options = options_for_select(captures)
= select_tag "section_#{section.id}", the_options, label: false, input_html: { class: 'form-control' }
%br
%hr
.form-group
.col-lg-10.col-lg-offset-0
%button.btn.btn-primary{:type => "submit"} Generate Binary
%br
%br
=render "section_transformations", device: @device, captures: @device.units.map(&:captures).flatten, without_baseline: @without_baseline
- unless @sections.blank?
%div.col-lg-12.well.well-lg
%h4 Share these sections as a template
%p Reverse engineering something that doesn't exist in our template library? Please consider sharing your section template with us all once you've finished reverse engineering this device.
= simple_form_for(SectionTemplate.new(:added_by => "anonymous")) do |f|
= f.hidden_field :device_id, :value => @device.id
/-#%button.btn.btn-default{:type => "reset"} Cancel
%label.col-lg-10.control-label{:for => "name"} Template Name (please be descriptive, but concise. E.g. "Generic Remote SC226x")
.col-lg-10
= f.input :name, label: false, input_html: { class: 'form-control' }
%br
%label.col-lg-10.control-label{:for => "added_by"} Your Name or Handle (or leave this field unchanged and submit anonymously)
.col-lg-10
= f.input :added_by, label: false, input_html: { class: 'form-control' }
%br
.form-group
.col-lg-10.col-lg-offset-0
%button.btn.btn-primary{:type => "submit"} Share as Template
%br
================================================
FILE: app/views/sections/index.json.jbuilder
================================================
json.array!(@sections) do |section|
json.extract! section, :id, :device_id, :name, :notes, :start_pos, :end_pos, :colour
json.url section_url(section, format: :json)
end
================================================
FILE: app/views/sections/new.html.haml
================================================
%h1 New section
= render 'form'
= link_to 'Back', sections_path
================================================
FILE: app/views/sections/show.html.haml
================================================
%p#notice= notice
%p
%b Device:
= @section.device_id
%p
%b Name:
= @section.name
%p
%b Notes:
= @section.notes
%p
%b Start pos:
= @section.start_pos
%p
%b End pos:
= @section.end_pos
%p
%b Colour:
= @section.colour
= link_to 'Edit', edit_section_path(@section)
\|
= link_to 'Back', sections_path
%div.container-fluid
%div.row
%div.col-lg-12
%h3
Device:
= @device.name
%p A device is effectively a category. It should have at least one unit. If you have multiple units of the same type (e.g. 3 identical garage door remotes), they are best represented as multiple units of the same device.
%br
%div.col-lg-8
%table.table.table-bordered
%tr
%th.bg-primary{style:"width:15%;"} Name
%td= @device.name
%tr
%th.bg-primary FCC ID
%td= @device.fcc_id
%tr
%th.bg-primary Modulation
%td
= @device.modulation
%tr
%th.bg-primary Encoding
%td= @device.encoding
%tr
%th.bg-primary Frequency
%td
= @device.frequency
= ' Mhz'
%tr
%th.bg-primary Baudrate
%td= @device.baudrate
%tr
%th.bg-primary Notes
%td= @device.notes
%div.col-lg-3
.well.well-lg
%h5 Actions
-#= link_to 'Add New Unit', edit_device_path(@device), :style => "color:#2a9fd6;"
-#%br
=link_to 'Edit Device', edit_device_path(@device), :style => "color:#2a9fd6;"
%br
= link_to 'Back to Devices', devices_path, :style => "color:#2a9fd6;"
=render "manchester_analysis", device: @device, without_baseline: @without_baseline
/ =render "manchester_analysis", unit: @unit
=render "pwm_analysis", device: @device, without_baseline: @without_baseline
/ =render "raw_analysis", unit: @unit
/ # change raw so only shows if no encoding
=render "raw_analysis", device: @device, without_baseline: @without_baseline
/ # replace with section add ??????
=render "add_unit", unit: @unit
=render "show_units", device: @device
%br
-#Vertical text style for TH
-#%th{:style => "color:grey;-webkit-transform: rotate(-90deg);-moz-transform: rotate(-90deg);-ms-transform: rotate(-90deg);-o-transform: rotate(-90deg);filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);color: #FFF;text-transform: uppercase;"} 0
================================================
FILE: app/views/sections/show.json.jbuilder
================================================
json.extract! @section, :id, :device_id, :name, :notes, :start_pos, :end_pos, :colour, :created_at, :updated_at
================================================
FILE: app/views/units/_captures.html.haml
================================================
%h4 Captures
%table.table.table-bordered.table.hover
%thead
%tr.bg-primary
%th ID
%th Name
%th Raw Binary
%th Actions
%tbody
- unit.captures.each do |u|
%tr
%td= u.id
%td= u.name
%td{:style=>"max-width:200px; word-wrap:break-word;"}
/ - u.original_binary.scan(/.{1,40}/).each do |s|
/ ="#{s}"
/ %br
= u.original_binary
%td{:style => "width:15%;"}
= link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' }
%div.col-lg-12
================================================
FILE: app/views/units/_form.html.haml
================================================
= simple_form_for(@unit) do |f|
= f.error_notification
= f.hidden_field :device_id
.form-group
%label.col-lg-2.control-label{:for => "inputEmail"} Name
.col-lg-10
= f.input :name, label: false, input_html: { class: 'form-control' }
%br
.form-group
.col-lg-10.col-lg-offset-2
/-#%button.btn.btn-default{:type => "reset"} Cancel
%button.btn.btn-primary{:type => "submit"} Submit
================================================
FILE: app/views/units/_manchester_analysis.html.haml
================================================
- if unit.captures.present?
- if unit.device.could_be_manchester?
%div.col-lg-12
%hr
%h4 Manchester Bit Position Analysis Tool
%p The longest binary string is used as the comparison baseline (B) below
%br
/ -`inspectrum`
%table.table.table-hover.table-bordered{style:'background-color:black;'}
- x1 = unit.captures.each
- x = x1.sort_by {|y|y.manchester_decode.scan(/\w/).count}
- baseline = x.last.manchester_decode.scan(/\w/)
- x.each do |xx|
- diff = baseline.count - xx.manchester_decode.scan(/\w/).count
- if diff > 0
- diff.times do |i|
- xx.binary = xx.manchester_decode << 'p'
%thead
%tr
%th
-baseline.flatten.each_with_index do |it,index|
%th{:style => "color:grey;"}= index
%tbody
- x.each do |barray|
%tr
%td
= barray.name
- barray.manchester_decode.scan(/\w/).each_with_index do |b, index|
- if b == baseline[index]
- if b != 'p'
%td.text-success= b
- else
%td
-else
- if b != 'p'
%td.text-danger= b
- else
%td
%td{style:"text-align:center;"} B
-baseline.each do |b|
- if b != 'p'
%td.text-primary= b
- else
%td
%br
================================================
FILE: app/views/units/_manchester_decoding.html.haml
================================================
%h5 Manchester Encoding
- if manchester_format.blank?
%span{:style => "float:right;"}= link_to "Switch to IEEE 802 Format", '?manchester_format=802', style:"color:#2a9fd6"
%p Defaulting to Manchester format: "G. E. Thomas"
- else
%span{:style => "float:right;"}= link_to "Switch to G. E. Thomas Format", '?', style:"color:#2a9fd6"
%p Showing as Manchester format: "IEE 802"
%table.table.table-bordered.table.hover
%thead
%tr.bg-primary
%th ID
%th Name
%th Valid?
%th Manchester Binary
%th Hex
%th Ascii
%th Actions
%tbody
- unit.captures.each do |u|
%tr
%td= u.id
%td= u.name
%td{:style=>"word-wrap:break-word;"}
- if u.valid_manchester?
%p{:style => "color:green;"}= "#{u.valid_manchester? human=true}"
- else
%p{:style => "color:red;"}= "#{u.valid_manchester? human=true}"
%td
- manchester = (manchester_format.blank? ? manchester = u.manchester_decode : u.flip(u.manchester_decode))
- manchester.scan(/.{1,40}/).each do |s|
="#{s}"
%br
%td{:style=>"word-wrap:break-word;"}="#{u.to_hexcode manchester}"
%td{:style=>"word-wrap:break-word;"}="#{u.bin_to_ascii(manchester)}"
%td{:style => "width:15%;"}
= link_to 'show', u
\|
= link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' }
================================================
FILE: app/views/units/_pwm_analysis.html.haml
================================================
- if unit.captures.present?
- if unit.device.could_be_pwm?
%div.col-lg-12
%hr
%h4 PWM Bit Position Analysis Tool (66/33)
%p The longest binary string is used as the comparison baseline (B) below
%br
/ -`inspectrum`
%table.table.table-hover.table-bordered{style:'background-color:black;'}
- x1 = unit.captures.each
- x = x1.sort_by {|y|y.pwm_decode.scan(/\w/).count}
- baseline = x.last.pwm_decode.scan(/\w/)
- x.each do |xx|
- diff = baseline.count - xx.pwm_decode.scan(/\w/).count
- if diff > 0
- diff.times do |i|
- xx.binary = xx.pwm_decode << 'p'
%thead
%tr
%th
-baseline.flatten.each_with_index do |it,index|
%th{:style => "color:grey;"}= index
%tbody
- x.each do |barray|
%tr
%td
= barray.name
- barray.pwm_decode.scan(/\w/).each_with_index do |b, index|
- if b == baseline[index]
- if b != 'p'
%td.text-success= b
- else
%td
-else
- if b != 'p'
%td.text-danger= b
- else
%td
%td{style:"text-align:center;"} B
-baseline.each do |b|
- if b != 'p'
%td.text-primary= b
- else
%td
%br
- if unit.device.could_be_pwm_7525?
%div.col-lg-12
%hr
%h4 PWM Bit Position Analysis Tool (75/25)
%p The longest binary string is used as the comparison baseline (B) below
%br
/ -`inspectrum`
%table.table.table-hover.table-bordered{style:'background-color:black;'}
- x1 = unit.captures.each
- x = x1.sort_by {|y|y.pwm_decode_7525.scan(/\w/).count}
- baseline = x.last.pwm_decode_7525.scan(/\w/)
- x.each do |xx|
- diff = baseline.count - xx.pwm_decode_7525.scan(/\w/).count
- if diff > 0
- diff.times do |i|
- xx.binary = xx.pwm_decode_7525 << 'p'
%thead
%tr
%th
-baseline.flatten.each_with_index do |it,index|
%th{:style => "color:grey;"}= index
%tbody
- x.each do |barray|
%tr
%td
= barray.name
- barray.pwm_decode_7525.scan(/\w/).each_with_index do |b, index|
- if b == baseline[index]
- if b != 'p'
%td.text-success= b
- else
%td
-else
- if b != 'p'
%td.text-danger= b
- else
%td
%td{style:"text-align:center;"} B
-baseline.each do |b|
- if b != 'p'
%td.text-primary= b
- else
%td
%br
================================================
FILE: app/views/units/_pwm_decoding.html.haml
================================================
%h5 PWM Encoding
- if pwm_format.blank?
%span{:style => "float:right;"}= link_to "Flip bits", '?pwm_format=flipped', style:"color:#2a9fd6"
%p Attempts to decode as PWM 66/33 Format (i.e. a 1 is 110, and a 0 is 100)
- else
%span{:style => "float:right;"}= link_to "Undo flip bits", '?', style:"color:#2a9fd6"
%p Attempts to decode as PWM 66/33 Format, with bits flipped (i.e. a 1 is 100, and a 0 is 110)
%table.table.table-bordered.table.hover
%thead
%tr.bg-primary
%th ID
%th Name
%th Valid?
%th PWM Binary
%th Hex
%th Ascii
%th Actions
%tbody
- unit.captures.each do |u|
%tr
%td= u.id
%td= u.name
%td
- if u.valid_pwm?
%p{:style => "color:green;"}= "#{u.valid_pwm? human=true}"
- else
%p{:style => "color:red;"}= "#{u.valid_pwm? human=true}"
%td{:style=>"word-wrap:break-word;"}
- pwm = (pwm_format.blank? ? u.pwm_decode : u.flip(u.pwm_decode))
- pwm.scan(/.{1,40}/).each do |s|
="#{s}"
%br
%td{:style=>"word-wrap:break-word;"}="#{u.to_hexcode pwm}"
%td{:style=>"word-wrap:break-word;"}="#{u.bin_to_ascii(pwm)}"
%td{:style => "width:15%;"}
= link_to 'show', u
\|
= link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' }
/ # 75/25
%h5 PWM Encoding
- if pwm_format.blank?
%span{:style => "float:right;"}= link_to "Flip bits", '?pwm_format=flipped', style:"color:#2a9fd6"
%p Attempts to decode as PWM 75/25 Format (i.e. a 1 is 1110, and a 0 is 1000)
- else
%span{:style => "float:right;"}= link_to "Undo flip bits", '?', style:"color:#2a9fd6"
%p Attempts to decode as PWM 75/25 Format, with bits flipped (i.e. a 1 is 1000, and a 0 is 1110)
%table.table.table-bordered.table.hover
%thead
%tr.bg-primary
%th ID
%th Name
%th Valid?
%th PWM Binary
%th Hex
%th Ascii
%th Actions
%tbody
- unit.captures.each do |u|
%tr
%td= u.id
%td= u.name
%td
- if u.valid_pwm_7525?
%p{:style => "color:green;"}= "#{u.valid_pwm_7525? human=true}"
- else
%p{:style => "color:red;"}= "#{u.valid_pwm_7525? human=true}"
%td{:style=>"word-wrap:break-word;"}
- pwm = (pwm_format.blank? ? u.pwm_decode_7525 : u.flip(u.pwm_decode_7525))
- pwm.scan(/.{1,40}/).each do |s|
="#{s}"
%br
%td{:style=>"word-wrap:break-word;"}="#{u.to_hexcode pwm}"
%td{:style=>"word-wrap:break-word;"}="#{u.bin_to_ascii(pwm)}"
%td{:style => "width:15%;"}
= link_to 'show', u
\|
= link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' }
================================================
FILE: app/views/units/_raw_analysis.html.haml
================================================
- if unit.captures.present?
%div.col-lg-12
%hr
%h4 Raw Bit Position Analysis Tool
%p The longest binary string is used as the comparison baseline (B) below
%br
/ -`inspectrum`
%table.table.table-hover.table-bordered{style:'background-color:black;'}
- x1 = unit.captures.each
- x = x1.sort_by {|y|y.original_binary.scan(/\w/).count}
- baseline = x.last.original_binary.scan(/\w/)
- x.each do |xx|
- diff = baseline.count - xx.original_binary.scan(/\w/).count
- xx.binary = xx.original_binary
- if diff > 0
- diff.times do |i|
- xx.binary = xx.binary << 'p'
%thead
%tr
%th
-baseline.flatten.each_with_index do |it,index|
%th{:style => "color:grey;"}= index
%tbody
- x.each do |barray|
%tr
%td
= barray.name
- barray.binary.scan(/\w/).each_with_index do |b, index|
- if b == baseline[index]
- if b != 'p'
%td.text-success= b
- else
%td
-else
- if b != 'p'
%td.text-danger= b
- else
%td
%td{style:"text-align:center;"} B
-baseline.each do |b|
- if b != 'p'
%td.text-primary= b
- else
%td
%br
================================================
FILE: app/views/units/_raw_decoding.html.haml
================================================
%h5 Raw (No special encoding)
%table.table.table-bordered.table.hover
%thead
%tr.bg-primary
%th ID
%th Name
%th Raw Binary To Hex
%th Raw Binary To Ascii
%th Actions
%tbody
- unit.captures.each do |u|
%tr
%td= u.id
%td= u.name
%td{:style=>"word-wrap:break-word;"}="#{u.to_hexcode }"
%td{:style=>"word-wrap:break-word;"}="#{u.to_ascii(manchester=false)}"
%td{:style => "width:15%;"}
= link_to 'show', u
\|
= link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' }
================================================
FILE: app/views/units/edit.html.haml
================================================
%h1 Editing unit
= render 'form'
= link_to 'Show', @unit
\|
= link_to 'Back', units_path
================================================
FILE: app/views/units/index.html.haml
================================================
%h1 Listing units
%table
%thead
%tr
%th Device
%th Name
%th Notes
%th
%th
%th
%tbody
- @units.each do |unit|
%tr
%td= unit.device_id
%td= unit.name
%td= unit.notes
%td= link_to 'Show', unit
%td= link_to 'Edit', edit_unit_path(unit)
%td= link_to 'Destroy', unit, :method => :delete, :data => { :confirm => 'Are you sure?' }
%br
= link_to 'New Unit', new_unit_path
================================================
FILE: app/views/units/index.json.jbuilder
================================================
json.array!(@units) do |unit|
json.extract! unit, :id, :device_id, :name, :notes
json.url unit_url(unit, format: :json)
end
================================================
FILE: app/views/units/new.html.haml
================================================
%h1 New unit
= render 'form'
= link_to 'Back', units_path
================================================
FILE: app/views/units/show.html.haml
================================================
%div.container-fluid
%div.row
%div.col-lg-12
%h3
Unit:
= @unit.name
%p
This unit is a
= link_to @unit.device.name, @unit.device, style:"color:#2a9fd6"
%br
%div.col-lg-8
%table.table.table-bordered
%tr
%th.bg-primary{style:"width:25%;"} Name
%td= @unit.name
%tr
%th.bg-primary Device ID
%td= @unit.device.id
%tr
%th.bg-primary Device Name
%td
= @unit.device.name
%tr
%th.bg-primary Notes
%td= @unit.notes
%div.col-lg-3
.well.well-lg
%h5 Actions
= link_to 'Add New Capture' , new_device_unit_capture_path(@unit.device.id, @unit.id), style:"color:#2a9fd6"
%br
= link_to 'Edit Unit', edit_unit_path(@unit), style:"color:#2a9fd6"
%br
= link_to 'View Device', @unit.device, style:"color:#2a9fd6"
%div.col-lg-12
%hr
=render "captures", unit: @unit
%hr
%h4 Automated Demodulation Attempts
%br
=render "raw_decoding", unit: @unit
=render "manchester_decoding", unit: @unit, manchester_format: @manchester_format
=render "pwm_decoding", unit: @unit, pwm_format: @pwm_format
=render "manchester_analysis", unit: @unit
=render "pwm_analysis", unit: @unit
=render "raw_analysis", unit: @unit
= simple_form_for(@unit) do |f|
= f.error_notification
.form-group
%label.col-lg-2.control-label{:for => "notes"} Notes
.col-lg-10
= f.input :notes, label: false, type: 'text-area', input_html: { class: 'form-control textArea', rows: 10 }
%br
.form-group
.col-lg-10.col-lg-offset-2
/-#%button.btn.btn-default{:type => "reset"} Cancel
%button.btn.btn-primary{:type => "submit"} Update
================================================
FILE: app/views/units/show.json.jbuilder
================================================
json.extract! @unit, :id, :device_id, :name, :notes, :created_at, :updated_at
================================================
FILE: bin/bundle
================================================
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
load Gem.bin_path('bundler', 'bundle')
================================================
FILE: bin/rails
================================================
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
require 'rails/commands'
================================================
FILE: bin/rake
================================================
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
Rake.application.run
================================================
FILE: bin/setup
================================================
#!/usr/bin/env ruby
require 'pathname'
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
Dir.chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file:
puts "== Installing dependencies =="
system "gem install bundler --conservative"
system "bundle check || bundle install"
# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# system "cp config/database.yml.sample config/database.yml"
# end
puts "\n== Preparing database =="
system "bin/rake db:setup"
puts "\n== Removing old logs and tempfiles =="
system "rm -f log/*"
system "rm -rf tmp/cache"
puts "\n== Restarting application server =="
system "touch tmp/restart.txt"
end
================================================
FILE: config/application.rb
================================================
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module DspectrumGUI
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
end
end
================================================
FILE: config/boot.rb
================================================
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
================================================
FILE: config/database.yml
================================================
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
================================================
FILE: config/environment.rb
================================================
# Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Rails.application.initialize!
================================================
FILE: config/environments/development.rb
================================================
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
end
================================================
FILE: config/environments/production.rb
================================================
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
end
================================================
FILE: config/environments/test.rb
================================================
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure static file server for tests with Cache-Control for performance.
config.serve_static_files = true
config.static_cache_control = 'public, max-age=3600'
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Randomize the order test cases are executed.
config.active_support.test_order = :random
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
================================================
FILE: config/favicon.json
================================================
{
"master_picture": "public/adb.png",
"favicon_design": {
"ios": {
"picture_aspect": "no_change"
},
"desktop_browser": [
],
"windows": {
"picture_aspect": "no_change",
"background_color": "#da532c",
"on_conflict": "override"
},
"android_chrome": {
"picture_aspect": "no_change",
"theme_color": "#ffffff",
"manifest": {
"name": "AdvisoryDB",
"display": "browser",
"orientation": "not_set",
"on_conflict": "override",
"declared": true
}
},
"safari_pinned_tab": {
"picture_aspect": "black_and_white",
"threshold": 50,
"theme_color": "#5bbad5"
}
},
"settings": {
"scaling_algorithm": "Mitchell",
"error_on_image_too_small": false
}
}
================================================
FILE: config/initializers/action_mailer.rb
================================================
# Be sure to restart your server when you modify this file.
# /config/initializers/action_mailer.rb..
# ActionMailer email configuration
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.zoho.com", #ENV['SMTP_ADDRESS'],
:port => 465, # ENV['SMTP_PORT'],
:domain => Rails.env == 'production' ? "advisorydb.com" : "localhost", # ENV['SMTP_DOMAIN'],
:user_name => "do-not-reply@advisorydb.com", #ENV['SMTP_USERNAME'],
:password => "ActionMailer!", #ENV['SMTP_PASSWORD'],
:authentication => :login,
:enable_starttls_auto => true,
:ssl => true
}
================================================
FILE: config/initializers/assets.rb
================================================
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# Rails.application.config.assets.precompile += %w( search.js )
Rails.application.config.assets.precompile += %w( bootstrap.min.js )
Rails.application.config.assets.precompile += %w( favicon/.* )
================================================
FILE: config/initializers/backtrace_silencers.rb
================================================
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
================================================
FILE: config/initializers/cookies_serializer.rb
================================================
# Be sure to restart your server when you modify this file.
Rails.application.config.action_dispatch.cookies_serializer = :json
================================================
FILE: config/initializers/devise.rb
================================================
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render invalid all existing
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`
# by default. You can change it below and use your own secret key.
# config.secret_key = '27ff1e4ffa3ec01fac4d388cd37ea67780a1fbbd936d7e9ba30ba89f289f55ef8a6914dd77b4ef0e60c2b9365c89950f5ae6d45c058c25da2c7977d2d736d49f'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = 'do-not-reply@advisorydb.com'
# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
require 'devise/orm/active_record'
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
# just :email. You can configure it to use [:username, :subdomain], so for
# authenticating a user, both parameters are required. Remember that those
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
# config.authentication_keys = [:email]
# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
# find_for_authentication method and considered in your model lookup. For instance,
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
# The same considerations mentioned for authentication_keys also apply to request_keys.
# config.request_keys = []
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [:email]
# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [:email]
# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
# given strategies, for example, `config.params_authenticatable = [:database]` will
# enable it only for database (email + password) authentication.
# config.params_authenticatable = true
# Tell if authentication through HTTP Auth is enabled. False by default.
# It can be set to an array that will enable http authentication only for the
# given strategies, for example, `config.http_authenticatable = [:database]` will
# enable it only for database authentication. The supported strategies are:
# :database = Support basic authentication with authentication key + password
# config.http_authenticatable = false
# If 401 status code should be returned for AJAX requests. True by default.
# config.http_authenticatable_on_xhr = true
# The realm used in Http Basic Authentication. 'Application' by default.
# config.http_authentication_realm = 'Application'
# It will change confirmation, password recovery and other workflows
# to behave the same regardless if the e-mail provided was right or wrong.
# Does not affect registerable.
# config.paranoid = true
# By default Devise will store the user in session. You can skip storage for
# particular strategies by setting this option.
# Notice that if you are skipping storage for all authentication paths, you
# may want to disable generating routes to Devise's sessions controller by
# passing skip: :sessions to `devise_for` in your config/routes.rb
config.skip_session_storage = [:http_auth]
# By default, Devise cleans up the CSRF token on authentication to
# avoid CSRF token fixation attacks. This means that, when using AJAX
# requests for sign in and sign up, you need to get a new CSRF token
# from the server. You can disable this option at your own risk.
# config.clean_up_csrf_token_on_authentication = true
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
# using other encryptors, it sets how many times you want the password re-encrypted.
#
# Limiting the stretches to just one in testing will increase the performance of
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
# a value less than 10 in other environments. Note that, for bcrypt (the default
# encryptor), the cost increases exponentially with the number of stretches (e.g.
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
config.stretches = Rails.env.test? ? 1 : 10
# Setup a pepper to generate the encrypted password.
# config.pepper = '675698e6390c4de3dab1e89dda134d42b1b0a840702898ccd2a827db475d43bb91f76276a315c00c5765c1624e378f6e411bae12a3015db2747324323c6a1d2d'
# Send a notification email when the user's password is changed
# config.send_password_change_notification = false
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
# confirming their account. For instance, if set to 2.days, the user will be
# able to access the website for two days without confirming their account,
# access will be blocked just in the third day. Default is 0.days, meaning
# the user cannot access the website without confirming their account.
# config.allow_unconfirmed_access_for = 2.days
# A period that the user is allowed to confirm their account before their
# token becomes invalid. For example, if set to 3.days, the user can confirm
# their account within 3 days after the mail was sent, but on the fourth day
# their account can't be confirmed with the token any more.
# Default is nil, meaning there is no restriction on how long a user can take
# before confirming their account.
# config.confirm_within = 3.days
# If true, requires any email changes to be confirmed (exactly the same way as
# initial account confirmation) to be applied. Requires additional unconfirmed_email
# db field (see migrations). Until confirmed, new email is stored in
# unconfirmed_email column, and copied to email column on successful confirmation.
config.reconfirmable = true
# Defines which key will be used when confirming an account
# config.confirmation_keys = [:email]
# ==> Configuration for :rememberable
# The time the user will be remembered without asking for credentials again.
# config.remember_for = 2.weeks
# Invalidates all the remember me tokens when the user signs out.
config.expire_all_remember_me_on_sign_out = true
# If true, extends the user's remember period when remembered via cookie.
# config.extend_remember_period = false
# Options to be passed to the created cookie. For instance, you can set
# secure: true in order to force SSL only cookies.
# config.rememberable_options = {}
# ==> Configuration for :validatable
# Range for password length.
config.password_length = 8..72
# Email regex used to validate email formats. It simply asserts that
# one (and only one) @ exists in the given string. This is mainly
# to give user feedback and not to assert the e-mail validity.
# config.email_regexp = /\A[^@]+@[^@]+\z/
# ==> Configuration for :timeoutable
# The time you want to timeout the user session without activity. After this
# time the user will be asked for credentials again. Default is 30 minutes.
# config.timeout_in = 30.minutes
# ==> Configuration for :lockable
# Defines which strategy will be used to lock an account.
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
# :none = No lock strategy. You should handle locking by yourself.
# config.lock_strategy = :failed_attempts
# Defines which key will be used when locking and unlocking an account
# config.unlock_keys = [:email]
# Defines which strategy will be used to unlock an account.
# :email = Sends an unlock link to the user email
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
# :both = Enables both strategies
# :none = No unlock strategy. You should handle unlocking by yourself.
# config.unlock_strategy = :both
# Number of authentication tries before locking an account if lock_strategy
# is failed attempts.
# config.maximum_attempts = 20
# Time interval to unlock the account if :time is enabled as unlock_strategy.
# config.unlock_in = 1.hour
# Warn on the last attempt before the account is locked.
# config.last_attempt_warning = true
# ==> Configuration for :recoverable
#
# Defines which key will be used when recovering the password for an account
# config.reset_password_keys = [:email]
# Time interval you can reset your password with a reset password key.
# Don't put a too small interval or your users won't have the time to
# change their passwords.
config.reset_password_within = 6.hours
# When set to false, does not sign a user in automatically after their password is
# reset. Defaults to true, so a user is signed in automatically after a reset.
# config.sign_in_after_reset_password = true
# ==> Configuration for :encryptable
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
# REST_AUTH_SITE_KEY to pepper).
#
# Require the `devise-encryptable` gem when using anything other than bcrypt
# config.encryptor = :sha512
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "users/sessions/new". It's turned off by default because it's slower if you
# are using only default views.
# config.scoped_views = false
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes (usually :user).
# config.default_scope = :user
# Set this configuration to false if you want /users/sign_out to sign out
# only the current scope. By default, Devise signs out all scopes.
# config.sign_out_all_scopes = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
# :html, should redirect to the sign in page when the user does not have
# access, but formats like :xml or :json, should return 401.
#
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists.
#
# The "*/*" below is required to match Internet Explorer requests.
# config.navigational_formats = ['*/*', :html]
# The default HTTP method used to sign out a resource. Default is :delete.
config.sign_out_via = :delete
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
# ==> Warden configuration
# If you want to use other strategies, that are not supported by Devise, or
# change the failure app, you can configure them inside the config.warden block.
#
# config.warden do |manager|
# manager.intercept_401 = false
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# ==> Mountable engine configurations
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
# is mountable, there are some extra configurations to be taken into account.
# The following options are available, assuming the engine is mounted as:
#
# mount MyEngine, at: '/my_engine'
#
# The router that invoked `devise_for`, in the example above, would be:
# config.router_name = :my_engine
#
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
# so you need to do it manually. For the users scope, it would be:
# config.omniauth_path_prefix = '/my_engine/users/auth'
end
================================================
FILE: config/initializers/filter_parameter_logging.rb
================================================
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
================================================
FILE: config/initializers/inflections.rb
================================================
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
================================================
FILE: config/initializers/kaminari.rb
================================================
# config/initializers/kaminari.rb
Kaminari.configure do |config|
config.page_method_name = :per_page_kaminari
end
================================================
FILE: config/initializers/mime_types.rb
================================================
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
================================================
FILE: config/initializers/session_store.rb
================================================
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_advisorydb_session'
================================================
FILE: config/initializers/simple_form.rb
================================================
# Use this setup block to configure all options available in SimpleForm.
SimpleForm.setup do |config|
# Wrappers are used by the form builder to generate a
# complete input. You can remove any component from the
# wrapper, change the order or even add your own to the
# stack. The options given below are used to wrap the
# whole input.
config.wrappers :default, class: :input,
hint_class: :field_with_hint, error_class: :field_with_errors do |b|
## Extensions enabled by default
# Any of these extensions can be disabled for a
# given input by passing: `f.input EXTENSION_NAME => false`.
# You can make any of these extensions optional by
# renaming `b.use` to `b.optional`.
# Determines whether to use HTML5 (:email, :url, ...)
# and required attributes
b.use :html5
# Calculates placeholders automatically from I18n
# You can also pass a string as f.input placeholder: "Placeholder"
b.use :placeholder
## Optional extensions
# They are disabled unless you pass `f.input EXTENSION_NAME => true`
# to the input. If so, they will retrieve the values from the model
# if any exists. If you want to enable any of those
# extensions by default, you can change `b.optional` to `b.use`.
# Calculates maxlength from length validations for string inputs
b.optional :maxlength
# Calculates pattern from format validations for string inputs
b.optional :pattern
# Calculates min and max from length validations for numeric inputs
b.optional :min_max
# Calculates readonly automatically from readonly attributes
b.optional :readonly
## Inputs
b.use :label_input
b.use :hint, wrap_with: { tag: :span, class: :hint }
b.use :error, wrap_with: { tag: :span, class: :error }
## full_messages_for
# If you want to display the full error message for the attribute, you can
# use the component :full_error, like:
#
# b.use :full_error, wrap_with: { tag: :span, class: :error }
end
# The default wrapper to be used by the FormBuilder.
config.default_wrapper = :default
# Define the way to render check boxes / radio buttons with labels.
# Defaults to :nested for bootstrap config.
# inline: input + label
# nested: label > input
config.boolean_style = :nested
# Default class for buttons
config.button_class = 'btn'
# Method used to tidy up errors. Specify any Rails Array method.
# :first lists the first message for each field.
# Use :to_sentence to list all errors for each field.
# config.error_method = :first
# Default tag used for error notification helper.
config.error_notification_tag = :div
# CSS class to add for error notification helper.
config.error_notification_class = 'error_notification'
# ID to add for error notification helper.
# config.error_notification_id = nil
# Series of attempts to detect a default label method for collection.
# config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
# Series of attempts to detect a default value method for collection.
# config.collection_value_methods = [ :id, :to_s ]
# You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
# config.collection_wrapper_tag = nil
# You can define the class to use on all collection wrappers. Defaulting to none.
# config.collection_wrapper_class = nil
# You can wrap each item in a collection of radio/check boxes with a tag,
# defaulting to :span.
# config.item_wrapper_tag = :span
# You can define a class to use in all item wrappers. Defaulting to none.
# config.item_wrapper_class = nil
# How the label text should be generated altogether with the required text.
# config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" }
# You can define the class to use on all labels. Default is nil.
# config.label_class = nil
# You can define the default class to be used on forms. Can be overriden
# with `html: { :class }`. Defaulting to none.
# config.default_form_class = nil
# You can define which elements should obtain additional classes
# config.generate_additional_classes_for = [:wrapper, :label, :input]
# Whether attributes are required by default (or not). Default is true.
# config.required_by_default = true
# Tell browsers whether to use the native HTML5 validations (novalidate form option).
# These validations are enabled in SimpleForm's internal config but disabled by default
# in this configuration, which is recommended due to some quirks from different browsers.
# To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
# change this configuration to true.
config.browser_validations = false
# Collection of methods to detect if a file type was given.
# config.file_methods = [ :mounted_as, :file?, :public_filename ]
# Custom mappings for input types. This should be a hash containing a regexp
# to match as key, and the input type that will be used when the field name
# matches the regexp as value.
# config.input_mappings = { /count/ => :integer }
# Custom wrappers for input types. This should be a hash containing an input
# type as key and the wrapper that will be used for all inputs with specified type.
# config.wrapper_mappings = { string: :prepend }
# Namespaces where SimpleForm should look for custom input classes that
# override default inputs.
# config.custom_inputs_namespaces << "CustomInputs"
# Default priority for time_zone inputs.
# config.time_zone_priority = nil
# Default priority for country inputs.
# config.country_priority = nil
# When false, do not use translations for labels.
# config.translate_labels = true
# Automatically discover new inputs in Rails' autoload path.
# config.inputs_discovery = true
# Cache SimpleForm inputs discovery
# config.cache_discovery = !Rails.env.development?
# Default class for inputs
# config.input_class = nil
# Define the default class of the input wrapper of the boolean input.
config.boolean_label_class = 'checkbox'
# Defines if the default input wrapper class should be included in radio
# collection wrappers.
# config.include_default_input_wrapper_class = true
# Defines which i18n scope will be used in Simple Form.
# config.i18n_scope = 'simple_form'
end
================================================
FILE: config/initializers/wrap_parameters.rb
================================================
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
end
# To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true
# end
================================================
FILE: config/locales/devise.en.yml
================================================
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n
en:
devise:
confirmations:
confirmed: "Your email address has been successfully confirmed."
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
failure:
already_authenticated: "You are already signed in."
inactive: "Your account is not activated yet."
invalid: "Invalid %{authentication_keys} or password."
locked: "Your account is locked."
last_attempt: "You have one more attempt before your account is locked."
not_found_in_database: "Invalid %{authentication_keys} or password."
timeout: "Your session expired. Please sign in again to continue."
unauthenticated: "You need to sign in or sign up before continuing."
unconfirmed: "You have to confirm your email address before continuing."
mailer:
confirmation_instructions:
subject: "Confirmation instructions"
reset_password_instructions:
subject: "Reset password instructions"
unlock_instructions:
subject: "Unlock instructions"
password_change:
subject: "Password Changed"
omniauth_callbacks:
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
success: "Successfully authenticated from %{kind} account."
passwords:
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
updated: "Your password has been changed successfully. You are now signed in."
updated_not_active: "Your password has been changed successfully."
registrations:
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
signed_up: "Welcome! You have signed up successfully."
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
updated: "Your account has been updated successfully."
sessions:
signed_in: "Signed in successfully."
signed_out: "Signed out successfully."
already_signed_out: "Signed out successfully."
unlocks:
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
errors:
messages:
already_confirmed: "was already confirmed, please try signing in"
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
expired: "has expired, please request a new one"
not_found: "not found"
not_locked: "was not locked"
not_saved:
one: "1 error prohibited this %{resource} from being saved:"
other: "%{count} errors prohibited this %{resource} from being saved:"
================================================
FILE: config/locales/en.yml
================================================
# Files in the config/locales directory are used for internationalization
# and are automatically loaded by Rails. If you want to use locales other
# than English, add the necessary files in this directory.
#
# To use the locales, use `I18n.t`:
#
# I18n.t 'hello'
#
# In views, this is aliased to just `t`:
#
# <%= t('hello') %>
#
# To use a different locale, set it with `I18n.locale`:
#
# I18n.locale = :es
#
# This would use the information in config/locales/es.yml.
#
# To learn more, please read the Rails Internationalization guide
# available at http://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"
================================================
FILE: config/locales/simple_form.en.yml
================================================
en:
simple_form:
"yes": 'Yes'
"no": 'No'
required:
text: 'required'
mark: '*'
# You can uncomment the line below if you need to overwrite the whole required html.
# When using html, text and mark won't be used.
# html: '*'
error_notification:
default_message: "Please review the problems below:"
# Examples
# labels:
# defaults:
# password: 'Password'
# user:
# new:
# email: 'E-mail to sign in.'
# edit:
# email: 'E-mail.'
# hints:
# defaults:
# username: 'User name to sign in.'
# password: 'No special characters, please.'
# include_blanks:
# defaults:
# age: 'Rather not say'
# prompts:
# defaults:
# age: 'Select your age'
================================================
FILE: config/locales/social_share_button.en.yml
================================================
en:
social_share_button:
share_to: Share to %{name}
weibo: Sina Weibo
twitter: Twitter
facebook: Facebook
douban: Douban
qq: Qzone
tqq: Tqq
delicious: Delicious
baidu: Baidu.com
kaixin001: Kaixin001.com
renren: Renren.com
google_plus: Google+
google_bookmark: Google Bookmark
tumblr: Tumblr
plurk: Plurk
pinterest: Pinterest
email: Email
================================================
FILE: config/locales/social_share_button.zh-CN.yml
================================================
'zh-CN':
social_share_button:
share_to: 分享到 %{name}
weibo: 新浪微博
twitter: Twitter
facebook: Facebook
douban: 豆瓣
qq: QQ空间
tqq: 腾讯微博
delicious: Delicious
baidu: 百度收藏
kaixin001: 开心网
renren: 人人网
google_plus: Google+
google_bookmark: Google 收藏
tumblr: Tumblr
plurk: Plurk
pinterest: Pinterest
email: Email
================================================
FILE: config/locales/social_share_button.zh-TW.yml
================================================
'zh-TW':
social_share_button:
share_to: 分享到 %{name}
weibo: 新浪微博
twitter: Twitter
facebook: Facebook
douban: 豆瓣
qq: QQ空間
tqq: 腾讯微博
delicious: Delicious
baidu: 百度收藏
kaixin001: 開心網
renren: 人人網
google_plus: Google+
google_bookmark: Google 收藏
tumblr: Tumblr
plurk: 噗浪
pinterest: Pinterest
email: Email
================================================
FILE: config/railscomposer.yml
================================================
# This application was generated with Rails Composer
development:
apps4: rails-devise-roles
announcements: none
dev_webserver: webrick
prod_webserver: puma
database: postgresql
templates: haml
tests: rspec
continuous_testing: guard
frontend: bootstrap3
email: gmail
authentication: devise
devise_modules: invitable
omniauth_provider:
authorization: roles
form_builder: simple_form
pages: about+users
layouts: bare
locale: none
analytics:
deployment:
ban_spiders:
github:
local_env_file: false
quiet_assets: true
better_errors: true
pry: false
rvmrc:
dashboard: upmin
================================================
FILE: config/routes.rb
================================================
Rails.application.routes.draw do
resources :section_templates
resources :sections
resources :captures
resources :devices
resources :devices do
post 'apply_template' => "devices#apply_template"
resources :sections
resources :units do
resources :captures do
post 'shift_left', to: 'captures#shift_left'
post 'shift_right', to: 'captures#shift_right'
end
end
end
resources :units
# resources :challenge_attempts, :except => [:edit, :update, :show, :destroy]
# resources :challenges, :except => [:edit, :update, :destroy]
#
# resources :challenges, :except => [:edit, :update, :destroy] do
# resources :challenge_attempts, :except => [:edit, :update, :show, :destroy]
# end
post 'generate', to: 'sections#generate'
# get 'profiles', to: 'profile#index'
get 'profile', to: 'profile#show'
# get 'profile/:id', to: 'profile#show'
get 'profile/edit'
devise_for :users, :controllers => { registrations: 'registrations' }
get '/about', to: 'dashboard#about'
get '/temp', to: 'dashboard#temp'
get '/contribute', to: 'dashboard#contribute'
root 'devices#index'
end
================================================
FILE: config/secrets.yml
================================================
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.
development:
secret_key_base: c9e2ad75f8cd301df9c4c770ac47579464172d05d88ec7f0c5a050884b321adf843b2f33c3c0776689a8978cbf4f7963bd1d307870423be311ecedba4e191553
test:
secret_key_base: 12759866d8d9b1206451b4f53c65b038140db7acbe1824bdb342ae83a02acdb3b377172e67eea09af9113bd2f9a7daf8634926d8317a6c9d3cb14cc5288919c8
# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
================================================
FILE: config.ru
================================================
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
run Rails.application
================================================
FILE: db/migrate/20160225071956_devise_create_users.rb
================================================
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps null: false
end
add_index :users, :email, unique: true
add_index :users, :reset_password_token, unique: true
# add_index :users, :confirmation_token, unique: true
# add_index :users, :unlock_token, unique: true
end
end
================================================
FILE: db/migrate/20160227015521_add_full_name_to_user.rb
================================================
class AddFullNameToUser < ActiveRecord::Migration
def change
add_column :users, :full_name, :string
end
end
================================================
FILE: db/migrate/20160918060423_create_devices.rb
================================================
class CreateDevices < ActiveRecord::Migration
def change
create_table :devices do |t|
t.string :fcc_id
t.string :baudrate
t.float :frequency
t.string :modulation
t.string :encoding
t.string :name
t.text :notes
t.timestamps null: false
end
end
end
================================================
FILE: db/migrate/20160918060509_create_units.rb
================================================
class CreateUnits < ActiveRecord::Migration
def change
create_table :units do |t|
t.integer :device_id
t.string :name
t.text :notes
t.timestamps null: false
end
end
end
================================================
FILE: db/migrate/20160918060631_create_captures.rb
================================================
class CreateCaptures < ActiveRecord::Migration
def change
create_table :captures do |t|
t.integer :unit_id
t.integer :device_id
t.string :name
t.text :notes
t.text :binary
t.text :original_binary
t.timestamps null: false
end
end
end
================================================
FILE: db/migrate/20170515023720_create_sections.rb
================================================
class CreateSections < ActiveRecord::Migration
def change
create_table :sections do |t|
t.integer :device_id
t.string :name
t.string :notes
t.integer :start_pos
t.integer :end_pos
t.string :colour
t.timestamps null: false
end
end
end
================================================
FILE: db/migrate/20170520033410_add_flip_pwm_to_devices.rb
================================================
class AddFlipPwmToDevices < ActiveRecord::Migration
def change
add_column :devices, :flip_pwm, :boolean
end
end
================================================
FILE: db/migrate/20170525084143_create_section_templates.rb
================================================
class CreateSectionTemplates < ActiveRecord::Migration
def change
create_table :section_templates do |t|
t.string :name
t.text :sections
t.string :added_by
t.timestamps null: false
end
end
end
================================================
FILE: db/schema.rb
================================================
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170525084143) do
create_table "captures", force: :cascade do |t|
t.integer "unit_id"
t.integer "device_id"
t.string "name"
t.text "notes"
t.text "binary"
t.text "original_binary"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "devices", force: :cascade do |t|
t.string "fcc_id"
t.string "baudrate"
t.float "frequency"
t.string "modulation"
t.string "encoding"
t.string "name"
t.text "notes"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "flip_pwm"
end
create_table "section_templates", force: :cascade do |t|
t.string "name"
t.text "sections"
t.string "added_by"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "sections", force: :cascade do |t|
t.integer "device_id"
t.string "name"
t.string "notes"
t.integer "start_pos"
t.integer "end_pos"
t.string "colour"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "units", force: :cascade do |t|
t.integer "device_id"
t.string "name"
t.text "notes"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "full_name"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
================================================
FILE: db/seeds.rb
================================================
u = User.find_or_create_by(:email => "user@example.com") do |user|
user.password = "password"
user.password_confirmation = "password"
user.full_name = "Nameless"
end
puts "Seeded user: #{u.full_name} (#{u.email})"
puts "Seeding Section Template Library"
Dir[File.join(Rails.root, 'db', 'template_seeds', '*.rb')].sort.each { |seed| load seed }
puts "#{SectionTemplate.all.count} templates imported into library"
================================================
FILE: db/template_seeds/user_contributions.rb
================================================
SectionTemplate.find_or_create_by(:name => "Generic Wireless Alarm System") do |st|
st.sections = "name,start_pos,end_pos,colour,notes
Device ID,0,15,indigo,Changes between devices; static across functions. Must be device id. Recommend expressing this as an integer.
Function Code,16,23,darkgreen,Static between devices as long as same button is pressed. Must be the button. Lets call it the function code. Recommend expressing this as an integer.
Packet Terminator,24,24,gray,This bit is always 0 so far. We're just going to assume it's a packet terminator."
st.added_by = 'nullwolf'
end
================================================
FILE: lib/assets/.keep
================================================
================================================
FILE: lib/tasks/.keep
================================================
================================================
FILE: lib/tasks/account_seeds.rake
================================================
namespace :dspectrum do
task :accounts => :environment do
#####
# User
####
puts "[!] Seeding user"
u = User.create!(:email => "user@example.com", :full_name => "some guy", :password => "password", :password_confirmation => "password")
end
end
================================================
FILE: lib/tasks/custom_seed.rake
================================================
# lib/tasks/custom_seed.rake
# rake db:custom_seed
namespace :dspectrum do
task :seed do
puts
puts
puts "[*] Starting Seeds"
puts
puts "[*] Seeding Accounts"
Rake::Task['dspectrum:accounts'].invoke
puts
end
end
================================================
FILE: lib/templates/haml/scaffold/_form.html.haml
================================================
= simple_form_for(@<%= singular_table_name %>) do |f|
= f.error_notification
.form-inputs
<%- attributes.each do |attribute| -%>
= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
<%- end -%>
.form-actions
= f.button :submit
================================================
FILE: public/404.html
================================================
The page you were looking for doesn't exist (404)
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
If you are the application owner check the logs for more information.
================================================
FILE: public/422.html
================================================
The change you wanted was rejected (422)
The change you wanted was rejected.
Maybe you tried to change something you didn't have access to.
If you are the application owner check the logs for more information.
================================================
FILE: public/500.html
================================================
We're sorry, but something went wrong (500)
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
================================================
FILE: public/robots.txt
================================================
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-agent: *
# Disallow: /
================================================
FILE: spec/controllers/captures_controller_spec.rb
================================================
# require 'rails_helper'
# # This spec was generated by rspec-rails when you ran the scaffold generator.
# # It demonstrates how one might use RSpec to specify the controller code that
# # was generated by Rails when you ran the scaffold generator.
# #
# # It assumes that the implementation code is generated by the rails scaffold
# # generator. If you are using any extension libraries to generate different
# # controller code, this generated spec may or may not pass.
# #
# # It only uses APIs available in rails and/or rspec-rails. There are a number
# # of tools you can use to make these specs even more expressive, but we're
# # sticking to rails and rspec-rails APIs to keep things simple and stable.
# #
# # Compared to earlier versions of this generator, there is very limited use of
# # stubs and message expectations in this spec. Stubs are only used when there
# # is no simpler way to get a handle on the object needed for the example.
# # Message expectations are only used when there is no simpler way to specify
# # that an instance is receiving a specific message.
# RSpec.describe CapturesController, type: :controller do
# # This should return the minimal set of attributes required to create a valid
# # Capture. As you add validations to Capture, be sure to
# # adjust the attributes here as well.
# let(:valid_attributes) {
# skip("Add a hash of attributes valid for your model")
# }
# let(:invalid_attributes) {
# skip("Add a hash of attributes invalid for your model")
# }
# # This should return the minimal set of values that should be in the session
# # in order to pass any filters (e.g. authentication) defined in
# # CapturesController. Be sure to keep this updated too.
# let(:valid_session) { {} }
# describe "GET #index" do
# it "assigns all captures as @captures" do
# capture = Capture.create! valid_attributes
# get :index, {}, valid_session
# expect(assigns(:captures)).to eq([capture])
# end
# end
# describe "GET #show" do
# it "assigns the requested capture as @capture" do
# capture = Capture.create! valid_attributes
# get :show, {:id => capture.to_param}, valid_session
# expect(assigns(:capture)).to eq(capture)
# end
# end
# describe "GET #new" do
# it "assigns a new capture as @capture" do
# get :new, {}, valid_session
# expect(assigns(:capture)).to be_a_new(Capture)
# end
# end
# describe "GET #edit" do
# it "assigns the requested capture as @capture" do
# capture = Capture.create! valid_attributes
# get :edit, {:id => capture.to_param}, valid_session
# expect(assigns(:capture)).to eq(capture)
# end
# end
# describe "POST #create" do
# context "with valid params" do
# it "creates a new Capture" do
# expect {
# post :create, {:capture => valid_attributes}, valid_session
# }.to change(Capture, :count).by(1)
# end
# it "assigns a newly created capture as @capture" do
# post :create, {:capture => valid_attributes}, valid_session
# expect(assigns(:capture)).to be_a(Capture)
# expect(assigns(:capture)).to be_persisted
# end
# it "redirects to the created capture" do
# post :create, {:capture => valid_attributes}, valid_session
# expect(response).to redirect_to(Capture.last)
# end
# end
# context "with invalid params" do
# it "assigns a newly created but unsaved capture as @capture" do
# post :create, {:capture => invalid_attributes}, valid_session
# expect(assigns(:capture)).to be_a_new(Capture)
# end
# it "re-renders the 'new' template" do
# post :create, {:capture => invalid_attributes}, valid_session
# expect(response).to render_template("new")
# end
# end
# end
# describe "PUT #update" do
# context "with valid params" do
# let(:new_attributes) {
# skip("Add a hash of attributes valid for your model")
# }
# it "updates the requested capture" do
# capture = Capture.create! valid_attributes
# put :update, {:id => capture.to_param, :capture => new_attributes}, valid_session
# capture.reload
# skip("Add assertions for updated state")
# end
# it "assigns the requested capture as @capture" do
# capture = Capture.create! valid_attributes
# put :update, {:id => capture.to_param, :capture => valid_attributes}, valid_session
# expect(assigns(:capture)).to eq(capture)
# end
# it "redirects to the capture" do
# capture = Capture.create! valid_attributes
# put :update, {:id => capture.to_param, :capture => valid_attributes}, valid_session
# expect(response).to redirect_to(capture)
# end
# end
# context "with invalid params" do
# it "assigns the capture as @capture" do
# capture = Capture.create! valid_attributes
# put :update, {:id => capture.to_param, :capture => invalid_attributes}, valid_session
# expect(assigns(:capture)).to eq(capture)
# end
# it "re-renders the 'edit' template" do
# capture = Capture.create! valid_attributes
# put :update, {:id => capture.to_param, :capture => invalid_attributes}, valid_session
# expect(response).to render_template("edit")
# end
# end
# end
# describe "DELETE #destroy" do
# it "destroys the requested capture" do
# capture = Capture.create! valid_attributes
# expect {
# delete :destroy, {:id => capture.to_param}, valid_session
# }.to change(Capture, :count).by(-1)
# end
# it "redirects to the captures list" do
# capture = Capture.create! valid_attributes
# delete :destroy, {:id => capture.to_param}, valid_session
# expect(response).to redirect_to(captures_url)
# end
# end
# end
================================================
FILE: spec/controllers/devices_controller_spec.rb
================================================
# require 'rails_helper'
# # This spec was generated by rspec-rails when you ran the scaffold generator.
# # It demonstrates how one might use RSpec to specify the controller code that
# # was generated by Rails when you ran the scaffold generator.
# #
# # It assumes that the implementation code is generated by the rails scaffold
# # generator. If you are using any extension libraries to generate different
# # controller code, this generated spec may or may not pass.
# #
# # It only uses APIs available in rails and/or rspec-rails. There are a number
# # of tools you can use to make these specs even more expressive, but we're
# # sticking to rails and rspec-rails APIs to keep things simple and stable.
# #
# # Compared to earlier versions of this generator, there is very limited use of
# # stubs and message expectations in this spec. Stubs are only used when there
# # is no simpler way to get a handle on the object needed for the example.
# # Message expectations are only used when there is no simpler way to specify
# # that an instance is receiving a specific message.
# RSpec.describe DevicesController, type: :controller do
# # This should return the minimal set of attributes required to create a valid
# # Device. As you add validations to Device, be sure to
# # adjust the attributes here as well.
# let(:valid_attributes) {
# skip("Add a hash of attributes valid for your model")
# }
# let(:invalid_attributes) {
# skip("Add a hash of attributes invalid for your model")
# }
# # This should return the minimal set of values that should be in the session
# # in order to pass any filters (e.g. authentication) defined in
# # DevicesController. Be sure to keep this updated too.
# let(:valid_session) { {} }
# describe "GET #index" do
# it "assigns all devices as @devices" do
# device = Device.create! valid_attributes
# get :index, {}, valid_session
# expect(assigns(:devices)).to eq([device])
# end
# end
# describe "GET #show" do
# it "assigns the requested device as @device" do
# device = Device.create! valid_attributes
# get :show, {:id => device.to_param}, valid_session
# expect(assigns(:device)).to eq(device)
# end
# end
# describe "GET #new" do
# it "assigns a new device as @device" do
# get :new, {}, valid_session
# expect(assigns(:device)).to be_a_new(Device)
# end
# end
# describe "GET #edit" do
# it "assigns the requested device as @device" do
# device = Device.create! valid_attributes
# get :edit, {:id => device.to_param}, valid_session
# expect(assigns(:device)).to eq(device)
# end
# end
# describe "POST #create" do
# context "with valid params" do
# it "creates a new Device" do
# expect {
# post :create, {:device => valid_attributes}, valid_session
# }.to change(Device, :count).by(1)
# end
# it "assigns a newly created device as @device" do
# post :create, {:device => valid_attributes}, valid_session
# expect(assigns(:device)).to be_a(Device)
# expect(assigns(:device)).to be_persisted
# end
# it "redirects to the created device" do
# post :create, {:device => valid_attributes}, valid_session
# expect(response).to redirect_to(Device.last)
# end
# end
# context "with invalid params" do
# it "assigns a newly created but unsaved device as @device" do
# post :create, {:device => invalid_attributes}, valid_session
# expect(assigns(:device)).to be_a_new(Device)
# end
# it "re-renders the 'new' template" do
# post :create, {:device => invalid_attributes}, valid_session
# expect(response).to render_template("new")
# end
# end
# end
# describe "PUT #update" do
# context "with valid params" do
# let(:new_attributes) {
# skip("Add a hash of attributes valid for your model")
# }
# it "updates the requested device" do
# device = Device.create! valid_attributes
# put :update, {:id => device.to_param, :device => new_attributes}, valid_session
# device.reload
# skip("Add assertions for updated state")
# end
# it "assigns the requested device as @device" do
# device = Device.create! valid_attributes
# put :update, {:id => device.to_param, :device => valid_attributes}, valid_session
# expect(assigns(:device)).to eq(device)
# end
# it "redirects to the device" do
# device = Device.create! valid_attributes
# put :update, {:id => device.to_param, :device => valid_attributes}, valid_session
# expect(response).to redirect_to(device)
# end
# end
# context "with invalid params" do
# it "assigns the device as @device" do
# device = Device.create! valid_attributes
# put :update, {:id => device.to_param, :device => invalid_attributes}, valid_session
# expect(assigns(:device)).to eq(device)
# end
# it "re-renders the 'edit' template" do
# device = Device.create! valid_attributes
# put :update, {:id => device.to_param, :device => invalid_attributes}, valid_session
# expect(response).to render_template("edit")
# end
# end
# end
# describe "DELETE #destroy" do
# it "destroys the requested device" do
# device = Device.create! valid_attributes
# expect {
# delete :destroy, {:id => device.to_param}, valid_session
# }.to change(Device, :count).by(-1)
# end
# it "redirects to the devices list" do
# device = Device.create! valid_attributes
# delete :destroy, {:id => device.to_param}, valid_session
# expect(response).to redirect_to(devices_url)
# end
# end
# end
================================================
FILE: spec/controllers/section_templates_controller_spec.rb
================================================
# require 'rails_helper'
# # This spec was generated by rspec-rails when you ran the scaffold generator.
# # It demonstrates how one might use RSpec to specify the controller code that
# # was generated by Rails when you ran the scaffold generator.
# #
# # It assumes that the implementation code is generated by the rails scaffold
# # generator. If you are using any extension libraries to generate different
# # controller code, this generated spec may or may not pass.
# #
# # It only uses APIs available in rails and/or rspec-rails. There are a number
# # of tools you can use to make these specs even more expressive, but we're
# # sticking to rails and rspec-rails APIs to keep things simple and stable.
# #
# # Compared to earlier versions of this generator, there is very limited use of
# # stubs and message expectations in this spec. Stubs are only used when there
# # is no simpler way to get a handle on the object needed for the example.
# # Message expectations are only used when there is no simpler way to specify
# # that an instance is receiving a specific message.
# RSpec.describe SectionTemplatesController, type: :controller do
# # This should return the minimal set of attributes required to create a valid
# # SectionTemplate. As you add validations to SectionTemplate, be sure to
# # adjust the attributes here as well.
# let(:valid_attributes) {
# skip("Add a hash of attributes valid for your model")
# }
# let(:invalid_attributes) {
# skip("Add a hash of attributes invalid for your model")
# }
# # This should return the minimal set of values that should be in the session
# # in order to pass any filters (e.g. authentication) defined in
# # SectionTemplatesController. Be sure to keep this updated too.
# let(:valid_session) { {} }
# describe "GET #index" do
# it "assigns all section_templates as @section_templates" do
# section_template = SectionTemplate.create! valid_attributes
# get :index, {}, valid_session
# expect(assigns(:section_templates)).to eq([section_template])
# end
# end
# describe "GET #show" do
# it "assigns the requested section_template as @section_template" do
# section_template = SectionTemplate.create! valid_attributes
# get :show, {:id => section_template.to_param}, valid_session
# expect(assigns(:section_template)).to eq(section_template)
# end
# end
# describe "GET #new" do
# it "assigns a new section_template as @section_template" do
# get :new, {}, valid_session
# expect(assigns(:section_template)).to be_a_new(SectionTemplate)
# end
# end
# describe "GET #edit" do
# it "assigns the requested section_template as @section_template" do
# section_template = SectionTemplate.create! valid_attributes
# get :edit, {:id => section_template.to_param}, valid_session
# expect(assigns(:section_template)).to eq(section_template)
# end
# end
# describe "POST #create" do
# context "with valid params" do
# it "creates a new SectionTemplate" do
# expect {
# post :create, {:section_template => valid_attributes}, valid_session
# }.to change(SectionTemplate, :count).by(1)
# end
# it "assigns a newly created section_template as @section_template" do
# post :create, {:section_template => valid_attributes}, valid_session
# expect(assigns(:section_template)).to be_a(SectionTemplate)
# expect(assigns(:section_template)).to be_persisted
# end
# it "redirects to the created section_template" do
# post :create, {:section_template => valid_attributes}, valid_session
# expect(response).to redirect_to(SectionTemplate.last)
# end
# end
# context "with invalid params" do
# it "assigns a newly created but unsaved section_template as @section_template" do
# post :create, {:section_template => invalid_attributes}, valid_session
# expect(assigns(:section_template)).to be_a_new(SectionTemplate)
# end
# it "re-renders the 'new' template" do
# post :create, {:section_template => invalid_attributes}, valid_session
# expect(response).to render_template("new")
# end
# end
# end
# describe "PUT #update" do
# context "with valid params" do
# let(:new_attributes) {
# skip("Add a hash of attributes valid for your model")
# }
# it "updates the requested section_template" do
# section_template = SectionTemplate.create! valid_attributes
# put :update, {:id => section_template.to_param, :section_template => new_attributes}, valid_session
# section_template.reload
# skip("Add assertions for updated state")
# end
# it "assigns the requested section_template as @section_template" do
# section_template = SectionTemplate.create! valid_attributes
# put :update, {:id => section_template.to_param, :section_template => valid_attributes}, valid_session
# expect(assigns(:section_template)).to eq(section_template)
# end
# it "redirects to the section_template" do
# section_template = SectionTemplate.create! valid_attributes
# put :update, {:id => section_template.to_param, :section_template => valid_attributes}, valid_session
# expect(response).to redirect_to(section_template)
# end
# end
# context "with invalid params" do
# it "assigns the section_template as @section_template" do
# section_template = SectionTemplate.create! valid_attributes
# put :update, {:id => section_template.to_param, :section_template => invalid_attributes}, valid_session
# expect(assigns(:section_template)).to eq(section_template)
# end
# it "re-renders the 'edit' template" do
# section_template = SectionTemplate.create! valid_attributes
# put :update, {:id => section_template.to_param, :section_template => invalid_attributes}, valid_session
# expect(response).to render_template("edit")
# end
# end
# end
# describe "DELETE #destroy" do
# it "destroys the requested section_template" do
# section_template = SectionTemplate.create! valid_attributes
# expect {
# delete :destroy, {:id => section_template.to_param}, valid_session
# }.to change(SectionTemplate, :count).by(-1)
# end
# it "redirects to the section_templates list" do
# section_template = SectionTemplate.create! valid_attributes
# delete :destroy, {:id => section_template.to_param}, valid_session
# expect(response).to redirect_to(section_templates_url)
# end
# end
# end
================================================
FILE: spec/controllers/sections_controller_spec.rb
================================================
# require 'rails_helper'
# # This spec was generated by rspec-rails when you ran the scaffold generator.
# # It demonstrates how one might use RSpec to specify the controller code that
# # was generated by Rails when you ran the scaffold generator.
# #
# # It assumes that the implementation code is generated by the rails scaffold
# # generator. If you are using any extension libraries to generate different
# # controller code, this generated spec may or may not pass.
# #
# # It only uses APIs available in rails and/or rspec-rails. There are a number
# # of tools you can use to make these specs even more expressive, but we're
# # sticking to rails and rspec-rails APIs to keep things simple and stable.
# #
# # Compared to earlier versions of this generator, there is very limited use of
# # stubs and message expectations in this spec. Stubs are only used when there
# # is no simpler way to get a handle on the object needed for the example.
# # Message expectations are only used when there is no simpler way to specify
# # that an instance is receiving a specific message.
# RSpec.describe SectionsController, type: :controller do
# # This should return the minimal set of attributes required to create a valid
# # Section. As you add validations to Section, be sure to
# # adjust the attributes here as well.
# let(:valid_attributes) {
# skip("Add a hash of attributes valid for your model")
# }
# let(:invalid_attributes) {
# skip("Add a hash of attributes invalid for your model")
# }
# # This should return the minimal set of values that should be in the session
# # in order to pass any filters (e.g. authentication) defined in
# # SectionsController. Be sure to keep this updated too.
# let(:valid_session) { {} }
# describe "GET #index" do
# it "assigns all sections as @sections" do
# section = Section.create! valid_attributes
# get :index, {}, valid_session
# expect(assigns(:sections)).to eq([section])
# end
# end
# describe "GET #show" do
# it "assigns the requested section as @section" do
# section = Section.create! valid_attributes
# get :show, {:id => section.to_param}, valid_session
# expect(assigns(:section)).to eq(section)
# end
# end
# describe "GET #new" do
# it "assigns a new section as @section" do
# get :new, {}, valid_session
# expect(assigns(:section)).to be_a_new(Section)
# end
# end
# describe "GET #edit" do
# it "assigns the requested section as @section" do
# section = Section.create! valid_attributes
# get :edit, {:id => section.to_param}, valid_session
# expect(assigns(:section)).to eq(section)
# end
# end
# describe "POST #create" do
# context "with valid params" do
# it "creates a new Section" do
# expect {
# post :create, {:section => valid_attributes}, valid_session
# }.to change(Section, :count).by(1)
# end
# it "assigns a newly created section as @section" do
# post :create, {:section => valid_attributes}, valid_session
# expect(assigns(:section)).to be_a(Section)
# expect(assigns(:section)).to be_persisted
# end
# it "redirects to the created section" do
# post :create, {:section => valid_attributes}, valid_session
# expect(response).to redirect_to(Section.last)
# end
# end
# context "with invalid params" do
# it "assigns a newly created but unsaved section as @section" do
# post :create, {:section => invalid_attributes}, valid_session
# expect(assigns(:section)).to be_a_new(Section)
# end
# it "re-renders the 'new' template" do
# post :create, {:section => invalid_attributes}, valid_session
# expect(response).to render_template("new")
# end
# end
# end
# describe "PUT #update" do
# context "with valid params" do
# let(:new_attributes) {
# skip("Add a hash of attributes valid for your model")
# }
# it "updates the requested section" do
# section = Section.create! valid_attributes
# put :update, {:id => section.to_param, :section => new_attributes}, valid_session
# section.reload
# skip("Add assertions for updated state")
# end
# it "assigns the requested section as @section" do
# section = Section.create! valid_attributes
# put :update, {:id => section.to_param, :section => valid_attributes}, valid_session
# expect(assigns(:section)).to eq(section)
# end
# it "redirects to the section" do
# section = Section.create! valid_attributes
# put :update, {:id => section.to_param, :section => valid_attributes}, valid_session
# expect(response).to redirect_to(section)
# end
# end
# context "with invalid params" do
# it "assigns the section as @section" do
# section = Section.create! valid_attributes
# put :update, {:id => section.to_param, :section => invalid_attributes}, valid_session
# expect(assigns(:section)).to eq(section)
# end
# it "re-renders the 'edit' template" do
# section = Section.create! valid_attributes
# put :update, {:id => section.to_param, :section => invalid_attributes}, valid_session
# expect(response).to render_template("edit")
# end
# end
# end
# describe "DELETE #destroy" do
# it "destroys the requested section" do
# section = Section.create! valid_attributes
# expect {
# delete :destroy, {:id => section.to_param}, valid_session
# }.to change(Section, :count).by(-1)
# end
# it "redirects to the sections list" do
# section = Section.create! valid_attributes
# delete :destroy, {:id => section.to_param}, valid_session
# expect(response).to redirect_to(sections_url)
# end
# end
# end
================================================
FILE: spec/controllers/units_controller_spec.rb
================================================
# require 'rails_helper'
# # This spec was generated by rspec-rails when you ran the scaffold generator.
# # It demonstrates how one might use RSpec to specify the controller code that
# # was generated by Rails when you ran the scaffold generator.
# #
# # It assumes that the implementation code is generated by the rails scaffold
# # generator. If you are using any extension libraries to generate different
# # controller code, this generated spec may or may not pass.
# #
# # It only uses APIs available in rails and/or rspec-rails. There are a number
# # of tools you can use to make these specs even more expressive, but we're
# # sticking to rails and rspec-rails APIs to keep things simple and stable.
# #
# # Compared to earlier versions of this generator, there is very limited use of
# # stubs and message expectations in this spec. Stubs are only used when there
# # is no simpler way to get a handle on the object needed for the example.
# # Message expectations are only used when there is no simpler way to specify
# # that an instance is receiving a specific message.
# RSpec.describe UnitsController, type: :controller do
# # This should return the minimal set of attributes required to create a valid
# # Unit. As you add validations to Unit, be sure to
# # adjust the attributes here as well.
# let(:valid_attributes) {
# skip("Add a hash of attributes valid for your model")
# }
# let(:invalid_attributes) {
# skip("Add a hash of attributes invalid for your model")
# }
# # This should return the minimal set of values that should be in the session
# # in order to pass any filters (e.g. authentication) defined in
# # UnitsController. Be sure to keep this updated too.
# let(:valid_session) { {} }
# describe "GET #index" do
# it "assigns all units as @units" do
# unit = Unit.create! valid_attributes
# get :index, {}, valid_session
# expect(assigns(:units)).to eq([unit])
# end
# end
# describe "GET #show" do
# it "assigns the requested unit as @unit" do
# unit = Unit.create! valid_attributes
# get :show, {:id => unit.to_param}, valid_session
# expect(assigns(:unit)).to eq(unit)
# end
# end
# describe "GET #new" do
# it "assigns a new unit as @unit" do
# get :new, {}, valid_session
# expect(assigns(:unit)).to be_a_new(Unit)
# end
# end
# describe "GET #edit" do
# it "assigns the requested unit as @unit" do
# unit = Unit.create! valid_attributes
# get :edit, {:id => unit.to_param}, valid_session
# expect(assigns(:unit)).to eq(unit)
# end
# end
# describe "POST #create" do
# context "with valid params" do
# it "creates a new Unit" do
# expect {
# post :create, {:unit => valid_attributes}, valid_session
# }.to change(Unit, :count).by(1)
# end
# it "assigns a newly created unit as @unit" do
# post :create, {:unit => valid_attributes}, valid_session
# expect(assigns(:unit)).to be_a(Unit)
# expect(assigns(:unit)).to be_persisted
# end
# it "redirects to the created unit" do
# post :create, {:unit => valid_attributes}, valid_session
# expect(response).to redirect_to(Unit.last)
# end
# end
# context "with invalid params" do
# it "assigns a newly created but unsaved unit as @unit" do
# post :create, {:unit => invalid_attributes}, valid_session
# expect(assigns(:unit)).to be_a_new(Unit)
# end
# it "re-renders the 'new' template" do
# post :create, {:unit => invalid_attributes}, valid_session
# expect(response).to render_template("new")
# end
# end
# end
# describe "PUT #update" do
# context "with valid params" do
# let(:new_attributes) {
# skip("Add a hash of attributes valid for your model")
# }
# it "updates the requested unit" do
# unit = Unit.create! valid_attributes
# put :update, {:id => unit.to_param, :unit => new_attributes}, valid_session
# unit.reload
# skip("Add assertions for updated state")
# end
# it "assigns the requested unit as @unit" do
# unit = Unit.create! valid_attributes
# put :update, {:id => unit.to_param, :unit => valid_attributes}, valid_session
# expect(assigns(:unit)).to eq(unit)
# end
# it "redirects to the unit" do
# unit = Unit.create! valid_attributes
# put :update, {:id => unit.to_param, :unit => valid_attributes}, valid_session
# expect(response).to redirect_to(unit)
# end
# end
# context "with invalid params" do
# it "assigns the unit as @unit" do
# unit = Unit.create! valid_attributes
# put :update, {:id => unit.to_param, :unit => invalid_attributes}, valid_session
# expect(assigns(:unit)).to eq(unit)
# end
# it "re-renders the 'edit' template" do
# unit = Unit.create! valid_attributes
# put :update, {:id => unit.to_param, :unit => invalid_attributes}, valid_session
# expect(response).to render_template("edit")
# end
# end
# end
# describe "DELETE #destroy" do
# it "destroys the requested unit" do
# unit = Unit.create! valid_attributes
# expect {
# delete :destroy, {:id => unit.to_param}, valid_session
# }.to change(Unit, :count).by(-1)
# end
# it "redirects to the units list" do
# unit = Unit.create! valid_attributes
# delete :destroy, {:id => unit.to_param}, valid_session
# expect(response).to redirect_to(units_url)
# end
# end
# end
================================================
FILE: spec/factories/captures.rb
================================================
FactoryGirl.define do
factory :capture do
unit_id 1
device_id 1
name "MyString"
notes "MyText"
binary "MyText"
original_binary "MyText"
end
end
================================================
FILE: spec/factories/devices.rb
================================================
FactoryGirl.define do
factory :device do
fcc_id "MyString"
baudrate "MyString"
frequency 1.5
modulation "MyString"
encoding "MyString"
name "MyString"
notes "MyText"
end
end
================================================
FILE: spec/factories/section_templates.rb
================================================
FactoryGirl.define do
factory :section_template do
name "MyString"
sections "MyText"
added_by "MyString"
end
end
================================================
FILE: spec/factories/sections.rb
================================================
FactoryGirl.define do
factory :section do
device_id 1
name "MyString"
notes "MyString"
start_pos 1
end_pos 1
colour "MyString"
end
end
================================================
FILE: spec/factories/units.rb
================================================
FactoryGirl.define do
factory :unit do
device_id 1
name "MyString"
notes "MyText"
end
end
================================================
FILE: spec/helpers/captures_helper_spec.rb
================================================
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the CapturesHelper. For example:
#
# describe CapturesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe CapturesHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
================================================
FILE: spec/helpers/devices_helper_spec.rb
================================================
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the DevicesHelper. For example:
#
# describe DevicesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe DevicesHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
================================================
FILE: spec/helpers/section_templates_helper_spec.rb
================================================
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the SectionTemplatesHelper. For example:
#
# describe SectionTemplatesHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe SectionTemplatesHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
================================================
FILE: spec/helpers/sections_helper_spec.rb
================================================
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the SectionsHelper. For example:
#
# describe SectionsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe SectionsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
================================================
FILE: spec/helpers/units_helper_spec.rb
================================================
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the UnitsHelper. For example:
#
# describe UnitsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe UnitsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
================================================
FILE: spec/models/capture_spec.rb
================================================
require 'rails_helper'
RSpec.describe Capture, type: :model do
subject { described_class.new }
######################
# General
######################
it "flips the binary" do
expect(subject.flip("1111000011110000")).to eq("0000111100001111")
end
it "transforms binary to hexcode"
it "transforms arbitrarily supplied binary to hexcode"
it "transforms binary to ascii"
it "transforms arbitrarily supplied binary to ascii"
describe "Associations" do
it { should belong_to(:device) }
it { should belong_to(:unit) }
end
######################
# PWM 6633
######################
describe "Invalid PWM 66/33" do
subject { described_class.new(binary: "1100100011001000",original_binary: "1100100011001000") }
it "is reported as invalid" do
expect(subject.valid_pwm?).to eq(false)
end
end
describe "Valid PWM 66/33" do
let(:device) { Device.create(name: "name") }
let(:unit) { Unit.create(name: "name", device_id: device.id) }
subject { described_class.new(binary: "110100110100",original_binary: "110100110100", device_id: device.id, unit_id: unit.id) }
it "is reported as valid" do
expect(subject.valid_pwm?).to eq(true)
end
it "decodes PWM 66/33" do
expect(subject.pwm_decode).to eq("1010")
end
end
describe "Incomplete PWM 66/33" do
subject { described_class.new(binary: "1101001101",original_binary: "1101001101") }
it "is padded with 0s and saved" do
expect(subject.valid_pwm?).to eq(true)
end
end
describe "Incomplete PWM 66/33" do
subject { described_class.new(binary: "1101001101",original_binary: "1101001101") }
it "is padded with 0s and saved with message for human on first reload" do
expect(subject.valid_pwm?(true)).to eq("This was valid PWM but significant whitespace at the end was missed by you. I have added 0s to the end and saved the change.")
end
end
describe "Incomplete PWM 66/33" do
subject { described_class.new(binary: "1101001101",original_binary: "1101001101") }
it "should return as valid on second reload" do
subject.valid_pwm?(true)
expect(subject.valid_pwm?(true)).to eq("Yes")
end
end
describe "Shifted Dr Nick Edge case PWM 66/33" do
subject { described_class.new(binary: "0110100110100",original_binary: "0110100110100") }
it "should detect and correct shift" do
expect(subject.valid_pwm?(true)).to eq("This is likely to be a PWM capture but there was an unexpected '0' at the beginning which suggests the last cell was also chopped off. It is STRONGLY recommended that you re-create this capture but this time start one cell later, and add an extra cell at the end even if it is empty. This is an edge-case that seems to occur rarely with rtl-sdr captures. We don't know why exactly.")
end
end
######################
# PWM 7725
######################
describe "Invalid PWM 75/25" do
subject { described_class.new(binary: "110100110100",original_binary: "110100110100") }
it "is reported as invalid" do
expect(subject.valid_pwm_7525?).to eq(false)
end
end
describe "Valid PWM 75/25" do
let(:device) { Device.create(name: "name") }
let(:unit) { Unit.create(name: "name", device_id: device.id) }
subject { described_class.new(binary: "1110100011101000",original_binary: "1110100011101000", device_id: device.id, unit_id: unit.id) }
it "is reported as valid" do
expect(subject.valid_pwm_7525?).to eq(true)
end
it "decodes PWM 75/25" do
expect(subject.pwm_decode_7525).to eq("1010")
end
end
describe "Incomplete PWM 75/25" do
subject { described_class.new(binary: "11101000111010",original_binary: "11101000111010") }
it "is padded with 0s and saved" do
expect(subject.valid_pwm_7525?).to eq(true)
end
end
describe "Incomplete PWM 75/25" do
subject { described_class.new(binary: "11101000111010",original_binary: "11101000111010") }
it "is padded with 0s and saved with message for human on first reload" do
expect(subject.valid_pwm_7525?(true)).to eq("This was valid PWM but significant whitespace at the end was missed by you. I have added 0s to the end and saved the change.")
end
end
describe "Incomplete PWM 75/25" do
subject { described_class.new(binary: "11101000111010",original_binary: "11101000111010") }
it "should return as valid on second reload" do
subject.valid_pwm_7525?(true)
expect(subject.valid_pwm_7525?(true)).to eq("Yes")
end
end
describe "Shifted Dr Nick Edge case PWM 75/25" do
subject { described_class.new(binary: "01000111010001110",original_binary: "01000111010001110") }
it "should detect and correct shift" do
expect(subject.valid_pwm_7525?(true)).to eq("This is likely to be a PWM capture but there was an unexpected '0' at the beginning which suggests the last cell was also chopped off. It is STRONGLY recommended that you re-create this capture but this time start one cell later, and add an extra cell at the end even if it is empty. This is an edge-case that seems to occur rarely with rtl-sdr captures. We don't know why exactly.")
end
end
######################
# Manchester
######################
describe "well-aligned, valid, manchester" do
subject { described_class.new(binary: "1010010110100101",original_binary: "1010010110100101") }
it "is reported as valid" do
expect(subject.valid_manchester?).to eq(true)
end
end
describe "off-by-one/poorly aligned, valid, manchester" do
subject { described_class.new(binary: "101011001101001",original_binary: "101011001101001") }
it "is reported as valid" do
expect(subject.valid_manchester?(true)).to eq("\n If you add a 0 at the start it is... re-capture the signal with an empty cell at the beginning")
end
end
describe "manchester" do
subject { described_class.new(binary: "1010010110100101",original_binary: "1010010110100101") }
it "is decoded" do
expect(subject.manchester_decode).to eq("11001100")
end
end
end
================================================
FILE: spec/models/device_spec.rb
================================================
require 'rails_helper'
RSpec.describe Device, type: :model do
######################
# General
######################
describe "Associations" do
it { should have_many(:units) }
it { should have_many(:captures) }
it { should have_many(:sections) }
end
describe "format frequency" do
subject { described_class.create(name:'device name', frequency: 433.0) }
it "correctly formats 433 mhz" do
expect(subject.format_frequency).to eq("433000000")
end
end
describe "format frequency" do
subject { described_class.create(name:'device name', frequency: 1433.0) }
it "correctly formats 1.433 ghz" do
expect(subject.format_frequency).to eq("1433000000")
end
end
describe "format frequency" do
subject { described_class.create(name:'device name', frequency: 43.0) }
it "correctly formats 43 mhz" do
expect(subject.format_frequency).to eq("43000000")
end
end
describe "sharing templates" do
subject { described_class.create(name:'device name') }
it "correctly exports sections as csv" do
section = Section.create(name: "name", start_pos: 0, end_pos: 15, colour: 'blue', notes: 'none', device_id: subject.id)
subject.sections_to_csv('template','nobody')
expect(`cat #{Rails.root.join('mcs', 'contribution.md').to_s}`).to eq("```ruby\nSectionTemplate.find_or_create_by(:name => \"template\") do |st|\n st.sections = \"name,start_pos,end_pos,colour,notes\nname,0,15,blue,none\n\" \n st.added_by = 'nobody' \nend\n```\n")
end
end
######################
# Update Modulation
######################
describe "update modulation" do
subject { described_class.create(name:'device name') }
it "correctly updates as PWM 6633" do
unit = Unit.create(name: "name", device_id: subject.id)
capture = Capture.create(binary: "110100100",original_binary: "110100100", name: "name", device_id: subject.id, unit_id: unit.id)
subject.update_modulation
expect(subject.modulation).to eq("PWM")
expect(subject.encoding).to eq("66/33")
end
end
describe "update modulation" do
subject { described_class.create(name:'device name') }
it "correctly updates as PWM 7525" do
unit = Unit.create(name: "name", device_id: subject.id)
capture = Capture.create(binary: "1110100011101000",original_binary: "1110100011101000", name: "name", device_id: subject.id, unit_id: unit.id)
subject.update_modulation
expect(subject.modulation).to eq("PWM")
expect(subject.encoding).to eq("75/25")
end
end
describe "update modulation" do
subject { described_class.create(name:'device name') }
it "correctly updates as Manchester" do
unit = Unit.create(name: "name", device_id: subject.id)
capture = Capture.create(binary: "10100101",original_binary: "10100101", name: "name", device_id: subject.id, unit_id: unit.id)
subject.update_modulation
expect(subject.modulation).to eq("OOK")
expect(subject.encoding).to eq("Manchester")
end
end
describe "update modulation" do
subject { described_class.create(name:'device name') }
it "correctly updates as OOK if nothing else" do
unit = Unit.create(name: "name", device_id: subject.id)
capture = Capture.create(binary: "1111001010111",original_binary: "1111001010111", name: "name", device_id: subject.id, unit_id: unit.id)
subject.update_modulation
expect(subject.modulation).to eq("OOK")
expect(subject.encoding).to eq("n/a")
end
end
describe "update modulation" do
subject { described_class.create(name:'device name', modulation: "OOK", encoding: "n/a") }
it "is run if encoding and modulation match our OOK update" do
unit = Unit.create(name: "name", device_id: subject.id)
capture = Capture.create(binary: "10100101",original_binary: "10100101", name: "name", device_id: subject.id, unit_id: unit.id)
subject.update_modulation
expect(subject.modulation).to eq("OOK")
expect(subject.encoding).to eq("Manchester")
end
end
describe "update modulation" do
subject { described_class.create(name:'device name', modulation: "ASK", encoding: "Foobar") }
it "should not run if encoding and modulation are custom" do
unit = Unit.create(name: "name", device_id: subject.id)
capture = Capture.create(binary: "10100101",original_binary: "10100101", name: "name", device_id: subject.id, unit_id: unit.id)
subject.update_modulation
expect(subject.modulation).to eq("ASK")
expect(subject.encoding).to eq("Foobar")
end
end
end
================================================
FILE: spec/models/section_spec.rb
================================================
require 'rails_helper'
RSpec.describe Section, type: :model do
describe "Associations" do
it { should belong_to(:device) }
end
describe "section range" do
subject { described_class.create(name:'section name', start_pos: 0, end_pos: 16) }
it "correctly returns range object" do
expect(subject.section_range).to eq(0..16)
end
end
end
================================================
FILE: spec/models/section_template_spec.rb
================================================
require 'rails_helper'
RSpec.describe SectionTemplate, type: :model do
#pending "add some examples to (or delete) #{__FILE__}"
end
================================================
FILE: spec/models/unit_spec.rb
================================================
require 'rails_helper'
RSpec.describe Unit, type: :model do
#pending "add some examples to (or delete) #{__FILE__}"
end
================================================
FILE: spec/rails_helper.rb
================================================
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'spec_helper'
require 'rspec/rails'
# Add additional requires below this line. Rails is not loaded until this point!
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
#
# The following line is provided for convenience purposes. It has the downside
# of increasing the boot-up time by auto-requiring all files in the support
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
# Checks for pending migration and applies them before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
# Filter lines from Rails gems in backtraces.
config.filter_rails_from_backtrace!
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")
end
================================================
FILE: spec/requests/captures_spec.rb
================================================
require 'rails_helper'
RSpec.describe "Captures", type: :request do
describe "GET /captures without authenticating" do
it "redirects the user" do
get captures_path
expect(response).to have_http_status(302)
end
end
end
================================================
FILE: spec/requests/devices_spec.rb
================================================
require 'rails_helper'
RSpec.describe "Devices", type: :request do
describe "GET /devices without authenticating" do
it "redirects the user" do
get devices_path
expect(response).to have_http_status(302)
end
end
end
================================================
FILE: spec/requests/section_templates_spec.rb
================================================
require 'rails_helper'
RSpec.describe "SectionTemplates", type: :request do
describe "GET /section_templates without authenticating" do
it "redirects the user" do
get section_templates_path
expect(response).to have_http_status(302)
end
end
end
================================================
FILE: spec/requests/sections_spec.rb
================================================
require 'rails_helper'
RSpec.describe "Sections", type: :request do
describe "GET /sections without authenticating" do
it "redirects the user" do
get sections_path
expect(response).to have_http_status(302)
end
end
end
================================================
FILE: spec/requests/units_spec.rb
================================================
require 'rails_helper'
RSpec.describe "Units", type: :request do
describe "GET /units without authenticating" do
it "redirects the user" do
get units_path
expect(response).to have_http_status(302)
end
end
end
================================================
FILE: spec/routing/captures_routing_spec.rb
================================================
require "rails_helper"
RSpec.describe CapturesController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/captures").to route_to("captures#index")
end
it "routes to #new" do
expect(:get => "/captures/new").to route_to("captures#new")
end
it "routes to #show" do
expect(:get => "/captures/1").to route_to("captures#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/captures/1/edit").to route_to("captures#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/captures").to route_to("captures#create")
end
it "routes to #update via PUT" do
expect(:put => "/captures/1").to route_to("captures#update", :id => "1")
end
it "routes to #update via PATCH" do
expect(:patch => "/captures/1").to route_to("captures#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/captures/1").to route_to("captures#destroy", :id => "1")
end
end
end
================================================
FILE: spec/routing/devices_routing_spec.rb
================================================
require "rails_helper"
RSpec.describe DevicesController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/devices").to route_to("devices#index")
end
it "routes to #new" do
expect(:get => "/devices/new").to route_to("devices#new")
end
it "routes to #show" do
expect(:get => "/devices/1").to route_to("devices#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/devices/1/edit").to route_to("devices#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/devices").to route_to("devices#create")
end
it "routes to #update via PUT" do
expect(:put => "/devices/1").to route_to("devices#update", :id => "1")
end
it "routes to #update via PATCH" do
expect(:patch => "/devices/1").to route_to("devices#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/devices/1").to route_to("devices#destroy", :id => "1")
end
end
end
================================================
FILE: spec/routing/section_templates_routing_spec.rb
================================================
require "rails_helper"
RSpec.describe SectionTemplatesController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/section_templates").to route_to("section_templates#index")
end
it "routes to #new" do
expect(:get => "/section_templates/new").to route_to("section_templates#new")
end
it "routes to #show" do
expect(:get => "/section_templates/1").to route_to("section_templates#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/section_templates/1/edit").to route_to("section_templates#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/section_templates").to route_to("section_templates#create")
end
it "routes to #update via PUT" do
expect(:put => "/section_templates/1").to route_to("section_templates#update", :id => "1")
end
it "routes to #update via PATCH" do
expect(:patch => "/section_templates/1").to route_to("section_templates#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/section_templates/1").to route_to("section_templates#destroy", :id => "1")
end
end
end
================================================
FILE: spec/routing/sections_routing_spec.rb
================================================
require "rails_helper"
RSpec.describe SectionsController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/sections").to route_to("sections#index")
end
it "routes to #new" do
expect(:get => "/sections/new").to route_to("sections#new")
end
it "routes to #show" do
expect(:get => "/sections/1").to route_to("sections#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/sections/1/edit").to route_to("sections#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/sections").to route_to("sections#create")
end
it "routes to #update via PUT" do
expect(:put => "/sections/1").to route_to("sections#update", :id => "1")
end
it "routes to #update via PATCH" do
expect(:patch => "/sections/1").to route_to("sections#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/sections/1").to route_to("sections#destroy", :id => "1")
end
end
end
================================================
FILE: spec/routing/units_routing_spec.rb
================================================
require "rails_helper"
RSpec.describe UnitsController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/units").to route_to("units#index")
end
it "routes to #new" do
expect(:get => "/units/new").to route_to("units#new")
end
it "routes to #show" do
expect(:get => "/units/1").to route_to("units#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/units/1/edit").to route_to("units#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/units").to route_to("units#create")
end
it "routes to #update via PUT" do
expect(:put => "/units/1").to route_to("units#update", :id => "1")
end
it "routes to #update via PATCH" do
expect(:patch => "/units/1").to route_to("units#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/units/1").to route_to("units#destroy", :id => "1")
end
end
end
================================================
FILE: spec/spec_helper.rb
================================================
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, consider making
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.
#
# The `.rspec` file also contains a few flags that are not defaults but that
# users commonly want.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
config.filter_run :focus
config.run_all_when_everything_filtered = true
# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
config.example_status_persistence_file_path = "spec/examples.txt"
# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
config.disable_monkey_patching!
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = 'doc'
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
end
================================================
FILE: spec/views/captures/edit.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "captures/edit", type: :view do
end
================================================
FILE: spec/views/captures/index.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "captures/index", type: :view do
end
================================================
FILE: spec/views/captures/new.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "captures/new", type: :view do
end
================================================
FILE: spec/views/captures/show.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "captures/show", type: :view do
end
================================================
FILE: spec/views/devices/edit.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "devices/edit", type: :view do
before(:each) do
@device = assign(:device, Device.create!(
:fcc_id => "MyString",
:baudrate => "MyString",
:frequency => 1.5,
:modulation => "MyString",
:encoding => "MyString",
:name => "MyString",
:notes => "MyText"
))
end
it "renders the edit device form" do
render
assert_select "form[action=?][method=?]", device_path(@device), "post" do
assert_select "input#device_fcc_id[name=?]", "device[fcc_id]"
assert_select "input#device_baudrate[name=?]", "device[baudrate]"
assert_select "input#device_frequency[name=?]", "device[frequency]"
assert_select "input#device_modulation[name=?]", "device[modulation]"
assert_select "input#device_encoding[name=?]", "device[encoding]"
assert_select "input#device_name[name=?]", "device[name]"
assert_select "textarea#device_notes[name=?]", "device[notes]"
end
end
end
================================================
FILE: spec/views/devices/index.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "devices/index", type: :view do
before(:each) do
assign(:devices, [
Device.create!(
:fcc_id => "Fcc",
:baudrate => "Baudrate",
:frequency => 1.5,
:modulation => "Modulation",
:encoding => "Encoding",
:name => "Name",
:notes => "MyText"
),
Device.create!(
:fcc_id => "Fcc",
:baudrate => "Baudrate",
:frequency => 1.5,
:modulation => "Modulation",
:encoding => "Encoding",
:name => "Name",
:notes => "MyText"
)
])
end
it "renders a list of devices" do
render
assert_select "tr>td", :text => "Fcc".to_s, :count => 2
assert_select "tr>td", :text => "Baudrate".to_s, :count => 2
assert_select "tr>td", :text => 1.5.to_s, :count => 2
assert_select "tr>td", :text => "Modulation".to_s, :count => 2
assert_select "tr>td", :text => "Encoding".to_s, :count => 2
assert_select "tr>td", :text => "Name".to_s, :count => 2
assert_select "tr>td", :text => "MyText".to_s, :count => 2
end
end
================================================
FILE: spec/views/devices/new.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "devices/new", type: :view do
before(:each) do
assign(:device, Device.new(
:fcc_id => "MyString",
:baudrate => "MyString",
:frequency => 1.5,
:modulation => "MyString",
:encoding => "MyString",
:name => "MyString",
:notes => "MyText"
))
end
it "renders new device form" do
render
assert_select "form[action=?][method=?]", devices_path, "post" do
assert_select "input#device_fcc_id[name=?]", "device[fcc_id]"
assert_select "input#device_baudrate[name=?]", "device[baudrate]"
assert_select "input#device_frequency[name=?]", "device[frequency]"
assert_select "input#device_modulation[name=?]", "device[modulation]"
assert_select "input#device_encoding[name=?]", "device[encoding]"
assert_select "input#device_name[name=?]", "device[name]"
assert_select "textarea#device_notes[name=?]", "device[notes]"
end
end
end
================================================
FILE: spec/views/devices/show.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "devices/show", type: :view do
end
================================================
FILE: spec/views/section_templates/edit.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "section_templates/edit", type: :view do
end
================================================
FILE: spec/views/section_templates/index.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "section_templates/index", type: :view do
before(:each) do
assign(:section_templates, [
SectionTemplate.create!(
:name => "Name",
:sections => "MyText",
:added_by => "Added By"
),
SectionTemplate.create!(
:name => "Name",
:sections => "MyText",
:added_by => "Added By"
)
])
end
it "renders a list of section_templates" do
render
assert_select "tr>td", :text => "Name".to_s, :count => 2
assert_select "tr>td", :text => "MyText".to_s, :count => 2
assert_select "tr>td", :text => "Added By".to_s, :count => 2
end
end
================================================
FILE: spec/views/section_templates/new.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "section_templates/new", type: :view do
end
================================================
FILE: spec/views/section_templates/show.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "section_templates/show", type: :view do
before(:each) do
@section_template = assign(:section_template, SectionTemplate.create!(
:name => "Name",
:sections => "MyText",
:added_by => "Added By"
))
end
it "renders attributes in
" do
render
expect(rendered).to match(/Name/)
expect(rendered).to match(/MyText/)
expect(rendered).to match(/Added By/)
end
end
================================================
FILE: spec/views/sections/edit.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "sections/edit", type: :view do
end
================================================
FILE: spec/views/sections/index.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "sections/index", type: :view do
end
================================================
FILE: spec/views/sections/new.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "sections/new", type: :view do
end
================================================
FILE: spec/views/sections/show.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "sections/show", type: :view do
end
================================================
FILE: spec/views/units/edit.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "units/edit", type: :view do
end
================================================
FILE: spec/views/units/index.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "units/index", type: :view do
end
================================================
FILE: spec/views/units/new.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "units/new", type: :view do
end
================================================
FILE: spec/views/units/show.html.haml_spec.rb
================================================
require 'rails_helper'
RSpec.describe "units/show", type: :view do
end
================================================
FILE: test/controllers/.keep
================================================
================================================
FILE: test/fixtures/.keep
================================================
================================================
FILE: test/helpers/.keep
================================================
================================================
FILE: test/integration/.keep
================================================
================================================
FILE: test/mailers/.keep
================================================
================================================
FILE: test/models/.keep
================================================
================================================
FILE: test/test_helper.rb
================================================
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end
================================================
FILE: vendor/assets/javascripts/.keep
================================================
================================================
FILE: vendor/assets/stylesheets/.keep
================================================