aboutsummaryrefslogtreecommitdiff
path: root/web/lib
diff options
context:
space:
mode:
authorPeter Wilmott <p@p8952.info>2015-06-22 19:55:07 +0000
committerPeter Wilmott <p@p8952.info>2015-06-22 19:55:07 +0000
commitaa3bb2f4ac565031578d965c9757b457461bbbca (patch)
treec1f580ae815a53d444816afcd388eb7adbe3ffec /web/lib
parentAdd python linter (diff)
downloadruby-tinderbox-aa3bb2f4ac565031578d965c9757b457461bbbca.tar.gz
ruby-tinderbox-aa3bb2f4ac565031578d965c9757b457461bbbca.tar.bz2
ruby-tinderbox-aa3bb2f4ac565031578d965c9757b457461bbbca.zip
Fix most issues raised by linters, some python ones remain
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/ci.rb4
-rw-r--r--web/lib/helpers.rb78
-rw-r--r--web/lib/packages.rb2
3 files changed, 44 insertions, 40 deletions
diff --git a/web/lib/ci.rb b/web/lib/ci.rb
index 80de8fb..c3839c9 100644
--- a/web/lib/ci.rb
+++ b/web/lib/ci.rb
@@ -8,9 +8,9 @@ def run_ci(volume_container, ci_image, ci_type, num_of_packages)
next_target = package[2]
if ci_type == 'build'
- cmd = %W[/ruby-tinderbox/tinder.sh #{identifier} #{current_target} #{next_target}]
+ cmd = %W(/ruby-tinderbox/tinder.sh #{identifier} #{current_target} #{next_target})
elsif ci_type == 'repoman'
- cmd = %W[/ruby-tinderbox/repoman.sh #{identifier} #{current_target} #{next_target}]
+ cmd = %W(/ruby-tinderbox/repoman.sh #{identifier} #{current_target} #{next_target})
end
ci_container = Docker::Container.create(
Cmd: cmd,
diff --git a/web/lib/helpers.rb b/web/lib/helpers.rb
index ab96e20..d01e39d 100644
--- a/web/lib/helpers.rb
+++ b/web/lib/helpers.rb
@@ -4,52 +4,56 @@ class String
end
end
-module Archive::Tar::Minitar
- class << self
- def pack_file(entry, outputter)
- outputter = outputter.tar if outputter.kind_of?(Archive::Tar::Minitar::Output)
+module Archive
+ module Tar
+ module Minitar
+ class << self
+ def pack_file(entry, outputter)
+ outputter = outputter.tar if outputter.is_a?(Archive::Tar::Minitar::Output)
- stats = {}
+ stats = {}
- if entry.kind_of?(Hash)
- name = entry[:name]
+ if entry.is_a?(Hash)
+ name = entry[:name]
- entry.each { |kk, vv| stats[kk] = vv unless vv.nil? }
- else
- name = entry
- end
+ entry.each { |kk, vv| stats[kk] = vv unless vv.nil? }
+ else
+ name = entry
+ end
- name = name.sub(%r{\./}, '')
- stat = File.stat(name)
- stats[:mode] ||= stat.mode
- stats[:mtime] ||= stat.mtime
- stats[:size] = stat.size
+ name = name.sub(/\.\//, '')
+ stat = File.stat(name)
+ stats[:mode] ||= stat.mode
+ stats[:mtime] ||= stat.mtime
+ stats[:size] = stat.size
- if RUBY_PLATFORM =~ /win32/
- stats[:uid] = nil
- stats[:gid] = nil
- else
- stats[:uid] ||= stat.uid
- stats[:gid] ||= stat.gid
- end
+ if RUBY_PLATFORM =~ /win32/
+ stats[:uid] = nil
+ stats[:gid] = nil
+ else
+ stats[:uid] ||= stat.uid
+ stats[:gid] ||= stat.gid
+ end
- case
- when File.file?(name)
- outputter.add_file_simple(name, stats) do |os|
- stats[:current] = 0
- yield :file_start, name, stats if block_given?
- File.open(name, "rb") do |ff|
- until ff.eof?
- stats[:currinc] = os.write(ff.read(4096))
- stats[:current] += stats[:currinc]
- yield :file_progress, name, stats if block_given?
+ case
+ when File.file?(name)
+ outputter.add_file_simple(name, stats) do |os|
+ stats[:current] = 0
+ yield :file_start, name, stats if block_given?
+ File.open(name, 'rb') do |ff|
+ until ff.eof?
+ stats[:currinc] = os.write(ff.read(4096))
+ stats[:current] += stats[:currinc]
+ yield :file_progress, name, stats if block_given?
+ end
+ end
+ yield :file_done, name, stats if block_given?
end
+ when dir?(name)
+ yield :dir, name, stats if block_given?
+ outputter.mkdir(name, stats)
end
- yield :file_done, name, stats if block_given?
end
- when dir?(name)
- yield :dir, name, stats if block_given?
- outputter.mkdir(name, stats)
end
end
end
diff --git a/web/lib/packages.rb b/web/lib/packages.rb
index 3e5a8bc..8cad6d4 100644
--- a/web/lib/packages.rb
+++ b/web/lib/packages.rb
@@ -1,5 +1,5 @@
def update_packages(ci_image)
- cmd = %W[/ruby-tinderbox/packages.py | sort -u]
+ cmd = %w(/ruby-tinderbox/packages.py | sort -u)
ci_container = Docker::Container.create(
Cmd: cmd,
Image: ci_image.id