rubysl-un 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a1d8f30af87c8d726d778c0ad1aa5a5172d01bf1
4
+ data.tar.gz: e87674b7aaa08fd03c0267bd5567d1552b168fa4
5
+ SHA512:
6
+ metadata.gz: 5534520eb4d83e57552b7159f3a10edf6ed167c013c3b596060ff0aee85c7a66503c81f40130766a8f117db08cd79e8e078ab628bf61d7b9f9e2fca9c831a8f1
7
+ data.tar.gz: 715b720be472c5c1270e9de4301f01628d0d5ff90aa65ab0c721a2ea98d2288743b7d553b4c018b9f314cd5001093ae200fddc11233c9da898d7cda4fee8a57e
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem update --system
4
+ - gem --version
5
+ - gem install rubysl-bundler
6
+ script: bundle exec mspec spec
7
+ rvm:
8
+ - rbx-nightly-18mode
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rubysl-un.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2013, Brian Shirai
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ 3. Neither the name of the library nor the names of its contributors may be
13
+ used to endorse or promote products derived from this software without
14
+ specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT,
20
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
25
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,29 @@
1
+ # Rubysl::Un
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'rubysl-un'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install rubysl-un
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,2 @@
1
+ require "rubysl/un/un"
2
+ require "rubysl/un/version"
@@ -0,0 +1,235 @@
1
+ #
2
+ # = un.rb
3
+ #
4
+ # Copyright (c) 2003 WATANABE Hirofumi <eban@ruby-lang.org>
5
+ #
6
+ # This program is free software.
7
+ # You can distribute/modify this program under the same terms of Ruby.
8
+ #
9
+ # == Utilities to replace common UNIX commands in Makefiles etc
10
+ #
11
+ # == SYNOPSIS
12
+ #
13
+ # ruby -run -e cp -- [OPTION] SOURCE DEST
14
+ # ruby -run -e ln -- [OPTION] TARGET LINK_NAME
15
+ # ruby -run -e mv -- [OPTION] SOURCE DEST
16
+ # ruby -run -e rm -- [OPTION] FILE
17
+ # ruby -run -e mkdir -- [OPTION] DIRS
18
+ # ruby -run -e rmdir -- [OPTION] DIRS
19
+ # ruby -run -e install -- [OPTION] SOURCE DEST
20
+ # ruby -run -e chmod -- [OPTION] OCTAL-MODE FILE
21
+ # ruby -run -e touch -- [OPTION] FILE
22
+ # ruby -run -e help [COMMAND]
23
+
24
+ require "fileutils"
25
+ require "optparse"
26
+
27
+ module FileUtils
28
+ # @fileutils_label = ""
29
+ @fileutils_output = $stdout
30
+ end
31
+
32
+ def setup(options = "")
33
+ ARGV.map! do |x|
34
+ case x
35
+ when /^-/
36
+ x.delete "^-#{options}v"
37
+ when /[*?\[{]/
38
+ Dir[x]
39
+ else
40
+ x
41
+ end
42
+ end
43
+ ARGV.flatten!
44
+ ARGV.delete_if{|x| x == "-"}
45
+ opt_hash = {}
46
+ OptionParser.new do |o|
47
+ options.scan(/.:?/) do |s|
48
+ o.on("-" + s.tr(":", " ")) do |val|
49
+ opt_hash[s.delete(":").intern] = val
50
+ end
51
+ end
52
+ o.on("-v") do opt_hash[:verbose] = true end
53
+ o.parse!
54
+ end
55
+ yield ARGV, opt_hash
56
+ end
57
+
58
+ ##
59
+ # Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY
60
+ #
61
+ # ruby -run -e cp -- [OPTION] SOURCE DEST
62
+ #
63
+ # -p preserve file attributes if possible
64
+ # -r copy recursively
65
+ # -v verbose
66
+ #
67
+
68
+ def cp
69
+ setup("pr") do |argv, options|
70
+ cmd = "cp"
71
+ cmd += "_r" if options.delete :r
72
+ options[:preserve] = true if options.delete :p
73
+ dest = argv.pop
74
+ argv = argv[0] if argv.size == 1
75
+ FileUtils.send cmd, argv, dest, options
76
+ end
77
+ end
78
+
79
+ ##
80
+ # Create a link to the specified TARGET with LINK_NAME.
81
+ #
82
+ # ruby -run -e ln -- [OPTION] TARGET LINK_NAME
83
+ #
84
+ # -s make symbolic links instead of hard links
85
+ # -f remove existing destination files
86
+ # -v verbose
87
+ #
88
+
89
+ def ln
90
+ setup("sf") do |argv, options|
91
+ cmd = "ln"
92
+ cmd += "_s" if options.delete :s
93
+ options[:force] = true if options.delete :f
94
+ dest = argv.pop
95
+ argv = argv[0] if argv.size == 1
96
+ FileUtils.send cmd, argv, dest, options
97
+ end
98
+ end
99
+
100
+ ##
101
+ # Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
102
+ #
103
+ # ruby -run -e mv -- [OPTION] SOURCE DEST
104
+ #
105
+ # -v verbose
106
+ #
107
+
108
+ def mv
109
+ setup do |argv, options|
110
+ dest = argv.pop
111
+ argv = argv[0] if argv.size == 1
112
+ FileUtils.mv argv, dest, options
113
+ end
114
+ end
115
+
116
+ ##
117
+ # Remove the FILE
118
+ #
119
+ # ruby -run -e rm -- [OPTION] FILE
120
+ #
121
+ # -f ignore nonexistent files
122
+ # -r remove the contents of directories recursively
123
+ # -v verbose
124
+ #
125
+
126
+ def rm
127
+ setup("fr") do |argv, options|
128
+ cmd = "rm"
129
+ cmd += "_r" if options.delete :r
130
+ options[:force] = true if options.delete :f
131
+ FileUtils.send cmd, argv, options
132
+ end
133
+ end
134
+
135
+ ##
136
+ # Create the DIR, if they do not already exist.
137
+ #
138
+ # ruby -run -e mkdir -- [OPTION] DIR
139
+ #
140
+ # -p no error if existing, make parent directories as needed
141
+ # -v verbose
142
+ #
143
+
144
+ def mkdir
145
+ setup("p") do |argv, options|
146
+ cmd = "mkdir"
147
+ cmd += "_p" if options.delete :p
148
+ FileUtils.send cmd, argv, options
149
+ end
150
+ end
151
+
152
+ ##
153
+ # Remove the DIR.
154
+ #
155
+ # ruby -run -e rmdir -- [OPTION] DIR
156
+ #
157
+ # -v verbose
158
+ #
159
+
160
+ def rmdir
161
+ setup do |argv, options|
162
+ FileUtils.rmdir argv, options
163
+ end
164
+ end
165
+
166
+ ##
167
+ # Copy SOURCE to DEST.
168
+ #
169
+ # ruby -run -e install -- [OPTION] SOURCE DEST
170
+ #
171
+ # -p apply access/modification times of SOURCE files to
172
+ # corresponding destination files
173
+ # -m set permission mode (as in chmod), instead of 0755
174
+ # -v verbose
175
+ #
176
+
177
+ def install
178
+ setup("pm:") do |argv, options|
179
+ options[:mode] = (mode = options.delete :m) ? mode.oct : 0755
180
+ options[:preserve] = true if options.delete :p
181
+ dest = argv.pop
182
+ argv = argv[0] if argv.size == 1
183
+ FileUtils.install argv, dest, options
184
+ end
185
+ end
186
+
187
+ ##
188
+ # Change the mode of each FILE to OCTAL-MODE.
189
+ #
190
+ # ruby -run -e chmod -- [OPTION] OCTAL-MODE FILE
191
+ #
192
+ # -v verbose
193
+ #
194
+
195
+ def chmod
196
+ setup do |argv, options|
197
+ mode = argv.shift.oct
198
+ FileUtils.chmod mode, argv, options
199
+ end
200
+ end
201
+
202
+ ##
203
+ # Update the access and modification times of each FILE to the current time.
204
+ #
205
+ # ruby -run -e touch -- [OPTION] FILE
206
+ #
207
+ # -v verbose
208
+ #
209
+
210
+ def touch
211
+ setup do |argv, options|
212
+ FileUtils.touch argv, options
213
+ end
214
+ end
215
+
216
+ ##
217
+ # Display help message.
218
+ #
219
+ # ruby -run -e help [COMMAND]
220
+ #
221
+
222
+ def help
223
+ setup do |argv,|
224
+ all = argv.empty?
225
+ open(__FILE__) do |me|
226
+ while me.gets("##\n")
227
+ if help = me.gets("\n\n")
228
+ if all or argv.delete help[/-e \w+/].sub(/-e /, "")
229
+ print help.gsub(/^# ?/, "")
230
+ end
231
+ end
232
+ end
233
+ end
234
+ end
235
+ end
@@ -0,0 +1,5 @@
1
+ module RubySL
2
+ module Un
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require "rubysl/un"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ require './lib/rubysl/un/version'
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = "rubysl-un"
6
+ spec.version = RubySL::Un::VERSION
7
+ spec.authors = ["Brian Shirai"]
8
+ spec.email = ["brixen@gmail.com"]
9
+ spec.description = %q{Ruby standard library un.}
10
+ spec.summary = %q{Ruby standard library un.}
11
+ spec.homepage = "https://github.com/rubysl/rubysl-un"
12
+ spec.license = "BSD"
13
+
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_runtime_dependency "rubysl-fileutils", "~> 1.0"
20
+ spec.add_runtime_dependency "rubysl-optparse", "~> 1.0"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "mspec", "~> 1.5"
25
+ spec.add_development_dependency "rubysl-prettyprint", "~> 1.0"
26
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubysl-un
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brian Shirai
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubysl-fileutils
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubysl-optparse
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: mspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '1.5'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '1.5'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubysl-prettyprint
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ description: Ruby standard library un.
98
+ email:
99
+ - brixen@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - .gitignore
105
+ - .travis.yml
106
+ - Gemfile
107
+ - LICENSE
108
+ - README.md
109
+ - Rakefile
110
+ - lib/rubysl/un.rb
111
+ - lib/rubysl/un/un.rb
112
+ - lib/rubysl/un/version.rb
113
+ - lib/un.rb
114
+ - rubysl-un.gemspec
115
+ homepage: https://github.com/rubysl/rubysl-un
116
+ licenses:
117
+ - BSD
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.0.7
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: Ruby standard library un.
139
+ test_files: []