Class: Parcel::Rails::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/parcel/rails/runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Runner

Returns a new instance of Runner.



19
20
21
# File 'lib/parcel/rails/runner.rb', line 19

def initialize(args)
  @args = args
end

Class Method Details

.from_command_line(args) ⇒ Object



6
7
8
9
# File 'lib/parcel/rails/runner.rb', line 6

def self.from_command_line(args)
  return from_config if args.empty?
  new(args)
end

.from_configObject



11
12
13
# File 'lib/parcel/rails/runner.rb', line 11

def self.from_config
  to_args(::Rails.application.config.parcel)
end

.to_args(config) ⇒ Object



15
16
17
# File 'lib/parcel/rails/runner.rb', line 15

def self.to_args(config)
  new([*config.entry_points, '-d', config.destination])
end

Instance Method Details

#compileObject



23
24
25
# File 'lib/parcel/rails/runner.rb', line 23

def compile
  parcel_commmand(:build)
end

#serveObject



27
28
29
# File 'lib/parcel/rails/runner.rb', line 27

def serve
  parcel_commmand
end