subcheat 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -19
- data/Gemfile +2 -0
- data/Gemfile.lock +43 -0
- data/LICENSE +1 -1
- data/README.rdoc +2 -1
- data/Rakefile +15 -54
- data/lib/subcheat.rb +6 -11
- data/lib/subcheat/commands/shortcuts.rb +6 -1
- data/lib/subcheat/commands/undo.rb +3 -3
- data/lib/subcheat/version.rb +4 -0
- data/subcheat.gemspec +25 -0
- data/test/command_test.rb +17 -0
- data/test/runner_test.rb +39 -0
- data/test/subcheat_test.rb +7 -0
- data/test/svn_test.rb +30 -0
- data/test/test_helper.rb +7 -0
- metadata +110 -82
- data/VERSION +0 -1
- data/test/helper.rb +0 -19
- data/test/test_command.rb +0 -21
- data/test/test_runner.rb +0 -42
- data/test/test_subcheat.rb +0 -8
- data/test/test_svn.rb +0 -32
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
subcheat (0.4.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
builder (3.0.0)
|
10
|
+
cucumber (1.1.0)
|
11
|
+
builder (>= 2.1.2)
|
12
|
+
diff-lcs (>= 1.1.2)
|
13
|
+
gherkin (~> 2.5.0)
|
14
|
+
json (>= 1.4.6)
|
15
|
+
term-ansicolor (>= 1.0.6)
|
16
|
+
diff-lcs (1.1.3)
|
17
|
+
gherkin (2.5.1)
|
18
|
+
json (>= 1.4.6)
|
19
|
+
json (1.6.1)
|
20
|
+
metaclass (0.0.1)
|
21
|
+
minitest (2.6.1)
|
22
|
+
mocha (0.10.0)
|
23
|
+
metaclass (~> 0.0.1)
|
24
|
+
multi_json (1.0.3)
|
25
|
+
rake (0.9.2)
|
26
|
+
rdoc (3.9.4)
|
27
|
+
simplecov (0.5.3)
|
28
|
+
multi_json (~> 1.0.3)
|
29
|
+
simplecov-html (~> 0.5.3)
|
30
|
+
simplecov-html (0.5.3)
|
31
|
+
term-ansicolor (1.0.6)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
cucumber
|
38
|
+
minitest
|
39
|
+
mocha (>= 0.9.8)
|
40
|
+
rake
|
41
|
+
rdoc (~> 3.9)
|
42
|
+
simplecov
|
43
|
+
subcheat!
|
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -19,6 +19,7 @@ Subcheat is a simple wrapper around Subversion's svn command-line client.
|
|
19
19
|
* <tt>subcheat root</tt>: output the current project root folder
|
20
20
|
* <tt>subcheat path</tt>: output the current path in the repository
|
21
21
|
* <tt>subcheat revision</tt>: output the current revision number
|
22
|
+
* <tt>subcheat pretty-log</tt>: output friendly single-line logs
|
22
23
|
|
23
24
|
Also, some existing subcommands are enhanced:
|
24
25
|
|
@@ -93,4 +94,4 @@ It might some day be made more flexible, but this works for me right now.
|
|
93
94
|
|
94
95
|
== Copyright
|
95
96
|
|
96
|
-
Copyright (c) 2009 Arjan van der Gaag. See LICENSE for details.
|
97
|
+
Copyright (c) 2009 Arjan van der Gaag. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,66 +1,27 @@
|
|
1
|
-
require '
|
2
|
-
require 'rake'
|
1
|
+
require 'bundler/gem_tasks'
|
3
2
|
|
4
|
-
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "subcheat"
|
8
|
-
gem.summary = %Q{Wrapper for Subversion CLI}
|
9
|
-
gem.description = %Q{Wrap the Subversion CLI to extract some usage patterns into commands}
|
10
|
-
gem.email = "arjan@arjanvandergaag.nl"
|
11
|
-
gem.homepage = "http://github.com/avdgaag/subcheat"
|
12
|
-
gem.authors = ["Arjan van der Gaag"]
|
13
|
-
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
|
-
gem.add_development_dependency "cucumber", ">= 0"
|
15
|
-
gem.add_development_dependency "mocha", ">= 0.9.8"
|
16
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
17
|
-
end
|
18
|
-
Jeweler::GemcutterTasks.new
|
19
|
-
rescue LoadError
|
20
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
-
end
|
3
|
+
task :default => :test
|
22
4
|
|
23
5
|
require 'rake/testtask'
|
24
6
|
Rake::TestTask.new(:test) do |test|
|
25
7
|
test.libs << 'lib' << 'test'
|
26
|
-
test.pattern = 'test
|
8
|
+
test.pattern = 'test/**/*_test.rb'
|
27
9
|
test.verbose = true
|
28
10
|
end
|
29
11
|
|
30
|
-
|
31
|
-
|
32
|
-
Rcov::RcovTask.new do |test|
|
33
|
-
test.libs << 'test'
|
34
|
-
test.pattern = 'test/**/test_*.rb'
|
35
|
-
test.verbose = true
|
36
|
-
end
|
37
|
-
rescue LoadError
|
38
|
-
task :rcov do
|
39
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
task :test => :check_dependencies
|
12
|
+
require 'cucumber/rake/task'
|
13
|
+
Cucumber::Rake::Task.new(:features)
|
44
14
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
task :features => :check_dependencies
|
50
|
-
rescue LoadError
|
51
|
-
task :features do
|
52
|
-
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
53
|
-
end
|
15
|
+
desc 'Generate code coverage report'
|
16
|
+
task :coverage do
|
17
|
+
ENV['COVERAGE'] = 'true'
|
18
|
+
Rake::Task['test'].invoke
|
54
19
|
end
|
55
20
|
|
56
|
-
task
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
rdoc.rdoc_dir = 'rdoc'
|
63
|
-
rdoc.title = "subcheat #{version}"
|
64
|
-
rdoc.rdoc_files.include('README*')
|
65
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
require 'rdoc/task'
|
22
|
+
RDoc::Task.new :doc do |t|
|
23
|
+
t.title = "subcheat #{Subcheat::VERSION}"
|
24
|
+
t.main = 'README.rdoc'
|
25
|
+
t.rdoc_dir = 'doc'
|
26
|
+
t.rdoc_files.include('README.rdoc', 'lib/**/*.rb')
|
66
27
|
end
|
data/lib/subcheat.rb
CHANGED
@@ -1,12 +1,7 @@
|
|
1
|
-
|
2
|
-
%w{exceptions runner svn command}.each do |filename|
|
3
|
-
require File.join(File.dirname(__FILE__), 'subcheat', filename)
|
4
|
-
end
|
5
|
-
|
1
|
+
require 'subcheat/exceptions'
|
6
2
|
module Subcheat
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
3
|
+
autoload :Runner, 'subcheat/runner'
|
4
|
+
autoload :Command, 'subcheat/command'
|
5
|
+
autoload :Svn, 'subcheat/svn'
|
6
|
+
autoload :VERSION, 'subcheat/version'
|
7
|
+
end
|
@@ -23,6 +23,11 @@ Subcheat::Command.define('cop') do
|
|
23
23
|
"svn checkout #{url} #{arguments[1..-1].join(' ')}"
|
24
24
|
end
|
25
25
|
|
26
|
+
# Print pretty formatted log output
|
27
|
+
Subcheat::Command.define('pretty-log') do
|
28
|
+
%Q{svn log --stop-on-copy -q | grep -E "r[0-9]+" | tail -1 | sed 's/r\([0-9][0-9]*\).*/\1/'}
|
29
|
+
end
|
30
|
+
|
26
31
|
# Enable exporting of tags
|
27
32
|
#
|
28
33
|
# > svn export REL-1.0 ~/Desktop/export
|
@@ -54,4 +59,4 @@ Subcheat::Command.define('switch') do
|
|
54
59
|
arguments[1..-1].join(' ')
|
55
60
|
]
|
56
61
|
end
|
57
|
-
end
|
62
|
+
end
|
@@ -12,11 +12,11 @@
|
|
12
12
|
Subcheat::Command.define('undo') do
|
13
13
|
revision, url = arguments[0], arguments[1]
|
14
14
|
revision = case revision
|
15
|
-
when /^\d
|
16
|
-
when /^\d+:\d
|
15
|
+
when /^\d+$/ then "#{revision}:#{revision.to_i - 1}"
|
16
|
+
when /^\d+:\d+$/ then revision.split(':').reverse.join(':')
|
17
17
|
else
|
18
18
|
raise Subcheat::CommandException, "Bad revision: #{revision}"
|
19
19
|
end
|
20
20
|
url ||= attr('URL')
|
21
21
|
"svn merge -r #{revision} #{url}"
|
22
|
-
end
|
22
|
+
end
|
data/subcheat.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "subcheat/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'subcheat'
|
7
|
+
s.version = Subcheat::VERSION
|
8
|
+
s.authors = ['Arjan van der Gaag']
|
9
|
+
s.email = ['arjan@arjanvandergaag.nl']
|
10
|
+
s.homepage = 'http://github.com/avdgaag/subcheat'
|
11
|
+
s.summary = 'Wrapper for Subversion CLI'
|
12
|
+
s.description = 'Wrap the Subversion CLI to extract some usage patterns into commands'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
|
19
|
+
s.add_development_dependency 'rake'
|
20
|
+
s.add_development_dependency 'minitest'
|
21
|
+
s.add_development_dependency 'cucumber'
|
22
|
+
s.add_development_dependency 'mocha', '>= 0.9.8'
|
23
|
+
s.add_development_dependency 'simplecov'
|
24
|
+
s.add_development_dependency 'rdoc', '~> 3.9'
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe Subcheat::Command do
|
4
|
+
it 'should create a command' do
|
5
|
+
old_count = Subcheat::Command.commands.size
|
6
|
+
Subcheat::Command.define('name') { puts 'foo' }
|
7
|
+
Subcheat::Command.commands.size.must_equal old_count + 1
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should find a command by name' do
|
11
|
+
Subcheat::Command.on('undo').must_be_instance_of Subcheat::Command
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should raise when loading non-exstant commands' do
|
15
|
+
lambda { Subcheat::Command.on('foo') }.must_raise(Subcheat::NoSuchCommand)
|
16
|
+
end
|
17
|
+
end
|
data/test/runner_test.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe Subcheat::Runner do
|
4
|
+
before do
|
5
|
+
Subcheat::Runner.output = StringIO.new
|
6
|
+
Subcheat::Runner.perform_run = false
|
7
|
+
end
|
8
|
+
|
9
|
+
def subcheat_output
|
10
|
+
Subcheat::Runner.output.string.chomp
|
11
|
+
end
|
12
|
+
|
13
|
+
describe 'No arguments' do
|
14
|
+
it 'should run help by default' do
|
15
|
+
Subcheat::Runner.new
|
16
|
+
subcheat_output.must_equal 'svn help'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'unwrapped commands' do
|
21
|
+
it 'should pass through commands' do
|
22
|
+
Subcheat::Runner.new('status')
|
23
|
+
subcheat_output.must_equal 'svn status'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should pass through arguments' do
|
27
|
+
Subcheat::Runner.new('status --ignore-externals')
|
28
|
+
subcheat_output.must_equal 'svn status --ignore-externals'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'wrapped commands' do
|
33
|
+
it 'should find and call associated command' do
|
34
|
+
Subcheat::Command.expects(:on).with('undo').returns(stub(:call => 'foo'))
|
35
|
+
Subcheat::Runner.new('undo', '55')
|
36
|
+
subcheat_output.must_equal 'foo'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/test/svn_test.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
describe Subcheat::Svn do
|
4
|
+
before do
|
5
|
+
@info = <<-EOS
|
6
|
+
Path: .
|
7
|
+
URL: https://some-kind-of-svn.com/svn/project_name/branches/languages
|
8
|
+
Repository Root: https://some-kind-of-svn.com/svn
|
9
|
+
Repository UUID: 11af7ba9-5ee7-4c51-9542-47637e3bfceb
|
10
|
+
Revision: 8049
|
11
|
+
Node Kind: directory
|
12
|
+
Schedule: normal
|
13
|
+
Last Changed Author: Andy
|
14
|
+
Last Changed Rev: 5019
|
15
|
+
Last Changed Date: 2009-12-11 15:12:57 +0100 (vr, 11 dec 2009)
|
16
|
+
|
17
|
+
EOS
|
18
|
+
@svn = Subcheat::Svn.new([])
|
19
|
+
@svn.stubs(:info).returns(@info)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should read attributes' do
|
23
|
+
@svn.attr('URL').must_equal 'https://some-kind-of-svn.com/svn/project_name/branches/languages'
|
24
|
+
@svn.attr('Revision').must_equal '8049'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'find project base URL' do
|
28
|
+
@svn.base_url.must_equal 'https://some-kind-of-svn.com/svn/project_name/'
|
29
|
+
end
|
30
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,76 +1,97 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: subcheat
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 3
|
8
|
-
- 0
|
9
|
-
version: 0.3.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Arjan van der Gaag
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2011-10-02 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: &70188927126540 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
22
23
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
version_requirements: *70188927126540
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: minitest
|
27
|
+
requirement: &70188927117000 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
30
33
|
type: :development
|
31
|
-
version_requirements: *id001
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: cucumber
|
34
34
|
prerelease: false
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
version_requirements: *70188927117000
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: cucumber
|
38
|
+
requirement: &70188927115080 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
42
44
|
type: :development
|
43
|
-
version_requirements: *id002
|
44
|
-
- !ruby/object:Gem::Dependency
|
45
|
-
name: mocha
|
46
45
|
prerelease: false
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
version_requirements: *70188927115080
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: mocha
|
49
|
+
requirement: &70188927113220 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
55
54
|
version: 0.9.8
|
56
55
|
type: :development
|
57
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70188927113220
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: simplecov
|
60
|
+
requirement: &70188927111720 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70188927111720
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rdoc
|
71
|
+
requirement: &70188927109880 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.9'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70188927109880
|
58
80
|
description: Wrap the Subversion CLI to extract some usage patterns into commands
|
59
|
-
email:
|
60
|
-
|
81
|
+
email:
|
82
|
+
- arjan@arjanvandergaag.nl
|
83
|
+
executables:
|
61
84
|
- subcheat
|
62
85
|
extensions: []
|
63
|
-
|
64
|
-
|
65
|
-
- LICENSE
|
66
|
-
- README.rdoc
|
67
|
-
files:
|
86
|
+
extra_rdoc_files: []
|
87
|
+
files:
|
68
88
|
- .document
|
69
89
|
- .gitignore
|
90
|
+
- Gemfile
|
91
|
+
- Gemfile.lock
|
70
92
|
- LICENSE
|
71
93
|
- README.rdoc
|
72
94
|
- Rakefile
|
73
|
-
- VERSION
|
74
95
|
- bin/subcheat
|
75
96
|
- features/shortcuts.feature
|
76
97
|
- features/step_definitions/wrapper_steps.rb
|
@@ -87,44 +108,51 @@ files:
|
|
87
108
|
- lib/subcheat/exceptions.rb
|
88
109
|
- lib/subcheat/runner.rb
|
89
110
|
- lib/subcheat/svn.rb
|
90
|
-
-
|
91
|
-
-
|
92
|
-
- test/
|
93
|
-
- test/
|
94
|
-
- test/
|
95
|
-
|
111
|
+
- lib/subcheat/version.rb
|
112
|
+
- subcheat.gemspec
|
113
|
+
- test/command_test.rb
|
114
|
+
- test/runner_test.rb
|
115
|
+
- test/subcheat_test.rb
|
116
|
+
- test/svn_test.rb
|
117
|
+
- test/test_helper.rb
|
96
118
|
homepage: http://github.com/avdgaag/subcheat
|
97
119
|
licenses: []
|
98
|
-
|
99
120
|
post_install_message:
|
100
|
-
rdoc_options:
|
101
|
-
|
102
|
-
require_paths:
|
121
|
+
rdoc_options: []
|
122
|
+
require_paths:
|
103
123
|
- lib
|
104
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
124
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
none: false
|
126
|
+
requirements:
|
127
|
+
- - ! '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
segments:
|
109
131
|
- 0
|
110
|
-
|
111
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
132
|
+
hash: 4452813104064210158
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
segments:
|
116
140
|
- 0
|
117
|
-
|
141
|
+
hash: 4452813104064210158
|
118
142
|
requirements: []
|
119
|
-
|
120
143
|
rubyforge_project:
|
121
|
-
rubygems_version: 1.
|
144
|
+
rubygems_version: 1.8.6
|
122
145
|
signing_key:
|
123
146
|
specification_version: 3
|
124
147
|
summary: Wrapper for Subversion CLI
|
125
|
-
test_files:
|
126
|
-
-
|
127
|
-
-
|
128
|
-
-
|
129
|
-
-
|
130
|
-
-
|
148
|
+
test_files:
|
149
|
+
- features/shortcuts.feature
|
150
|
+
- features/step_definitions/wrapper_steps.rb
|
151
|
+
- features/subcommands.feature
|
152
|
+
- features/support/env.rb
|
153
|
+
- features/wrapper.feature
|
154
|
+
- test/command_test.rb
|
155
|
+
- test/runner_test.rb
|
156
|
+
- test/subcheat_test.rb
|
157
|
+
- test/svn_test.rb
|
158
|
+
- test/test_helper.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.3.0
|
data/test/helper.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'test/unit'
|
3
|
-
require 'shoulda'
|
4
|
-
require 'mocha'
|
5
|
-
|
6
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
7
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
|
-
require 'subcheat'
|
9
|
-
|
10
|
-
class Test::Unit::TestCase
|
11
|
-
def disable_running_of_commands
|
12
|
-
Subcheat::Runner.output = StringIO.new
|
13
|
-
Subcheat::Runner.perform_run = false
|
14
|
-
end
|
15
|
-
|
16
|
-
def subcheat_output
|
17
|
-
Subcheat::Runner.output.string.chomp
|
18
|
-
end
|
19
|
-
end
|
data/test/test_command.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestRunner < Test::Unit::TestCase
|
4
|
-
context "creating a command" do
|
5
|
-
should "create a command" do
|
6
|
-
old_count = Subcheat::Command.commands.size
|
7
|
-
Subcheat::Command.define('name') { puts 'foo' }
|
8
|
-
assert_equal(old_count + 1, Subcheat::Command.commands.size)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'finding commands' do
|
13
|
-
should 'return a command for a name' do
|
14
|
-
assert_instance_of(Subcheat::Command, Subcheat::Command.on('undo'))
|
15
|
-
end
|
16
|
-
|
17
|
-
should 'raise when loading non-exstant commands' do
|
18
|
-
assert_raise(Subcheat::NoSuchCommand) { Subcheat::Command.on('foo') }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/test/test_runner.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestRunner < Test::Unit::TestCase
|
4
|
-
context 'No arguments' do
|
5
|
-
setup do
|
6
|
-
disable_running_of_commands
|
7
|
-
end
|
8
|
-
|
9
|
-
should 'run help by default' do
|
10
|
-
Subcheat::Runner.new
|
11
|
-
assert_equal('svn help', subcheat_output)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
context 'unwrapped commands' do
|
16
|
-
setup do
|
17
|
-
disable_running_of_commands
|
18
|
-
end
|
19
|
-
|
20
|
-
should 'pass through commands' do
|
21
|
-
Subcheat::Runner.new('status')
|
22
|
-
assert_equal('svn status', subcheat_output)
|
23
|
-
end
|
24
|
-
|
25
|
-
should 'pass through arguments' do
|
26
|
-
Subcheat::Runner.new('status --ignore-externals')
|
27
|
-
assert_equal('svn status --ignore-externals', subcheat_output)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'wrapped commands' do
|
32
|
-
setup do
|
33
|
-
disable_running_of_commands
|
34
|
-
end
|
35
|
-
|
36
|
-
should 'find and call associated command' do
|
37
|
-
Subcheat::Command.expects(:on).with('undo').returns(stub(:call => 'foo'))
|
38
|
-
Subcheat::Runner.new('undo', '55')
|
39
|
-
assert_equal('foo', subcheat_output)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
data/test/test_subcheat.rb
DELETED
data/test/test_svn.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestRunner < Test::Unit::TestCase
|
4
|
-
context 'a working copy' do
|
5
|
-
setup do
|
6
|
-
@info = <<-EOS
|
7
|
-
Path: .
|
8
|
-
URL: https://some-kind-of-svn.com/svn/project_name/branches/languages
|
9
|
-
Repository Root: https://some-kind-of-svn.com/svn
|
10
|
-
Repository UUID: 11af7ba9-5ee7-4c51-9542-47637e3bfceb
|
11
|
-
Revision: 8049
|
12
|
-
Node Kind: directory
|
13
|
-
Schedule: normal
|
14
|
-
Last Changed Author: Andy
|
15
|
-
Last Changed Rev: 5019
|
16
|
-
Last Changed Date: 2009-12-11 15:12:57 +0100 (vr, 11 dec 2009)
|
17
|
-
|
18
|
-
EOS
|
19
|
-
@svn = Subcheat::Svn.new([])
|
20
|
-
@svn.stubs(:info).returns(@info)
|
21
|
-
end
|
22
|
-
|
23
|
-
should "read attributes" do
|
24
|
-
assert_equal('https://some-kind-of-svn.com/svn/project_name/branches/languages', @svn.attr('URL'))
|
25
|
-
assert_equal('8049', @svn.attr('Revision'))
|
26
|
-
end
|
27
|
-
|
28
|
-
should 'find project base URL' do
|
29
|
-
assert_equal('https://some-kind-of-svn.com/svn/project_name/', @svn.base_url)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|