Sha256: f9a444ab3abbafb3b7de36985379c1ac3ec1dac94b352c2c9b0acf47ff6c2cbd
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
require 'thor' module WhippedCream # The CLI gets invoked from the binary, and encapsulates all user interaction # logic class CLI < Thor default_task :usage desc "usage", "Display usage banner", hide: true def usage puts [ "Whipped Cream #{WhippedCream::VERSION}", "https://github.com/justincampbell/whipped-cream" ].join("\n") puts "\n" help end desc "demo", "Start the demo plugin" def demo plugin = Plugin.from_file(File.expand_path('../../../demo.rb', __FILE__)) server = Server.new(plugin) server.start end desc "deploy PLUGIN IP", "Deploy a plugin to a Pi" def deploy(plugin_name, pi_address) plugin_path = resolve_plugin(plugin_name) deployer = Deployer.new(plugin_path, pi_address) deployer.deploy end desc "start PLUGIN", "Start a plugin" method_option :daemonize, type: :boolean, desc: "Run the server in the background" method_option :port, desc: "Choose a different port to run the server on" def start(plugin_name) plugin_path = resolve_plugin(plugin_name) plugin = Plugin.from_file(plugin_path) server = Server.new(plugin, options) server.start end no_tasks do def resolve_plugin(name) name # TODO: resolve name to filename end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whipped-cream-0.1.1 | lib/whipped-cream/cli.rb |
whipped-cream-0.1.0 | lib/whipped-cream/cli.rb |