Skip to content

Commit

Permalink
Merge pull request #292 from kylev/kv_glob_packagecloud
Browse files Browse the repository at this point in the history
[packagecloud] Allow users to specify a package_glob we will search.
  • Loading branch information
BanzaiMan committed Aug 27, 2015
2 parents 24654e4 + 62e0bc3 commit c269aa7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/dpl/provider/packagecloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_source_files_for(orig_filename)

def push_app
packages = []
glob_args = ["**/*"]
glob_args = Array(options.fetch(:package_glob, '**/*'))
Dir.chdir(options.fetch(:local_dir, Dir.pwd)) do
Dir.glob(*glob_args) do |filename|
unless File.directory?(filename)
Expand Down
23 changes: 22 additions & 1 deletion spec/provider/packagecloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,25 @@

end

end
describe "#push_app" do
it 'defaults to searching everywhere' do
expect(Dir).to receive(:glob).with('**/*')
expect { provider.push_app }.to raise_error(DPL::Error)
end

it 'accepts and uses a string glob' do
provider.options.update(:package_glob => 'foo*.gem')

expect(Dir).to receive(:glob).with('foo*.gem')
expect { provider.push_app }.to raise_error(DPL::Error)
end

it 'accepts and uses an array of globs' do
provider.options.update(:package_glob => ['*.rpm', '**/*.deb'])

expect(Dir).to receive(:glob).with('*.rpm', '**/*.deb')
expect { provider.push_app }.to raise_error(DPL::Error)
end
end

end

0 comments on commit c269aa7

Please sign in to comment.