unix_utils 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ 0.0.14 / 2012-07-06
2
+
3
+ * Breaking changes
4
+
5
+ * UnixUtils.du_sk -> UnixUtils.du (but it's still `du -sk`)
6
+ * Heuristic for detecting attempts to curl a local file changed - now it looks for absence of '://'
7
+
1
8
  0.0.13 / 2012-05-16
2
9
 
3
10
  * Bug fixes
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Brighter Planet, Inc.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,3 +1,3 @@
1
1
  module UnixUtils
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
data/lib/unix_utils.rb CHANGED
@@ -12,9 +12,12 @@ module UnixUtils
12
12
 
13
13
  def self.curl(url, form_data = nil)
14
14
  outfile = tmp_path url
15
- if url.start_with?('file://') or url.start_with?('/') or url.count('/') == 0
15
+ if url.start_with?('file://') or not url.include?('://')
16
16
  # deal with local files
17
17
  infile = ::File.expand_path url.sub('file://', '')
18
+ unless File.readable?(infile)
19
+ raise "[unix_utils] #{url.inspect} does not exist or is not readable on the local filesystem."
20
+ end
18
21
  ::FileUtils.cp infile, outfile
19
22
  return outfile
20
23
  end
@@ -71,7 +74,7 @@ module UnixUtils
71
74
  end
72
75
  end
73
76
 
74
- def self.du_sk(srcdir)
77
+ def self.du(srcdir)
75
78
  srcdir = ::File.expand_path srcdir
76
79
  argv = ['du', '-sk', srcdir]
77
80
  stdout = spawn argv
data/test/helper.rb CHANGED
@@ -23,7 +23,7 @@ module TestHelper
23
23
  when :file
24
24
  checksum = UnixUtils.shasum infile_or_srcdir, 256
25
25
  when :directory
26
- size = UnixUtils.du_sk infile_or_srcdir
26
+ size = UnixUtils.du infile_or_srcdir
27
27
  end
28
28
  destdir = UnixUtils.send(*([method_id] + args))
29
29
  safe_delete destdir
@@ -32,7 +32,7 @@ module TestHelper
32
32
  when :file
33
33
  UnixUtils.shasum(infile_or_srcdir, 256).must_equal checksum
34
34
  when :directory
35
- UnixUtils.du_sk(infile_or_srcdir).must_equal size
35
+ UnixUtils.du(infile_or_srcdir).must_equal size
36
36
  end
37
37
  end
38
38
 
@@ -61,9 +61,9 @@ describe UnixUtils do
61
61
  end
62
62
  end
63
63
 
64
- describe :du_sk do
64
+ describe :du do
65
65
  it "calculates the size of a directory in bytes" do
66
- UnixUtils.du_sk('directory').must_equal 8
66
+ UnixUtils.du('directory').must_equal 8
67
67
  end
68
68
  end
69
69
 
data/unix_utils.gemspec CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
15
15
  gem.name = "unix_utils"
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = UnixUtils::VERSION
18
+ gem.license = 'MIT'
18
19
 
19
20
  gem.add_runtime_dependency 'posix-spawn'
20
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unix_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-16 00:00:00.000000000 Z
12
+ date: 2012-07-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: posix-spawn
@@ -39,6 +39,7 @@ files:
39
39
  - .gitignore
40
40
  - CHANGELOG
41
41
  - Gemfile
42
+ - LICENSE
42
43
  - README.markdown
43
44
  - Rakefile
44
45
  - lib/unix_utils.rb
@@ -63,7 +64,8 @@ files:
63
64
  - unix-philosophy-quote-pg2.png
64
65
  - unix_utils.gemspec
65
66
  homepage: https://github.com/seamusabshere/unix_utils
66
- licenses: []
67
+ licenses:
68
+ - MIT
67
69
  post_install_message:
68
70
  rdoc_options: []
69
71
  require_paths:
@@ -82,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
84
  version: '0'
83
85
  requirements: []
84
86
  rubyforge_project:
85
- rubygems_version: 1.8.21
87
+ rubygems_version: 1.8.24
86
88
  signing_key:
87
89
  specification_version: 3
88
90
  summary: Like FileUtils, but provides zip, unzip, bzip2, bunzip2, tar, untar, sed,