lib/jive/cli.rb in jive-0.2.3 vs lib/jive/cli.rb in jive-0.3.0
- old
+ new
@@ -7,46 +7,94 @@
require "jive"
module Jive
module Cli
class App < Thor
+ package_name "jive"
+
def self.exit_on_failure?
true
end
+ def self.handle_no_command_error(name)
+ ::Jive::Cli::App.start(["exec", name])
+ end
+
+ desc "docker SUBCOMMAND ...ARGS", "docker commands"
+ subcommand "docker", (Class.new(Thor) do
+ desc "build", "build the Dockerfile in the current directory"
+ def build
+ Docker.new.build(Pathname.pwd)
+ end
+
+ desc "launch", "launch a shell into a container"
+ def launch
+ Docker.new.launch(Pathname.pwd)
+ end
+
+ desc "size", "print the size of each image"
+ def size
+ Docker.new.size(Pathname.pwd)
+ end
+ end)
+
+ desc "git SUBCOMMAND ...ARGS", "git commands"
+ subcommand "git", (Class.new(Thor) do
+ desc "semantic", "Print help for semantic commit messages"
+ def semantic
+ say <<~MESSAGE
+ Format: <type>(<scope>): <subject>
+
+ <scope> is optional
+
+ feat: add hat wobble
+ ^--^ ^------------^
+ | |
+ | +-> Summary in present tense.
+ |
+ +-------> Type: chore, docs, feat, fix, refactor, style, or test.
+
+ chore: updating grunt tasks etc; no production code change
+ docs: changes to the documentation
+ feat: new feature for the user, not a new feature for build script
+ fix: bug fix for the user, not a fix to a build script
+ refactor: refactoring production code, eg. renaming a variable
+ style: formatting, missing semi colons, etc; no production code change
+ test: adding missing tests, refactoring tests; no production code change
+ MESSAGE
+ end
+ end)
+
desc "cd <org>/<project>", "cd to ~/src/github.com/<org>/<project>"
def cd(slug)
- runner.run_safely { Git.new(runner).cd(slug) }
+ Jive.shell.run_safely { Git.new(Jive.shell).cd(slug) }
end
desc "clone <org>/<project>", "git clone to ~/src/github.com/<org>/<project>"
def clone(slug)
- runner.run_safely { Git.new(runner).clone(slug) }
+ Jive.shell.run_safely { Git.new(Jive.shell).clone(slug) }
end
desc "exec <command>", "run command from jive.yml"
def exec(command)
path = Pathname.pwd.join("jive.yml")
return shell.error("Error: jive.yml not found") unless path.exist?
- runner.run_safely do
- runner.execute(YAML.safe_load(path.read).dig("commands", command))
+ Jive.shell.run_safely do
+ Jive.shell.execute(YAML.safe_load(path.read).dig("commands", command))
end
end
- desc "setup", "provide instructions to integrate into shell"
- def setup
- say <<~MESSAGE
- Include the following in your ~/.bash_profile
-
- source #{::Jive.root.join("jive.sh")}
- MESSAGE
+ desc "bootstrap", "bootstrap the current project"
+ def bootstrap
+ Project
+ .new(Pathname.pwd)
+ .bootstrap(Jive.shell)
end
- private
-
- def runner
- @runner ||= ::Jive::Shell.new
+ desc "setup", "provide instructions to integrate into shell"
+ def setup
+ print "source #{::Jive.root.join("jive.sh")}"
end
end
end
end