dpl 1.6.7.travis.546.1 → 1.6.7.travis.549.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzExMzg4NTk0YmJiZmZmZTg3YTFkYmY0YzlhNTc3MjljMWQ0OTNhOQ==
4
+ NDE1ODI3OGVjODZiNzE4MGQ3M2I3NmU5NWVlYmUyM2ZhYjc2MWVjZQ==
5
5
  data.tar.gz: !binary |-
6
- NTNkMWJjNTEzY2UzMjI2OThmZjE4MDgyMzJjZjU4YzAzMzRkOWQ4Zg==
6
+ ZGM3ODNlNTgyYTVkY2EyOWE3ZTI1Njc3NTA1YzEyYzA1N2NhMjZlMw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NWRmYWJkZjU1OGI2ZDNhOTE1MDI5NWI1YThhY2I0OGVlNDE0YTI4YmY4M2Vm
10
- MjI4MTE0NGExNTkxYTJhNWY2NzgxMjNlZGRiYjhiMGFjODM1NGQ2YzgxNzgz
11
- Yjg1OWE1MTg2OGVkNDY1MzQzYWQ1NjlkYWUwMjc2NTJjYTEwMjU=
9
+ ZTk4MDczMDI1NDhiNjhmNjFhODhlMGU1N2IyNTdhNmMwYzgwNDYzYWJhZjQ5
10
+ ZmM4OGQyMjAwMGMzMGZiYjc0ZjQxOWI4Y2NhOWMwMjhkMmJjZjA4MjU3NjRm
11
+ YjY1ZmQ4YWQ4ZGIzN2Y3ODhjZWIzYTRkNjk5NDk5ZmJiNjJkNGU=
12
12
  data.tar.gz: !binary |-
13
- ZTkzNjkwMjUwNWEyNTk3ZGJkMzRjZTczZmJlNjcyODNhM2MxZjQ1ZGE0NjZk
14
- N2E4NDJmMjE5ZjFkMDFiZmFhYjA1Y2Q3MTMzYWI3MDc2OTYyM2E3YjBlOWI1
15
- NTg0ZjNkMDNiNDFmOTBjNzExYjQ4ODIwZTNkZDMxMTk0MTAwOTE=
13
+ ZTkyYzNkNzVkMTFjYmYzNmNlMTE1MTdmNWQ4ZGMxYjRhMDJiMWY3ZjRjNTcw
14
+ ODExYjYzMzU3YmI5OGQ0MmY1M2U3MGVmODY5YTQzYTYzNzcxNDFjNmY4OTAx
15
+ ODViNzljMzY2OTQyN2Y1NDBjZjc1ZjMzNWJjMjJiZDk4ZTkyYTI=
data/README.md CHANGED
@@ -284,6 +284,7 @@ As a rule of thumb, you should switch to the Git strategy if you run into issues
284
284
  * **password**: GitHub Password. Not necessary if `api-key` is used.
285
285
  * **repo**: GitHub Repo. Defaults to git repo's name.
286
286
  * **file**: File to upload to GitHub Release.
287
+ * **file_glob**: If files should be interpreted as globs (\* and \*\* wildcards). Defaults to false.
287
288
  * **release-number**: Overide automatic release detection, set a release manually.
288
289
 
289
290
  #### GitHub Two Factor Authentication
@@ -43,6 +43,16 @@ module DPL
43
43
  @user ||= api.user
44
44
  end
45
45
 
46
+ def files
47
+ if options[:file_glob]
48
+ Array(options[:file]).map do |glob|
49
+ Dir.glob(glob)
50
+ end.flatten
51
+ else
52
+ Array(options[:file])
53
+ end
54
+ end
55
+
46
56
  def needs_key?
47
57
  false
48
58
  end
@@ -89,7 +99,7 @@ module DPL
89
99
  release_url = api.create_release(slug, get_tag).rels[:self].href
90
100
  end
91
101
 
92
- Array(options[:file]).each do |file|
102
+ files.each do |file|
93
103
  already_exists = false
94
104
  filename = Pathname.new(file).basename.to_s
95
105
  api.release(release_url).rels[:assets].get.data.each do |existing_file|
@@ -60,6 +60,32 @@ describe DPL::Provider::Releases do
60
60
  end
61
61
  end
62
62
 
63
+ describe "#files" do
64
+ example "without file globbing and a single file" do
65
+ expect(provider.files).to eq(['blah.txt'])
66
+ end
67
+
68
+ example "without file globbing and multiple files" do
69
+ provider.options.update(:file => ['foo.txt', 'bar.txt'])
70
+ expect(provider.files).to eq(['foo.txt', 'bar.txt'])
71
+ end
72
+
73
+ example "with file globbing and a single glob" do
74
+ provider.options.update(:file_glob => true)
75
+ provider.options.update(:file => 'bl*.txt')
76
+ expect(::Dir).to receive(:glob).with('bl*.txt').and_return(['blah.txt'])
77
+ expect(provider.files).to eq(['blah.txt'])
78
+ end
79
+
80
+ example "with file globbing and multiple globs" do
81
+ provider.options.update(:file_glob => true)
82
+ provider.options.update(:file => ['f*.txt', 'b*.txt'])
83
+ expect(::Dir).to receive(:glob).with('f*.txt').and_return(['foo.txt'])
84
+ expect(::Dir).to receive(:glob).with('b*.txt').and_return(['bar.txt'])
85
+ expect(provider.files).to eq(['foo.txt', 'bar.txt'])
86
+ end
87
+ end
88
+
63
89
  describe "#needs_key?" do
64
90
  example do
65
91
  expect(provider.needs_key?).to eq(false)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7.travis.546.1
4
+ version: 1.6.7.travis.549.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-23 00:00:00.000000000 Z
11
+ date: 2014-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec