Class: Specjour::CLI
- Inherits:
-
Thor
- Object
- Thor
- Specjour::CLI
- Defined in:
- lib/specjour/cli.rb
Class Method Summary collapse
- .dispatcher_option ⇒ Object
- .rsync_port_option ⇒ Object
-
.start(original_args = ARGV, config = {}) ⇒ Object
allow specjour to be called with path arguments.
- .worker_option ⇒ Object
Instance Method Summary collapse
- #dispatch(*paths) ⇒ Object
- #listen ⇒ Object
- #load ⇒ Object
- #prepare(path = Dir.pwd) ⇒ Object
- #version ⇒ Object
Class Method Details
.dispatcher_option ⇒ Object
9 10 11 |
# File 'lib/specjour/cli.rb', line 9 def self.dispatcher_option method_option :alias, :aliases => "-a", :desc => "Project name advertised to listeners" end |
.rsync_port_option ⇒ Object
13 14 15 |
# File 'lib/specjour/cli.rb', line 13 def self.rsync_port_option method_option :rsync_port, :type => :numeric, :default => 23456, :desc => "Port to use for rsync daemon" end |
.start(original_args = ARGV, config = {}) ⇒ Object
allow specjour to be called with path arguments
18 19 20 21 22 23 24 25 |
# File 'lib/specjour/cli.rb', line 18 def self.start(original_args=ARGV, config={}) Specjour.trap_interrupt real_tasks = all_tasks.keys | @map.keys unless real_tasks.include? original_args.first original_args.unshift default_task end super(original_args) end |
.worker_option ⇒ Object
5 6 7 |
# File 'lib/specjour/cli.rb', line 5 def self.worker_option method_option :workers, :aliases => "-w", :type => :numeric, :desc => "Number of concurent processes to run. Defaults to your system's available cores." end |
Instance Method Details
#dispatch(*paths) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/specjour/cli.rb', line 73 def dispatch(*paths) handle_logging handle_workers handle_dispatcher(paths) append_to_program_name "dispatch" Specjour::Dispatcher.new(params).start end |
#listen ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/specjour/cli.rb', line 38 def listen handle_logging handle_workers params[:registered_projects] = params.delete(:projects) || [File.basename(Dir.pwd)] append_to_program_name "listen" Specjour::Manager.new(params).start end |
#load ⇒ Object
53 54 55 56 57 58 |
# File 'lib/specjour/cli.rb', line 53 def load handle_logging handle_workers append_to_program_name "load" Specjour::Loader.new(params).start end |
#prepare(path = Dir.pwd) ⇒ Object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/specjour/cli.rb', line 89 def prepare(path = Dir.pwd) handle_logging handle_workers params[:project_path] = File.(path) params[:project_alias] = params.delete(:alias) params[:test_paths] = [] params[:worker_task] = 'prepare' append_to_program_name "prepare" Specjour::Dispatcher.new(params).start end |
#version ⇒ Object
102 103 104 |
# File 'lib/specjour/cli.rb', line 102 def version puts Specjour::VERSION end |