Class: Agile::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/agile.rb,
lib/agile/commands/dod.rb,
lib/agile/commands/dor.rb,
lib/agile/commands/help.rb,
lib/agile/commands/init.rb,
lib/agile/commands/hello.rb,
lib/agile/commands/login.rb,
lib/agile/commands/users.rb,
lib/agile/commands/events.rb,
lib/agile/commands/values.rb,
lib/agile/commands/remotes.rb,
lib/agile/commands/tickets.rb,
lib/agile/commands/version.rb,
lib/agile/commands/projects.rb,
lib/agile/commands/manifesto.rb,
lib/agile/commands/principles.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.help(shell, subcommand = false) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/agile/commands/help.rb', line 6

def help(shell, subcommand = false)
  list = printable_commands(true, subcommand)
  Thor::Util.thor_classes_in(self).each do |klass|
    list += klass.printable_commands(false)
  end
  list.sort! { |a, b| a[0] <=> b[0] }
  list.reject! { |l| l[0].split[1] == 'help' }

  if defined?(@package_name) && @package_name
    shell.say "#{@package_name} commands:"
  else
    shell.say Rainbow('Commands:').whitesmoke
  end

  shell.print_table(list, indent: 2, truncate: true)
  shell.say
  class_options_help(shell)
  shell.say Rainbow('All commands can be run with -h (or --help) for more information.').whitesmoke
  shell.say Rainbow('Homepage https://github.com/rubizza-camp/AgileCli').whitesmoke
end

Instance Method Details

#DoDObject



6
7
8
9
10
# File 'lib/agile/commands/dod.rb', line 6

def DoD
  dod = []
  dod << File.read("#{GEM_PATH}/agile/assets/definition_of_done.txt")
  say Terminal::Table.new title: "Definition of Done", rows: [dod], style: TERMINAL_STYLE
end

#DoRObject



6
7
8
9
10
# File 'lib/agile/commands/dor.rb', line 6

def DoR
  dor = []
  dor << File.read("#{GEM_PATH}/agile/assets/definition_of_ready.txt")
  say Terminal::Table.new title: "Definition of Ready", rows: [dor], style: TERMINAL_STYLE
end

#helloObject



4
5
6
# File 'lib/agile/commands/hello.rb', line 4

def hello
  say "Hello world!"
end

#init(remote) ⇒ Object



7
8
9
10
11
# File 'lib/agile/commands/init.rb', line 7

def init(remote)
  error_checking_init
  write_remote_to_config(remote)
  say "Successfully added new remote!"
end

#loginObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/agile/commands/login.rb', line 6

def 
  
  open_link
  @secret_node = call_cli
  @response = RestClient.get "#{CONFIG['current_remote']}/api/v1/users/#{@secret_node}"
  if JSON.parse(@response)["data"]["attributes"]
    
  else
    say "Something went wrong"
  end
end

#manifestoObject



4
5
6
7
8
# File 'lib/agile/commands/manifesto.rb', line 4

def manifesto
  manifest = []
  manifest << File.read("#{GEM_PATH}/agile/assets/manifesto.txt")
  say Terminal::Table.new title: "Manifesto", rows: [manifest], style: TERMINAL_STYLE
end

#principlesObject



4
5
6
7
8
# File 'lib/agile/commands/principles.rb', line 4

def principles
  principl = []
  principl << File.read("#{GEM_PATH}/agile/assets/agile_principles.txt")
  say Terminal::Table.new title: "Agile principles", rows: [principl], style: TERMINAL_STYLE
end

#valuesObject



4
5
6
7
8
# File 'lib/agile/commands/values.rb', line 4

def values
  values = []
  values << File.read("#{GEM_PATH}/agile/assets/agile_values.txt")
  say Terminal::Table.new title: "Values", rows: [values], style: TERMINAL_STYLE
end

#versionObject



4
5
6
# File 'lib/agile/commands/version.rb', line 4

def version
  say "agile #{Agile::VERSION}"
end