fedux_org-stdlib 0.11.7 → 0.11.8

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: 70d9f9c25c6588ef079066da6f92c093255ec1c4
4
- data.tar.gz: 920da8791d5efc00eb42d1393ec6de54a4ad5f0e
3
+ metadata.gz: 92863f4f14d8538ca71621a0c77176dc0b7eb5a2
4
+ data.tar.gz: 1b19ae4518b632afc6d43a119814c469c1b65375
5
5
  SHA512:
6
- metadata.gz: 77293897f8cd7ce9276b16a413a490b11a499fdc18be05d46be4490654f8ece276de70946bd243ebacc118a9fbe8053d9be891d126dd12b1fb11f31836c4c98b
7
- data.tar.gz: 83081d2426ffb2f0152cc75ff6b6db95f32db12b509b420fabcb7b3e4f2e3d36a188a4076235469c240d0e8faede540c04ce5f1c26c121112180981abf143c2e
6
+ metadata.gz: ed419d0a94dae984c48e911fb65a64ce7b5c230d8874c138785d56e4ba0a12151e80bbdce8c15c3ebcc7301e5fbfeccfa5eeaa324843f1409f843a8c5bacb039
7
+ data.tar.gz: 2bb8dc9e06c5df34bae130a0c3717824f7be9de63a34404f2bdbef5ef95b666582b5c1de1a42ef1f79e6bfee543fc06bca4d7db954595328d68afce99bfcfd03
data/Gemfile CHANGED
@@ -16,7 +16,7 @@ group :development, :test do
16
16
  gem 'byebug'
17
17
  end
18
18
 
19
- gem 'aruba', '>= 0.6.1', require: false
19
+ gem 'aruba', git: 'https://github.com/cucumber/aruba', require: false
20
20
  gem 'awesome_print', require: 'ap'
21
21
  gem 'bundler', '>= 1.3', require: false
22
22
  gem 'coveralls', require: false
@@ -47,6 +47,8 @@ group :development, :test do
47
47
  gem 'rugged'
48
48
  gem 'addressable'
49
49
 
50
+ gem 'rubyzip'
51
+
50
52
  gem 'fedux_org_stdlib-fixtures-plugin_manager-load', require: false, path: File.expand_path('../fixtures/plugin-load-app', __FILE__)
51
53
  # gem 'fedux_org_stdlib-fixtures-plugin_manager-no_load', require: false, path: File.expand_path('../fixtures/plugin-no_load-app', __FILE__)
52
54
  end
@@ -1,7 +1,16 @@
1
+ GIT
2
+ remote: https://github.com/cucumber/aruba
3
+ revision: ec87d91bb43011eb49b619d58c16a9fa22b5ac2f
4
+ specs:
5
+ aruba (0.6.1)
6
+ childprocess (>= 0.3.6)
7
+ cucumber (>= 1.1.1)
8
+ rspec-expectations (>= 2.7.0)
9
+
1
10
  PATH
2
11
  remote: .
3
12
  specs:
4
- fedux_org-stdlib (0.11.6)
13
+ fedux_org-stdlib (0.11.7)
5
14
  activesupport
6
15
 
7
16
  PATH
@@ -20,10 +29,6 @@ GEM
20
29
  thread_safe (~> 0.1)
21
30
  tzinfo (~> 1.1)
22
31
  addressable (2.3.6)
23
- aruba (0.6.1)
24
- childprocess (>= 0.3.6)
25
- cucumber (>= 1.1.1)
26
- rspec-expectations (>= 2.7.0)
27
32
  ast (2.0.0)
28
33
  astrolabe (1.3.0)
29
34
  parser (>= 2.2.0.pre.3, < 3.0)
@@ -127,6 +132,7 @@ GEM
127
132
  rainbow (>= 1.99.1, < 3.0)
128
133
  ruby-progressbar (~> 1.4)
129
134
  ruby-progressbar (1.7.0)
135
+ rubyzip (1.1.6)
130
136
  rugged (0.21.2)
131
137
  simplecov (0.9.1)
132
138
  docile (~> 1.1.0)
@@ -159,7 +165,7 @@ PLATFORMS
159
165
 
160
166
  DEPENDENCIES
161
167
  addressable
162
- aruba (>= 0.6.1)
168
+ aruba!
163
169
  awesome_print
164
170
  bundler (>= 1.3)
165
171
  byebug
@@ -184,6 +190,7 @@ DEPENDENCIES
184
190
  rspec
185
191
  rspec-legacy_formatters
186
192
  rubocop
193
+ rubyzip
187
194
  rugged
188
195
  simplecov
189
196
  taskjuggler
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.11.7'
4
+ VERSION = '0.11.8'
5
5
  end
@@ -0,0 +1,36 @@
1
+ # encoding: utf-8
2
+ require 'fedux_org_stdlib/require_files'
3
+ require_library %w(zip zip/filesystem active_support/core_ext/object/blank)
4
+
5
+ module FeduxOrgStdlib
6
+ module Zipper
7
+ def unzip(source_file, destination_directory)
8
+ return unless destination_directory
9
+
10
+ Zip::File.open(source_file) do |z|
11
+ z.each do |e|
12
+ new_path = File.join(destination_directory, e.name)
13
+
14
+ FileUtils.mkdir_p File.dirname(new_path)
15
+ e.extract(new_path)
16
+ end
17
+ end
18
+ end
19
+
20
+ def zip(source_directory, destination_file, prefix: '', executables: [])
21
+ Zip::File.open(destination_file, Zip::File::CREATE) do |z|
22
+ Dir.glob(File.join(source_directory, '**', '*')).each do |filename|
23
+ paths = []
24
+ paths << Pathname.new(prefix) unless prefix.blank?
25
+ paths << Pathname.new(filename).relative_path_from(Pathname.new(source_directory))
26
+
27
+ z.add(File.join(*paths), filename)
28
+ z.file.chmod(0755, File.join(*paths)) if File.executable? filename
29
+ z.file.chmod(0755, File.join(*paths)) if executables.any? { |f| Regexp.new(f) === filename }
30
+ end
31
+ end
32
+ end
33
+
34
+ module_function :zip, :unzip
35
+ end
36
+ end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'fedux_org_stdlib/zipper'
4
+
5
+ RSpec.describe FeduxOrgStdlib::Zipper do
6
+ context '#zip' do
7
+ it 'creates a zip file' do
8
+ create_dir 'source'
9
+ source_directory = absolute_path('source/')
10
+ destination_file = absolute_path('source.zip')
11
+ FeduxOrgStdlib::Zipper.zip(source_directory, destination_file)
12
+
13
+ expect(File.exist?(destination_file)).to be true
14
+ end
15
+
16
+ it 'handles a source directory with files a root level' do
17
+ write_file('source/file', 'text')
18
+ source_directory = absolute_path('source/')
19
+ destination_file = absolute_path('source.zip')
20
+ FeduxOrgStdlib::Zipper.zip(source_directory, destination_file)
21
+
22
+ expect(File.exist?(destination_file)).to be true
23
+ end
24
+ end
25
+
26
+ context '#unzip' do
27
+ it 'unzips zip file' do
28
+ write_file 'unzip.d/file', 'text'
29
+ source_directory = absolute_path('unzip.d')
30
+ zip_file = absolute_path('unzip.d.zip')
31
+ FeduxOrgStdlib::Zipper.zip(source_directory, zip_file)
32
+
33
+ destination_directory = absolute_path('destination.d')
34
+ FeduxOrgStdlib::Zipper.unzip(zip_file, destination_directory)
35
+
36
+ expect(File.exist?(destination_directory)).to be true
37
+ end
38
+
39
+ end
40
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fedux_org-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.7
4
+ version: 0.11.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-30 00:00:00.000000000 Z
11
+ date: 2015-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -173,6 +173,7 @@ files:
173
173
  - lib/fedux_org_stdlib/version_management/rubygem_version_file_parser.rb
174
174
  - lib/fedux_org_stdlib/version_management/software_version.rb
175
175
  - lib/fedux_org_stdlib/version_management/version_builder.rb
176
+ - lib/fedux_org_stdlib/zipper.rb
176
177
  - rakefiles/default.rake
177
178
  - rakefiles/travis.rake
178
179
  - script/console
@@ -239,6 +240,7 @@ files:
239
240
  - spec/version_management/rubygem_version_file_spec.rb
240
241
  - spec/version_management/software_version_spec.rb
241
242
  - spec/version_management/version_builder_spec.rb
243
+ - spec/zipper_spec.rb
242
244
  homepage: ''
243
245
  licenses:
244
246
  - MIT
@@ -326,4 +328,5 @@ test_files:
326
328
  - spec/version_management/rubygem_version_file_spec.rb
327
329
  - spec/version_management/software_version_spec.rb
328
330
  - spec/version_management/version_builder_spec.rb
331
+ - spec/zipper_spec.rb
329
332
  has_rdoc: