roku_builder 4.5.3 → 4.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b82094fab56c8c0774b2a28b3af4bcbcc557ae1
4
- data.tar.gz: 01c3112a67d4395a72543d7f1094b0d1652c5694
3
+ metadata.gz: 14a9f485846b42df5df6187aeeb2611620c90efa
4
+ data.tar.gz: 52ccf4b5a9642cf40ec84552464ce03d542f7f17
5
5
  SHA512:
6
- metadata.gz: 6f00700d91331017b295030fbbad5553f6dfea5eeecfbacaa7b84590034fbfc57162bda93b9e89023bb612a21446624412dd2c14557f645b7fc5a906eadf354f
7
- data.tar.gz: ada412c6e3736f5727e5a30b40147aa66640dc552a8734c2133e2a11c2cc8ffc916fc6c06c6e427bde51bc2046abdf46e1f13101987d26d530969ef63ee7cb8c
6
+ metadata.gz: e0e3c653d5482fa18f1cf46d86fe8cd79a0f00db30c0317e886927027d6693a4f4292f7a9a66ddb2807ff9369d2e6bda1db0c17170e9060087df15ea48350d30
7
+ data.tar.gz: f2207a16b2bc713971293de9e553f6dbd53375dbf83119c5d71d30cb36c3cd271bc39d3ce1ff7d2e6789f07ba6ea26920866bcab6c6f5d590e2a926739a0bf2a
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ = 4.6.0
2
+
3
+ - Allow locally defined key files
4
+ - Allow locally defined config to omit directory
5
+ - Allow absolute project paths as well as a project_dir config
6
+ - Update Dependancies
7
+
1
8
  = 4.5.3 =
2
9
 
3
10
  - Allow development of installed plugin
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roku_builder (4.5.3)
4
+ roku_builder (4.6.0)
5
5
  faraday (~> 0.13)
6
6
  faraday-digestauth (~> 0.2)
7
7
  git (~> 1.3)
@@ -18,7 +18,7 @@ GEM
18
18
  public_suffix (>= 2.0.2, < 4.0)
19
19
  ansi (1.5.0)
20
20
  ast (2.4.0)
21
- byebug (10.0.0)
21
+ byebug (10.0.2)
22
22
  coderay (1.1.2)
23
23
  coveralls (0.8.21)
24
24
  json (>= 1.8, < 3)
@@ -29,7 +29,7 @@ GEM
29
29
  crack (0.4.3)
30
30
  safe_yaml (~> 1.0.0)
31
31
  docile (1.1.5)
32
- faraday (0.14.0)
32
+ faraday (0.15.0)
33
33
  multipart-post (>= 1.2, < 3)
34
34
  faraday-digestauth (0.3.0)
35
35
  faraday (~> 0.7)
@@ -58,7 +58,7 @@ GEM
58
58
  rb-fsevent (~> 0.9, >= 0.9.4)
59
59
  rb-inotify (~> 0.9, >= 0.9.7)
60
60
  ruby_dep (~> 1.2)
61
- lumberjack (1.0.12)
61
+ lumberjack (1.0.13)
62
62
  m (1.5.1)
63
63
  method_source (>= 0.6.7)
64
64
  rake (>= 0.9.2.2)
@@ -73,19 +73,19 @@ GEM
73
73
  multipart-post (2.0.0)
74
74
  nenv (0.3.0)
75
75
  net-http-digest_auth (1.4.1)
76
- net-ping (2.0.2)
76
+ net-ping (2.0.4)
77
77
  net-telnet (0.1.1)
78
78
  notiffany (0.1.1)
79
79
  nenv (~> 0.1)
80
80
  shellany (~> 0.0)
81
- oga (2.14)
81
+ oga (2.15)
82
82
  ast
83
83
  ruby-ll (~> 2.1)
84
84
  pry (0.11.3)
85
85
  coderay (~> 1.1.0)
86
86
  method_source (~> 0.9.0)
87
87
  public_suffix (3.0.2)
88
- rake (12.3.0)
88
+ rake (12.3.1)
89
89
  rb-fsevent (0.10.3)
90
90
  rb-inotify (0.9.10)
91
91
  ffi (>= 0.5.0, < 2)
data/lib/roku_builder.rb CHANGED
@@ -37,7 +37,6 @@ module RokuBuilder
37
37
  # @param options [Hash] The options hash
38
38
  def self.run(options: nil)
39
39
  @@options = nil
40
- @@dev = false
41
40
  setup_plugins
42
41
  setup_options(options: options)
43
42
  return unless @@options
@@ -75,6 +74,7 @@ module RokuBuilder
75
74
  end
76
75
 
77
76
  def self.register_plugin(plugin)
77
+ @@dev ||= false
78
78
  @@plugins ||= []
79
79
  @@plugins.delete(plugin) if @@dev
80
80
  @@plugins << plugin
@@ -121,10 +121,21 @@ module RokuBuilder
121
121
  local_config_path = "./.roku_config.json"
122
122
  if File.exist?(local_config_path)
123
123
  local_config_hash = read_config(File.open(local_config_path))
124
+ add_missing_directories(local_config_hash)
124
125
  @config = @config.deep_merge(local_config_hash)
125
126
  end
126
127
  end
127
128
 
129
+ def add_missing_directories(local_config)
130
+ if local_config[:projects]
131
+ local_config[:projects].each_pair do |key,value|
132
+ unless value[:directory]
133
+ local_config[:projects][key][:directory] = RokuBuilder.system(command: "pwd")
134
+ end
135
+ end
136
+ end
137
+ end
138
+
128
139
  def fix_config_symbol_values
129
140
  if @config[:devices]
130
141
  @config[:devices][:default] = @config[:devices][:default].to_sym
@@ -73,7 +73,7 @@ module RokuBuilder
73
73
  end
74
74
 
75
75
  def get_repo_path(project_config:)
76
- if @config[:projects][:project_dir]
76
+ if @config[:projects][:project_dir] and !Pathname.new(project_config[:directory]).absolute?
77
77
  Pathname.new(File.join(@config[:projects][:project_dir], project_config[:directory])).realdirpath
78
78
  else
79
79
  Pathname.new(project_config[:directory]).realdirpath
@@ -137,7 +137,7 @@ module RokuBuilder
137
137
  end
138
138
 
139
139
  def set_project_directory
140
- if @config[:projects][:project_dir]
140
+ if @config[:projects][:project_dir] and !Pathname.new(@parsed[:project][:directory]).absolute?
141
141
  @parsed[:project][:directory] = File.join(@config[:projects][:project_dir], @parsed[:project][:directory])
142
142
  end
143
143
  unless Dir.exist?(@parsed[:project][:directory])
@@ -170,7 +170,7 @@ module RokuBuilder
170
170
  def get_global_key_config
171
171
  raise ParseError, "Unknown Key: #{@parsed[:key]}" unless @config[:keys][@parsed[:key].to_sym]
172
172
  @parsed[:key] = @config[:keys][@parsed[:key].to_sym].dup
173
- if @config[:keys][:key_dir]
173
+ if @config[:keys][:key_dir] and !@parsed[:key][:keyed_pkg].start_with?("./")
174
174
  @parsed[:key][:keyed_pkg] = File.join(@config[:keys][:key_dir], @parsed[:key][:keyed_pkg])
175
175
  end
176
176
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module RokuBuilder
4
4
  # Version of the RokuBuilder Gem
5
- VERSION = "4.5.3"
5
+ VERSION = "4.6.0"
6
6
  end
@@ -103,6 +103,32 @@ module RokuBuilder
103
103
  assert_equal "app2", config.raw[:projects][:p2][:app_name]
104
104
  end
105
105
 
106
+ def test_config_read_local_directory
107
+ options = build_options({config: File.join(test_files_path(ConfigTest), "config.json"), validate: true})
108
+ config = Config.new(options: options)
109
+
110
+ mock = Minitest::Mock.new
111
+ io = proc { |path|
112
+ if path == './.roku_config.json'
113
+ mock
114
+ else
115
+ IO.new(IO.sysopen(path))
116
+ end
117
+ }
118
+ local_config_content = IO.read(File.join(test_files_path(ConfigTest), "local.json"))
119
+ mock.expect(:read, local_config_content)
120
+
121
+ File.stub(:exist?, true) do
122
+ File.stub(:open, io) do
123
+ config.load
124
+ end
125
+ end
126
+
127
+ mock.verify
128
+ refute_nil config.raw[:projects][:p2]
129
+ assert_equal `pwd`.chomp, config.raw[:projects][:p2][:directory]
130
+ end
131
+
106
132
  def test_config_edit
107
133
  orginal = File.join(test_files_path(ConfigTest), "config.json")
108
134
  tmp = File.join(test_files_path(ConfigTest), "tmpconfig.json")
@@ -196,6 +196,24 @@ module RokuBuilder
196
196
  assert_equal "/tmp/project2", configs[:project][:directory]
197
197
  end
198
198
 
199
+ def test_manifest_config_project_directory_select
200
+ options = build_options({validate: true, working: true})
201
+ options.define_singleton_method(:source_commands){[:validate]}
202
+ config = good_config(ConfigParserTest)
203
+ config[:projects][:project_dir] = "/tmp"
204
+ config[:projects][:project1][:directory] = "/tmp/project1"
205
+
206
+ configs = nil
207
+ Pathname.stub(:pwd, Pathname.new("/tmp/project1")) do
208
+ Dir.stub(:exist?, true) do
209
+ configs = ConfigParser.parse(options: options, config: config)
210
+ end
211
+ end
212
+
213
+ assert_equal Hash, config.class
214
+ assert_equal "/tmp/project1", configs[:project][:directory]
215
+ end
216
+
199
217
  def test_key_config_key_directory
200
218
  tmp_file = Tempfile.new("pkg")
201
219
  options = build_options({validate: true, project: :project2, stage: 'production'})
@@ -211,6 +229,23 @@ module RokuBuilder
211
229
  tmp_file.close
212
230
  end
213
231
 
232
+ def test_key_config_key_local_directory
233
+ tmp_file = Tempfile.new("pkg")
234
+ FileUtils.touch("./pkg")
235
+ options = build_options({validate: true, project: :project2, stage: 'production'})
236
+ options.define_singleton_method(:source_commands){[:validate]}
237
+ config = good_config(ConfigParserTest)
238
+ config[:keys][:key_dir] = File.dirname(tmp_file.path)
239
+ config[:keys][:a][:keyed_pkg] = "./pkg"
240
+
241
+ configs = ConfigParser.parse(options: options, config: config)
242
+
243
+ assert_equal Hash, config.class
244
+ assert_equal "./pkg", configs[:key][:keyed_pkg]
245
+ tmp_file.close
246
+ FileUtils.rm("./pkg")
247
+ end
248
+
214
249
  def test_key_config_key_directory_bad
215
250
  tmp_file = Tempfile.new("pkg")
216
251
  options = build_options({validate: true, project: :project2, stage: 'production'})
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "projects": {
3
3
  "p2": {
4
- "directory": "/tmp",
5
4
  "folders": ["resources","source"],
6
5
  "files": ["manifest"],
7
6
  "app_name": "app2",
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.5.3
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - greeneca
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-05 00:00:00.000000000 Z
11
+ date: 2018-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip