Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellberg committed Apr 5, 2023
1 parent 42f2856 commit 43506f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/monoz/services/run_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class RunService < Monoz::Services::BaseService
attr_reader :errors, :warnings

def initialize(thor_instance)
super(thor_instance)
@projects = nil
@errors = []
@warnings = []
super(thor_instance)
end

def success?
Expand All @@ -48,7 +48,7 @@ def warnings?
end

def call(projects, *command)
raise ArgumentError.new("Missing command") if command.empty?
raise ArgumentError, "Missing command" if command.empty?

if projects.is_a?(Monoz::ProjectCollection)
@projects = projects.all
Expand All @@ -69,9 +69,9 @@ def call(projects, *command)
response = run_commands_in_project(project, *command)

if response.success?
spinner.success! unless Monoz.tty?
spinner&.success! unless Monoz.tty?
else
spinner.error! unless Monoz.tty?
spinner&.error! unless Monoz.tty?
say response.output
say "" # line break
@errors << {
Expand All @@ -95,7 +95,7 @@ def call(projects, *command)

private
def run_commands_in_project(project, *command)
raise ArgumentError.new("Invalid command") if command.empty?
raise ArgumentError, "Invalid command" if command.empty?

output = ""
exit_status = nil
Expand All @@ -118,9 +118,9 @@ def run_commands_in_project(project, *command)
end
end

return Monoz::Responses::RunServiceResponse.new(output, exit_status)
Monoz::Responses::RunServiceResponse.new(output, exit_status)
rescue Errno::ENOENT => e
return Monoz::Responses::RunServiceResponse.new(e.message, 1)
Monoz::Responses::RunServiceResponse.new(e.message, 1)
end
end
end
Expand Down

0 comments on commit 43506f5

Please sign in to comment.