Class: Houcho::CLI::Role
- Inherits:
-
Thor
- Object
- Thor
- Houcho::CLI::Role
- Defined in:
- lib/houcho/cli/role.rb
Constant Summary collapse
Instance Method Summary collapse
- #create(*args) ⇒ Object
- #delete(*args) ⇒ Object
- #details(*args) ⇒ Object
- #exec(*args) ⇒ Object
- #list ⇒ Object
- #rename(exist_role, name) ⇒ Object
Instance Method Details
#create(*args) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/houcho/cli/role.rb', line 12 def create(*args) Houcho::CLI::Main.empty_args(self, shell, __method__) if args.empty? @@r.create(args) rescue Houcho::RoleExistenceException => e puts e. exit! end |
#delete(*args) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/houcho/cli/role.rb', line 21 def delete(*args) Houcho::CLI::Main.empty_args(self, shell, __method__) if args.empty? @@r.delete(args) rescue SQLite3::ConstraintException => e puts e. exit! end |
#details(*args) ⇒ Object
38 39 40 41 |
# File 'lib/houcho/cli/role.rb', line 38 def details(*args) Houcho::CLI::Main.empty_args(self, shell, __method__) if args.empty? Houcho::CLI::Main.puts_details(@@r.details(args)) end |
#exec(*args) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/houcho/cli/role.rb', line 51 def exec(*args) Houcho::CLI::Main.empty_args(self, shell, __method__) if args.empty? runner = Houcho::Spec::Runner.new begin exit! unless runner.execute_role( args, ([:exclude_hosts] || []), [:dry_run], true #output to console ) rescue Houcho::SpecFileException => e puts e. exit! end end |
#list ⇒ Object
44 45 46 |
# File 'lib/houcho/cli/role.rb', line 44 def list puts @@r.list.join("\n") end |
#rename(exist_role, name) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/houcho/cli/role.rb', line 30 def rename(exist_role, name) @@r.rename(exist_role, name) rescue SQLite3::ConstraintException, SQLite3::SQLException => e puts e. exit! end |