benry-unixcmd 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +207 -122
- data/benry-unixcmd.gemspec +25 -44
- data/doc/benry-unixcmd.html +894 -0
- data/doc/css/style.css +168 -0
- data/lib/benry/unixcmd.rb +3 -3
- data/test/run_all.rb +2 -2
- data/test/unixcmd_test.rb +6 -6
- metadata +9 -30
- data/Rakefile.rb +0 -113
data/doc/css/style.css
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
|
3
|
+
body {
|
4
|
+
font-family: "Helvetica Neue",Arial,"Hiragino Kaku Gothic ProN","Hiragino Sans",Meiryo,sans-serif;
|
5
|
+
color: #333;
|
6
|
+
line-height: 1.42857143;
|
7
|
+
background: #eef0f6;
|
8
|
+
margin-top: 0;
|
9
|
+
}
|
10
|
+
main {
|
11
|
+
max-width: 830px;
|
12
|
+
margin: 0 auto;
|
13
|
+
font-size: 16px;
|
14
|
+
color: #999;
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
h1 {
|
19
|
+
text-align: center;
|
20
|
+
margin: 0 0 30px 0;
|
21
|
+
padding: 50px 0 30px 0;
|
22
|
+
background: #39c;
|
23
|
+
color: #fff;
|
24
|
+
font-weight: normal;
|
25
|
+
font-size: 280%;
|
26
|
+
border-radius: 0 0 10px 10px;
|
27
|
+
}
|
28
|
+
h2 {
|
29
|
+
border: solid 0px #39c;
|
30
|
+
border-width: 0 0 0 15px;
|
31
|
+
padding: 20px 0 10px 15px;
|
32
|
+
font-size: 200%;
|
33
|
+
font-weight: normal;
|
34
|
+
color: #39c;
|
35
|
+
margin: 0 0 20px 0;
|
36
|
+
}
|
37
|
+
h3 {
|
38
|
+
color: #39c;
|
39
|
+
margin-top: 30px;
|
40
|
+
font-size: 180%;
|
41
|
+
font-weight: normal;
|
42
|
+
}
|
43
|
+
h2 > code, h3 > code {
|
44
|
+
color: #39c;
|
45
|
+
font-weight: bold;
|
46
|
+
}
|
47
|
+
|
48
|
+
|
49
|
+
section.section {
|
50
|
+
background: #fff;
|
51
|
+
border-radius: 10px;
|
52
|
+
padding: 30px 15px 30px 15px;
|
53
|
+
color: #333;
|
54
|
+
margin: 30px 0 30px 0;
|
55
|
+
}
|
56
|
+
section.subsection {
|
57
|
+
margin-top: 60px;
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
pre, code, kbd, var, samp {
|
62
|
+
font-family: 'Courier New',Courier,Menlo,Monaco,Consolas,Meiryo,monospace,monospace;
|
63
|
+
}
|
64
|
+
pre {
|
65
|
+
border: solid 1px #ddd;
|
66
|
+
border-radius: 4px;
|
67
|
+
background: #eee;
|
68
|
+
Xbackground: #f6f6f6;
|
69
|
+
padding: 5px 10px;
|
70
|
+
color: #444;
|
71
|
+
word-break: break-all;
|
72
|
+
}
|
73
|
+
pre > strong {
|
74
|
+
font-weight: bold;
|
75
|
+
color: #900;
|
76
|
+
}
|
77
|
+
pre.language-terminal {
|
78
|
+
background: #333;
|
79
|
+
color: #fff;
|
80
|
+
border-color: #000;
|
81
|
+
}
|
82
|
+
pre.language-terminal > strong {
|
83
|
+
color: #f66;
|
84
|
+
}
|
85
|
+
code {
|
86
|
+
border: solid 1px #e9e9e9;
|
87
|
+
border-radius: 2px;
|
88
|
+
background: #f6f6f6;
|
89
|
+
padding: 1px 3px;
|
90
|
+
color: #444;
|
91
|
+
}
|
92
|
+
h2 > code, h3 > code {
|
93
|
+
border: none;
|
94
|
+
background-color: transparent;
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
dt.bold {
|
99
|
+
font-weight: bold;
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
/**
|
104
|
+
nav.nav {
|
105
|
+
}
|
106
|
+
ul.nav {
|
107
|
+
padding: 0;
|
108
|
+
border: solid 1px #39c;
|
109
|
+
border-width: 0 0 6px 0;
|
110
|
+
}
|
111
|
+
li.nav {
|
112
|
+
display: inline-block;
|
113
|
+
margin-left: 10px;
|
114
|
+
padding: 5px 30px;
|
115
|
+
font-size: large;
|
116
|
+
Xfont-weight: bold;
|
117
|
+
background: #fff;
|
118
|
+
border-radius: 5px 5px 0 0;
|
119
|
+
border: solid 1px #39c;
|
120
|
+
border-width: 1px 1px 0 1px;
|
121
|
+
}
|
122
|
+
li.nav > a {
|
123
|
+
color: #39c;
|
124
|
+
text-decoration: none;
|
125
|
+
}
|
126
|
+
li.nav > a:hover {
|
127
|
+
text-decoration: underline;
|
128
|
+
}
|
129
|
+
li.nav.curr {
|
130
|
+
background: #39c;
|
131
|
+
}
|
132
|
+
li.nav.curr > a {
|
133
|
+
color: #fff;
|
134
|
+
}
|
135
|
+
**/
|
136
|
+
nav.nav {
|
137
|
+
text-align: center;
|
138
|
+
}
|
139
|
+
ul.nav {
|
140
|
+
padding-left: 0;
|
141
|
+
display: inline-block;
|
142
|
+
margin: 0;
|
143
|
+
font-size: 0;
|
144
|
+
}
|
145
|
+
li.nav {
|
146
|
+
display: inline-block;
|
147
|
+
padding: 0 20px;
|
148
|
+
border: solid #39c;
|
149
|
+
border-width: 0 0 0 1px;
|
150
|
+
margin: 0;
|
151
|
+
background: #eef0f6;
|
152
|
+
}
|
153
|
+
li.nav:first-child {
|
154
|
+
border-width: 0 0 0 0;
|
155
|
+
}
|
156
|
+
li.nav > a {
|
157
|
+
font-size: large;
|
158
|
+
text-decoration: none;
|
159
|
+
color: #39c;
|
160
|
+
margin: 0;
|
161
|
+
}
|
162
|
+
li.nav > a:hover {
|
163
|
+
text-decoration: underline;
|
164
|
+
}
|
165
|
+
li.nav.curr > a {
|
166
|
+
font-weight: bold;
|
167
|
+
text-decoration: underline;
|
168
|
+
}
|
data/lib/benry/unixcmd.rb
CHANGED
data/test/run_all.rb
CHANGED
data/test/unixcmd_test.rb
CHANGED
@@ -708,14 +708,14 @@ Oktest.scope do
|
|
708
708
|
File.utime(atime2, mtime2, "d1/bar.txt")
|
709
709
|
cp :p, "d1/bar.txt", "blabla.txt"
|
710
710
|
ok {File.atime("blabla.txt")} != atime1
|
711
|
-
ok {File.atime("blabla.txt")}
|
711
|
+
ok {File.atime("blabla.txt")} == atime2 # !!!
|
712
712
|
ok {File.mtime("blabla.txt")} != mtime1
|
713
713
|
ok {File.mtime("blabla.txt")} == mtime2 # !!!
|
714
714
|
ok {File.ctime("blabla.txt")} != ctime1
|
715
715
|
#
|
716
716
|
cp :pr, "d1", "d9"
|
717
717
|
ok {File.atime("d9/bar.txt")} != atime1
|
718
|
-
ok {File.atime("d9/bar.txt")}
|
718
|
+
ok {File.atime("d9/bar.txt")} == atime2 # !!!
|
719
719
|
ok {File.mtime("d9/bar.txt")} != mtime1
|
720
720
|
ok {File.mtime("d9/bar.txt")} == mtime2 # !!!
|
721
721
|
ok {File.ctime("d9/bar.txt")} != ctime1
|
@@ -842,14 +842,14 @@ Oktest.scope do
|
|
842
842
|
ok {File.mtime("d9/bar.txt")} != mtime1
|
843
843
|
ok {File.mtime("d9/bar.txt")} == mtime2 # !!!
|
844
844
|
ok {File.atime("d9/bar.txt")} != atime1
|
845
|
-
ok {File.atime("d9/bar.txt")}
|
845
|
+
ok {File.atime("d9/bar.txt")} == atime2 # !!!
|
846
846
|
#
|
847
847
|
cp :pr, "d1", to: "d9"
|
848
848
|
ok {File.ctime("d9/d1/bar.txt")} != ctime1
|
849
849
|
ok {File.mtime("d9/d1/bar.txt")} != mtime1
|
850
850
|
ok {File.mtime("d9/d1/bar.txt")} == mtime2 # !!!
|
851
851
|
ok {File.atime("d9/d1/bar.txt")} != atime1
|
852
|
-
ok {File.atime("d9/d1/bar.txt")}
|
852
|
+
ok {File.atime("d9/d1/bar.txt")} == atime2 # !!!
|
853
853
|
end
|
854
854
|
end
|
855
855
|
spec "[!zoun9] not keep file timestamp (mtime) if '-p' option not specified." do
|
@@ -1963,8 +1963,8 @@ Oktest.scope do
|
|
1963
1963
|
store :p, "d1/**/*.txt", to: "d9"
|
1964
1964
|
ok {File.atime("d1/d2/baz.txt")} != atime1
|
1965
1965
|
ok {File.mtime("d1/d2/baz.txt")} != mtime1
|
1966
|
-
ok {File.atime("d1/d2/baz.txt")}
|
1967
|
-
ok {File.mtime("d1/d2/baz.txt")} == mtime2
|
1966
|
+
ok {File.atime("d1/d2/baz.txt")} == atime2 # !!!
|
1967
|
+
ok {File.mtime("d1/d2/baz.txt")} == mtime2 # !!!
|
1968
1968
|
end
|
1969
1969
|
end
|
1970
1970
|
spec "[!w8oq6] creates hard links if '-l' option specified." do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: benry-unixcmd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kwatch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oktest
|
@@ -24,29 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1'
|
27
|
-
description:
|
28
|
-
Unix commnads implementation, like `fileutils.rb`.
|
29
|
-
|
30
|
-
Features compared to `fileutils.rb`:
|
31
|
-
|
32
|
-
* supports file patterns (`*`, `.`, `{}`) directly.
|
33
|
-
* provides `cp :r`, `mv :p`, `rm :rf`, ... instead of `cp_r`, `mv_p`, `rm_rf`, ...
|
34
|
-
* prints command prompt `$ ` before command echoback.
|
35
|
-
* provides `pushd` which is similar to `cd` but supports nested calls naturally.
|
36
|
-
* implements `capture2`, `capture2e`, and `capture3` which calls
|
37
|
-
`Popen3.capture2`, `Popen3.capture2`, and `Popen3.capture3` respectively.
|
38
|
-
* supports `touch -r reffile`.
|
39
|
-
* provides `sys` command which is similar to `sh` in Rake but different in details.
|
40
|
-
* provides `zip` and `unzip` commands (requires `rubyzip` gem).
|
41
|
-
* provides `store` command which copies files recursively into target directory, keeping file path.
|
42
|
-
* provides `atomic_symlink!` command which switches symlink atomically.
|
43
|
-
|
44
|
-
```
|
45
|
-
cp Dir['*.rb'], 'tmpdir' ## fileutils.rb
|
46
|
-
cp '*.rb', 'tmpdir' ## benry-unixcmd
|
47
|
-
```
|
48
|
-
|
49
|
-
Benry-unixcmd provides `cp_p` and `cp_pr` which are equivarent to `cp -p` and `cp -pr` respectively and not provided by `fileutiles.rb`.
|
27
|
+
description: "(OBSOLETE; use 'benry-unixcommand' gem instead.)"
|
50
28
|
email: kwatch@gmail.com
|
51
29
|
executables: []
|
52
30
|
extensions: []
|
@@ -55,12 +33,13 @@ files:
|
|
55
33
|
- CHANGES.md
|
56
34
|
- MIT-LICENSE
|
57
35
|
- README.md
|
58
|
-
- Rakefile.rb
|
59
36
|
- benry-unixcmd.gemspec
|
37
|
+
- doc/benry-unixcmd.html
|
38
|
+
- doc/css/style.css
|
60
39
|
- lib/benry/unixcmd.rb
|
61
40
|
- test/run_all.rb
|
62
41
|
- test/unixcmd_test.rb
|
63
|
-
homepage: https://github.
|
42
|
+
homepage: https://kwatch.github.io/benry-ruby/benry-unixcmd.html
|
64
43
|
licenses:
|
65
44
|
- MIT
|
66
45
|
metadata: {}
|
@@ -72,16 +51,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
72
51
|
requirements:
|
73
52
|
- - ">="
|
74
53
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
54
|
+
version: '2.3'
|
76
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
56
|
requirements:
|
78
57
|
- - ">="
|
79
58
|
- !ruby/object:Gem::Version
|
80
59
|
version: '0'
|
81
60
|
requirements: []
|
82
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.4.10
|
83
62
|
signing_key:
|
84
63
|
specification_version: 4
|
85
|
-
summary:
|
64
|
+
summary: "(OBSOLETE; use 'benry-unixcommand' gem instead.)"
|
86
65
|
test_files:
|
87
66
|
- test/run_all.rb
|
data/Rakefile.rb
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
project = "benry-unixcmd"
|
4
|
-
release = ENV['RELEASE'] || "0.0.0"
|
5
|
-
copyright = "copyright(c) 2021 kuwata-lab.com all rights reserved"
|
6
|
-
license = "MIT License"
|
7
|
-
|
8
|
-
target_files = Dir[*%W[
|
9
|
-
README.md CHANGES.md MIT-LICENSE Rakefile.rb
|
10
|
-
lib/**/*.rb
|
11
|
-
test/**/*_test.rb test/run_all.rb
|
12
|
-
#{project}.gemspec
|
13
|
-
]]
|
14
|
-
|
15
|
-
require 'rake/clean'
|
16
|
-
CLEAN << "build"
|
17
|
-
CLOBBER << Dir.glob("#{project}-*.gem")
|
18
|
-
|
19
|
-
begin
|
20
|
-
require './task/readme-task'
|
21
|
-
rescue LoadError => exc
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
task :default => :help
|
26
|
-
|
27
|
-
|
28
|
-
desc "show help"
|
29
|
-
task :help do
|
30
|
-
puts "rake help # help"
|
31
|
-
puts "rake test # run test"
|
32
|
-
puts "rake package RELEASE=X.X.X # create gem file"
|
33
|
-
puts "rake publish RELEASE=X.X.X # upload gem file"
|
34
|
-
puts "rake clean # remove files"
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
desc "do test"
|
39
|
-
task :test do
|
40
|
-
#sh "ruby", *Dir.glob("test/*.rb")
|
41
|
-
#sh "ruby", "test/run_all.rb"
|
42
|
-
#sh "oktest -ss test"
|
43
|
-
sh "ruby -r oktest -e 'puts RUBY_VERSION;Oktest.main' -- test -ss"
|
44
|
-
end
|
45
|
-
|
46
|
-
$ruby_versions = %w[2.4.10 2.5.8 2.6.6 2.7.1 3.0.2]
|
47
|
-
|
48
|
-
desc "do test for each Ruby version"
|
49
|
-
task :'test:all' do
|
50
|
-
vs_home = ENV['VS_HOME']
|
51
|
-
if vs_home.nil? || vs_home.empty?
|
52
|
-
fail "$VS_HOME should be set."
|
53
|
-
end
|
54
|
-
$ruby_versions.each do |ver|
|
55
|
-
puts "======== Ruby #{ver} ========"
|
56
|
-
ruby = File.join(vs_home, "ruby/#{ver}/bin/ruby")
|
57
|
-
sh "#{ruby} -r oktest -e 'puts RUBY_VERSION;Oktest.main' -- test -sp" do end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
desc "create package"
|
63
|
-
task :package do
|
64
|
-
release != "0.0.0" or
|
65
|
-
raise "specify $RELEASE"
|
66
|
-
## copy
|
67
|
-
dir = "build"
|
68
|
-
rm_rf dir if File.exist?(dir)
|
69
|
-
mkdir dir
|
70
|
-
target_files.each do |file|
|
71
|
-
dest = File.join(dir, File.dirname(file))
|
72
|
-
mkdir_p dest, :verbose=>false unless File.exist?(dest)
|
73
|
-
cp file, "#{dir}/#{file}"
|
74
|
-
end
|
75
|
-
## edit
|
76
|
-
Dir.glob("#{dir}/**/*").each do |file|
|
77
|
-
next unless File.file?(file)
|
78
|
-
File.open(file, 'rb+') do |f|
|
79
|
-
s1 = f.read()
|
80
|
-
s2 = s1
|
81
|
-
s2 = s2.gsub(/\$Release[:].*?\$/, "$"+"Release: #{release} $")
|
82
|
-
s2 = s2.gsub(/\$Copyright[:].*?\$/, "$"+"Copyright: #{copyright} $")
|
83
|
-
s2 = s2.gsub(/\$License[:].*?\$/, "$"+"License: #{license} $")
|
84
|
-
#
|
85
|
-
if s1 != s2
|
86
|
-
f.rewind()
|
87
|
-
f.truncate(0)
|
88
|
-
f.write(s2)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
## build
|
93
|
-
cd dir do
|
94
|
-
sh "gem build #{project}.gemspec"
|
95
|
-
end
|
96
|
-
mv "#{dir}/#{project}-#{release}.gem", "."
|
97
|
-
end
|
98
|
-
|
99
|
-
|
100
|
-
desc "upload gem file to rubygems.org"
|
101
|
-
task :publish do
|
102
|
-
release != "0.0.0" or
|
103
|
-
raise "specify $RELEASE"
|
104
|
-
#
|
105
|
-
gemfile = "#{project}-#{release}.gem"
|
106
|
-
print "** Are you sure to publish #{gemfile}? [y/N]: "
|
107
|
-
answer = $stdin.gets().strip()
|
108
|
-
if answer.downcase == "y"
|
109
|
-
sh "gem push #{gemfile}"
|
110
|
-
sh "git tag ruby-#{project}-#{release}"
|
111
|
-
sh "git push --tags"
|
112
|
-
end
|
113
|
-
end
|