basketcase 1.0.0 → 1.1.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.
- data.tar.gz.sig +0 -0
- data/History.txt +5 -0
- data/Manifest.txt +1 -0
- data/README.txt +6 -5
- data/bin/bc-mirror +127 -0
- data/lib/basketcase.rb +1 -1
- metadata +29 -6
- metadata.gz.sig +3 -0
data.tar.gz.sig
ADDED
Binary file
|
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
= basketcase
|
2
2
|
|
3
|
+
* http://basketcase.rubyforge.org/
|
4
|
+
* http://rubyforge.org/projects/basketcase/
|
5
|
+
* http://dogbiscuit.org/mdub/
|
6
|
+
|
7
|
+
== Description
|
8
|
+
|
3
9
|
BasketCase is a (Ruby) script that encapsulates the Rational ClearCase
|
4
10
|
command-line interface, <code>cleartool</code>, making it (slightly) more
|
5
11
|
comfortable for developers more used to non-locking version-control systems
|
@@ -77,11 +83,6 @@ way:
|
|
77
83
|
|
78
84
|
Mike wrote BasketCase in frustration.
|
79
85
|
|
80
|
-
== See also
|
81
|
-
|
82
|
-
* http://rubyforge.org/projects/basketcase/
|
83
|
-
* http://dogbiscuit.org/mdub/
|
84
|
-
|
85
86
|
== License
|
86
87
|
|
87
88
|
(The MIT License)
|
data/bin/bc-mirror
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
# Synchronise a directory with a Clearcase snapshot view.
|
4
|
+
#
|
5
|
+
# @author Mike Williams
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
|
8
|
+
|
9
|
+
require 'basketcase'
|
10
|
+
require 'pathname'
|
11
|
+
require 'ftools'
|
12
|
+
|
13
|
+
class DirSyncer
|
14
|
+
|
15
|
+
def initialize(src_root, dest_root)
|
16
|
+
@src_root = Pathname(src_root)
|
17
|
+
@dest_root = Pathname(dest_root)
|
18
|
+
end
|
19
|
+
|
20
|
+
def sync
|
21
|
+
visit(@src_root)
|
22
|
+
cleanup(@dest_root)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def ignored?(path)
|
28
|
+
path.to_str =~ %r{(^|/).git($|/)}
|
29
|
+
end
|
30
|
+
|
31
|
+
def visit(src_file)
|
32
|
+
return if ignored?(src_file)
|
33
|
+
if src_file.directory?
|
34
|
+
sync_dir(src_file)
|
35
|
+
else
|
36
|
+
sync_file(src_file)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def ensure_we_can_write_to(file)
|
41
|
+
file.chmod(file.stat.mode | 0600) unless file.writable?
|
42
|
+
end
|
43
|
+
|
44
|
+
def sync_dir(src_dir)
|
45
|
+
src_dir.children.sort.each do |f|
|
46
|
+
visit(f)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def sync_file(src_file)
|
51
|
+
file_path = src_file.relative_path_from(@src_root)
|
52
|
+
dest_file = @dest_root + file_path
|
53
|
+
dest_file.parent.mkpath
|
54
|
+
ensure_we_can_write_to(dest_file.parent)
|
55
|
+
if dest_file.exist?
|
56
|
+
if File.read(src_file) == File.read(dest_file)
|
57
|
+
return
|
58
|
+
end
|
59
|
+
ensure_we_can_write_to(dest_file)
|
60
|
+
end
|
61
|
+
puts file_path
|
62
|
+
FileUtils.copy(src_file, dest_file)
|
63
|
+
end
|
64
|
+
|
65
|
+
def cleanup(dest_file)
|
66
|
+
if dest_file.directory?
|
67
|
+
cleanup_dir(dest_file)
|
68
|
+
else
|
69
|
+
cleanup_file(dest_file)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def cleanup_dir(dest_dir)
|
74
|
+
dest_dir.children.sort.each do |f|
|
75
|
+
cleanup(f)
|
76
|
+
end
|
77
|
+
if dest_dir.children.empty?
|
78
|
+
puts "rmdir #{dest_dir.relative_path_from(@dest_root)}"
|
79
|
+
dest_dir.rmdir
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def cleanup_file(dest_file)
|
84
|
+
file_path = dest_file.relative_path_from(@dest_root)
|
85
|
+
src_file = @src_root + file_path
|
86
|
+
if !src_file.exist? || ignored?(file_path)
|
87
|
+
ensure_we_can_write_to(dest_file.parent)
|
88
|
+
puts "rm #{file_path}"
|
89
|
+
dest_file.delete
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
#---( Mainline )---
|
96
|
+
|
97
|
+
def exit_with(status, message)
|
98
|
+
$stderr.puts message; exit(status)
|
99
|
+
end
|
100
|
+
|
101
|
+
exit_with(3, "usage: #{File.basename($0)} <source> <clearcase_snapshot>") unless ARGV.size == 2
|
102
|
+
|
103
|
+
source_dir, cc_snapshot_dir = ARGV
|
104
|
+
source_dir = Pathname(source_dir).expand_path
|
105
|
+
cc_snapshot_dir = Pathname(cc_snapshot_dir).expand_path
|
106
|
+
|
107
|
+
def check_dir(dir)
|
108
|
+
exit_with(5, "ERROR: no such directory? #{dir}") unless dir.exist?
|
109
|
+
exit_with(5, "ERROR: #{dir} is not a directory") unless dir.directory?
|
110
|
+
end
|
111
|
+
|
112
|
+
check_dir(source_dir)
|
113
|
+
check_dir(cc_snapshot_dir)
|
114
|
+
|
115
|
+
puts "--- Syncing to CC view"
|
116
|
+
DirSyncer.new(source_dir, cc_snapshot_dir).sync
|
117
|
+
|
118
|
+
Dir.chdir(cc_snapshot_dir)
|
119
|
+
basketcase = Basketcase.new
|
120
|
+
|
121
|
+
puts "--- Adding/removing stuff"
|
122
|
+
basketcase.do('auto-sync', '-n')
|
123
|
+
|
124
|
+
puts "--- Commiting"
|
125
|
+
basketcase.do('auto-commit', '-m', "upload from #{source_dir}")
|
126
|
+
|
127
|
+
puts "--- Done"
|
data/lib/basketcase.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,36 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: basketcase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mdub
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDNDCCAhygAwIBAgIBADANBgkqhkiG9w0BAQUFADBAMQ0wCwYDVQQDDARtZHVi
|
14
|
+
MRowGAYKCZImiZPyLGQBGRYKZG9nYmlzY3VpdDETMBEGCgmSJomT8ixkARkWA29y
|
15
|
+
ZzAeFw0wODEwMTgxOTEyMjFaFw0wOTEwMTgxOTEyMjFaMEAxDTALBgNVBAMMBG1k
|
16
|
+
dWIxGjAYBgoJkiaJk/IsZAEZFgpkb2diaXNjdWl0MRMwEQYKCZImiZPyLGQBGRYD
|
17
|
+
b3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuN6ECjnDnRrS8+e/
|
18
|
+
Ld0qOFQm7pLwSbyqHr0ZFRTZybDUTOw1IHpaKUzEcblOfAI6QhdqiRAhd0/SGHhV
|
19
|
+
kLky24wpdI1mpvdYNB7EUQKp0xlDKD4H2zpI7aOpcaWQD2vtkx2QcaOqzwd7WDHz
|
20
|
+
PqgylAv6RCHFhbUOjDcwkaxce0VYwnCxtAn7UaxdOUoXvMwptKUp9Kn9AxFNklYU
|
21
|
+
4m29nz9n8o1Yat1wSen+eUM6HRbazeK5jiMUIC9lygvdibfxAVeGtQwk3g18WmR8
|
22
|
+
gbROV9ZPCwbIQyxoMvY2ZBTVfAxf6pEYiwr33HlgdTKUHdymJ9FGuRINF5L/Q3DI
|
23
|
+
mDltTwIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU
|
24
|
+
BSFEL+Pfdvqb0bjyd7t4x1++/NgwDQYJKoZIhvcNAQEFBQADggEBAHM3UqaW13Os
|
25
|
+
Q1ME0sLhHFvF4QE7Z6mRmWUwaokJgSLQdy+YDC069AJPBDiSBmg3oJtzVTTrGadV
|
26
|
+
bguWLRGZwjHEBSWGSnJlIoz3jKgVBcYEYhe+snrLYOr0BoF1U64WiVPPEGDdHlbM
|
27
|
+
/tcBD2oDTz7mt52yHGJArq3bceD8UE5ZRZ4GMO5X+oQlSDkI395dcgAgCWhvzppa
|
28
|
+
7tmPDgdNhjWsIS5Ozf1hu4VguwOXYMX2Gez4B3Al/2Jn+2vzSCsmd3RRHUq9RBx5
|
29
|
+
+pTb3lixdToGe6TKuoxCURlQWS5JYyXm8TRVmaZrJcaNKN6bmlLNTfPWv3rMqbTz
|
30
|
+
oYjap0xxejs=
|
31
|
+
-----END CERTIFICATE-----
|
11
32
|
|
12
|
-
date: 2008-10-
|
33
|
+
date: 2008-10-19 00:00:00 +11:00
|
13
34
|
default_executable:
|
14
35
|
dependencies:
|
15
36
|
- !ruby/object:Gem::Dependency
|
@@ -22,11 +43,12 @@ dependencies:
|
|
22
43
|
- !ruby/object:Gem::Version
|
23
44
|
version: 1.7.0
|
24
45
|
version:
|
25
|
-
description:
|
46
|
+
description: BasketCase is a (Ruby) script that encapsulates the Rational ClearCase command-line interface, <code>cleartool</code>, making it (slightly) more comfortable for developers more used to non-locking version-control systems such as CVS or Subversion.
|
26
47
|
email:
|
27
48
|
- mdub@dogbiscuit.org
|
28
49
|
executables:
|
29
50
|
- basketcase
|
51
|
+
- bc-mirror
|
30
52
|
extensions: []
|
31
53
|
|
32
54
|
extra_rdoc_files:
|
@@ -39,9 +61,10 @@ files:
|
|
39
61
|
- README.txt
|
40
62
|
- Rakefile
|
41
63
|
- bin/basketcase
|
64
|
+
- bin/bc-mirror
|
42
65
|
- lib/basketcase.rb
|
43
66
|
has_rdoc: true
|
44
|
-
homepage:
|
67
|
+
homepage: http://basketcase.rubyforge.org/
|
45
68
|
post_install_message:
|
46
69
|
rdoc_options:
|
47
70
|
- --main
|
@@ -66,6 +89,6 @@ rubyforge_project: basketcase
|
|
66
89
|
rubygems_version: 1.2.0
|
67
90
|
signing_key:
|
68
91
|
specification_version: 2
|
69
|
-
summary:
|
92
|
+
summary: BasketCase is a (Ruby) script that encapsulates the Rational ClearCase command-line interface, <code>cleartool</code>, making it (slightly) more comfortable for developers more used to non-locking version-control systems such as CVS or Subversion.
|
70
93
|
test_files: []
|
71
94
|
|
metadata.gz.sig
ADDED