rubocop: Resolve indentation inconsistencies
This commit is contained in:
parent
921e1e8745
commit
4c1cdc8ab8
@ -6,16 +6,6 @@
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 56
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: IndentationWidth.
|
||||
Layout/Tab:
|
||||
Exclude:
|
||||
- '_build/txpreview/addlang.rb'
|
||||
- '_contrib/comparelinks.rb'
|
||||
- '_plugins/events.rb'
|
||||
- '_plugins/sitemap.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: AllowInHeredoc.
|
||||
|
||||
@ -14,8 +14,8 @@ end
|
||||
contents = File.read(PATH + '/_config.yml')
|
||||
|
||||
if Regexp.new('langsorder:.*?' + "\n" + '- \'' + la + '\'' + "\n", Regexp::MULTILINE).match(contents).nil?
|
||||
contents.gsub!(Regexp.new("(langsorder:.*?)\n\n", Regexp::MULTILINE), '\1' + "\n" + '- \'' + la + '\'' + "\n\n")
|
||||
contents.gsub!(Regexp.new("(langs:.*?)\n\n", Regexp::MULTILINE), '\1' + "\n" + ' \'' + la + '\': \'' + la + '\'' + "\n\n")
|
||||
contents.gsub!(Regexp.new("(langsorder:.*?)\n\n", Regexp::MULTILINE), '\1' + "\n" + '- \'' + la + '\'' + "\n\n")
|
||||
contents.gsub!(Regexp.new("(langs:.*?)\n\n", Regexp::MULTILINE), '\1' + "\n" + ' \'' + la + '\': \'' + la + '\'' + "\n\n")
|
||||
end
|
||||
|
||||
File.open(PATH + '/_config.yml', 'w') do |file|
|
||||
|
||||
@ -27,69 +27,69 @@ if !File.exist?('_config.yml')
|
||||
end
|
||||
|
||||
def fetchlinks()
|
||||
# Fetch new list of links
|
||||
links = {}
|
||||
dirs = Dir.glob(WORKDIR + "/_site/**/*.html").each { |file|
|
||||
content = File.read(file)
|
||||
content.scan(/ href *= *"(.*?)"/).each { |link|
|
||||
link = link[0].to_s.gsub(/^(https?:\/\/(www\.)?bitcoin\.org)?\//, '/')
|
||||
next if (link.match(/^#|^http:\/\/www.meetup.com\//))
|
||||
# Fetch new list of links
|
||||
links = {}
|
||||
dirs = Dir.glob(WORKDIR + "/_site/**/*.html").each { |file|
|
||||
content = File.read(file)
|
||||
content.scan(/ href *= *"(.*?)"/).each { |link|
|
||||
link = link[0].to_s.gsub(/^(https?:\/\/(www\.)?bitcoin\.org)?\//, '/')
|
||||
next if (link.match(/^#|^http:\/\/www.meetup.com\//))
|
||||
|
||||
if (!link.match(/^https?:\/\/|^\/[^\/]|^mailto:/))
|
||||
link = File.dirname(file.sub(WORKDIR + '/_site', '')) + '/' + File.basename(link)
|
||||
end
|
||||
links[link] = "0"
|
||||
}
|
||||
content.scan(/ src *= *"(.*?)"/).each { |link|
|
||||
link = link[0].to_s.gsub(/^(https?:\/\/(www\.)?bitcoin\.org)?\//, '/')
|
||||
links[link] = "0"
|
||||
}
|
||||
}
|
||||
if (!link.match(/^https?:\/\/|^\/[^\/]|^mailto:/))
|
||||
link = File.dirname(file.sub(WORKDIR + '/_site', '')) + '/' + File.basename(link)
|
||||
end
|
||||
links[link] = "0"
|
||||
}
|
||||
content.scan(/ src *= *"(.*?)"/).each { |link|
|
||||
link = link[0].to_s.gsub(/^(https?:\/\/(www\.)?bitcoin\.org)?\//, '/')
|
||||
links[link] = "0"
|
||||
}
|
||||
}
|
||||
|
||||
return links
|
||||
return links
|
||||
end
|
||||
|
||||
Dir.mktmpdir { |workdir|
|
||||
WORKDIR = workdir.gsub("\n", '')
|
||||
WORKDIR = workdir.gsub("\n", '')
|
||||
|
||||
# Copy current repository to a temporary directory
|
||||
`rsync -a ./ "#{WORKDIR}/"`
|
||||
# Copy current repository to a temporary directory
|
||||
`rsync -a ./ "#{WORKDIR}/"`
|
||||
|
||||
# Build both version of the website and fetch all links
|
||||
oldlinks = {}
|
||||
newlinks = {}
|
||||
# Build both version of the website and fetch all links
|
||||
oldlinks = {}
|
||||
newlinks = {}
|
||||
|
||||
Dir.chdir(WORKDIR) do
|
||||
`git checkout #{srcbr}`
|
||||
`jekyll`
|
||||
oldlinks = fetchlinks()
|
||||
Dir.chdir(WORKDIR) do
|
||||
`git checkout #{srcbr}`
|
||||
`jekyll`
|
||||
oldlinks = fetchlinks()
|
||||
|
||||
`git checkout #{dstbr}`
|
||||
`jekyll`
|
||||
newlinks = fetchlinks()
|
||||
end
|
||||
`git checkout #{dstbr}`
|
||||
`jekyll`
|
||||
newlinks = fetchlinks()
|
||||
end
|
||||
|
||||
# Find added links, removed links
|
||||
diffaddlinks = []
|
||||
diffrmlinks = []
|
||||
newlinks.each { |link, etag|
|
||||
next if oldlinks.has_key?(link)
|
||||
# Find added links, removed links
|
||||
diffaddlinks = []
|
||||
diffrmlinks = []
|
||||
newlinks.each { |link, etag|
|
||||
next if oldlinks.has_key?(link)
|
||||
|
||||
diffaddlinks.push(link)
|
||||
}
|
||||
oldlinks.each { |link, etag|
|
||||
next if newlinks.has_key?(link)
|
||||
diffaddlinks.push(link)
|
||||
}
|
||||
oldlinks.each { |link, etag|
|
||||
next if newlinks.has_key?(link)
|
||||
|
||||
diffrmlinks.push(link)
|
||||
}
|
||||
diffrmlinks.push(link)
|
||||
}
|
||||
|
||||
# Display resulting diff
|
||||
diff = ''
|
||||
if diffaddlinks.length > 0
|
||||
diff = diff + "## links added\n\n" + diffaddlinks.join("\n") + "\n\n"
|
||||
end
|
||||
if diffrmlinks.length > 0
|
||||
diff = diff + "## links removed\n\n" + diffrmlinks.join("\n") + "\n\n"
|
||||
end
|
||||
print diff
|
||||
# Display resulting diff
|
||||
diff = ''
|
||||
if diffaddlinks.length > 0
|
||||
diff = diff + "## links added\n\n" + diffaddlinks.join("\n") + "\n\n"
|
||||
end
|
||||
if diffrmlinks.length > 0
|
||||
diff = diff + "## links removed\n\n" + diffrmlinks.join("\n") + "\n\n"
|
||||
end
|
||||
print diff
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ module Jekyll
|
||||
# Loop in _events.yml
|
||||
YAML.load_file('_events.yml').each do |data|
|
||||
# Skip event if it has started more than five days ago
|
||||
date = data['date'].to_s.split('-')
|
||||
date = data['date'].to_s.split('-')
|
||||
next if Time.new.to_i > (Time.new(date[0].to_i, date[1].to_i, date[2].to_i).to_i + 432000)
|
||||
|
||||
# Get geolocalisation data from Google Maps
|
||||
|
||||
Loading…
Reference in New Issue
Block a user