test_flight_client 0.1.0 → 0.2.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/README.md +4 -0
- data/lib/test_flight_client.rb +24 -1
- data/lib/test_flight_client/version.rb +1 -1
- data/spec/lib/test_flight_client_spec.rb +23 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57e11f05c6a373adde72b35a1d45bbeadf3f5793
|
4
|
+
data.tar.gz: ac7d18298e3c90410a65ef3808cd4729e08b7b36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06f8ad47a7f681b2f56c05b67205154610d7ae683935d49e6fc0cfd0c97f0b9a10ebff2bf4fe41611f7ba735e007a0a560b9abdad55503e68895ae431367949
|
7
|
+
data.tar.gz: 61525ac7088c1c75659537be9bb3851327fa8c64df091a940455473c84a800014247d846d077ec12b6357589e301defbb1312ccbd593f388d68e3642873135ec
|
data/README.md
CHANGED
@@ -26,6 +26,10 @@ Or install it yourself as:
|
|
26
26
|
file: 'file path or file object',
|
27
27
|
notes: 'whatever notes you want to add'
|
28
28
|
)
|
29
|
+
|
30
|
+
# if you are using bundler then any parameters found in file
|
31
|
+
# config/test_flight.yml will be used but overridden by what
|
32
|
+
# is sent through manually to #build as parameter
|
29
33
|
|
30
34
|
## Contributing
|
31
35
|
|
data/lib/test_flight_client.rb
CHANGED
@@ -4,7 +4,30 @@ require 'test_flight_client/api_request'
|
|
4
4
|
module TestFlightClient
|
5
5
|
|
6
6
|
def self.build(params = {})
|
7
|
-
ApiRequest.new.post('/builds', params)
|
7
|
+
ApiRequest.new.post('/builds', merged_parameters(params))
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def self.merged_parameters(params)
|
13
|
+
config_params.merge(params)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.config_params
|
17
|
+
if config_file && File.exists?(config_file)
|
18
|
+
YAML::load(ERB.new(File.read(config_file)).result)
|
19
|
+
else
|
20
|
+
{}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.config_file
|
25
|
+
if ENV['BUNDLE_GEMFILE']
|
26
|
+
application_root = ENV['BUNDLE_GEMFILE'].gsub('Gemfile', '')
|
27
|
+
File.expand_path(File.join(application_root, 'config', 'test_flight.yml'), __FILE__)
|
28
|
+
else
|
29
|
+
false
|
30
|
+
end
|
8
31
|
end
|
9
32
|
|
10
33
|
end
|
@@ -17,12 +17,34 @@ describe TestFlightClient do
|
|
17
17
|
|
18
18
|
context 'when given parameters' do
|
19
19
|
|
20
|
-
let(:params) {
|
20
|
+
let(:params) { {one: 'ONE', two: 'TWO'} }
|
21
21
|
|
22
22
|
it 'posts an API request passing through given parameters' do
|
23
23
|
expect(api_request).to receive(:post).with anything, params
|
24
24
|
subject.build params
|
25
25
|
end
|
26
|
+
|
27
|
+
context 'when a config file is available' do
|
28
|
+
|
29
|
+
let(:config_file) { double('config file') }
|
30
|
+
let(:gemfile_path) { 'path/to/Gemfile' }
|
31
|
+
let(:config_double) { double('config') }
|
32
|
+
let(:erb_double) { double('erb', :result => config_file) }
|
33
|
+
let(:config_file_params) { {one: '1', two: '2', three: '3'} }
|
34
|
+
|
35
|
+
before do
|
36
|
+
ENV.stub(:[]).with('BUNDLE_GEMFILE').and_return gemfile_path
|
37
|
+
File.stub(:exists?).and_return true
|
38
|
+
File.stub(:read).and_return config_double
|
39
|
+
ERB.stub(:new).with(config_double).and_return erb_double
|
40
|
+
YAML.stub(:load).with(config_file).and_return config_file_params
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'merges in any parameters found in the config file that dont already exist' do
|
44
|
+
expect(api_request).to receive(:post).with(anything, {one: 'ONE', two: 'TWO', three: '3'})
|
45
|
+
subject.build params
|
46
|
+
end
|
47
|
+
end
|
26
48
|
end
|
27
49
|
end
|
28
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_flight_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seb Glazebrook
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httmultiparty
|