roku_builder 4.2.3 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b09590f2140d74e4d8e7df74d529a6671caa604d
4
- data.tar.gz: '095ab9e4a6140114bd075778b16f67cec461be10'
3
+ metadata.gz: b0772c12ebdcd69b9302ca440d1f2e5051940d4d
4
+ data.tar.gz: b13067ec43f38578d3393bfad7c8ba6e30d4a3b3
5
5
  SHA512:
6
- metadata.gz: 8a9285f2d9190207a250bf7a3e62fd7e2963db54735fb5ccc00b3018eed5f96c77fbaad72b1962944bf6268c6b53dde64b3be12f5f03682fc65ea741e3807264
7
- data.tar.gz: e477faa4ac4f846670240268b7c3224f5711d0b824317e75bf10fcbf2f83917ae48d41d70fb7f4469937e8d454d5d7f696ecacd5f69eba1339e74519ff953dbf
6
+ metadata.gz: 44f6adf44331e86cc7b26abd5675a192982a27e4cd7c2d10c75f5ed6abfa432f7a7f736841ed614b337a8b1e1d9390b65a97e939bbead151bf67590ec2f2039d
7
+ data.tar.gz: '090622268bdabcbd3806c5dfa7e8687227048f730db1542a334419ba87e3cbfedc28c3fb45dd7b1fb4150a2ea921bb44b436e149c56d54bec1c52d223436df86'
data/CHANGELOG CHANGED
@@ -1,7 +1,7 @@
1
1
  = 4.2.3 =
2
2
 
3
3
  - Fix Windows compatiability issues #21 and #23 on github
4
- - Update Dependancies
4
+ - Update Dependencies
5
5
 
6
6
  = 4.2.2 =
7
7
 
@@ -15,7 +15,7 @@ require "minitest/autorun"
15
15
  require "minitest/utils"
16
16
  require "securerandom"
17
17
 
18
- ROKU_IP = "192.168.1.114"
18
+ ROKU_IP = "192.168.1.127"
19
19
 
20
20
  module Minitest
21
21
  module Assertions
@@ -84,19 +84,20 @@ module RokuBuilder
84
84
  @config = {parent_config: @options[:config]}
85
85
  depth = 1
86
86
  while @config[:parent_config]
87
- parent_config_hash = get_parent_config
87
+ parent_config_hash = read_config(parent_io)
88
88
  @config[:child_config] = @config[:parent_config]
89
89
  @config.delete(:parent_config)
90
90
  @config.merge!(parent_config_hash) {|_key, v1, _v2| v1}
91
91
  depth += 1
92
92
  raise InvalidConfig, "Parent Configs Too Deep." if depth > 10
93
93
  end
94
+ merge_local_config
94
95
  fix_config_symbol_values
95
96
  end
96
97
 
97
- def get_parent_config
98
+ def read_config(io)
98
99
  begin
99
- JSON.parse(parent_io.read, {symbolize_names: true})
100
+ JSON.parse(io.read, {symbolize_names: true})
100
101
  rescue JSON::ParserError
101
102
  raise InvalidConfig, "Config file is not valid JSON"
102
103
  end
@@ -115,6 +116,14 @@ module RokuBuilder
115
116
  end
116
117
  end
117
118
 
119
+ def merge_local_config
120
+ local_config_path = "./.roku_config.json"
121
+ if File.exist?(local_config_path)
122
+ local_config_hash = read_config(File.open(local_config_path))
123
+ @config = @config.deep_merge(local_config_hash)
124
+ end
125
+ end
126
+
118
127
  def fix_config_symbol_values
119
128
  if @config[:devices]
120
129
  @config[:devices][:default] = @config[:devices][:default].to_sym
@@ -2,5 +2,5 @@
2
2
 
3
3
  module RokuBuilder
4
4
  # Version of the RokuBuilder Gem
5
- VERSION = "4.2.3"
5
+ VERSION = "4.3.0"
6
6
  end
@@ -77,6 +77,32 @@ module RokuBuilder
77
77
  assert_equal "app", config.raw[:projects][:p1][:app_name]
78
78
  end
79
79
 
80
+ def test_config_read_local
81
+ options = build_options({config: File.join(test_files_path(ConfigTest), "config.json"), validate: true})
82
+ config = Config.new(options: options)
83
+
84
+ mock = Minitest::Mock.new
85
+ io = proc { |path|
86
+ if path == './.roku_config.json'
87
+ mock
88
+ else
89
+ IO.new(IO.sysopen(path))
90
+ end
91
+ }
92
+ local_config_content = IO.read(File.join(test_files_path(ConfigTest), "local.json"))
93
+ mock.expect(:read, local_config_content)
94
+
95
+ File.stub(:exist?, true) do
96
+ File.stub(:open, io) do
97
+ config.load
98
+ end
99
+ end
100
+
101
+ mock.verify
102
+ refute_nil config.raw[:projects][:p2]
103
+ assert_equal "app2", config.raw[:projects][:p2][:app_name]
104
+ end
105
+
80
106
  def test_config_edit
81
107
  orginal = File.join(test_files_path(ConfigTest), "config.json")
82
108
  tmp = File.join(test_files_path(ConfigTest), "tmpconfig.json")
@@ -0,0 +1,20 @@
1
+ {
2
+ "projects": {
3
+ "p2": {
4
+ "directory": "/tmp",
5
+ "folders": ["resources","source"],
6
+ "files": ["manifest"],
7
+ "app_name": "app2",
8
+ "stage_method": "git",
9
+ "stages":{
10
+ "production": {
11
+ "branch": "master",
12
+ "key": {
13
+ "keyed_pkg": "/tmp/package.pkg",
14
+ "password": "password"
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
20
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roku_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.3
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - greeneca
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-22 00:00:00.000000000 Z
11
+ date: 2017-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -503,6 +503,7 @@ files:
503
503
  - test/roku_builder/test_files/config_test/bad.json
504
504
  - test/roku_builder/test_files/config_test/child.json
505
505
  - test/roku_builder/test_files/config_test/config.json
506
+ - test/roku_builder/test_files/config_test/local.json
506
507
  - test/roku_builder/test_files/config_test/non_json.json
507
508
  - test/roku_builder/test_files/config_test/parent.json
508
509
  - test/roku_builder/test_files/config_test/parent_projects.json
@@ -596,6 +597,7 @@ test_files:
596
597
  - test/roku_builder/test_files/config_test/bad.json
597
598
  - test/roku_builder/test_files/config_test/child.json
598
599
  - test/roku_builder/test_files/config_test/config.json
600
+ - test/roku_builder/test_files/config_test/local.json
599
601
  - test/roku_builder/test_files/config_test/non_json.json
600
602
  - test/roku_builder/test_files/config_test/parent.json
601
603
  - test/roku_builder/test_files/config_test/parent_projects.json