clutil 2011.138.0 → 2014.304.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,92 +1,68 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: clutil
3
- version: !ruby/object:Gem::Version
4
- hash: 15599
3
+ version: !ruby/object:Gem::Version
4
+ version: 2014.304.0
5
5
  prerelease:
6
- segments:
7
- - 2011
8
- - 138
9
- - 0
10
- version: 2011.138.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - chrismo
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-05-19 00:00:00 Z
19
- dependencies: []
20
-
21
- description: a mish-mash of spare utility libs for Ruby. All BSD license.
22
- email:
12
+ date: 2014-10-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: a mish-mash of spare utility libs for Ruby.
31
+ email:
23
32
  - chrismo@clabs.org
24
33
  executables: []
25
-
26
34
  extensions: []
27
-
28
35
  extra_rdoc_files: []
29
-
30
- files:
31
- - cl/util/clqsend.rb
32
- - cl/util/console.rb
33
- - cl/util/cvs.maint.rb
34
- - cl/util/decide.rb
35
- - cl/util/dirsize.rb
36
- - cl/util/file.rb
37
- - cl/util/install.rb
38
- - cl/util/install.util.rb
39
- - cl/util/net.rb
40
- - cl/util/progress.rb
41
- - cl/util/smtp.rb
42
- - cl/util/string.rb
43
- - cl/util/test.rb
44
- - cl/util/time.rb
45
- - cl/util/win.rb
46
- - cl/util/doc/License
47
- - cl/util/doc/Readme
48
- - cl/util/test/dirsizetest.rb
49
- - cl/util/test/filetest.rb
50
- - cl/util/test/installtest.rb
51
- - cl/util/test/progresstest.rb
52
- - cl/util/test/stringtest.rb
53
- - cl/util/test/wintest.rb
36
+ files: []
54
37
  homepage: http://clabs.org/ruby.htm
55
- licenses: []
56
-
38
+ licenses:
39
+ - MIT
57
40
  post_install_message:
58
41
  rdoc_options: []
59
-
60
- require_paths:
61
- - ""
62
- required_ruby_version: !ruby/object:Gem::Requirement
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
63
45
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- hash: 57
68
- segments:
69
- - 1
70
- - 8
71
- - 7
72
- version: 1.8.7
73
- required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ segments:
51
+ - 0
52
+ hash: 193850118184005195
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
54
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- hash: 23
79
- segments:
80
- - 1
81
- - 3
82
- - 6
83
- version: 1.3.6
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ segments:
60
+ - 0
61
+ hash: 193850118184005195
84
62
  requirements: []
85
-
86
- rubyforge_project: scrapware
87
- rubygems_version: 1.8.2
63
+ rubyforge_project:
64
+ rubygems_version: 1.8.23.2
88
65
  signing_key:
89
66
  specification_version: 3
90
67
  summary: cLabs Ruby Utilities
91
68
  test_files: []
92
-
data/cl/util/clqsend.rb DELETED
@@ -1,86 +0,0 @@
1
- # $Id: clqsend.rb,v 1.1 2002/04/18 13:44:38 chrismo Exp $
2
- =begin
3
- --------------------------------------------------------------------------
4
- Copyright (c) 2001-2002, Chris Morris
5
- All rights reserved.
6
-
7
- Redistribution and use in source and binary forms, with or without modification,
8
- are permitted provided that the following conditions are met:
9
-
10
- 1. Redistributions of source code must retain the above copyright notice, this
11
- list of conditions and the following disclaimer.
12
-
13
- 2. Redistributions in binary form must reproduce the above copyright notice,
14
- this list of conditions and the following disclaimer in the documentation and/or
15
- other materials provided with the distribution.
16
-
17
- 3. Neither the names Chris Morris, cLabs nor the names of contributors to this
18
- software may be used to endorse or promote products derived from this software
19
- without specific prior written permission.
20
-
21
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
22
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
25
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
29
- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- --------------------------------------------------------------------------------
32
- =end
33
- require 'cl/util/smtp'
34
-
35
- def getSwitch(switch)
36
- i = ARGV.index(switch)
37
- if i != nil
38
- ARGV[i + 1]
39
- else
40
- nil
41
- end
42
- end
43
-
44
- def showhelp
45
- puts '-h Help'
46
- puts '-t To'
47
- puts '-f From'
48
- puts '-bf file name of body'
49
- puts '-s Subject'
50
- puts '-i SMTP ip address or server name'
51
- end
52
-
53
- if ARGV.include?('-h')
54
- showhelp
55
- else
56
- to = getSwitch('-t')
57
- subj = getSwitch('-s')
58
- from = getSwitch('-f')
59
- bodyfn = getSwitch('-bf')
60
- smtpsrv = getSwitch('-i')
61
- params = {
62
- :from.to_s => from,
63
- :to.to_s => to,
64
- :subj.to_s => subj,
65
- :bodyfn.to_s => bodyfn,
66
- :smtpsrv.to_s => smtpsrv
67
- }
68
- anymissing = false
69
- params.each do |key, value|
70
- if value == nil
71
- puts 'missing param <' + key + '>'
72
- anymissing = true
73
- end
74
- end
75
-
76
- body = File.readlines(bodyfn).join
77
-
78
- if !anymissing
79
- puts "sending To:#{to} From:#{from} Subj:#{subj}"
80
- puts body
81
- sendmail(to, from, subj, body, smtpsrv)
82
- else
83
- puts
84
- showhelp
85
- end
86
- end
data/cl/util/console.rb DELETED
@@ -1,60 +0,0 @@
1
- # $Id: console.rb,v 1.4 2002/10/15 21:00:58 chrismo Exp $
2
- =begin
3
- --------------------------------------------------------------------------
4
- Copyright (c) 2001-2002, Chris Morris
5
- All rights reserved.
6
-
7
- Redistribution and use in source and binary forms, with or without modification,
8
- are permitted provided that the following conditions are met:
9
-
10
- 1. Redistributions of source code must retain the above copyright notice, this
11
- list of conditions and the following disclaimer.
12
-
13
- 2. Redistributions in binary form must reproduce the above copyright notice,
14
- this list of conditions and the following disclaimer in the documentation and/or
15
- other materials provided with the distribution.
16
-
17
- 3. Neither the names Chris Morris, cLabs nor the names of contributors to this
18
- software may be used to endorse or promote products derived from this software
19
- without specific prior written permission.
20
-
21
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
22
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
25
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
29
- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
- --------------------------------------------------------------------------------
32
- =end
33
-
34
- def ifSwitch(switch)
35
- ARGV.index(switch) != nil
36
- end
37
-
38
- alias :if_switch :ifSwitch
39
-
40
- def getSwitch(switch)
41
- value = nil
42
- i = ARGV.index(switch)
43
- value = ARGV[i + 1] if i != nil
44
- end
45
-
46
- alias :get_switch :getSwitch
47
-
48
- def yn_prompt(text, &blk)
49
- custom_prompt(text + '? (Y/[N]):', /y/i, @yesToAll, &blk)
50
- end
51
-
52
- def custom_prompt(text, execReply=/y/i, autoYield=false)
53
- if !autoYield
54
- print text
55
- reply = $stdin.gets.chomp
56
- else
57
- puts text
58
- end
59
- yield reply if reply =~ execReply || autoYield
60
- end
data/cl/util/cvs.maint.rb DELETED
@@ -1,41 +0,0 @@
1
- require 'sn/util/smtp'
2
-
3
- # the commit command will add new folders. then 2nd time this is run
4
- # files in that folder will be addressed.
5
-
6
- $output = ''
7
-
8
- def do_puts(text)
9
- $output << text << "\n"
10
- puts text
11
- end
12
-
13
- def execute
14
- begin
15
- cvscmd = "..\\..\\cvs\\wincvs\\cvs.exe"
16
- r = `#{cvscmd} -n up`; do_puts r
17
- a = r.split("\n"); do_puts a.inspect
18
- a.collect! { |item| item.slice(2..item.length) if item[0..0] == "?" }; do_puts a.inspect
19
- a.compact!; do_puts a.inspect
20
- outstanding_files = (a.length > 0)
21
- if outstanding_files
22
- cmd = "#{cvscmd} add " + a.join(" "); do_puts cmd
23
- r = `#{cmd}`; do_puts r
24
- raise 'cmd returned error' if $? != 0
25
- end
26
- cmd = "#{cvscmd} commit -F cvs.log.txt"; do_puts cmd
27
- r = `#{cmd}`; do_puts r
28
- raise 'cmd returned error' if $? != 0
29
- end while outstanding_files
30
- end
31
-
32
- to = 'chris.morris@snelling.com'
33
- from = to
34
- subj = 'Wiki Cvs Update'
35
- begin
36
- execute
37
- sendmail(to, from, subj, $output)
38
- rescue Exception => e
39
- body = $output << "\n" << e.message << "\n" << e.backtrace.join("\n")
40
- sendmail(to, from, subj + ' ERROR', body)
41
- end
data/cl/util/decide.rb DELETED
@@ -1,69 +0,0 @@
1
- class Integer
2
- def odd?
3
- self.divmod(2)[1] != 0
4
- end
5
- end
6
-
7
- def decide(items)
8
- round = 1
9
- while items.length > 1
10
- items.sort! { rand(3) - 1 }
11
-
12
- pairs = []
13
- gate = 0
14
- items.each { |item|
15
- pairs << [item] if gate == 0
16
- pairs[-1] << item if gate == 1
17
- gate = gate ^ 1
18
- }
19
-
20
- puts "=" * 20
21
- puts "Round #{round} :: #{pairs.length} pairs".center(20)
22
- puts "=" * 20
23
-
24
- pairs.each do |pair|
25
- begin
26
- puts "1) #{pair[0]}"
27
- puts "2) #{pair[1]}"
28
- print "keep: "
29
- keeper = gets.chomp
30
- end while keeper !~ /[12]/
31
- delete = (keeper.to_i - 1) ^ 1
32
- items.delete(pair[delete])
33
- end
34
- round += 1
35
- end
36
-
37
- puts "Winner is: #{items[0]}"
38
- end
39
-
40
- if __FILE__ == $0
41
- def do_test
42
- puts "Odd number item list test"
43
- items = ["a", "b", "c", "d", "e"]
44
- decide(items)
45
-
46
- puts "Even number item list test"
47
- items = ["a", "b", "c", "d"]
48
- decide(items)
49
- end
50
-
51
- list_fn = ARGV[0]
52
- ARGV.clear
53
-
54
- if list_fn =~ /test/i
55
- do_test
56
- exit
57
- end
58
-
59
- if list_fn.nil? || !File.exists?(list_fn)
60
- puts "Usage: #{File.basename(__FILE__)} [list_filename]"
61
- exit
62
- end
63
-
64
- items = File.readlines(list_fn)
65
- items.delete_if { |item| item.chomp.empty? }
66
- items.compact!
67
- decide(items)
68
- end
69
-
data/cl/util/dirsize.rb DELETED
@@ -1,144 +0,0 @@
1
- =begin
2
- --------------------------------------------------------------------------
3
- Copyright (c) 2001, Chris Morris
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without modification,
7
- are permitted provided that the following conditions are met:
8
-
9
- 1. Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- 2. Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation and/or
14
- other materials provided with the distribution.
15
-
16
- 3. Neither the names Chris Morris, cLabs nor the names of contributors to this
17
- software may be used to endorse or promote products derived from this software
18
- without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
21
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
24
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
28
- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
- --------------------------------------------------------------------------------
31
- =end
32
-
33
- =begin
34
- uses Classes;
35
-
36
- type
37
- { future, make a cache/factory object for TDirSizes, so we don't have to
38
- recalc dirs we've already sized }
39
-
40
- TDirSize = class(TObject)
41
- private
42
- @diskSpace: Int64;
43
- @fileCount: integer;
44
- @fileSize: Int64;
45
- FClusterSize: Int64;
46
- FDirectory: string;
47
- FParent: TDirSize;
48
-
49
- FChildDirs: TList;
50
- public
51
- constructor Create;
52
- destructor Destroy; override;
53
-
54
- function AvgFileSize(IncludeSubs: boolean): Int64;
55
- function DiskSpace(IncludeSubs: boolean): Int64;
56
- function FileCount(IncludeSubs: boolean): integer;
57
- function FileSize(IncludeSubs: boolean): Int64;
58
- procedure GetSize;
59
- function UnusedDiskSpace(IncludeSubs: boolean): Int64;
60
-
61
- property ChildDirs: TList read FChildDirs;
62
- property ClusterSize: Int64 read FClusterSize write FClusterSize;
63
- property Directory: string read FDirectory write FDirectory;
64
- property Parent: TDirSize read FParent;
65
- end
66
- =end
67
-
68
- class DirSize
69
- attr_reader :childDirs, :exception
70
- attr_accessor :clusterSize, :directory, :parent
71
-
72
- def avgFileSize(includeSubs=false)
73
- aFileCount = fileCount(includeSubs)
74
- if aFileCount != 0
75
- fileSize(includeSubs) / aFileCount
76
- else
77
- 0
78
- end
79
- end
80
-
81
- def initialize
82
- @childDirs = []
83
- @fileSize = 0
84
- @diskSpace = 0
85
- @fileCount = 0
86
- end
87
-
88
- def diskSpace(includeSubs=false)
89
- total = 0
90
- @childDirs.each do |adir|
91
- total += adir.diskSpace(includeSubs)
92
- end if includeSubs
93
- total + @diskSpace
94
- end
95
-
96
- def fileCount(includeSubs=false)
97
- result = @fileCount
98
- @childDirs.each do |adir|
99
- result += adir.fileCount(includeSubs)
100
- end if includeSubs
101
- result
102
- end
103
-
104
- def fileSize(includeSubs=false)
105
- total = 0
106
- @childDirs.each do |adir|
107
- total += adir.fileSize(includeSubs)
108
- end if includeSubs
109
- total + @fileSize
110
- end
111
-
112
- def getSize(&block)
113
- @fileSize = 0
114
- @diskSpace = 0
115
- @fileCount = 0
116
- begin
117
- Dir.foreach(@directory) do |entry|
118
- if (entry != '.') && (entry != '..')
119
- entry = File.join(@directory, entry)
120
- if (File.directory?(entry))
121
- childDirSize = DirSize.new
122
- childDirSize.parent = self
123
- childDirSize.directory = entry
124
- childDirSize.clusterSize = @clusterSize
125
- childDirSize.getSize(&block)
126
- @childDirs << childDirSize
127
- else
128
- if !block_given? || yield(entry)
129
- @fileCount += 1
130
- @fileSize += File.size(entry)
131
- @diskSpace += ((@fileSize / @clusterSize) * @clusterSize) + @clusterSize
132
- end
133
- end
134
- end
135
- end
136
- rescue Exception => e
137
- @exception = e
138
- end
139
- end
140
-
141
- def unusedDiskSpace(includeSubs=false)
142
- diskSpace(includeSubs) - fileSize(includeSubs)
143
- end
144
- end
data/cl/util/doc/License DELETED
@@ -1,14 +0,0 @@
1
- --------------------------------------------------------------------------------
2
- Copyright (c) 2001-2010, Chris Morris
3
- All rights reserved.
4
-
5
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6
-
7
- 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8
-
9
- 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
-
11
- 3. Neither the names Chris Morris, cLabs nor the names of contributors to this software may be used to endorse or promote products derived from this software without specific prior written permission.
12
-
13
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
- --------------------------------------------------------------------------------
data/cl/util/doc/Readme DELETED
@@ -1,22 +0,0 @@
1
- =cLabs Ruby Utilities
2
-
3
- Home Page:: http://clabs.org/ruby.htm
4
-
5
- ===Overview
6
-
7
- A set of miscellaneous utilities for Ruby.
8
-
9
- ===License
10
-
11
- Copyright (c) 2001-2010, Chris Morris (mailto:chrismo@clabs.com). BSD license.
12
-
13
- ===Usage
14
-
15
- RDoc docs in future versions. For now, browse the code and unit tests.
16
-
17
- ===Change Log
18
-
19
- * [hrm - probably out of date]
20
- * win.rb: system_return_exitcode added, since the system cmd with a
21
- ruby.exe built with MSVC does not set $?
22
- * version.rb: execute the file itself to get template code in stdout