markryall-basketcase 1.1.7
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/.gitignore +5 -0
- data/History.txt +8 -0
- data/Manifest.txt +7 -0
- data/README.txt +109 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/bin/basketcase +13 -0
- data/bin/bc-mirror +127 -0
- data/lib/basketcase.rb +1046 -0
- data/spec/auto_sync_spec.rb +61 -0
- data/spec/basketcase_spec.rb +43 -0
- data/spec/cleartool +28 -0
- data/spec/spec_helper.rb +5 -0
- metadata +70 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
|
+
load 'cleartool'
|
|
3
|
+
|
|
4
|
+
describe 'Autosync' do
|
|
5
|
+
|
|
6
|
+
it 'should be able to handle lots of files that need to be added' do
|
|
7
|
+
|
|
8
|
+
ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__))}:#{ENV['PATH']}"
|
|
9
|
+
|
|
10
|
+
File.delete(CLEARTOOL_ARGS_LOG) if File.exists?(CLEARTOOL_ARGS_LOG)
|
|
11
|
+
|
|
12
|
+
OutputQueue.enqueue(%q{
|
|
13
|
+
deleteddir1@@\main\2 [loaded but missing] Rule: \main\LATEST
|
|
14
|
+
deletedfile1.txt@@\main\1 [loaded but missing] Rule: \main\LATEST
|
|
15
|
+
lost+found@@\main\0 Rule: \main\LATEST
|
|
16
|
+
newdir1
|
|
17
|
+
newfile1.txt
|
|
18
|
+
newfile2.txt
|
|
19
|
+
updateddir1@@\main\2 Rule: \main\LATEST
|
|
20
|
+
updatedfiled1.txt@@\main\1 [hijacked] Rule: \main\LATEST
|
|
21
|
+
deleteddir1\deletedfile1.txt@@\main\1 [loaded but missing] Rule: \main\LATEST
|
|
22
|
+
newdir1\newfile1.txt
|
|
23
|
+
updateddir
|
|
24
|
+
1\deletedfile1.txt@@\main\1 [loaded but missing] Rule: \main\LATEST
|
|
25
|
+
updateddir1\newfile1.txt
|
|
26
|
+
updateddir1\updatedfiled1.txt@@\main\1 [hijacked] Rule: \main\LATEST
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
%q{
|
|
30
|
+
.@@\main\12 Rule: \main\LATEST
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
%q{
|
|
34
|
+
cleartool: Error: Can't modify directory "." because it is not checked out.
|
|
35
|
+
cleartool: Error: Can't modify directory "." because it is not checked out.
|
|
36
|
+
cleartool: Error: Can't modify directory "." because it is not checked out.
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
$stderr.stub!(:puts)
|
|
40
|
+
Basketcase.new.do('auto-sync','-n')
|
|
41
|
+
|
|
42
|
+
File.read(CLEARTOOL_ARGS_LOG).should == <<HERE
|
|
43
|
+
ls -recurse .
|
|
44
|
+
ls -directory .
|
|
45
|
+
checkout -unreserved -ncomment -nquery .
|
|
46
|
+
mkelem -ncomment newdir1 newfile1.txt
|
|
47
|
+
ls -directory . newdir1
|
|
48
|
+
mkelem -ncomment newfile2.txt newdir1/newfile1.txt
|
|
49
|
+
ls -directory . updateddir1
|
|
50
|
+
mkelem -ncomment updateddir updateddir1/newfile1.txt
|
|
51
|
+
ls -directory .
|
|
52
|
+
rmname -ncomment deleteddir1 deletedfile1.txt
|
|
53
|
+
ls -directory deleteddir1 1
|
|
54
|
+
rmname -ncomment deleteddir1/deletedfile1.txt 1/deletedfile1.txt
|
|
55
|
+
checkout -unreserved -ncomment -usehijack updatedfiled1.txt updateddir1/updatedfiled1.txt
|
|
56
|
+
HERE
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Basketcase do
|
|
4
|
+
before do
|
|
5
|
+
@io = stub('io')
|
|
6
|
+
@io.stub!(:each_line)
|
|
7
|
+
IO.stub!(:popen).and_return(@io)
|
|
8
|
+
@basketcase = Basketcase.new
|
|
9
|
+
@basketcase.stub!(:exit)
|
|
10
|
+
$stderr.stub!(:puts, :sync)
|
|
11
|
+
$stdout.stub!(:puts, :sync)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'should sync stderr' do
|
|
15
|
+
$stderr.should_receive(:sync=).with(true)
|
|
16
|
+
@basketcase.do('ls')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'should sync stdout' do
|
|
20
|
+
$stdout.should_receive(:sync=).with(true)
|
|
21
|
+
@basketcase.do('ls')
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it 'should determine test mode from command line option --test' do
|
|
25
|
+
@basketcase.do('--test','ls')
|
|
26
|
+
@basketcase.instance_variable_get('@test_mode').should == true
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'should determine test mode from command line option -t' do
|
|
30
|
+
@basketcase.do('-t','ls')
|
|
31
|
+
@basketcase.instance_variable_get('@test_mode').should == true
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'should determine debug mode from command line option --test' do
|
|
35
|
+
@basketcase.do('--debug','ls')
|
|
36
|
+
@basketcase.instance_variable_get('@debug_mode').should == true
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'should determine debug mode from command line option -te' do
|
|
40
|
+
@basketcase.do('-d','ls')
|
|
41
|
+
@basketcase.instance_variable_get('@debug_mode').should == true
|
|
42
|
+
end
|
|
43
|
+
end
|
data/spec/cleartool
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
DELIMITER = "\n++++\n"
|
|
4
|
+
CLEARTOOL_ARGS_LOG = File.dirname(__FILE__)+'/ct.log'
|
|
5
|
+
|
|
6
|
+
class OutputQueue
|
|
7
|
+
CLEARTOOL_FAKE_OUTPUT_FILE = File.dirname(__FILE__)+"/ct.output"
|
|
8
|
+
|
|
9
|
+
def self.enqueue *messages
|
|
10
|
+
write_messages messages
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.dequeue
|
|
14
|
+
messages = File.read(CLEARTOOL_FAKE_OUTPUT_FILE).split(DELIMITER)
|
|
15
|
+
current = messages.shift
|
|
16
|
+
write_messages messages
|
|
17
|
+
current
|
|
18
|
+
end
|
|
19
|
+
private
|
|
20
|
+
def self.write_messages messages
|
|
21
|
+
File.open(CLEARTOOL_FAKE_OUTPUT_FILE, 'w') { |out| out.puts messages.join(DELIMITER) }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if $0 == __FILE__
|
|
26
|
+
File.open(CLEARTOOL_ARGS_LOG, 'a') { |io| io.puts ARGV.join(' ') }
|
|
27
|
+
puts OutputQueue.dequeue
|
|
28
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: markryall-basketcase
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.1.7
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- mdub
|
|
8
|
+
- mark ryall
|
|
9
|
+
- duana stanley
|
|
10
|
+
autorequire:
|
|
11
|
+
bindir: bin
|
|
12
|
+
cert_chain: []
|
|
13
|
+
|
|
14
|
+
date: 2009-08-26 00:00:00 -07:00
|
|
15
|
+
default_executable:
|
|
16
|
+
dependencies: []
|
|
17
|
+
|
|
18
|
+
description: TODO
|
|
19
|
+
email: mdub@dogbiscuit.org
|
|
20
|
+
executables:
|
|
21
|
+
- basketcase
|
|
22
|
+
- bc-mirror
|
|
23
|
+
extensions: []
|
|
24
|
+
|
|
25
|
+
extra_rdoc_files:
|
|
26
|
+
- README.txt
|
|
27
|
+
files:
|
|
28
|
+
- .gitignore
|
|
29
|
+
- History.txt
|
|
30
|
+
- Manifest.txt
|
|
31
|
+
- README.txt
|
|
32
|
+
- Rakefile
|
|
33
|
+
- VERSION
|
|
34
|
+
- bin/basketcase
|
|
35
|
+
- bin/bc-mirror
|
|
36
|
+
- lib/basketcase.rb
|
|
37
|
+
- spec/auto_sync_spec.rb
|
|
38
|
+
- spec/basketcase_spec.rb
|
|
39
|
+
- spec/cleartool
|
|
40
|
+
- spec/spec_helper.rb
|
|
41
|
+
has_rdoc: false
|
|
42
|
+
homepage: http://github.com/markryall/basketcase
|
|
43
|
+
post_install_message:
|
|
44
|
+
rdoc_options:
|
|
45
|
+
- --charset=UTF-8
|
|
46
|
+
require_paths:
|
|
47
|
+
- lib
|
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: "0"
|
|
53
|
+
version:
|
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
|
+
requirements:
|
|
56
|
+
- - ">="
|
|
57
|
+
- !ruby/object:Gem::Version
|
|
58
|
+
version: "0"
|
|
59
|
+
version:
|
|
60
|
+
requirements: []
|
|
61
|
+
|
|
62
|
+
rubyforge_project:
|
|
63
|
+
rubygems_version: 1.2.0
|
|
64
|
+
signing_key:
|
|
65
|
+
specification_version: 3
|
|
66
|
+
summary: clearcase for the masses
|
|
67
|
+
test_files:
|
|
68
|
+
- spec/auto_sync_spec.rb
|
|
69
|
+
- spec/basketcase_spec.rb
|
|
70
|
+
- spec/spec_helper.rb
|