Class: Arigato::CLI

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

Constant Summary collapse

HTML_DIR =
'thanks'
HTML_FILE =
File.join(HTML_DIR, 'index.html')

Instance Method Summary collapse

Instance Method Details

#csv(file = './Gemfile') ⇒ Object



51
52
53
54
55
# File 'lib/arigato/cli.rb', line 51

def csv(file = './Gemfile')
  Arigato.specs_array(file, false).each do |spec|
    say spec.values.to_csv
  end
end

#generate(theme = 'default') ⇒ Object



23
24
25
26
27
28
# File 'lib/arigato/cli.rb', line 23

def generate(theme = 'default')
  empty_directory(HTML_DIR)
  gemfile = options[:file]
  view = View.new(theme, gemfile)
  create_file(HTML_FILE, view.render)
end

#json(file = './Gemfile') ⇒ Object



41
42
43
# File 'lib/arigato/cli.rb', line 41

def json(file = './Gemfile')
  say JSON.pretty_generate(Arigato.specs_array(file))
end

#themesObject



36
37
38
# File 'lib/arigato/cli.rb', line 36

def themes
  puts Dir::entries(Arigato.themes_dir).reject { |e| e =~ /^\./ }
end

#versionObject



31
32
33
# File 'lib/arigato/cli.rb', line 31

def version
  say "Arigato #{Arigato::VERSION}"
end

#yaml(file = './Gemfile') ⇒ Object



46
47
48
# File 'lib/arigato/cli.rb', line 46

def yaml(file = './Gemfile')
  say Arigato.specs_hash(file).to_yaml
end