AllCops:
Include:
+ - '**/*.gemspec'
+ - '**/*.podspec'
+ - '**/*.jbuilder'
+ - '**/*.rake'
+ - '**/*.opal'
+ - '**/config.ru'
+ - '**/Gemfile'
+ - '**/Rakefile'
+ - '**/Capfile'
+ - '**/Guardfile'
+ - '**/Podfile'
+ - '**/Thorfile'
+ - '**/Vagrantfile'
+ - '**/Berksfile'
+ - '**/Cheffile'
+ - '**/Vagabondfile'
+ - '**/Fastfile'
- '**/*.builder'
Rails:
Rails/HttpPositionalArguments:
Enabled: false
+
+Rails/SkipsModelValidations:
+ Exclude:
+ - 'db/migrate/*.rb'
+ - 'app/controllers/user_controller.rb'
gem "image_optim_rails"
# Load rails plugins
-gem "rails-i18n", "~> 4.0.0"
-gem "dynamic_form"
-gem "rinku", ">= 1.2.2", :require => "rails_rinku"
-gem "oauth-plugin", ">= 0.5.1"
-gem "validates_email_format_of", ">= 1.5.1"
+gem "actionpack-page_caching"
gem "composite_primary_keys", "~> 8.1.0"
-gem "http_accept_language", "~> 2.0.0"
-gem "paperclip", "~> 4.0"
gem "deadlock_retry", ">= 1.2.0"
+gem "dynamic_form"
+gem "http_accept_language", "~> 2.0.0"
gem "i18n-js", ">= 3.0.0.rc10"
+gem "oauth-plugin", ">= 0.5.1"
+gem "paperclip", "~> 4.0"
gem "rack-cors"
-gem "actionpack-page_caching"
+gem "rails-i18n", "~> 4.0.0"
+gem "rinku", ">= 1.2.2", :require => "rails_rinku"
+gem "validates_email_format_of", ">= 1.5.1"
# Sanitise URIs
gem "rack-uri_sanitizer"
# Omniauth for authentication
gem "omniauth"
-gem "omniauth-openid"
-gem "omniauth-google-oauth2", ">= 0.2.7"
gem "omniauth-facebook"
-gem "omniauth-windowslive"
gem "omniauth-github"
+gem "omniauth-google-oauth2", ">= 0.2.7"
gem "omniauth-mediawiki", ">= 0.0.3"
+gem "omniauth-openid"
+gem "omniauth-windowslive"
# Markdown formatting support
gem "redcarpet"
gem "libxml-ruby", ">= 2.0.5", :require => "libxml"
# Use for HTML sanitisation
-gem "sanitize"
gem "htmlentities"
+gem "sanitize"
# Load SystemTimer for implementing request timeouts
gem "SystemTimer", ">= 1.1.3", :require => "system_timer", :platforms => :ruby_18
# Gems needed for running tests
group :test do
+ gem "minitest", "~> 5.1", :platforms => [:ruby_19, :ruby_20]
gem "rubocop"
gem "timecop"
- gem "minitest", "~> 5.1", :platforms => [:ruby_19, :ruby_20]
gem "webmock"
end
# Needed in development as well so rake can see konacha tasks
group :development, :test do
+ gem "coveralls", :require => false
+ gem "factory_girl_rails"
gem "jshint"
gem "konacha"
gem "poltergeist"
- gem "factory_girl_rails"
- gem "coveralls", :require => false
end
request_store (1.3.1)
rinku (2.0.2)
rotp (3.3.0)
- rubocop (0.46.0)
- parser (>= 2.3.1.1, < 3.0)
+ rubocop (0.47.1)
+ parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
thread_safe (~> 0.1)
uglifier (3.0.4)
execjs (>= 0.3.0, < 3)
- unicode-display_width (1.1.2)
+ unicode-display_width (1.1.3)
validates_email_format_of (1.6.3)
i18n
vendorer (0.1.16)
loaded_lang = "en"
# Load English defaults
- en = YAML.load(File.open("#{Rails.root}/config/potlatch/locales/en.yml"))["en"]
+ en = YAML.safe_load(File.open(Rails.root.join("config", "potlatch", "locales", "en.yml")))["en"]
if lang == "en"
return [loaded_lang, en]
else
# Use English as a fallback
begin
- other = YAML.load(File.open("#{Rails.root}/config/potlatch/locales/#{lang}.yml"))[lang]
+ other = YAML.safe_load(File.open(Rails.root.join("config", "potlatch", "locales", "#{lang}.yml")))[lang]
loaded_lang = lang
rescue
other = en
end
def getlocales
- @locales ||= Locale.list(Dir.glob("#{Rails.root}/config/potlatch/locales/*").collect { |f| File.basename(f, ".yml") })
+ @locales ||= Locale.list(Dir.glob(Rails.root.join("config", "potlatch", "locales", "*")).collect { |f| File.basename(f, ".yml") })
end
##
message = Message.find(params[:message_id])
if message.to_user_id == @user.id
- message.update_attribute(:message_read, true)
+ message.update(:message_read => true)
@message = Message.new(
:recipient => message.sender,
def self.load(file)
Language.transaction do
- YAML.load(File.read(file)).each do |k, v|
+ YAML.safe_load(File.read(file)).each do |k, v|
begin
Language.update(k, :english_name => v["english"], :native_name => v["native"])
rescue ActiveRecord::RecordNotFound
user = nil
end
- token.update_column(:expiry, 1.week.from_now) if token && user
+ token.update(:expiry => 1.week.from_now) if token && user
user
end
# perform a spam check on a user
def spam_check
if status == "active" && spam_score > SPAM_THRESHOLD
- update_column(:status, "suspended")
+ update(:status => "suspended")
end
end
<div id="mapkey">
<table class="mapkey-table">
- <% YAML.load_file("#{Rails.root}/config/key.yml").each do |name,data| %>
+ <% YAML.load_file(Rails.root.join("config", "key.yml")).each do |name,data| %>
<% data.each do |entry| %>
<tr class="mapkey-table-entry" data-layer="<%= name %>" data-zoom-min="<%= entry['min_zoom'] %>" data-zoom-max="<%= entry['max_zoom'] %>">
<td class="mapkey-table-key">
end
# Configure image optimisation
- config.assets.image_optim = YAML.load_file("#{Rails.root}/config/image_optim.yml")
+ config.assets.image_optim = YAML.load_file(Rails.root.join("config", "image_optim.yml"))
end
end
Rails.application.config.assets.version = "1.0"
# Location of manifest file.
-Rails.application.config.assets.manifest = Rails.root.join("tmp/manifest.json")
+Rails.application.config.assets.manifest = Rails.root.join("tmp", "manifest.json")
# Add additional assets to the asset load path
Rails.application.config.assets.paths << Rails.root.join("config")
begin
- BANNERS = YAML.load_file("#{Rails.root}/config/banners.yml").deep_symbolize_keys
+ BANNERS = YAML.load_file(Rails.root.join("config", "banners.yml")).deep_symbolize_keys
rescue
BANNERS = {}.freeze
end
else
require "openid/store/filesystem"
- openid_store = OpenID::Store::Filesystem.new(Rails.root.join("tmp/openids"))
+ openid_store = OpenID::Store::Filesystem.new(Rails.root.join("tmp", "openids"))
end
openid_options = { :name => "openid", :store => openid_store }
-WIKI_PAGES = YAML.load_file("#{Rails.root}/config/wiki_pages.yml")
+WIKI_PAGES = YAML.load_file(Rails.root.join("config", "wiki_pages.yml"))
add_index "ways", ["id"], :name => "ways_id_version_idx"
end
- def self.down
- end
+ def self.down; end
end
add_primary_key :languages, [:code]
- Language.load("#{Rails.root}/config/languages.yml")
+ Language.load(Rails.root.join("config", "languages.yml"))
add_foreign_key :users, :languages, :column => :locale, :primary_key => :code, :name => "users_locale_fkey"
add_foreign_key :diary_entries, :languages, :column => :language_code, :primary_key => :code, :name => "diary_entries_language_code_fkey"
class DropCountries < ActiveRecord::Migration
- def change
+ def up
drop_table :countries
end
end
end
end
-options = YAML.load(
+options = YAML.safe_load(
ERB.new(
IO.read(
File.dirname(__FILE__) + "/../../config/daemons.yml"
module ID
- LOCALES = Locale.list(Rails.root.join("vendor/assets/iD/iD/locales").entries.map { |p| p.basename.to_s[/(.*).json/] && Regexp.last_match(1) }.compact)
+ LOCALES = Locale.list(Rails.root.join("vendor", "assets", "iD", "iD", "locales").entries.map { |p| p.basename.to_s[/(.*).json/] && Regexp.last_match(1) }.compact)
end
# Return the terms and conditions text for a given country
def self.legal_text_for_country(country_code)
- file_name = File.join(Rails.root, "config", "legales", country_code.to_s + ".yml")
- file_name = File.join(Rails.root, "config", "legales", DEFAULT_LEGALE + ".yml") unless File.exist? file_name
+ file_name = Rails.root.join("config", "legales", country_code.to_s + ".yml")
+ file_name = Rails.root.join("config", "legales", DEFAULT_LEGALE + ".yml") unless File.exist? file_name
YAML.load_file(file_name)
end
presettype = ""
presetcategory = ""
# StringIO.open(txt) do |file|
- File.open("#{Rails.root}/config/potlatch/presets.txt") do |file|
+ File.open(Rails.root.join("config", "potlatch", "presets.txt")) do |file|
file.each_line do |line|
t = line.chomp
if t =~ %r{(\w+)/(\w+)}
colours = {}
casing = {}
areas = {}
- File.open("#{Rails.root}/config/potlatch/colours.txt") do |file|
+ File.open(Rails.root.join("config", "potlatch", "colours.txt")) do |file|
file.each_line do |line|
next unless line.chomp =~ /(\w+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/
relcolours = {}
relalphas = {}
relwidths = {}
- File.open("#{Rails.root}/config/potlatch/relation_colours.txt") do |file|
+ File.open(Rails.root.join("config", "potlatch", "relation_colours.txt")) do |file|
file.each_line do |line|
next unless line.chomp =~ /(\w+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/
# Read POI presets
icon_list = []
icon_tags = {}
- File.open("#{Rails.root}/config/potlatch/icon_presets.txt") do |file|
+ File.open(Rails.root.join("config", "potlatch", "icon_presets.txt")) do |file|
file.each_line do |line|
(icon, tags) = line.chomp.split("\t")
icon_list.push(icon)
# Read auto-complete
autotags = { "point" => {}, "way" => {}, "POI" => {} }
- File.open("#{Rails.root}/config/potlatch/autocomplete.txt") do |file|
+ File.open(Rails.root.join("config", "potlatch", "autocomplete.txt")) do |file|
file.each_line do |line|
next unless line.chomp =~ %r{^([\w:]+)/(\w+)\s+(.+)$}
exit 0 unless token == digest[0, 6]
exit 0 if date < 1.month.ago
-message.update_attribute(:message_read, true) if message
+message.update(:message_read => true) if message
mail = Mail.new(STDIN.readlines.join)