roku_builder 3.13.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG +12 -0
- data/Gemfile.lock +22 -7
- data/Guardfile +3 -3
- data/README.md +22 -398
- data/bin/roku +1 -194
- data/config.json.example +1 -1
- data/intergration/roku_builder/test_core.rb +52 -0
- data/intergration/roku_builder/test_files/core_intergration_test/manifest_template +7 -0
- data/intergration/roku_builder/test_files/core_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/components/rectanglescene.xml +28 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/source/main.brs +23 -0
- data/intergration/roku_builder/test_files/inspector_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/linker_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/loader_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/monitor_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/navigator_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/packager_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/profiler_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/scripter_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/components/rectanglescene.xml +29 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rde_mm_focus_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rde_splash_fhd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rde_splash_sd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rsgde_bg_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rsgde_mm_focus_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/images/rsgde_splash_hd.jpg +0 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/manifest +21 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/source/main.brs +21 -0
- data/intergration/roku_builder/test_files/tester_intergration_test/test.pkg +0 -0
- data/intergration/roku_builder/test_helper.rb +138 -0
- data/intergration/roku_builder/test_inspector.rb +35 -0
- data/intergration/roku_builder/test_linker.rb +32 -0
- data/intergration/roku_builder/test_loader.rb +38 -0
- data/intergration/roku_builder/test_monitor.rb +21 -0
- data/intergration/roku_builder/test_navigator.rb +34 -0
- data/intergration/roku_builder/test_packager.rb +41 -0
- data/intergration/roku_builder/test_profiler.rb +48 -0
- data/intergration/roku_builder/test_scripter.rb +38 -0
- data/intergration/roku_builder/test_tester.rb +21 -0
- data/lib/roku_builder.rb +143 -154
- data/lib/roku_builder/config.rb +17 -40
- data/lib/roku_builder/config_parser.rb +49 -200
- data/lib/roku_builder/config_validator.rb +1 -1
- data/lib/roku_builder/errors.rb +12 -0
- data/lib/roku_builder/git.rb +28 -0
- data/lib/roku_builder/hash.rb +8 -0
- data/lib/roku_builder/manifest.rb +121 -0
- data/lib/roku_builder/options.rb +68 -29
- data/lib/roku_builder/plugin.rb +30 -0
- data/lib/roku_builder/plugins/core.rb +117 -0
- data/lib/roku_builder/plugins/inspector.rb +104 -0
- data/lib/roku_builder/{linker.rb → plugins/linker.rb} +38 -12
- data/lib/roku_builder/plugins/loader.rb +152 -0
- data/lib/roku_builder/{monitor.rb → plugins/monitor.rb} +20 -9
- data/lib/roku_builder/{navigator.rb → plugins/navigator.rb} +136 -88
- data/lib/roku_builder/plugins/packager.rb +194 -0
- data/lib/roku_builder/plugins/profiler.rb +135 -0
- data/lib/roku_builder/plugins/scripter.rb +53 -0
- data/lib/roku_builder/{tester.rb → plugins/tester.rb} +28 -19
- data/lib/roku_builder/stager.rb +48 -12
- data/lib/roku_builder/string.rb +20 -0
- data/lib/roku_builder/util.rb +10 -34
- data/lib/roku_builder/version.rb +1 -1
- data/rakefile +5 -1
- data/roku_builder.gemspec +2 -0
- data/test/roku_builder/plugins/test_core.rb +112 -0
- data/test/roku_builder/plugins/test_inspector.rb +165 -0
- data/test/roku_builder/plugins/test_linker.rb +123 -0
- data/test/roku_builder/plugins/test_loader.rb +115 -0
- data/test/roku_builder/plugins/test_monitor.rb +141 -0
- data/test/roku_builder/plugins/test_navigator.rb +274 -0
- data/test/roku_builder/plugins/test_packager.rb +202 -0
- data/test/roku_builder/plugins/test_profiler.rb +127 -0
- data/test/roku_builder/plugins/test_scripter.rb +110 -0
- data/test/roku_builder/plugins/test_tester.rb +109 -0
- data/test/roku_builder/test_config.rb +51 -35
- data/test/roku_builder/test_config_parser.rb +76 -154
- data/test/roku_builder/test_config_validator.rb +18 -1
- data/test/roku_builder/test_files/{loader_test/manifest → config_parser_test/test.pkg} +0 -0
- data/test/roku_builder/test_files/config_test/config.json +3 -0
- data/test/roku_builder/test_files/controller_commands_test/manifest_template +7 -0
- data/test/roku_builder/test_files/core_test/manifest_template +7 -0
- data/test/roku_builder/test_files/core_test/test.pkg +0 -0
- data/test/roku_builder/test_files/inspector_test/manifest +6 -0
- data/test/roku_builder/test_files/inspector_test/test.pkg +0 -0
- data/test/roku_builder/test_files/linker_test/manifest +6 -0
- data/test/roku_builder/test_files/linker_test/test.pkg +0 -0
- data/test/roku_builder/test_files/loader_test/manifest_template +6 -0
- data/test/roku_builder/test_files/loader_test/test.pkg +0 -0
- data/test/roku_builder/test_files/loader_test/test.zip +0 -0
- data/test/roku_builder/test_files/manifest_test/manifest_comments +6 -0
- data/test/roku_builder/test_files/manifest_test/manifest_template +7 -0
- data/test/roku_builder/test_files/manifest_test/test.zip +0 -0
- data/test/roku_builder/test_files/packager_test/manifest +6 -0
- data/test/roku_builder/test_files/packager_test/scripter_test/manifest +6 -0
- data/test/roku_builder/test_files/packager_test/test.pkg +0 -0
- data/test/roku_builder/test_files/roku_builder_test/config.json +32 -0
- data/test/roku_builder/test_files/scripter_test/manifest +6 -0
- data/test/roku_builder/test_files/scripter_test/test.pkg +0 -0
- data/test/roku_builder/test_files/stager_test/test.pkg +0 -0
- data/test/roku_builder/test_files/tester_test/manifest +6 -0
- data/test/roku_builder/test_files/tester_test/test.pkg +0 -0
- data/test/roku_builder/test_helper.rb +44 -11
- data/test/roku_builder/test_logger.rb +1 -0
- data/test/roku_builder/test_manifest.rb +99 -0
- data/test/roku_builder/test_options.rb +106 -77
- data/test/roku_builder/test_options_plugins.rb +111 -0
- data/test/roku_builder/test_plugin.rb +48 -0
- data/test/roku_builder/test_roku_builder.rb +239 -0
- data/test/roku_builder/test_stager.rb +49 -101
- data/test/roku_builder/test_util.rb +19 -4
- metadata +241 -47
- data/lib/roku_builder/controller.rb +0 -98
- data/lib/roku_builder/controller_commands.rb +0 -224
- data/lib/roku_builder/error_handler.rb +0 -142
- data/lib/roku_builder/inspector.rb +0 -82
- data/lib/roku_builder/keyer.rb +0 -106
- data/lib/roku_builder/loader.rb +0 -131
- data/lib/roku_builder/manifest_manager.rb +0 -126
- data/lib/roku_builder/packager.rb +0 -43
- data/lib/roku_builder/profiler.rb +0 -96
- data/lib/roku_builder/scripter.rb +0 -39
- data/test/roku_builder/test_controller.rb +0 -70
- data/test/roku_builder/test_controller_commands.rb +0 -465
- data/test/roku_builder/test_error_handler.rb +0 -90
- data/test/roku_builder/test_inspector.rb +0 -298
- data/test/roku_builder/test_keyer.rb +0 -176
- data/test/roku_builder/test_linker.rb +0 -110
- data/test/roku_builder/test_loader.rb +0 -337
- data/test/roku_builder/test_manifest_manager.rb +0 -103
- data/test/roku_builder/test_monitor.rb +0 -137
- data/test/roku_builder/test_navigator.rb +0 -280
- data/test/roku_builder/test_packager.rb +0 -127
- data/test/roku_builder/test_profiler.rb +0 -35
- data/test/roku_builder/test_scripter.rb +0 -102
- data/test/roku_builder/test_tester.rb +0 -130
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
|
2
|
+
|
|
3
|
+
require_relative "test_helper.rb"
|
|
4
|
+
|
|
5
|
+
module RokuBuilder
|
|
6
|
+
class OptionsPluginTest < Minitest::Test
|
|
7
|
+
def setup
|
|
8
|
+
Logger.set_testing
|
|
9
|
+
end
|
|
10
|
+
def test_options_plugins_parse
|
|
11
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
12
|
+
parser = Minitest::Mock.new()
|
|
13
|
+
options_hash = {}
|
|
14
|
+
RokuBuilder.register_plugin( OptionsTestPlugin)
|
|
15
|
+
options = Options.allocate
|
|
16
|
+
parser.expect(:parse!, nil)
|
|
17
|
+
parser.expect(:banner=, nil, [String])
|
|
18
|
+
parser.expect(:separator, nil, [String])
|
|
19
|
+
parser.expect(:separator, nil, [String])
|
|
20
|
+
OptionParser.stub(:new, parser) do
|
|
21
|
+
options.stub(:validate_parser, nil) do
|
|
22
|
+
options_hash = options.send(:parse)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
assert options_hash[:run]
|
|
26
|
+
parser.verify
|
|
27
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
28
|
+
end
|
|
29
|
+
def test_options_plugins_commands
|
|
30
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
31
|
+
RokuBuilder.register_plugin(OptionsTestPlugin)
|
|
32
|
+
options = Options.allocate
|
|
33
|
+
options.send(:setup_plugin_commands)
|
|
34
|
+
assert_includes options.send(:commands), :test
|
|
35
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
36
|
+
end
|
|
37
|
+
def test_options_plugins_commands_source
|
|
38
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
39
|
+
RokuBuilder.register_plugin(OptionsTestPlugin)
|
|
40
|
+
options = Options.allocate
|
|
41
|
+
options.send(:setup_plugin_commands)
|
|
42
|
+
assert_includes options.send(:source_commands), :test
|
|
43
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
44
|
+
end
|
|
45
|
+
def test_options_plugins_commands_device
|
|
46
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
47
|
+
RokuBuilder.register_plugin(OptionsTestPlugin)
|
|
48
|
+
options = Options.allocate
|
|
49
|
+
options.send(:setup_plugin_commands)
|
|
50
|
+
assert_includes options.send(:device_commands), :test
|
|
51
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
52
|
+
end
|
|
53
|
+
def test_options_plugins_commands_exclude
|
|
54
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
55
|
+
RokuBuilder.register_plugin(OptionsTestPlugin)
|
|
56
|
+
options = Options.allocate
|
|
57
|
+
options.send(:setup_plugin_commands)
|
|
58
|
+
assert_includes options.send(:exclude_commands), :test
|
|
59
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
60
|
+
end
|
|
61
|
+
def test_options_plugins_commands_basic
|
|
62
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
63
|
+
RokuBuilder.register_plugin(OptionsTestPlugin2)
|
|
64
|
+
options = Options.allocate
|
|
65
|
+
options.send(:setup_plugin_commands)
|
|
66
|
+
assert_includes options.send(:commands), :test
|
|
67
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
68
|
+
end
|
|
69
|
+
def test_options_plugins_commands_source_2
|
|
70
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
71
|
+
RokuBuilder.register_plugin(OptionsTestPlugin2)
|
|
72
|
+
options = Options.allocate
|
|
73
|
+
options.send(:setup_plugin_commands)
|
|
74
|
+
refute_includes options.send(:source_commands), :test
|
|
75
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
76
|
+
end
|
|
77
|
+
def test_options_plugins_commands_device_2
|
|
78
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
79
|
+
RokuBuilder.register_plugin(OptionsTestPlugin2)
|
|
80
|
+
options = Options.allocate
|
|
81
|
+
options.send(:setup_plugin_commands)
|
|
82
|
+
refute_includes options.send(:device_commands), :test
|
|
83
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
84
|
+
end
|
|
85
|
+
def test_options_plugins_commands_exclude_2
|
|
86
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
87
|
+
RokuBuilder.register_plugin(OptionsTestPlugin2)
|
|
88
|
+
options = Options.allocate
|
|
89
|
+
options.send(:setup_plugin_commands)
|
|
90
|
+
refute_includes options.send(:exclude_commands), :test
|
|
91
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
class OptionsTestPlugin
|
|
95
|
+
extend Plugin
|
|
96
|
+
def self.parse_options(parser:, options:)
|
|
97
|
+
options[:run] = true
|
|
98
|
+
end
|
|
99
|
+
def self.commands
|
|
100
|
+
{test: {device: true, source: true, exclude: true}}
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
class OptionsTestPlugin2
|
|
104
|
+
extend Plugin
|
|
105
|
+
def self.parse_options(parser:, options:)
|
|
106
|
+
end
|
|
107
|
+
def self.commands
|
|
108
|
+
{test: {}}
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
|
2
|
+
|
|
3
|
+
require_relative "test_helper.rb"
|
|
4
|
+
|
|
5
|
+
module RokuBuilder
|
|
6
|
+
class PluginTest < Minitest::Test
|
|
7
|
+
def setup
|
|
8
|
+
Logger.set_testing
|
|
9
|
+
end
|
|
10
|
+
def test_module_commands_fail
|
|
11
|
+
assert_raises ImplementationError do
|
|
12
|
+
TestClass.commands
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
def test_module_commands_success
|
|
16
|
+
TestClass2.commands
|
|
17
|
+
end
|
|
18
|
+
def test_module_parse_options_fail
|
|
19
|
+
assert_raises ImplementationError do
|
|
20
|
+
TestClass.parse_options(option_parser: nil, options: nil)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
def test_module_parse_options_success
|
|
24
|
+
TestClass2.parse_options(option_parser: nil, options: nil)
|
|
25
|
+
end
|
|
26
|
+
def test_module_dependencies
|
|
27
|
+
assert_equal Array, TestClass.dependencies.class
|
|
28
|
+
end
|
|
29
|
+
def test_module_dependencies_dependent
|
|
30
|
+
assert_equal Array, TestClass2.dependencies.class
|
|
31
|
+
assert_equal TestClass, TestClass2.dependencies[0]
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
class TestClass
|
|
35
|
+
extend Plugin
|
|
36
|
+
end
|
|
37
|
+
class TestClass2
|
|
38
|
+
extend Plugin
|
|
39
|
+
def self.commands
|
|
40
|
+
end
|
|
41
|
+
def self.parse_options(option_parser:, options:)
|
|
42
|
+
end
|
|
43
|
+
def self.dependencies
|
|
44
|
+
[TestClass]
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# ********** Copyright Viacom, Inc. Apache 2.0 **********
|
|
2
|
+
|
|
3
|
+
require_relative "test_helper.rb"
|
|
4
|
+
|
|
5
|
+
module RokuBuilder
|
|
6
|
+
class RokuBuilderTest < Minitest::Test
|
|
7
|
+
def setup
|
|
8
|
+
Logger.set_testing
|
|
9
|
+
RokuBuilder.class_variable_set(:@@plugins, [])
|
|
10
|
+
@ping = Minitest::Mock.new
|
|
11
|
+
@options = build_options({validate: true, device_given: false, working: true})
|
|
12
|
+
@options.define_singleton_method(:device_commands){
|
|
13
|
+
[:validate]
|
|
14
|
+
}
|
|
15
|
+
@raw = {
|
|
16
|
+
devices: {
|
|
17
|
+
a: {ip: "2.2.2.2"},
|
|
18
|
+
b: {ip: "3.3.3.3"}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
@parsed = {
|
|
22
|
+
device_config: {ip: "1.1.1.1"}
|
|
23
|
+
}
|
|
24
|
+
@config = Config.new(options: @options)
|
|
25
|
+
@config.instance_variable_set(:@config, @raw)
|
|
26
|
+
@config.instance_variable_set(:@parsed, @parsed)
|
|
27
|
+
RokuBuilder.class_variable_set(:@@options, @options)
|
|
28
|
+
RokuBuilder.class_variable_set(:@@config, @config)
|
|
29
|
+
end
|
|
30
|
+
def teardown
|
|
31
|
+
@ping.verify
|
|
32
|
+
RokuBuilder.class_variable_set(:@@plugins, [])
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_roku_builder_run
|
|
36
|
+
config = File.join(test_files_path(RokuBuilderTest), "config.json")
|
|
37
|
+
RokuBuilder.run(options: {validate: true, config: config})
|
|
38
|
+
end
|
|
39
|
+
def test_roku_builder_run_stage
|
|
40
|
+
config = File.join(test_files_path(RokuBuilderTest), "config.json")
|
|
41
|
+
commands = Minitest::Mock.new
|
|
42
|
+
commands.expect(:call, {validate: {stage: true}})
|
|
43
|
+
commands.expect(:call, {validate: {stage: true}})
|
|
44
|
+
commands.expect(:call, {validate: {stage: true}})
|
|
45
|
+
commands.expect(:call, {validate: {stage: true}})
|
|
46
|
+
Core.stub(:commands, commands) do
|
|
47
|
+
RokuBuilder.run(options: {validate: true, config: config})
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
def test_roku_builder_run_debug
|
|
51
|
+
config = File.join(test_files_path(RokuBuilderTest), "config.json")
|
|
52
|
+
RokuBuilder.run(options: {validate: true, debug: true, config: config})
|
|
53
|
+
end
|
|
54
|
+
def test_roku_builder_run_bad_options
|
|
55
|
+
RokuBuilder.class_variable_set(:@@plugins, [])
|
|
56
|
+
logger = Minitest::Mock.new
|
|
57
|
+
logger.expect(:fatal, nil, ["RokuBuilder::InvalidOptions: Specify at least one command"])
|
|
58
|
+
Logger.class_variable_set(:@@instance, logger)
|
|
59
|
+
RokuBuilder.run(options: {working: true})
|
|
60
|
+
logger.verify
|
|
61
|
+
Logger.set_testing
|
|
62
|
+
end
|
|
63
|
+
def test_roku_builder_run_bad_options_debug
|
|
64
|
+
config = File.join(test_files_path(RokuBuilderTest), "config.json")
|
|
65
|
+
RokuBuilder.class_variable_set(:@@plugins, [])
|
|
66
|
+
RokuBuilder.setup_plugins
|
|
67
|
+
register_plugins(Packager)
|
|
68
|
+
assert_raises DeviceError do
|
|
69
|
+
RokuBuilder.run(options: {package: true, in: "/in/path", debug: true, config: config})
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
def test_roku_builder_run_bad_config
|
|
73
|
+
config = File.join(test_files_path(RokuBuilderTest), "missing_config.json")
|
|
74
|
+
logger = Minitest::Mock.new
|
|
75
|
+
logger.expect(:level=, nil, [::Logger::WARN])
|
|
76
|
+
logger.expect(:fatal, nil, ["ArgumentError: Missing Config"])
|
|
77
|
+
Logger.class_variable_set(:@@instance, logger)
|
|
78
|
+
RokuBuilder.run(options: {validate: true, config: config})
|
|
79
|
+
logger.verify
|
|
80
|
+
Logger.set_testing
|
|
81
|
+
end
|
|
82
|
+
def test_roku_builder_check_devices_good
|
|
83
|
+
Net::Ping::External.stub(:new, @ping) do
|
|
84
|
+
@ping.expect(:ping?, true, [@parsed[:device_config][:ip], 1, 0.2, 1])
|
|
85
|
+
RokuBuilder.check_devices
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
def test_roku_builder_check_devices_no_devices
|
|
89
|
+
Net::Ping::External.stub(:new, @ping) do
|
|
90
|
+
@ping.expect(:ping?, false, [@parsed[:device_config][:ip], 1, 0.2, 1])
|
|
91
|
+
@ping.expect(:ping?, false, [@raw[:devices][:a][:ip], 1, 0.2, 1])
|
|
92
|
+
@ping.expect(:ping?, false, [@raw[:devices][:b][:ip], 1, 0.2, 1])
|
|
93
|
+
assert_raises DeviceError do
|
|
94
|
+
RokuBuilder.check_devices
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
def test_roku_builder_check_devices_changed_device
|
|
99
|
+
Net::Ping::External.stub(:new, @ping) do
|
|
100
|
+
@ping.expect(:ping?, false, [@parsed[:device_config][:ip], 1, 0.2, 1])
|
|
101
|
+
@ping.expect(:ping?, true, [@raw[:devices][:a][:ip], 1, 0.2, 1])
|
|
102
|
+
RokuBuilder.check_devices
|
|
103
|
+
assert_equal @raw[:devices][:a][:ip], @config.parsed[:device_config][:ip]
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
def test_roku_builder_check_devices_bad_device
|
|
107
|
+
Net::Ping::External.stub(:new, @ping) do
|
|
108
|
+
@options[:device_given] = true
|
|
109
|
+
@ping.expect(:ping?, false, [@parsed[:device_config][:ip], 1, 0.2, 1])
|
|
110
|
+
assert_raises DeviceError do
|
|
111
|
+
RokuBuilder.check_devices
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
def test_roku_builder_check_devices
|
|
116
|
+
Net::Ping::External.stub(:new, @ping) do
|
|
117
|
+
@options = build_options({validate: true, device_given: false, working: true})
|
|
118
|
+
RokuBuilder.class_variable_set(:@@options, @options)
|
|
119
|
+
RokuBuilder.check_devices
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def test_roku_builder_logger_debug
|
|
124
|
+
tests = [
|
|
125
|
+
{options: {debug: true}, method: :set_debug},
|
|
126
|
+
{options: {verbose: true}, method: :set_info},
|
|
127
|
+
{options: {}, method: :set_warn}
|
|
128
|
+
]
|
|
129
|
+
tests.each do |test|
|
|
130
|
+
logger = Minitest::Mock.new
|
|
131
|
+
logger.expect(:call, nil)
|
|
132
|
+
|
|
133
|
+
Logger.stub(test[:method], logger) do
|
|
134
|
+
RokuBuilder.class_variable_set(:@@options, test[:options])
|
|
135
|
+
RokuBuilder.initialize_logger
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
logger.verify
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
def test_roku_builder_options_parse_simple
|
|
142
|
+
options = "a:b, c:d"
|
|
143
|
+
options = RokuBuilder.options_parse(options: options)
|
|
144
|
+
refute_nil options[:a]
|
|
145
|
+
refute_nil options[:c]
|
|
146
|
+
assert_equal "b", options[:a]
|
|
147
|
+
assert_equal "d", options[:c]
|
|
148
|
+
end
|
|
149
|
+
def test_roku_builder_options_parse_complex
|
|
150
|
+
options = "a:b:c, d:e:f"
|
|
151
|
+
options = RokuBuilder.options_parse(options: options)
|
|
152
|
+
refute_nil options[:a]
|
|
153
|
+
refute_nil options[:d]
|
|
154
|
+
assert_equal "b:c", options[:a]
|
|
155
|
+
assert_equal "e:f", options[:d]
|
|
156
|
+
end
|
|
157
|
+
def test_roku_builder_plugins_empty
|
|
158
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
159
|
+
RokuBuilder.process_plugins
|
|
160
|
+
assert_equal Array, RokuBuilder.plugins.class
|
|
161
|
+
assert_equal 0, RokuBuilder.plugins.count
|
|
162
|
+
end
|
|
163
|
+
def test_roku_builder_plugins_empty_no_setup
|
|
164
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
165
|
+
assert_equal Array, RokuBuilder.plugins.class
|
|
166
|
+
assert_equal 0, RokuBuilder.plugins.count
|
|
167
|
+
end
|
|
168
|
+
def test_roku_builder_plugins_registered
|
|
169
|
+
RokuBuilder.class_variable_set(:@@plugins, nil)
|
|
170
|
+
RokuBuilder.register_plugin(TestPlugin)
|
|
171
|
+
RokuBuilder.process_plugins
|
|
172
|
+
assert_equal Array, RokuBuilder.plugins.class
|
|
173
|
+
assert_equal 1, RokuBuilder.plugins.count
|
|
174
|
+
assert_equal TestPlugin, RokuBuilder.plugins[0]
|
|
175
|
+
end
|
|
176
|
+
def test_roku_builder_plugins_duplicate_classes
|
|
177
|
+
RokuBuilder.register_plugin(TestPlugin)
|
|
178
|
+
RokuBuilder.register_plugin(TestPlugin)
|
|
179
|
+
assert_raises ImplementationError do
|
|
180
|
+
RokuBuilder.process_plugins
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
def test_roku_builder_plugins_dependencies
|
|
184
|
+
RokuBuilder.register_plugin(TestPlugin)
|
|
185
|
+
RokuBuilder.register_plugin(TestPlugin3)
|
|
186
|
+
RokuBuilder.process_plugins
|
|
187
|
+
end
|
|
188
|
+
def test_roku_builder_plugins_dependencies_missing
|
|
189
|
+
RokuBuilder.register_plugin(TestPlugin3)
|
|
190
|
+
assert_raises ImplementationError do
|
|
191
|
+
RokuBuilder.process_plugins
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
def test_roku_builder_plugins_missing_command_method
|
|
195
|
+
RokuBuilder.register_plugin(TestPlugin4)
|
|
196
|
+
assert_raises ImplementationError do
|
|
197
|
+
RokuBuilder.process_plugins
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
def test_roku_builder_load_config
|
|
201
|
+
config = Minitest::Mock.new
|
|
202
|
+
config.expect(:configure, nil)
|
|
203
|
+
config.expect(:load, nil)
|
|
204
|
+
config.expect(:validate, nil)
|
|
205
|
+
config.expect(:parse, nil)
|
|
206
|
+
Config.stub(:new, config) do
|
|
207
|
+
RokuBuilder.class_variable_set(:@@options, {})
|
|
208
|
+
RokuBuilder.load_config
|
|
209
|
+
assert config === RokuBuilder.class_variable_get(:@@config)
|
|
210
|
+
end
|
|
211
|
+
config.verify
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
class TestPlugin
|
|
215
|
+
extend Plugin
|
|
216
|
+
def self.commands
|
|
217
|
+
{}
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
class TestPlugin2
|
|
221
|
+
extend Plugin
|
|
222
|
+
end
|
|
223
|
+
class TestPlugin3
|
|
224
|
+
extend Plugin
|
|
225
|
+
def self.commands
|
|
226
|
+
{}
|
|
227
|
+
end
|
|
228
|
+
def self.dependencies
|
|
229
|
+
[TestPlugin]
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
class TestPlugin4
|
|
233
|
+
extend Plugin
|
|
234
|
+
def self.commands
|
|
235
|
+
{test: {}}
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
|
|
@@ -4,64 +4,56 @@ require_relative "test_helper.rb"
|
|
|
4
4
|
|
|
5
5
|
module RokuBuilder
|
|
6
6
|
class StagerTest < Minitest::Test
|
|
7
|
+
def setup
|
|
8
|
+
Logger.set_testing
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def build_config_options(options)
|
|
12
|
+
@options = build_options(options)
|
|
13
|
+
@options.define_singleton_method(:source_commands) {[:validate]}
|
|
14
|
+
@config = RokuBuilder::Config.new(options: @options)
|
|
15
|
+
@config.instance_variable_set(:@config, good_config(StagerTest))
|
|
16
|
+
@config.parse
|
|
17
|
+
end
|
|
7
18
|
|
|
8
19
|
def test_stager_method
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
root_dir: root_dir
|
|
13
|
-
}
|
|
14
|
-
stager = Stager.new(**stager_config)
|
|
15
|
-
assert_equal stager_config[:method], stager.method
|
|
20
|
+
build_config_options({validate: true, working: true})
|
|
21
|
+
stager = Stager.new(config: @config, options: @options)
|
|
22
|
+
assert_equal :working, stager.method
|
|
16
23
|
end
|
|
17
24
|
|
|
18
25
|
def test_stager_stage_working
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
method: :working,
|
|
22
|
-
root_dir: root_dir
|
|
23
|
-
}
|
|
24
|
-
stager = Stager.new(**stager_config)
|
|
26
|
+
build_config_options({validate: true, working: true})
|
|
27
|
+
stager = Stager.new(config: @config, options: @options)
|
|
25
28
|
assert stager.stage
|
|
26
29
|
assert stager.unstage
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
def test_stager_stage_current
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
stager = Stager.new(**stager_config)
|
|
33
|
+
Pathname.stub(:pwd, test_files_path(StagerTest)) do
|
|
34
|
+
build_config_options({validate: true, current: true})
|
|
35
|
+
end
|
|
36
|
+
stager = Stager.new(config: @config, options: @options)
|
|
36
37
|
assert stager.stage
|
|
37
38
|
assert stager.unstage
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
def test_stager_stage_in
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
root_dir: root_dir
|
|
45
|
-
}
|
|
46
|
-
stager = Stager.new(**stager_config)
|
|
42
|
+
in_file = File.join(test_files_path(StagerTest), "test.zip")
|
|
43
|
+
build_config_options({validate: true, in: in_file})
|
|
44
|
+
stager = Stager.new(config: @config, options: @options)
|
|
47
45
|
assert stager.stage
|
|
48
46
|
assert stager.unstage
|
|
49
47
|
end
|
|
50
48
|
|
|
51
49
|
def test_stager_stage_git_stash
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
branch_name = 'production'
|
|
51
|
+
build_config_options({validate: true, stage: "production"})
|
|
54
52
|
git = Minitest::Mock.new
|
|
55
53
|
branch = Minitest::Mock.new
|
|
56
54
|
stashes = Minitest::Mock.new
|
|
57
55
|
stash = Minitest::Mock.new
|
|
58
56
|
|
|
59
|
-
stager_config = {
|
|
60
|
-
method: :git,
|
|
61
|
-
root_dir: root_dir,
|
|
62
|
-
key: branch_name
|
|
63
|
-
}
|
|
64
|
-
|
|
65
57
|
git.expect(:current_branch, 'other_branch')
|
|
66
58
|
git.expect(:current_branch, 'other_branch')
|
|
67
59
|
git.expect(:branch, branch)
|
|
@@ -77,7 +69,7 @@ module RokuBuilder
|
|
|
77
69
|
stashes.expect(:pop, nil, ["stash@{0}"])
|
|
78
70
|
|
|
79
71
|
Git.stub(:open, git) do
|
|
80
|
-
stager = Stager.new(
|
|
72
|
+
stager = Stager.new(config: @config, options: @options)
|
|
81
73
|
assert stager.stage
|
|
82
74
|
assert stager.unstage
|
|
83
75
|
end
|
|
@@ -88,18 +80,12 @@ module RokuBuilder
|
|
|
88
80
|
end
|
|
89
81
|
|
|
90
82
|
def test_stager_stage_git_no_stash
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
branch_name = 'production'
|
|
84
|
+
build_config_options({validate: true, stage: "production"})
|
|
93
85
|
git = Minitest::Mock.new
|
|
94
86
|
branch = Minitest::Mock.new
|
|
95
87
|
stashes = Minitest::Mock.new
|
|
96
88
|
|
|
97
|
-
stager_config = {
|
|
98
|
-
method: :git,
|
|
99
|
-
root_dir: root_dir,
|
|
100
|
-
key: branch_name
|
|
101
|
-
}
|
|
102
|
-
|
|
103
89
|
git.expect(:current_branch, 'other_branch')
|
|
104
90
|
git.expect(:current_branch, 'other_branch')
|
|
105
91
|
git.expect(:branch, branch)
|
|
@@ -112,7 +98,7 @@ module RokuBuilder
|
|
|
112
98
|
branch.expect(:stashes, [])
|
|
113
99
|
|
|
114
100
|
Git.stub(:open, git) do
|
|
115
|
-
stager = Stager.new(
|
|
101
|
+
stager = Stager.new(config: @config, options: @options)
|
|
116
102
|
assert stager.stage
|
|
117
103
|
assert stager.unstage
|
|
118
104
|
end
|
|
@@ -122,19 +108,12 @@ module RokuBuilder
|
|
|
122
108
|
end
|
|
123
109
|
|
|
124
110
|
def test_stager_stage_git_error_stage
|
|
125
|
-
|
|
126
|
-
branch_name = 'branch'
|
|
111
|
+
build_config_options({validate: true, stage: "production"})
|
|
127
112
|
git = Minitest::Mock.new
|
|
128
113
|
branch = Minitest::Mock.new
|
|
129
114
|
stashes = Minitest::Mock.new
|
|
130
115
|
stash = Minitest::Mock.new
|
|
131
116
|
|
|
132
|
-
stager_config = {
|
|
133
|
-
method: :git,
|
|
134
|
-
root_dir: root_dir,
|
|
135
|
-
key: branch_name
|
|
136
|
-
}
|
|
137
|
-
|
|
138
117
|
def git.checkout(branch)
|
|
139
118
|
raise Git::GitExecuteError.new
|
|
140
119
|
end
|
|
@@ -152,7 +131,7 @@ module RokuBuilder
|
|
|
152
131
|
stashes.expect(:pop, nil, ["stash@{0}"])
|
|
153
132
|
|
|
154
133
|
Git.stub(:open, git) do
|
|
155
|
-
stager = Stager.new(
|
|
134
|
+
stager = Stager.new(config: @config, options: @options)
|
|
156
135
|
assert !stager.stage
|
|
157
136
|
assert stager.unstage
|
|
158
137
|
end
|
|
@@ -163,16 +142,10 @@ module RokuBuilder
|
|
|
163
142
|
end
|
|
164
143
|
|
|
165
144
|
def test_stager_stage_git_error_unstage
|
|
166
|
-
|
|
167
|
-
branch_name = 'branch'
|
|
145
|
+
build_config_options({validate: true, stage: "production"})
|
|
168
146
|
git = Minitest::Mock.new
|
|
169
147
|
logger = Minitest::Mock.new
|
|
170
148
|
|
|
171
|
-
stager_config = {
|
|
172
|
-
method: :git,
|
|
173
|
-
root_dir: root_dir,
|
|
174
|
-
key: branch_name
|
|
175
|
-
}
|
|
176
149
|
Logger.class_variable_set(:@@instance, logger)
|
|
177
150
|
|
|
178
151
|
def git.checkout(branch)
|
|
@@ -182,7 +155,7 @@ module RokuBuilder
|
|
|
182
155
|
logger.expect(:error, nil, ["Branch or ref does not exist"])
|
|
183
156
|
|
|
184
157
|
Git.stub(:open, git) do
|
|
185
|
-
stager = Stager.new(
|
|
158
|
+
stager = Stager.new(config: @config, options: @options)
|
|
186
159
|
stager.instance_variable_set(:@current_branch, "branch")
|
|
187
160
|
assert !stager.unstage
|
|
188
161
|
end
|
|
@@ -191,34 +164,14 @@ module RokuBuilder
|
|
|
191
164
|
Logger.set_testing
|
|
192
165
|
end
|
|
193
166
|
|
|
194
|
-
def test_stager_stage_script
|
|
195
|
-
root_dir = File.join(File.dirname(__FILE__), "test_files", "stager_test")
|
|
196
|
-
stager_config = {
|
|
197
|
-
method: :script,
|
|
198
|
-
key: {stage: "stage_script", unstage: "unstage_script"},
|
|
199
|
-
root_dir: root_dir
|
|
200
|
-
}
|
|
201
|
-
Controller.stub(:system, nil) do
|
|
202
|
-
stager = Stager.new(**stager_config)
|
|
203
|
-
assert stager.stage
|
|
204
|
-
assert stager.unstage
|
|
205
|
-
end
|
|
206
|
-
end
|
|
207
|
-
|
|
208
167
|
def test_stager_save_state
|
|
209
|
-
|
|
210
|
-
|
|
168
|
+
branch_name = 'production'
|
|
169
|
+
build_config_options({validate: true, stage: "production"})
|
|
211
170
|
git = Minitest::Mock.new
|
|
212
171
|
branch = Minitest::Mock.new
|
|
213
172
|
stashes = Minitest::Mock.new
|
|
214
173
|
pstore = Minitest::Mock.new
|
|
215
174
|
|
|
216
|
-
stager_config = {
|
|
217
|
-
method: :git,
|
|
218
|
-
root_dir: root_dir,
|
|
219
|
-
key: branch_name
|
|
220
|
-
}
|
|
221
|
-
|
|
222
175
|
git.expect(:current_branch, 'other_branch')
|
|
223
176
|
git.expect(:current_branch, 'other_branch')
|
|
224
177
|
git.expect(:branch, branch)
|
|
@@ -234,7 +187,7 @@ module RokuBuilder
|
|
|
234
187
|
|
|
235
188
|
Git.stub(:open, git) do
|
|
236
189
|
PStore.stub(:new, pstore) do
|
|
237
|
-
stager = Stager.new(
|
|
190
|
+
stager = Stager.new(config: @config, options: @options)
|
|
238
191
|
assert stager.stage
|
|
239
192
|
end
|
|
240
193
|
end
|
|
@@ -245,20 +198,13 @@ module RokuBuilder
|
|
|
245
198
|
end
|
|
246
199
|
|
|
247
200
|
def test_stager_load_state
|
|
248
|
-
|
|
249
|
-
branch_name = 'branch'
|
|
201
|
+
build_config_options({validate: true, stage: "production"})
|
|
250
202
|
git = Minitest::Mock.new
|
|
251
203
|
branch = Minitest::Mock.new
|
|
252
204
|
stashes = Minitest::Mock.new
|
|
253
205
|
stash = Minitest::Mock.new
|
|
254
206
|
pstore = Minitest::Mock.new
|
|
255
207
|
|
|
256
|
-
stager_config = {
|
|
257
|
-
method: :git,
|
|
258
|
-
root_dir: root_dir,
|
|
259
|
-
key: branch_name
|
|
260
|
-
}
|
|
261
|
-
|
|
262
208
|
pstore.expect(:transaction, nil) do |&block|
|
|
263
209
|
block.call
|
|
264
210
|
end
|
|
@@ -276,7 +222,7 @@ module RokuBuilder
|
|
|
276
222
|
|
|
277
223
|
Git.stub(:open, git) do
|
|
278
224
|
PStore.stub(:new, pstore) do
|
|
279
|
-
stager = Stager.new(
|
|
225
|
+
stager = Stager.new(config: @config, options: @options)
|
|
280
226
|
assert stager.unstage
|
|
281
227
|
end
|
|
282
228
|
end
|
|
@@ -288,8 +234,7 @@ module RokuBuilder
|
|
|
288
234
|
end
|
|
289
235
|
|
|
290
236
|
def test_stager_load_second_state
|
|
291
|
-
|
|
292
|
-
branch_name = 'branch'
|
|
237
|
+
build_config_options({validate: true, stage: "production"})
|
|
293
238
|
git = Minitest::Mock.new
|
|
294
239
|
branch = Minitest::Mock.new
|
|
295
240
|
stashes = Minitest::Mock.new
|
|
@@ -297,12 +242,6 @@ module RokuBuilder
|
|
|
297
242
|
other_stash = Minitest::Mock.new
|
|
298
243
|
pstore = Minitest::Mock.new
|
|
299
244
|
|
|
300
|
-
stager_config = {
|
|
301
|
-
method: :git,
|
|
302
|
-
root_dir: root_dir,
|
|
303
|
-
key: branch_name
|
|
304
|
-
}
|
|
305
|
-
|
|
306
245
|
pstore.expect(:transaction, nil) do |&block|
|
|
307
246
|
block.call
|
|
308
247
|
end
|
|
@@ -321,7 +260,7 @@ module RokuBuilder
|
|
|
321
260
|
|
|
322
261
|
Git.stub(:open, git) do
|
|
323
262
|
PStore.stub(:new, pstore) do
|
|
324
|
-
stager = Stager.new(
|
|
263
|
+
stager = Stager.new(config: @config, options: @options)
|
|
325
264
|
assert stager.unstage
|
|
326
265
|
end
|
|
327
266
|
end
|
|
@@ -332,5 +271,14 @@ module RokuBuilder
|
|
|
332
271
|
other_stash.verify
|
|
333
272
|
pstore.verify
|
|
334
273
|
end
|
|
274
|
+
def test_stager_stage_script
|
|
275
|
+
build_config_options({validate: true, stage: "production", project: "project2"})
|
|
276
|
+
RokuBuilder.stub(:system, nil) do
|
|
277
|
+
stager = Stager.new(config: @config, options: @options)
|
|
278
|
+
assert stager.stage
|
|
279
|
+
assert stager.unstage
|
|
280
|
+
end
|
|
281
|
+
end
|
|
282
|
+
|
|
335
283
|
end
|
|
336
284
|
end
|