em-file-utils 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +52 -11
- data/LICENSE.txt +1 -1
- data/README.md +19 -26
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/em-file-utils.gemspec +62 -0
- data/lib/em-file-utils.rb +19 -8
- metadata +75 -67
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 487ad984d19bcf91bf42568f233cba7cf1c4f3e5
|
4
|
+
data.tar.gz: ccb063ba247a552a21d52d6b8a35d49708c213f2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1e21c33f064a74c183ec3d70e2e4ce38817f6685e436f47116e61360f37a59ce2ff5e242820dfe0b2c31f660506b57bf0efcc4467c25e33f3f3f44472f2e0162
|
7
|
+
data.tar.gz: 634e1793ab1cfa4d4e867821c75eef20d7245c420e56b238b8cc17bcbb78a45928df939fbf60cd8ba71f480bc12c6ed40a5998a314e9e88d36506e9dc01a6555
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,27 +1,68 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
4
|
+
addressable (2.3.8)
|
5
|
+
builder (3.2.2)
|
6
|
+
command-builder (0.3.2)
|
6
7
|
pipe-run (>= 0.2.1)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
descendants_tracker (0.0.4)
|
9
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
10
|
+
faraday (0.9.1)
|
11
|
+
multipart-post (>= 1.2, < 3)
|
12
|
+
git (1.2.9.1)
|
13
|
+
github_api (0.12.3)
|
14
|
+
addressable (~> 2.3)
|
15
|
+
descendants_tracker (~> 0.0.4)
|
16
|
+
faraday (~> 0.8, < 0.10)
|
17
|
+
hashie (>= 3.3)
|
18
|
+
multi_json (>= 1.7.5, < 2.0)
|
19
|
+
nokogiri (~> 1.6.3)
|
20
|
+
oauth2
|
21
|
+
hash-utils (2.2.0)
|
22
|
+
ruby-version (>= 0.4.0)
|
23
|
+
hashie (3.4.2)
|
24
|
+
highline (1.7.2)
|
25
|
+
jeweler (2.0.1)
|
26
|
+
builder
|
27
|
+
bundler (>= 1.0)
|
11
28
|
git (>= 1.2.5)
|
29
|
+
github_api
|
30
|
+
highline (>= 1.6.15)
|
31
|
+
nokogiri (>= 1.5.10)
|
12
32
|
rake
|
13
|
-
|
14
|
-
|
15
|
-
|
33
|
+
rdoc
|
34
|
+
jwt (1.5.1)
|
35
|
+
mini_portile (0.6.2)
|
36
|
+
multi_json (1.11.2)
|
37
|
+
multi_xml (0.5.5)
|
38
|
+
multipart-post (2.0.0)
|
39
|
+
nokogiri (1.6.6.2)
|
40
|
+
mini_portile (~> 0.6.0)
|
41
|
+
oauth2 (1.0.0)
|
42
|
+
faraday (>= 0.8, < 0.10)
|
43
|
+
jwt (~> 1.0)
|
44
|
+
multi_json (~> 1.3)
|
45
|
+
multi_xml (~> 0.5)
|
46
|
+
rack (~> 1.2)
|
47
|
+
pipe-run (0.3.0)
|
48
|
+
rack (1.6.4)
|
49
|
+
rake (10.4.2)
|
50
|
+
rdoc (4.2.0)
|
51
|
+
riot (0.12.7)
|
16
52
|
rr
|
17
|
-
rr (1.
|
53
|
+
rr (1.1.2)
|
54
|
+
ruby-version (0.4.3)
|
55
|
+
thread_safe (0.3.5)
|
18
56
|
|
19
57
|
PLATFORMS
|
20
58
|
ruby
|
21
59
|
|
22
60
|
DEPENDENCIES
|
23
61
|
bundler (>= 1.0.0)
|
24
|
-
command-builder (>= 0.2.
|
62
|
+
command-builder (>= 0.2.1)
|
25
63
|
hash-utils (>= 0.8.0)
|
26
64
|
jeweler (>= 1.5.2)
|
27
65
|
riot (>= 0.12.3)
|
66
|
+
|
67
|
+
BUNDLED WITH
|
68
|
+
1.10.5
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -9,39 +9,32 @@ evented [EventMachine][3] interface support (although it isn't required).
|
|
9
9
|
|
10
10
|
Some example:
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
```ruby
|
13
|
+
# synchronous
|
14
|
+
require "em-file-utils"
|
15
|
+
output = EM::FileUtils::touch("./~test1").execute!
|
16
|
+
|
17
|
+
# asynchronous
|
18
|
+
EM::run # eventmachine
|
19
|
+
EM::FileUtils::touch("./~test1").execute do |output|
|
20
|
+
# ...
|
21
21
|
end
|
22
|
+
end
|
23
|
+
```
|
24
|
+
|
22
25
|
|
23
26
|
It returns [CommandBuilder][2] object which allows it to be flexible:
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
------------
|
31
|
-
|
32
|
-
1. Fork it.
|
33
|
-
2. Create a branch (`git checkout -b 20101220-my-change`).
|
34
|
-
3. Commit your changes (`git commit -am "Added something"`).
|
35
|
-
4. Push to the branch (`git push origin 20101220-my-change`).
|
36
|
-
5. Create an [Issue][9] with a link to your branch.
|
37
|
-
6. Enjoy a refreshing Diet Coke and wait.
|
38
|
-
|
28
|
+
```ruby
|
29
|
+
cmd = EM::FileUtils::touch("./~test1")
|
30
|
+
cmd.params.unshift(:a) # change access time only
|
31
|
+
cmd.execute!
|
32
|
+
```
|
39
33
|
|
40
34
|
Copyright
|
41
35
|
---------
|
42
36
|
|
43
|
-
Copyright © 2011 [Martin
|
44
|
-
further details.
|
37
|
+
Copyright © 2011 – 2015 [Martin Poljak][10]. See `LICENSE.txt` for further details.
|
45
38
|
|
46
39
|
[1]: http://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/classes/FileUtils.html
|
47
40
|
[2]: http://github.com/martinkozak/command-builder
|
@@ -49,4 +42,4 @@ further details.
|
|
49
42
|
[4]: http://en.wikipedia.org/wiki/Unix
|
50
43
|
[5]: http://en.wikipedia.org/wiki/GNU
|
51
44
|
[9]: http://github.com/martinkozak/em-file-utils/issues
|
52
|
-
[10]: http://www.
|
45
|
+
[10]: http://www.martinpoljak.net/
|
data/Rakefile
CHANGED
@@ -19,8 +19,8 @@ Jeweler::Tasks.new do |gem|
|
|
19
19
|
gem.homepage = "http://github.com/martinkozak/em-file-utils"
|
20
20
|
gem.license = "MIT"
|
21
21
|
gem.summary = "Allows base file operations using UNIX commands such as standard library FileUtils, but returns CommandBuilder objects which allows wide customizations to final call and asynchronous evented EventMachine interface support (although it isn't required). UNIX/Linux based systems only supported."
|
22
|
-
gem.email = "
|
23
|
-
gem.authors = ["Martin
|
22
|
+
gem.email = "martin@poljak.cz"
|
23
|
+
gem.authors = ["Martin Poljak"]
|
24
24
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
25
25
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
26
26
|
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.1
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: em-file-utils 1.1.1 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "em-file-utils"
|
9
|
+
s.version = "1.1.1"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Martin Poljak"]
|
14
|
+
s.date = "2015-07-19"
|
15
|
+
s.email = "martin@poljak.cz"
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"em-file-utils.gemspec",
|
29
|
+
"lib/em-file-utils.rb",
|
30
|
+
"test",
|
31
|
+
"test-em"
|
32
|
+
]
|
33
|
+
s.homepage = "http://github.com/martinkozak/em-file-utils"
|
34
|
+
s.licenses = ["MIT"]
|
35
|
+
s.rubygems_version = "2.4.5"
|
36
|
+
s.summary = "Allows base file operations using UNIX commands such as standard library FileUtils, but returns CommandBuilder objects which allows wide customizations to final call and asynchronous evented EventMachine interface support (although it isn't required). UNIX/Linux based systems only supported."
|
37
|
+
|
38
|
+
if s.respond_to? :specification_version then
|
39
|
+
s.specification_version = 4
|
40
|
+
|
41
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
+
s.add_runtime_dependency(%q<hash-utils>, [">= 0.8.0"])
|
43
|
+
s.add_runtime_dependency(%q<command-builder>, [">= 0.2.1"])
|
44
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
45
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.5.2"])
|
46
|
+
s.add_development_dependency(%q<riot>, [">= 0.12.3"])
|
47
|
+
else
|
48
|
+
s.add_dependency(%q<hash-utils>, [">= 0.8.0"])
|
49
|
+
s.add_dependency(%q<command-builder>, [">= 0.2.1"])
|
50
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
51
|
+
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
|
52
|
+
s.add_dependency(%q<riot>, [">= 0.12.3"])
|
53
|
+
end
|
54
|
+
else
|
55
|
+
s.add_dependency(%q<hash-utils>, [">= 0.8.0"])
|
56
|
+
s.add_dependency(%q<command-builder>, [">= 0.2.1"])
|
57
|
+
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
58
|
+
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
|
59
|
+
s.add_dependency(%q<riot>, [">= 0.12.3"])
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
data/lib/em-file-utils.rb
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
3
3
|
|
4
4
|
require "command-builder"
|
5
|
-
require "hash-utils/object" # >= 0.8.0
|
6
|
-
|
7
5
|
|
8
6
|
##
|
9
7
|
# Main EventMachine module.
|
@@ -29,7 +27,7 @@ module EM
|
|
29
27
|
#
|
30
28
|
# @param [String] from source path
|
31
29
|
# @param [String] to target path
|
32
|
-
# @return [CommandBuilder]
|
30
|
+
# @return [CommandBuilder] the command builder object
|
33
31
|
#
|
34
32
|
|
35
33
|
def self.cp(from, to)
|
@@ -45,7 +43,7 @@ module EM
|
|
45
43
|
#
|
46
44
|
# @param [String] from source path
|
47
45
|
# @param [String] to target path
|
48
|
-
# @return [CommandBuilder]
|
46
|
+
# @return [CommandBuilder] the command builder object
|
49
47
|
#
|
50
48
|
|
51
49
|
def self.mv(from, to)
|
@@ -59,7 +57,7 @@ module EM
|
|
59
57
|
# Removes object using +rm -r+ command.
|
60
58
|
#
|
61
59
|
# @param [String] path path to file
|
62
|
-
# @return [CommandBuilder]
|
60
|
+
# @return [CommandBuilder] the command builder object
|
63
61
|
#
|
64
62
|
|
65
63
|
def self.rm(path)
|
@@ -73,7 +71,7 @@ module EM
|
|
73
71
|
# Touches file using +touch+ command.
|
74
72
|
#
|
75
73
|
# @param [String] path to the file
|
76
|
-
# @return [CommandBuilder]
|
74
|
+
# @return [CommandBuilder] the command builder object
|
77
75
|
#
|
78
76
|
|
79
77
|
def self.touch(path)
|
@@ -81,6 +79,20 @@ module EM
|
|
81
79
|
cmd << path
|
82
80
|
cmd
|
83
81
|
end
|
82
|
+
|
83
|
+
##
|
84
|
+
# Creates directory using +mkdir -p+ command.
|
85
|
+
#
|
86
|
+
# @param [String] directory path
|
87
|
+
# @return [CommandBuilder] the command builder object
|
88
|
+
#
|
89
|
+
|
90
|
+
def self.mkdir(path)
|
91
|
+
cmd = __get(:mkdir)
|
92
|
+
cmd << :p
|
93
|
+
cmd << path
|
94
|
+
cmd
|
95
|
+
end
|
84
96
|
|
85
97
|
|
86
98
|
private
|
@@ -92,7 +104,7 @@ module EM
|
|
92
104
|
def self.__get(command)
|
93
105
|
command = command.to_sym
|
94
106
|
|
95
|
-
if
|
107
|
+
if @@cache.include? command
|
96
108
|
command = @@cache[command]
|
97
109
|
command.reset! # returns
|
98
110
|
else
|
@@ -102,4 +114,3 @@ module EM
|
|
102
114
|
|
103
115
|
end
|
104
116
|
end
|
105
|
-
|
metadata
CHANGED
@@ -1,121 +1,129 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-file-utils
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 1.0.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.1
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
-
|
6
|
+
authors:
|
7
|
+
- Martin Poljak
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2015-07-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
16
14
|
name: hash-utils
|
17
|
-
requirement:
|
18
|
-
|
19
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
20
17
|
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
18
|
+
- !ruby/object:Gem::Version
|
22
19
|
version: 0.8.0
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
27
28
|
name: command-builder
|
28
|
-
requirement:
|
29
|
-
|
30
|
-
requirements:
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
31
|
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 0.2.
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
38
42
|
name: bundler
|
39
|
-
requirement:
|
40
|
-
|
41
|
-
requirements:
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
42
45
|
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
46
|
+
- !ruby/object:Gem::Version
|
44
47
|
version: 1.0.0
|
45
48
|
type: :development
|
46
49
|
prerelease: false
|
47
|
-
version_requirements:
|
48
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
49
56
|
name: jeweler
|
50
|
-
requirement:
|
51
|
-
|
52
|
-
requirements:
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
53
59
|
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
60
|
+
- !ruby/object:Gem::Version
|
55
61
|
version: 1.5.2
|
56
62
|
type: :development
|
57
63
|
prerelease: false
|
58
|
-
version_requirements:
|
59
|
-
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.5.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
60
70
|
name: riot
|
61
|
-
requirement:
|
62
|
-
|
63
|
-
requirements:
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
64
73
|
- - ">="
|
65
|
-
- !ruby/object:Gem::Version
|
74
|
+
- !ruby/object:Gem::Version
|
66
75
|
version: 0.12.3
|
67
76
|
type: :development
|
68
77
|
prerelease: false
|
69
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.12.3
|
70
83
|
description:
|
71
|
-
email:
|
84
|
+
email: martin@poljak.cz
|
72
85
|
executables: []
|
73
|
-
|
74
86
|
extensions: []
|
75
|
-
|
76
|
-
extra_rdoc_files:
|
87
|
+
extra_rdoc_files:
|
77
88
|
- LICENSE.txt
|
78
89
|
- README.md
|
79
|
-
files:
|
80
|
-
- .document
|
90
|
+
files:
|
91
|
+
- ".document"
|
81
92
|
- Gemfile
|
82
93
|
- Gemfile.lock
|
83
94
|
- LICENSE.txt
|
84
95
|
- README.md
|
85
96
|
- Rakefile
|
86
97
|
- VERSION
|
98
|
+
- em-file-utils.gemspec
|
87
99
|
- lib/em-file-utils.rb
|
88
100
|
- test
|
89
101
|
- test-em
|
90
102
|
homepage: http://github.com/martinkozak/em-file-utils
|
91
|
-
licenses:
|
103
|
+
licenses:
|
92
104
|
- MIT
|
105
|
+
metadata: {}
|
93
106
|
post_install_message:
|
94
107
|
rdoc_options: []
|
95
|
-
|
96
|
-
require_paths:
|
108
|
+
require_paths:
|
97
109
|
- lib
|
98
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
-
|
100
|
-
requirements:
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
101
112
|
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
version: "0"
|
107
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
|
-
requirements:
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
110
117
|
- - ">="
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version:
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
113
120
|
requirements: []
|
114
|
-
|
115
121
|
rubyforge_project:
|
116
|
-
rubygems_version:
|
122
|
+
rubygems_version: 2.4.5
|
117
123
|
signing_key:
|
118
|
-
specification_version:
|
119
|
-
summary: Allows base file operations using UNIX commands such as standard library
|
124
|
+
specification_version: 4
|
125
|
+
summary: Allows base file operations using UNIX commands such as standard library
|
126
|
+
FileUtils, but returns CommandBuilder objects which allows wide customizations to
|
127
|
+
final call and asynchronous evented EventMachine interface support (although it
|
128
|
+
isn't required). UNIX/Linux based systems only supported.
|
120
129
|
test_files: []
|
121
|
-
|