Class: Ripe::CLI
- Inherits:
-
Thor
- Object
- Thor
- Ripe::CLI
- Defined in:
- lib/ripe/cli.rb,
lib/ripe/cli/helper.rb
Overview
This class represents the CLI interface to ripe. The methods defined in this class are wrappers for the methods defined in Ripe::Repo
and Ripe::WorkerController
.
Defined Under Namespace
Classes: Helper
Instance Method Summary collapse
-
#console ⇒ Object
Launch ripe console.
-
#init ⇒ Object
Initialize ripe repository.
-
#prepare(*samples) ⇒ Object
Prepare samples.
-
#version ⇒ Object
Retrieve ripe version.
Instance Method Details
#console ⇒ Object
Launch ripe console. It is a REPL bound to the context of a Ripe::WorkerController
initialized in the working directory.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ripe/cli.rb', line 46 def console repo = Repo.new repo.attach unless repo.has_repository? abort "Cannot launch console: ripe repo not initialized" end # Do not send arguments to the REPL ARGV.clear Ripl.config[:prompt] = proc do # This is the only place I could think of placing +Hirb#enable+. Hirb.enable unless Hirb::View.enabled? 'ripe> ' end # Launch the REPL session in the context of +WorkerController+. Ripl.start :binding => repo.controller.instance_eval { binding } end |
#init ⇒ Object
Initialize ripe repository.
30 31 32 33 34 |
# File 'lib/ripe/cli.rb', line 30 def init puts "Initialized ripe repository in #{Dir.pwd}" repo = Repo.new repo.attach_or_create end |
#prepare(*samples) ⇒ Object
Prepare samples.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/ripe/cli.rb', line 87 def prepare(*samples) repo = Repo.new repo.attach unless repo.has_repository? abort 'Cannot prepare samples: ripe repo not initialized' end abort 'No samples specified.' if samples.length == 0 config = [:config] ? Helper.parse_config([:config]) : {} = config[[:workflow].to_sym] ||= {} .merge!(Helper.parse_cli_opts([:options])) workers = repo.controller.prepare([:workflow], samples, ) repo.controller.start(workers) if [:start] end |
#version ⇒ Object
Retrieve ripe version.
113 |
# File 'lib/ripe/cli.rb', line 113 desc 'version', 'Retrieve ripe version' |