Skip to content

Commit

Permalink
runs rubocop autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
warp committed Jan 19, 2015
1 parent bb2798a commit 11244da
Show file tree
Hide file tree
Showing 391 changed files with 2,511 additions and 3,053 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,5 @@
StringLiterals:
Enabled: false

Metrics/LineLength:
Enabled: false
22 changes: 11 additions & 11 deletions Gemfile
Expand Up @@ -8,7 +8,7 @@ gem 'pg'

# Removes a gem dependency
def remove(name)
@dependencies.reject! {|d| d.name == name }
@dependencies.reject! { |d| d.name == name }
end

# Replaces an existing gem dependency (e.g. from gemspec) with an alternate source.
Expand All @@ -20,13 +20,13 @@ end
# Bundler no longer treats runtime dependencies as base dependencies.
# The following code restores this behaviour.
# (See https://github.com/carlhuda/bundler/issues/1041)
spec = Bundler.load_gemspec( File.expand_path("../fat_free_crm.gemspec", __FILE__) )
spec = Bundler.load_gemspec(File.expand_path("../fat_free_crm.gemspec", __FILE__))
spec.runtime_dependencies.each do |dep|
gem dep.name, *(dep.requirement.as_list)
end

# Remove premailer auto-require
gem 'premailer', :require => false
gem 'premailer', require: false

# Remove fat_free_crm dependency, to stop it from being auto-required too early.
remove 'fat_free_crm'
Expand All @@ -45,18 +45,18 @@ group :development do
gem 'guard'
gem 'guard-rspec'
gem 'guard-rails'
gem 'rb-inotify', :require => false
gem 'rb-fsevent', :require => false
gem 'rb-fchange', :require => false
gem 'rb-inotify', require: false
gem 'rb-fsevent', require: false
gem 'rb-fchange', require: false
end
end

group :development, :test do
gem 'rspec-rails'
gem 'rspec-activemodel-mocks'
gem 'headless'
gem 'debugger', :platforms => 'mri_19' unless ENV["CI"]
gem 'byebug', :platforms => ['mri_20', 'mri_21'] unless ENV["CI"]
gem 'debugger', platforms: 'mri_19' unless ENV["CI"]
gem 'byebug', platforms: %w(mri_20 mri_21) unless ENV["CI"]
gem 'pry-rails' unless ENV["CI"]
end

Expand All @@ -67,17 +67,17 @@ group :test do
gem "acts_as_fu"
gem 'factory_girl_rails'
gem 'zeus' unless ENV["CI"]
gem 'coveralls', :require => false
gem 'coveralls', require: false
gem 'timecop'
end

group :heroku do
gem 'unicorn', :platform => :ruby
gem 'unicorn', platform: :ruby
gem 'rails_12factor'
end

gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'execjs'
gem 'therubyracer', :platform => :ruby unless ENV["CI"]
gem 'therubyracer', platform: :ruby unless ENV["CI"]
1 change: 0 additions & 1 deletion Guardfile
Expand Up @@ -16,7 +16,6 @@ guard 'rspec', zeus: true, bundler: false, all_on_start: false, all_after_pass:

# Capybara features specs
# watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }

end

guard 'rails', server: 'thin', debugger: true, zeus: true do
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -6,4 +6,4 @@ require File.expand_path('../config/application', __FILE__)

FatFreeCRM::Application.load_tasks

task :default => ['spec']
task default: ['spec']
4 changes: 2 additions & 2 deletions app/controllers/admin/application_controller.rb
Expand Up @@ -4,7 +4,7 @@
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Admin::ApplicationController < ApplicationController
before_filter :require_admin_user
before_action :require_admin_user

layout "admin/application"
helper "admin/field_groups"
Expand All @@ -17,7 +17,7 @@ def auto_complete
render partial: 'auto_complete'
end

private
private

#----------------------------------------------------------------------------
def require_admin_user
Expand Down
7 changes: 3 additions & 4 deletions app/controllers/admin/field_groups_controller.rb
Expand Up @@ -4,7 +4,6 @@
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Admin::FieldGroupsController < Admin::ApplicationController

helper 'admin/fields'

# GET /admin/field_groups/new
Expand All @@ -22,7 +21,7 @@ def edit
@field_group = FieldGroup.find(params[:id])

if params[:previous].to_s =~ /(\d+)\z/
@previous = FieldGroup.find_by_id($1) || $1.to_i
@previous = FieldGroup.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i
end

respond_with(@field_group)
Expand Down Expand Up @@ -64,7 +63,7 @@ def sort
field_group_ids = params["#{asset}_field_groups"]

field_group_ids.each_with_index do |id, index|
FieldGroup.update_all({position: index+1}, {id: id})
FieldGroup.update_all({ position: index + 1 }, id: id)
end

render nothing: true
Expand All @@ -76,7 +75,7 @@ def confirm
@field_group = FieldGroup.find(params[:id])
end

protected
protected

def field_group_params
params[:field_group].permit!
Expand Down
19 changes: 9 additions & 10 deletions app/controllers/admin/fields_controller.rb
Expand Up @@ -4,7 +4,7 @@
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Admin::FieldsController < Admin::ApplicationController
before_filter "set_current_tab('admin/fields')", only: [ :index ]
before_action "set_current_tab('admin/fields')", only: [:index]

load_resource except: [:create, :subform]

Expand Down Expand Up @@ -52,14 +52,13 @@ def create
end

respond_with(@field)

end

# PUT /fields/1
# PUT /fields/1.xml AJAX
#----------------------------------------------------------------------------
def update
if (field_params[:as] =~ /pair/)
if field_params[:as] =~ /pair/
@field = CustomFieldPair.update_pair(params).first
else
@field = Field.find(params[:id])
Expand All @@ -86,7 +85,7 @@ def sort
field_ids = params["fields_field_group_#{field_group_id}"] || []

field_ids.each_with_index do |id, index|
Field.where(id: id).update_all(position: index+1, field_group_id: field_group_id)
Field.where(id: id).update_all(position: index + 1, field_group_id: field_group_id)
end

render nothing: true
Expand All @@ -99,19 +98,19 @@ def subform
as = field[:as]

@field = if (id = field[:id]).present?
Field.find(id).tap{|f| f.as = as}
else
field_group_id = field[:field_group_id]
klass = Field.lookup_class(as).classify.constantize
klass.new(field_group_id: field_group_id, as: as)
Field.find(id).tap { |f| f.as = as }
else
field_group_id = field[:field_group_id]
klass = Field.lookup_class(as).classify.constantize
klass.new(field_group_id: field_group_id, as: as)
end

respond_with(@field) do |format|
format.html { render partial: 'admin/fields/subform' }
end
end

protected
protected

def field_params
params[:field].permit!
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/admin/groups_controller.rb
Expand Up @@ -4,7 +4,7 @@
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Admin::GroupsController < Admin::ApplicationController
before_filter "set_current_tab('admin/groups')", only: [ :index, :show ]
before_action "set_current_tab('admin/groups')", only: [:index, :show]

load_resource

Expand Down Expand Up @@ -57,7 +57,7 @@ def destroy
respond_with(@group)
end

protected
protected

def group_params
params[:group].permit!
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/admin/plugins_controller.rb
Expand Up @@ -4,7 +4,7 @@
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Admin::PluginsController < Admin::ApplicationController
before_filter "set_current_tab('admin/plugins')", only: [ :index ]
before_action "set_current_tab('admin/plugins')", only: [:index]

# GET /admin/plugins
# GET /admin/plugins.xml
Expand All @@ -15,4 +15,3 @@ def index
respond_with(@plugins)
end
end

3 changes: 1 addition & 2 deletions app/controllers/admin/settings_controller.rb
Expand Up @@ -4,12 +4,11 @@
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Admin::SettingsController < Admin::ApplicationController
before_filter "set_current_tab('admin/settings')", only: [ :index ]
before_action "set_current_tab('admin/settings')", only: [:index]

# GET /admin/settings
# GET /admin/settings.xml
#----------------------------------------------------------------------------
def index
end
end

6 changes: 3 additions & 3 deletions app/controllers/admin/tags_controller.rb
Expand Up @@ -4,7 +4,7 @@
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Admin::TagsController < Admin::ApplicationController
before_filter "set_current_tab('admin/tags')", only: [ :index, :show ]
before_action "set_current_tab('admin/tags')", only: [:index, :show]

load_resource

Expand All @@ -27,7 +27,7 @@ def new
#----------------------------------------------------------------------------
def edit
if params[:previous].to_s =~ /(\d+)\z/
@previous = Tag.find_by_id($1) || $1.to_i
@previous = Tag.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i
end
end

Expand Down Expand Up @@ -63,7 +63,7 @@ def destroy
def confirm
end

protected
protected

def tag_params
params[:tag].permit!
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/admin/users_controller.rb
Expand Up @@ -4,7 +4,7 @@
# See MIT-LICENSE file or http://www.opensource.org/licenses/mit-license.php
#------------------------------------------------------------------------------
class Admin::UsersController < Admin::ApplicationController
before_filter "set_current_tab('admin/users')", only: [ :index, :show ]
before_action "set_current_tab('admin/users')", only: [:index, :show]

load_resource except: [:create]

Expand Down Expand Up @@ -34,7 +34,7 @@ def new
#----------------------------------------------------------------------------
def edit
if params[:previous].to_s =~ /(\d+)\z/
@previous = User.find_by_id($1) || $1.to_i
@previous = User.find_by_id(Regexp.last_match[1]) || Regexp.last_match[1].to_i
end

respond_with(@user)
Expand Down Expand Up @@ -100,7 +100,7 @@ def reactivate
respond_with(@user)
end

protected
protected

def user_params
params[:user].permit(
Expand All @@ -124,7 +124,7 @@ def user_params
)
end

private
private

#----------------------------------------------------------------------------
def get_users(options = {})
Expand Down

0 comments on commit 11244da

Please sign in to comment.