-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
556 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
require 'rubygems' | ||
require "bundler/gem_tasks" | ||
require 'bundler/gem_tasks' | ||
require 'coveralls/rake/task' | ||
require 'cucumber' | ||
require 'cucumber/rake/task' | ||
require "rspec/core/rake_task" | ||
require 'rspec/core/rake_task' | ||
require 'rubocop/rake_task' | ||
|
||
Cucumber::Rake::Task.new(:features) do |t| | ||
t.cucumber_opts = "features --format pretty" | ||
t.cucumber_opts = 'features --format pretty' | ||
end | ||
RSpec::Core::RakeTask.new(:spec) | ||
Coveralls::RakeTask.new | ||
RuboCop::RakeTask.new | ||
|
||
task :default => :spec | ||
task default: :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,64 @@ | ||
module Budik | ||
# 'Command' class holds definitions of CLI commands. | ||
class Command | ||
include Singleton | ||
def initialize(command, opts) | ||
@options = Config.instance.options | ||
@sources = Config.instance.sources | ||
@strings = Config.instance.lang.command | ||
|
||
def config(_args, opts) | ||
send(command, opts) | ||
end | ||
|
||
def run(_args, opts) | ||
options = Config.instance.options | ||
dl_options = options['sources']['download'] | ||
private | ||
|
||
dl_options['keep'] = opts.dl_keep if opts.dl_keep | ||
options['player']['player'] = opts.player if opts.player | ||
options['rng']['method'] = opts.rng if opts.rng | ||
def config(_opts) | ||
end | ||
|
||
def run(opts) | ||
sources = Sources.instance | ||
rng = Rng.instance | ||
devices = Devices.instance | ||
rng = Rng.new | ||
output = Output.instance | ||
player = Player.instance | ||
|
||
sources.parse(options['sources']['path'], opts.categories) | ||
run_use_cli_opts(opts) | ||
source = run_prepare(opts, sources, devices, rng, output) | ||
run_play(source, devices, player, sources) | ||
end | ||
|
||
def run_use_cli_opts(opts) | ||
@options['sources']['download']['keep'] = opts.dl_keep if opts.dl_keep | ||
@options['player']['player'] = opts.player if opts.player | ||
@options['rng']['method'] = opts.rng if opts.rng | ||
end | ||
|
||
def run_prepare(opts, sources, devices, rng, output) | ||
sources.parse(@sources) | ||
mods = opts.categories ? sources.parse_mods(opts.categories) : nil | ||
sources.apply_mods(mods) if mods | ||
|
||
devices.storage_mount | ||
number = opts.number ? opts.number : rng.generate(sources.count) | ||
number = opts.number || rng.generate(sources.count) | ||
source = sources.get(number) | ||
|
||
puts Output.instance.run_info_table(number, sources.sources[number][:name]) | ||
sources.download(number) | ||
puts output.run_info_table(number, source[:name]) | ||
sources.download(source) | ||
end | ||
|
||
def run_play(source, devices, player, sources) | ||
devices.tv_on | ||
player.play(sources.sources[number]) | ||
player.play(source) | ||
|
||
devices.tv_off | ||
sources.remove(number) | ||
sources.remove(source) | ||
devices.storage_unmount | ||
devices.storage_sleep | ||
end | ||
|
||
def set(_args, opts) | ||
end | ||
|
||
def sources(_args, opts) | ||
end | ||
|
||
def translate(_args, opts) | ||
def sources(_opts) | ||
end | ||
|
||
def unset(_args, opts) | ||
def translate(_opts) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.