Class: Sambot::CLI
- Inherits:
-
BaseCommand
- Object
- Thor
- BaseCommand
- Sambot::CLI
- Defined in:
- lib/sambot/cli.rb
Instance Method Summary collapse
- #build ⇒ Object
- #bump ⇒ Object
- #clean ⇒ Object
- #create ⇒ Object
- #down ⇒ Object
- #populate ⇒ Object
- #test ⇒ Object
- #up ⇒ Object
- #version ⇒ Object
Methods inherited from Thor
Instance Method Details
#build ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/sambot/cli.rb', line 54 def build execute do cloud = nil cloud = 'local' if [:local] cloud = 'google' if [:google] cloud = 'rackspace' if [:rackspace] unless cloud UI.error('Please select which environment this is building for using one of the following flags: --local, --rackspace or --google') exit end local_workflow = [:docker] ? 'docker' : 'vagrant' Chef::Cookbook.build(Config.read, cloud, local_workflow) end end |
#bump ⇒ Object
45 46 47 |
# File 'lib/sambot/cli.rb', line 45 def bump execute { Chef::Cookbook.bump } end |
#clean ⇒ Object
9 10 11 |
# File 'lib/sambot/cli.rb', line 9 def clean execute { Chef::Cookbook.clean } end |
#create ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/sambot/cli.rb', line 70 def create execute do opts = { name: ask(' What is the name of this cookbook?'), type: ask(' What type of cookbook will this be?', limited_to: %w[wrapper role]), platforms: ask(' What operating system will this cookbook run on?', limited_to: %w[windows centos both]), description: ask(' What does this cookbook do?') } opts[:identifier] = ask(' What will be the unique machiner identifier for this role cookbook i.e. TCA (TeamCity Agent) or RMQ (RabbitMQ role)?') if opts[:type] == 'role' opts[:platforms] = opts[:platforms] == 'both' ? %w[centos windows] : [opts[:platforms]] Chef::Cookbook.create(Config.new(opts)) end end |
#down ⇒ Object
22 23 24 25 26 |
# File 'lib/sambot/cli.rb', line 22 def down execute do `docker-compose down` end end |
#populate ⇒ Object
38 39 40 41 42 |
# File 'lib/sambot/cli.rb', line 38 def populate execute do populate_cmd end end |
#test ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/sambot/cli.rb', line 29 def test execute do `docker-compose -p chef up -d` populate_cmd `docker-compose down` end end |
#up ⇒ Object
14 15 16 17 18 19 |
# File 'lib/sambot/cli.rb', line 14 def up execute do `docker-compose -p chef up -d` populate_cmd end end |