Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
rubocop appease
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsiaw committed May 29, 2024
1 parent 37848fa commit ceb505a
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 39 deletions.
6 changes: 5 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ inherit_from: .rubocop_todo.yml
# its basically what they do anyway
Metrics/BlockLength:
Exclude:
- 'spec/**/*.rb'
- 'spec/**/*.rb'

Layout/LineLength:
Exclude:
- 'spec/**/*'
2 changes: 1 addition & 1 deletion lib/kaiser/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions lib/kaiser/kaiserfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
10 changes: 5 additions & 5 deletions lib/kaiser/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
30 changes: 15 additions & 15 deletions spec/kaiserfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
26 changes: 13 additions & 13 deletions spec/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ceb505a

Please sign in to comment.