Class: Houcho::CLI::Spec

Inherits:
Thor
  • Object
show all
Defined in:
lib/houcho/cli/spec.rb

Constant Summary collapse

@@s =
Houcho::Spec.new

Instance Method Summary collapse

Instance Method Details

#attach(*args) ⇒ Object



20
21
22
23
24
25
# File 'lib/houcho/cli/spec.rb', line 20

def attach(*args)
  @@s.attach(args, options[:roles])
rescue RoleExistenceException, SpecFileException, SQLite3::ConstraintException => e
  puts e.message
  exit!
end

#check(*args) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/houcho/cli/spec.rb', line 69

def check(*args)
  Houcho::CLI::Main.empty_args(self, shell, __method__) if args.empty?
  runner = Houcho::Spec::Runner.new

  begin
    exit! unless runner.check(args, options[:samples], false, true)
  rescue SpecFileException => e
    puts e.message
    exit!
  end
end

#delete(*args) ⇒ Object



49
50
51
52
53
54
55
56
57
58
# File 'lib/houcho/cli/spec.rb', line 49

def delete(*args)
  if options[:force]
    @@s.delete_file!(args)
  else
    @@s.delete_file(args)
  end
rescue SpecFileException => e
  puts e.message
  exit!
end

#detach(*args) ⇒ Object



30
31
32
33
34
35
# File 'lib/houcho/cli/spec.rb', line 30

def detach(*args)
  @@s.detach(args, options[:roles])
rescue RoleExistenceException, SQLite3::ConstraintException => e
  puts e.message
  exit!
end

#details(*args) ⇒ Object



62
63
64
# File 'lib/houcho/cli/spec.rb', line 62

def details(*args)
  Houcho::CLI::Main.puts_details(@@s.details(args))
end

#exec(*args) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/houcho/cli/spec.rb', line 86

def exec(*args)
  Houcho::CLI::Main.empty_args(self, shell, __method__) if args.empty?
  runner = Houcho::Spec::Runner.new

  begin
    exit! unless runner.execute_manually(
      options[:hosts],
      args,
      dryrun: options[:dry_run],
      console_output: true,
      attr: options[:attr]
    )
  rescue Houcho::SpecFileException => e
    puts e.message
    exit!
  end
end

#listObject



13
14
15
# File 'lib/houcho/cli/spec.rb', line 13

def list
  puts @@s.list.sort.join("\n")
end

#rename(from, to) ⇒ Object



39
40
41
42
43
44
# File 'lib/houcho/cli/spec.rb', line 39

def rename(from, to)
  @@s.rename(from, to)
rescue SpecFileException => e
  puts e.message
  exit!
end