Class: CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/testament/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#app_nameObject

Returns the value of attribute app_name.



11
12
13
# File 'lib/testament/cli.rb', line 11

def app_name
  @app_name
end

Instance Method Details

#init(path) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/testament/cli.rb', line 14

def init(path)
  self.app_name = File.basename File.expand_path(path)
  self.destination_root = path
  directory ".testament", ".testament"

  require 'testament/database'
  database = Testament::Database.new adapter: :sqlite, database: "#{path}/.testament/db.sqlite"
  database.create_schema
end

#logObject



32
33
34
35
# File 'lib/testament/cli.rb', line 32

def log
  project = Testament::Project.load
  puts project.log
end

#record(*command_words) ⇒ Object



25
26
27
28
29
# File 'lib/testament/cli.rb', line 25

def record(*command_words)
  project = Testament::Project.load
  record = project.record command_words
  exit record[:exit_status]
end

#report(name = 'default') ⇒ Object



44
45
46
47
48
49
50
# File 'lib/testament/cli.rb', line 44

def report(name='default')
  require 'terminal-table'
  project = Testament::Project.load
  report = project.report name
  table = Terminal::Table.new :headings => report.headers, :rows => report.rows
  puts table
end