Class: Castaway::CLI::Build
- Inherits:
-
Object
- Object
- Castaway::CLI::Build
- Extended by:
- GLI::App
- Defined in:
- lib/castaway/cli/build.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(definition, name, options) ⇒ Build
constructor
A new instance of Build.
Constructor Details
#initialize(definition, name, options) ⇒ Build
Returns a new instance of Build.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/castaway/cli/build.rb', line 49 def initialize(definition, name, ) deliverable = File.basename(name, File.extname(name)) + '.mp4' production = definition.new( resolution: [:resolution], fps: [:fps], deliverable: [:output] || deliverable) range = Castaway::Range.new(production) if ['start-time'] range.start_time = ['start-time'] elsif ['start-scene'] range.start_scene = ['start-scene'] elsif ['start-frame'] range.start_frame = ['start-frame'] end if ['end-time'] range.end_time = ['end-time'] elsif ['end-scene'] range.end_scene = ['end-scene'] elsif ['end-frame'] range.end_frame = ['end-frame'] end production.produce(range) rescue Exception => e puts "#{e.class} (#{e.})" puts e.backtrace abort end |
Class Method Details
.define(command) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/castaway/cli/build.rb', line 13 def self.define(command) command.desc 'The resolution at which to generate the frames' command.flag %i(r resolution), default_value: '540p' command.desc 'How many frames per second to generate' command.flag %i(f fps), default_value: 29.97, type: Float command.desc 'The frame from which to start producing frames' command.flag %i(start-frame), default_value: 0, type: Integer command.desc 'The frame after which to stop producing frames' command.flag %i(end-frame), type: Integer command.desc 'The scene from which to start producing frames' command.flag %i(start-scene) command.desc 'The scene after which to stop producing frames' command.flag %i(end-scene) command.desc 'The time from which to start producing frames' command.flag %i(start-time) command.desc 'The time after which to stop producing frames' command.flag %i(end-time) command.desc 'What to call the resulting movie' command.flag %i(o output) command.action do |_globals, , args| exit_now!('you have to supply a castaway program') if args.empty? definition = Castaway::Production.from_script(args.first) new(definition, args.first, ) end end |
.description ⇒ Object
9 10 11 |
# File 'lib/castaway/cli/build.rb', line 9 def self.description 'Builds the given castaway production' end |