Class: Jive::Cli::App

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/jive/cli.rb', line 15

def self.exit_on_failure?
  true
end

.handle_no_command_error(name) ⇒ Object



19
20
21
# File 'lib/jive/cli.rb', line 19

def self.handle_no_command_error(name)
  ::Jive::Cli::App.start(["exec", name])
end

Instance Method Details

#bootstrapObject



88
89
90
91
92
# File 'lib/jive/cli.rb', line 88

def bootstrap
  Project
    .new(Pathname.pwd)
    .bootstrap(Jive.shell)
end

#cd(slug) ⇒ Object



73
74
75
# File 'lib/jive/cli.rb', line 73

def cd(slug)
  Jive.shell.run_safely { Git.new(Jive.shell).cd(slug) }
end

#exec(command) ⇒ Object



78
79
80
81
82
83
84
85
# File 'lib/jive/cli.rb', line 78

def exec(command)
  path = Pathname.pwd.join("jive.yml")
  return shell.error("Error: jive.yml not found") unless path.exist?

  Jive.shell.run_safely do
    Jive.shell.execute(YAML.safe_load(path.read).dig("commands", command))
  end
end

#prObject



95
96
97
98
# File 'lib/jive/cli.rb', line 95

def pr
  pr = PullRequest.new(repo: Repo.current)
  pr.edit(ENV["EDITOR"])
end

#setupObject



101
102
103
# File 'lib/jive/cli.rb', line 101

def setup
  print "source #{::Jive.root.join("jive.sh")}"
end