diff options
author | azul <azul@riseup.net> | 2017-09-23 15:11:20 +0000 |
---|---|---|
committer | azul <azul@riseup.net> | 2017-09-23 15:11:20 +0000 |
commit | fac140a8ff76e98c275194845125d4c97f4ba07b (patch) | |
tree | 08ffafb2c70935892e975704911080b9da84e391 /Rakefile | |
parent | 787287318c54b019a12ef79525c9f5b10d93724d (diff) | |
parent | 8ac6bb8492c9a3b9ec5d7b5bf2b35907a1f8c332 (diff) |
Merge branch 'rubocop' into 'master'
Style fixes based on Rubocop
See merge request leap/nickserver!19
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 31 |
1 files changed, 15 insertions, 16 deletions
@@ -1,17 +1,17 @@ -#require "bundler/gem_tasks" +# require "bundler/gem_tasks" -require "rubygems" -require "pty" -require "fileutils" -require "rake/testtask" +require 'rubygems' +require 'pty' +require 'fileutils' +require 'rake/testtask' ## ## TESTING ## Rake::TestTask.new do |t| - t.pattern = "test/**/*_test.rb" - t.libs << "test" + t.pattern = 'test/**/*_test.rb' + t.libs << 'test' t.verbose = true end task default: :test @@ -28,9 +28,7 @@ $gem_path = File.join($base_dir, 'pkg', "#{$spec.name}-#{$spec.version}.gem") def run(cmd) PTY.spawn(cmd) do |output, _input, _pid| begin - while line = output.gets do - puts line - end + output.each { |line| puts line } rescue Errno::EIO end end @@ -38,13 +36,14 @@ rescue PTY::ChildExited end def built_gem_path - Dir[File.join($base_dir, "#{$spec.name}-*.gem")].sort_by{|f| File.mtime(f)}.last + Dir[File.join($base_dir, "#{$spec.name}-*.gem")] + .max_by { |f| File.mtime(f) } end desc "Build #{$spec.name}-#{$spec.version}.gem into the pkg directory" task 'build' do FileUtils.mkdir_p(File.join($base_dir, 'pkg')) - FileUtils.rm($gem_path) if File.exists?($gem_path) + FileUtils.rm($gem_path) if File.exist?($gem_path) run "gem build -V '#{$spec_path}'" file_name = File.basename(built_gem_path) FileUtils.mv(built_gem_path, 'pkg') @@ -53,11 +52,11 @@ end desc "Install #{$spec.name}-#{$spec.version}.gem into either system-wide or user gems" task 'install' do - if !File.exists?($gem_path) + if !File.exist?($gem_path) puts("Could not file #{$gem_path}. Try running 'rake build'") else options = '--verbose --conservative --no-rdoc --no-ri' - if ENV["USER"] == "root" + if ENV['USER'] == 'root' run "gem install #{options} '#{$gem_path}'" else home_gem_path = Gem.path.grep(/home/).first @@ -67,7 +66,7 @@ task 'install' do if input =~ /[yY]/ run "gem install #{$gem_path} #{options} --install-dir '#{home_gem_path}' " else - puts "bailing out." + puts 'bailing out.' end end end @@ -75,7 +74,7 @@ end desc "Uninstall #{$spec.name}-#{$spec.version}.gem from either system-wide or user gems" task 'uninstall' do - if ENV["USER"] == "root" + if ENV['USER'] == 'root' puts "Removing #{$spec.name}-#{$spec.version}.gem from system-wide gems" run "gem uninstall '#{$spec.name}' --version #{$spec.version} --verbose -x -I" else |