From ceb505ac1e74969fb8932b7137fba9b794a0b873 Mon Sep 17 00:00:00 2001 From: David Siaw Date: Wed, 29 May 2024 20:22:16 +0900 Subject: [PATCH] rubocop appease --- .rubocop.yml | 6 +++++- lib/kaiser/cli.rb | 2 +- lib/kaiser/kaiserfile.rb | 8 ++++---- lib/kaiser/service.rb | 10 +++++----- spec/kaiserfile_spec.rb | 30 +++++++++++++++--------------- spec/service_spec.rb | 26 +++++++++++++------------- 6 files changed, 43 insertions(+), 39 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0c7a7df4..8ef93dcb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,4 +4,8 @@ inherit_from: .rubocop_todo.yml # its basically what they do anyway Metrics/BlockLength: Exclude: - - 'spec/**/*.rb' \ No newline at end of file + - 'spec/**/*.rb' + +Layout/LineLength: + Exclude: + - 'spec/**/*' diff --git a/lib/kaiser/cli.rb b/lib/kaiser/cli.rb index fe6cf173..a930c537 100644 --- a/lib/kaiser/cli.rb +++ b/lib/kaiser/cli.rb @@ -244,7 +244,7 @@ def default_db_image def attach_app start_services - puts "Attaching to app..." + puts 'Attaching to app...' cmd = (ARGV || []).join(' ') killrm app_container_name diff --git a/lib/kaiser/kaiserfile.rb b/lib/kaiser/kaiserfile.rb index b71dea3c..1ceb7f4b 100644 --- a/lib/kaiser/kaiserfile.rb +++ b/lib/kaiser/kaiserfile.rb @@ -103,10 +103,10 @@ def type(value) end def service(name, - image: name, - command: nil, - binds: {}, - env: {}) + image: name, + command: nil, + binds: {}, + env: {}) raise "duplicate service #{name.inspect}" if @services.key?(name) diff --git a/lib/kaiser/service.rb b/lib/kaiser/service.rb index c3e8bd2f..32f48e41 100644 --- a/lib/kaiser/service.rb +++ b/lib/kaiser/service.rb @@ -32,18 +32,18 @@ def env end def start_docker_command - envstring = env.map do |k,v| + envstring = env.map do |k, v| "-e #{k}=#{v}" end.join(' ') - bindstring = binds.map do |k,v| + bindstring = binds.map do |k, v| "-v #{k}:#{v}" end.join(' ') commandstring = command cmd_array = [ - "docker run -d", + 'docker run -d', "--name #{shared_name}", "--network #{Config.config[:networkname]}", envstring, @@ -52,9 +52,9 @@ def start_docker_command commandstring ] - cmd_array.filter! {|x| !x.empty?} + cmd_array.filter! { |x| !x.empty? } - cmd_array.join(" ") + cmd_array.join(' ') end end end diff --git a/spec/kaiserfile_spec.rb b/spec/kaiserfile_spec.rb index d983b9f5..5bcba812 100644 --- a/spec/kaiserfile_spec.rb +++ b/spec/kaiserfile_spec.rb @@ -198,11 +198,11 @@ it 'adds a service' do kaiserfile = Kaiser::Kaiserfile.new('Kaiserfile') expect(kaiserfile.services).to eq('santaclaus' => { - image: 'santaclaus', - command: nil, - binds: {}, - env: {} - }) + image: 'santaclaus', + command: nil, + binds: {}, + env: {} + }) end end @@ -212,11 +212,11 @@ it 'adds a service with the image name' do kaiserfile = Kaiser::Kaiserfile.new('Kaiserfile') expect(kaiserfile.services).to eq('santaclaus' => { - image: 'northpole/santaclaus', - command: nil, - binds: {}, - env: {} - }) + image: 'northpole/santaclaus', + command: nil, + binds: {}, + env: {} + }) end end @@ -226,11 +226,11 @@ it 'adds a service with the image name' do kaiserfile = Kaiser::Kaiserfile.new('Kaiserfile') expect(kaiserfile.services).to eq('santaclaus' => { - image: 'northpole/santaclaus:last_christmas', - command: nil, - binds: {}, - env: {} - }) + image: 'northpole/santaclaus:last_christmas', + command: nil, + binds: {}, + env: {} + }) end end end diff --git a/spec/service_spec.rb b/spec/service_spec.rb index f38fa07e..4c708f90 100644 --- a/spec/service_spec.rb +++ b/spec/service_spec.rb @@ -34,31 +34,31 @@ it 'provides a command with envs' do s = Kaiser::Service.new('meow', 'santa', { - image: 'np/santa:lol', - env: { - "HELLO" => "world" - } - }) + image: 'np/santa:lol', + env: { + 'HELLO' => 'world' + } + }) expect(s.start_docker_command).to eq 'docker run -d --name meow-santa --network testnet -e HELLO=world np/santa:lol' end it 'provides a command with binds' do s = Kaiser::Service.new('meow', 'santa', { - image: 'np/santa:lol', - binds: { - "/home/user" => "/home/inside/container" - } - }) + image: 'np/santa:lol', + binds: { + '/home/user' => '/home/inside/container' + } + }) expect(s.start_docker_command).to eq 'docker run -d --name meow-santa --network testnet -v /home/user:/home/inside/container np/santa:lol' end it 'provides a command with command' do s = Kaiser::Service.new('meow', 'santa', { - image: 'np/santa:lol', - command: 'hohoho' - }) + image: 'np/santa:lol', + command: 'hohoho' + }) expect(s.start_docker_command).to eq 'docker run -d --name meow-santa --network testnet np/santa:lol hohoho' end