Fix rubocop violations

上级 e04de27b
......@@ -189,6 +189,8 @@ GEM
eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1)
ffi (1.9.17)
ffi (1.9.17-x64-mingw32)
ffi (1.9.17-x86-mingw32)
globalid (0.3.7)
activesupport (>= 4.1.0)
hiredis (0.6.1)
......@@ -234,7 +236,7 @@ GEM
mini_portile2 (~> 2.1.0)
nokogiri (1.7.0.1-x86-mingw32)
mini_portile2 (~> 2.1.0)
parser (2.3.3.1)
parser (2.4.0.0)
ast (~> 2.2)
pg (0.19.0)
pg (0.19.0-x64-mingw32)
......
......@@ -16,7 +16,7 @@ def block_code(code, language)
end
def link(url, title, content)
if url.start_with?('http://api.rubyonrails.org')
if url.start_with?("http://api.rubyonrails.org")
%(<a href="#{api_link(url)}">#{content}</a>)
elsif title
%(<a href="#{url}" title="#{title}">#{content}</a>)
......@@ -93,29 +93,29 @@ def convert_notes(body)
end
def github_file_url(file_path)
root, rest = file_path.split('/', 2)
root, rest = file_path.split("/", 2)
case root
when 'abstract_controller', 'action_controller', 'action_dispatch'
path = ['actionpack', 'lib', root, rest].join('/')
when 'active_support', 'active_record', 'active_model', 'action_view',
'action_cable', 'action_mailer', 'action_pack', 'active_job'
path = [root.sub('_', ''), 'lib', root, rest].join('/')
when "abstract_controller", "action_controller", "action_dispatch"
path = ["actionpack", "lib", root, rest].join("/")
when "active_support", "active_record", "active_model", "action_view",
"action_cable", "action_mailer", "action_pack", "active_job"
path = [root.sub("_", ""), "lib", root, rest].join("/")
else
path = file_path
end
["https://github.com/rails/rails/tree", version || 'master', path].join('/')
["https://github.com/rails/rails/tree", version || "master", path].join("/")
end
def version
ENV['RAILS_VERSION']
ENV["RAILS_VERSION"]
end
def api_link(url)
if version && !url.match(/v\d\.\d\.\d/)
url.insert(url.index('.org')+4, "/#{version}")
url.sub('http://edgeapi', 'http://api') if url.include?('edgeapi')
url.insert(url.index(".org") + 4, "/#{version}")
url.sub("http://edgeapi", "http://api") if url.include?("edgeapi")
end
url
......
namespace :yarn do
desc "Install all JavaScript dependencies as specified via Yarn"
task :install do
system('./bin/yarn install --no-progress')
system("./bin/yarn install --no-progress")
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册