Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
basic cli interface, no frills
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bresson committed Dec 5, 2016
1 parent 1da7891 commit e217075
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bin/bedouin
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env ruby
require 'bedouin'

exit_val = Bedouin::CLI.new.execute(*ARGV)

exit exit_val
1 change: 1 addition & 0 deletions lib/bedouin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "bedouin/environment"
require "bedouin/job"
require "bedouin/runner"
require "bedouin/cli"

module Bedouin
def self.template_for(template_path)
Expand Down
16 changes: 16 additions & 0 deletions lib/bedouin/cli.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Bedouin
class CLI
def execute(env_path, *template_paths)
e = Bedouin.environment_for(env_path)

template_paths.lazy.map do |path|
t = Bedouin.template_for(path)
j = Bedouin::Job.new(e, t)
Bedouin::Runner.new.run(j)
end.reduce(0) do |m,j|
puts j.to_s
j.status == 0 ? m : 1
end
end
end
end

0 comments on commit e217075

Please sign in to comment.