Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistify whitespace, code style in Ruby, CoffeeScript, SCSS #711

Merged
merged 9 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
170 changes: 85 additions & 85 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
source 'https://rubygems.org'
# If you bump the Ruby version, make sure to update the Vagrantfile appropriately
source "https://rubygems.org"
# If you bump the Ruby version, make sure to update the Vagrantfile appropriately
ruby "2.5.1"
gem "rails", "4.2.11"

gem 'pg'
gem 'jquery-rails'
gem 'bcrypt', '~> 3.1.7'
gem 'active_model_serializers', '~> 0.9.3'
gem 'aws-sdk', '~> 1.33'
gem "pg"
gem "jquery-rails"
gem "bcrypt", "~> 3.1.7"
gem "active_model_serializers", "~> 0.9.3"
gem "aws-sdk", "~> 1.33"

# Speed
gem 'fast_blank', '~> 1.0'
gem "fast_blank", "~> 1.0"

# Redis and redis dependents
gem "hiredis"
gem "redis", ">= 3.2.0", require: ["redis", "redis/connection/hiredis"]
gem "sidekiq", "~> 5.1.0" # Background processing
gem "sidekiq-failures"
gem 'rollout' # Feature flags
gem 'soulheart', '~> 0.3.0'

gem 'rack-contrib'
gem 'unicorn' # Use Puma as the app server
gem 'unicorn-worker-killer'
gem 'geocoder'
gem 'money-rails'
gem 'i18n'
gem 'hamlit'
gem 'journey', '~> 1.0.3'
gem 'kramdown' # Markdown
gem 'redcarpet' # Something to do with swagger? Guess we needed another markdown parser
gem 'kaminari' # pagination
gem 'pg_search'
gem 'nokogiri', '~> 1.8.1'
gem "rollout" # Feature flags
gem "soulheart", "~> 0.3.0"

gem "rack-contrib"
gem "unicorn" # Use Puma as the app server
gem "unicorn-worker-killer"
gem "geocoder"
gem "money-rails"
gem "i18n"
gem "hamlit"
gem "journey", "~> 1.0.3"
gem "kramdown" # Markdown
gem "redcarpet" # Something to do with swagger? Guess we needed another markdown parser
gem "kaminari" # pagination
gem "pg_search"
gem "nokogiri", "~> 1.8.1"
gem "carrierwave", "~> 0.11.2"
gem "carrierwave_backgrounder"
gem 'rmagick'
gem 'mini_magick' # a smaller implementation of rmagick, required for rqrcode
gem 'rqrcode-rails3'
gem 'libv8', '~> 3.16.14.7'
gem "rmagick"
gem "mini_magick" # a smaller implementation of rmagick, required for rqrcode
gem "rqrcode-rails3"
gem "libv8", "~> 3.16.14.7"
gem "stripe"
gem 'high_voltage'
gem 'omniauth-facebook'
gem 'omniauth-strava'
gem 'omniauth', '~> 1.3.1'
gem "high_voltage"
gem "omniauth-facebook"
gem "omniauth-strava"
gem "omniauth", "~> 1.3.1"
gem "fog-aws"
gem 'dalli'
gem 'draper', require: false
gem 'eventmachine'
gem 'httparty'
gem "dalli"
gem "draper", require: false
gem "eventmachine"
gem "httparty"
gem "sitemap_generator", "~> 6"
gem 'paranoia'
gem "paranoia"

# Making other files
gem "wkhtmltopdf-binary"
Expand All @@ -61,64 +61,64 @@ gem "axlsx" # Write Excel files - OrganizationExports
gem "where-or" # backports rails 5 or query support - TODO: Rails 5 update, remove

# API wrappers
gem 'twitter' # Twitter. For rendering tweets
gem 'simple_spark' # Sparkpost gem - we use it to send newsletters
gem "twitter" # Twitter. For rendering tweets
gem "simple_spark" # Sparkpost gem - we use it to send newsletters

# OAuth provider, Grape, associated parts of API V2
gem 'doorkeeper', '~> 3.1.0'
gem 'wine_bouncer'
gem 'grape', '~> 0.14.0'
gem 'grape-active_model_serializers', '~> 1.4.0'
gem 'grape-swagger', '~> 0.10.4'
gem 'swagger-ui_rails'
gem 'api-pagination'
gem "doorkeeper", "~> 3.1.0"
gem "wine_bouncer"
gem "grape", "~> 0.14.0"
gem "grape-active_model_serializers", "~> 1.4.0"
gem "grape-swagger", "~> 0.10.4"
gem "swagger-ui_rails"
gem "api-pagination"

# Secure things
gem 'rack-throttle'
gem 'secure_headers', '~> 2.5.0'
gem "rack-throttle"
gem "secure_headers", "~> 2.5.0"

# Frontend
gem 'sprockets-rails', '~> 3.0.4'
gem 'coffee-rails'
gem 'therubyracer'
gem 'uglifier'
gem 'premailer-rails' # Inline styles for email
gem 'backbone-on-rails', '~>0.9.10.0' # Legacy js
gem 'chartkick' # Display charts
gem 'groupdate' # Required for charts
gem 'bootstrap', '~> 4.0.0.alpha3' # Bootstrap 4 - used for revised stylesheets
gem 'jquery-datatables-rails', '~>3.4.0'
gem 'webpacker', '~> 4.x'
gem "sprockets-rails", "~> 3.0.4"
gem "coffee-rails"
gem "therubyracer"
gem "uglifier"
gem "premailer-rails" # Inline styles for email
gem "backbone-on-rails", "~>0.9.10.0" # Legacy js
gem "chartkick" # Display charts
gem "groupdate" # Required for charts
gem "bootstrap", "~> 4.0.0.alpha3" # Bootstrap 4 - used for revised stylesheets
gem "jquery-datatables-rails", "~>3.4.0"
gem "webpacker", "~> 4.x"

# Show performance metrics
gem 'stackprof', require: false
gem 'memory_profiler', require: false
gem 'flamegraph', require: false
gem 'rack-mini-profiler', require: false # If you can't see it you can't make it better

gem 'responders', '~> 2.0' # required because of class level respond_to blocks (API v1)
gem 'thor', '0.19.1' # Locking it; http://stackoverflow.com/questions/40986923/meaning-of-expected-string-default-value-for-on-ruby-on-rails

gem 'bundler', '>= 1.8.4' # required for rails-assets.org - JS and CSS assets
source 'https://rails-assets.org' do # JS land is crazy, so lock everything
gem 'rails-assets-lodash', '~> 4.9.0'
gem 'rails-assets-tether', '~> 1.1.0' # Required by bootstrap 4, but not included :(
gem 'rails-assets-mustache', '~> 2.2.1'
gem 'rails-assets-jquery.dirtyforms', '~> 2.0.0' # Alert on attempts to leave with dirt on forms
gem 'rails-assets-selectize', '~> 0.12.1' # Manually configured scss
gem 'rails-assets-select2', '~> 4.0.3' # Use select2 for a few things, it's a bit better sometimes
gem 'rails-assets-Stickyfill', '~> 1.1.3' # Affix bike edit menu
gem 'rails-assets-mailcheck', '~> 1.1.2' # Check for common email errors
gem 'rails-assets-waypoints', '~> 3.1.1' # For documentation pages
gem 'rails-assets-moment', '~> 2.18.1' # Javascript Time - localizing :)
gem 'rails-assets-moment-timezone', '~> 0.5.13' # Timezones for moment
gem "stackprof", require: false
gem "memory_profiler", require: false
gem "flamegraph", require: false
gem "rack-mini-profiler", require: false # If you can't see it you can't make it better

gem "responders", "~> 2.0" # required because of class level respond_to blocks (API v1)
gem "thor", "0.19.1" # Locking it; http://stackoverflow.com/questions/40986923/meaning-of-expected-string-default-value-for-on-ruby-on-rails

gem "bundler", ">= 1.8.4" # required for rails-assets.org - JS and CSS assets
source "https://rails-assets.org" do # JS land is crazy, so lock everything
gem "rails-assets-lodash", "~> 4.9.0"
gem "rails-assets-tether", "~> 1.1.0" # Required by bootstrap 4, but not included :(
gem "rails-assets-mustache", "~> 2.2.1"
gem "rails-assets-jquery.dirtyforms", "~> 2.0.0" # Alert on attempts to leave with dirt on forms
gem "rails-assets-selectize", "~> 0.12.1" # Manually configured scss
gem "rails-assets-select2", "~> 4.0.3" # Use select2 for a few things, it's a bit better sometimes
gem "rails-assets-Stickyfill", "~> 1.1.3" # Affix bike edit menu
gem "rails-assets-mailcheck", "~> 1.1.2" # Check for common email errors
gem "rails-assets-waypoints", "~> 3.1.1" # For documentation pages
gem "rails-assets-moment", "~> 2.18.1" # Javascript Time - localizing :)
gem "rails-assets-moment-timezone", "~> 0.5.13" # Timezones for moment
# Sortable breaks assets:precompile, so it's included manually
# gem 'rails-assets-jquery-sortable', '~> 0.9.12' # Sort photo order
end

gem 'grape_logging' # Grape logging. Also how we pass it to lograge. Always used, not just in Prod
gem 'lograge' # Structure log data, put it in single lines to improve the functionality
gem 'logstash-event' # Use logstash format for logging data
gem "grape_logging" # Grape logging. Also how we pass it to lograge. Always used, not just in Prod
gem "lograge" # Structure log data, put it in single lines to improve the functionality
gem "logstash-event" # Use logstash format for logging data

group :production do
gem "honeybadger", "~> 2.0" # Error monitoring
Expand All @@ -127,8 +127,8 @@ end

group :development do
# gem 'test-unit', '~> 3.0'
gem 'rerun'
gem 'bullet'
gem "rerun"
gem "bullet"
# gem 'pry-rails'
end

Expand Down
5 changes: 3 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require File.expand_path("../config/application", __FILE__)

require 'sitemap_generator/tasks'
require "sitemap_generator/tasks"

module TempFixForRakeLastComment
def last_comment
last_description
end
end

Rake::Application.send :include, TempFixForRakeLastComment

Bikeindex::Application.load_tasks
14 changes: 7 additions & 7 deletions app/assets/javascripts/bike_index.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ updateInvoiceCalculations = ->
if recurring.length > 0
recurringCost = recurring.reduce (x,y) -> x+y
else
recurringCost = 0
recurringCost = 0
oneTime = $(".paidFeatureCheck input.oneTime:checked").get().map (i) -> parseInt($(i).attr("data-amount"), 10)
if oneTime.length > 0
oneTimeCost = oneTime.reduce (x,y) -> x+y
Expand Down Expand Up @@ -60,9 +60,9 @@ $(document).ready ->
new BikeIndex.Views.Global

if document.getElementById('home_headies')
new BikeIndex.Views.Home
new BikeIndex.Views.Home
if document.getElementById('news_display')
new BikeIndex.Views.NewsDisplay
new BikeIndex.Views.NewsDisplay

else if document.getElementById('documentation-menu')
new BikeIndex.Views.DocumentationIndex
Expand All @@ -72,7 +72,7 @@ $(document).ready ->
new BikeIndex.Views.ContentWhere
if document.getElementById('manufacturers-list')
new BikeIndex.Views.ContentManufacturers

else if document.getElementById('choose-registration-type')
new BikeIndex.Views.BikesChooseRegistration

Expand All @@ -90,7 +90,7 @@ $(document).ready ->

else if document.getElementById('user-home-page')
new BikeIndex.Views.DataTables

else if document.getElementById('edit-bike-form')
new BikeIndex.Views.BikesEdit

Expand All @@ -117,10 +117,10 @@ $(document).ready ->
new BikeIndex.Views.AdminGraphs
else if document.getElementById('invoiceForm')
initializeInvoiceForm()

else if document.getElementById('photo-page')
new BikeIndex.Views.PhotosIndex

if document.getElementById('multi_serial_search')
new BikeIndex.Views.StolenMultiSerialSearch

10 changes: 5 additions & 5 deletions app/assets/javascripts/external_scripts/are-you-sure.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# * Author: chris.dance@papercut.com
# * Version: 1.5.0
# * Date: 15th Nov 2013
#
#
(($) ->
$.fn.areYouSure = (options) ->
settings = $.extend(
Expand Down Expand Up @@ -48,7 +48,7 @@

isDirty = false
$form = $(this).parents("form")

# Test on the target first as it's the most likely to be dirty.
isDirty = true if isFieldDirty($(evt.target))
unless isDirty
Expand All @@ -63,7 +63,7 @@
markDirty = ($form, isDirty) ->
changed = isDirty isnt $form.hasClass(settings.dirtyClass)
$form.toggleClass settings.dirtyClass, isDirty

# Fire change event if required
if changed
settings.change.call $form, $form if settings.change
Expand All @@ -86,7 +86,7 @@
unless settings.silent
$(window).bind "beforeunload", ->
$dirtyForms = $("form").filter("." + settings.dirtyClass)

# $dirtyForms.removeClass(settings.dirtyClass); // Prevent multiple calls?
settings.message if $dirtyForms.length > 0

Expand All @@ -99,7 +99,7 @@
$form.bind "reset", ->
markDirty $form, false


# Add a custom events
$form.bind "rescan.areYouSure", rescan
$form.bind "reinitialize.areYouSure", reinitialize
Expand Down
10 changes: 5 additions & 5 deletions app/assets/javascripts/external_scripts/embed_script.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ updateSerial = (e) ->
if $(e.target).prop('checked') == true
$('#bike_serial_number').val('absent').addClass('absent-serial')
else
$('#bike_serial_number').val('').removeClass('absent-serial')
$('#bike_serial_number').val('').removeClass('absent-serial')

optionalFormUpdate = (e) ->
# $(@).find('a').data('target')
Expand All @@ -93,7 +93,7 @@ otherManufacturerDisplay = (current_value) ->
if current_value == expand_value
# show the bugger!
hidden_other.slideDown().addClass('unhidden')
else
else
# if it's visible, clear it and slide up
if hidden_other.hasClass('unhidden')
hidden_other.find('input').selectize()[0].selectize.setValue('')
Expand Down Expand Up @@ -131,7 +131,7 @@ $(document).ready ->

$('#bike_has_no_serial').change (e) ->
updateSerial(e)

$('#alert-block .close').click ->
$('#alert-block').fadeOut('fast')

Expand Down Expand Up @@ -162,9 +162,9 @@ $(document).ready ->
# Update any hidden fields with current timezone
window.timezone ||= moment.tz.guess()
$(".hiddenFieldTimezone").val(window.timezone)

# prevent double posting
$('#new_bike').submit ->
$('#new_bike').submit ->
$this = $(this)
if $this.data().isSubmitted
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ next = document.getElementById('bi-slide-next')
if document.contains(prev)
slider = document.getElementById('slider')
slider.className += " swipe"
window.mySwipe = new Swipe(slider,
window.mySwipe = new Swipe(slider,
auto: 4000
)
if document.body.addEventListener
Expand All @@ -16,4 +16,3 @@ if document.contains(prev)
mySwipe.prev()
next.attachEvent "click", ->
mySwipe.next()

Loading