graffle 0.1.0 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/LICENSE.txt +2 -2
- data/Manifest.txt +7 -15
- data/Rakefile +5 -10
- data/Rakefile.hoe +9 -4
- data/bin/bin-skeleton +1 -11
- data/graffle.tmproj +2 -310
- data/lib/graffle/stereotypes.rb +32 -19
- data/lib/graffle/styled-text-reader.rb +0 -5
- data/lib/graffle/version.rb +1 -1
- data/lib/grail_test.rb +16 -0
- data/lib/grail_test/command-interpreters.rb +78 -0
- data/test/grails-tests/commands-from-quoted-args-tests.rb +86 -0
- data/test/grails-tests/destinations-tests.rb +19 -0
- data/test/grails-tests/do-nothing-commands-tests.rb +18 -0
- data/test/grails-tests/graphic-interpreter-tests.rb +70 -0
- data/test/grails-tests/translation-testcase.rb +25 -0
- data/test/line-graphic-tests.rb +10 -0
- data/test/set-standalone-test-paths.rb +4 -1
- data/test/shaped-graphic-tests.rb +6 -2
- data/test/styled-text-reader-tests.rb +0 -12
- data/test/text-tests.rb +9 -5
- metadata +25 -20
- data/lib/graffle/third-party/s4t-utils.rb +0 -21
- data/lib/graffle/third-party/s4t-utils/capturing-globals.rb +0 -78
- data/lib/graffle/third-party/s4t-utils/claims.rb +0 -14
- data/lib/graffle/third-party/s4t-utils/command-line.rb +0 -15
- data/lib/graffle/third-party/s4t-utils/error-handling.rb +0 -20
- data/lib/graffle/third-party/s4t-utils/friendly-format.rb +0 -27
- data/lib/graffle/third-party/s4t-utils/hacks.rb +0 -32
- data/lib/graffle/third-party/s4t-utils/load-path-auto-adjuster.rb +0 -120
- data/lib/graffle/third-party/s4t-utils/more-assertions.rb +0 -29
- data/lib/graffle/third-party/s4t-utils/os.rb +0 -28
- data/lib/graffle/third-party/s4t-utils/rake-task-helpers.rb +0 -75
- data/lib/graffle/third-party/s4t-utils/rakefile-common.rb +0 -106
- data/lib/graffle/third-party/s4t-utils/svn-file-movement.rb +0 -101
- data/lib/graffle/third-party/s4t-utils/test-util.rb +0 -19
- data/lib/graffle/third-party/s4t-utils/version.rb +0 -3
@@ -1,29 +0,0 @@
|
|
1
|
-
module Test
|
2
|
-
module Unit
|
3
|
-
|
4
|
-
module Assertions
|
5
|
-
def assert_true(boolean, message = nil)
|
6
|
-
assert(boolean, message)
|
7
|
-
end
|
8
|
-
|
9
|
-
def assert_false(boolean, message = nil)
|
10
|
-
_wrap_assertion do
|
11
|
-
assert_block(build_message(message, "<?> should be false or nil.", boolean)) { !boolean }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def assert_raise_with_matching_message(exception_class, message, &block)
|
16
|
-
exception = assert_raise(exception_class, &block)
|
17
|
-
assert_match(message, exception.message)
|
18
|
-
end
|
19
|
-
alias_method :assert_raises_with_matching_message,
|
20
|
-
:assert_raise_with_matching_message
|
21
|
-
|
22
|
-
def assert_wants_to_exit
|
23
|
-
assert_raise(SystemExit) do
|
24
|
-
yield
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
module S4tUtils
|
2
|
-
|
3
|
-
def self.on_windows?
|
4
|
-
Config::CONFIG["arch"] =~ /dos|win32/i
|
5
|
-
end
|
6
|
-
|
7
|
-
# Lifted this from Rubygems, which is released under the
|
8
|
-
# Ruby license.
|
9
|
-
def self.find_home # :nodoc:
|
10
|
-
['HOME', 'USERPROFILE'].each do |homekey|
|
11
|
-
return ENV[homekey] if ENV[homekey]
|
12
|
-
end
|
13
|
-
if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
|
14
|
-
return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
|
15
|
-
end
|
16
|
-
begin
|
17
|
-
File.expand_path("~")
|
18
|
-
rescue StandardError => ex
|
19
|
-
if File::ALT_SEPARATOR
|
20
|
-
"C:/"
|
21
|
-
else
|
22
|
-
"/"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
module S4tUtils
|
2
|
-
|
3
|
-
module_function
|
4
|
-
|
5
|
-
def broaden_test_name(name)
|
6
|
-
if /test$/ =~ name
|
7
|
-
"{#{name},#{name}s}"
|
8
|
-
elsif /tests$/ =~ name
|
9
|
-
"{#{name[0...-1]},#{name}}"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
def pending?(test)
|
14
|
-
/^pending[.-]/ =~ File.basename(test)
|
15
|
-
end
|
16
|
-
|
17
|
-
def desired_subset(tests,
|
18
|
-
pendingp = ENV['S4T_ONLY_PENDING_TESTS'] == 'true')
|
19
|
-
if pendingp
|
20
|
-
tests
|
21
|
-
else
|
22
|
-
tests.reject { | test | pending?(test) }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def run_particular_tests(where, which)
|
27
|
-
Dir.chdir(where) {
|
28
|
-
test_description = case which
|
29
|
-
when nil, 'all', 'alltests'
|
30
|
-
"**/*{tests,test}.rb"
|
31
|
-
when 'fast'
|
32
|
-
"**/*-{tests,test}.rb"
|
33
|
-
when 'slow'
|
34
|
-
"**/*-{slowtests,slowtest}.rb"
|
35
|
-
else
|
36
|
-
which = broaden_test_name(which)
|
37
|
-
"**/*-#{which}.rb"
|
38
|
-
end
|
39
|
-
|
40
|
-
tests = desired_subset(Dir.glob(test_description))
|
41
|
-
tests.each do | testfile |
|
42
|
-
puts testfile
|
43
|
-
require testfile
|
44
|
-
end
|
45
|
-
}
|
46
|
-
end
|
47
|
-
|
48
|
-
def increment_version(version_file)
|
49
|
-
text = IO.read(version_file)
|
50
|
-
text.gsub!(/Version\s*=\s*'(\d+)\.(\d+)\.(\d+)'/) { | match |
|
51
|
-
update = "Version = '#{$1}.#{$2}.#{$3.to_i+1}'"
|
52
|
-
puts update
|
53
|
-
update
|
54
|
-
}
|
55
|
-
File.open(version_file, 'w') do | io |
|
56
|
-
io.write(text)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def generated_taskname(string, prefix="__generated__")
|
61
|
-
prefix + symbol_safe_name(string)
|
62
|
-
end
|
63
|
-
|
64
|
-
def update_peer_subtask_name(filesystem_name)
|
65
|
-
generated_taskname(filesystem_name, "__update_peers_")
|
66
|
-
end
|
67
|
-
|
68
|
-
def subprocess(args)
|
69
|
-
Dir.chdir($test_search_root) do
|
70
|
-
cmd = "ruby -S rake #{$rakefile_local} #{args}" # Windows can't find Rake directly.
|
71
|
-
system(cmd)
|
72
|
-
raise "#{cmd} failed" unless $?==0
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,106 +0,0 @@
|
|
1
|
-
# This is the part of a Rakefile that is common to all those that
|
2
|
-
# follow the Scripting for Testers format.
|
3
|
-
|
4
|
-
require 'pathname'
|
5
|
-
|
6
|
-
desc 'The default is "rake test".'
|
7
|
-
task 'default' => 'test'
|
8
|
-
|
9
|
-
desc "Run fast and slow tests."
|
10
|
-
task 'test' => ['fast', 'slow']
|
11
|
-
|
12
|
-
task 'tests' => 'test'
|
13
|
-
task 'alltests' => 'tests'
|
14
|
-
task 'all-tests' => 'alltests'
|
15
|
-
|
16
|
-
$test_search_root=Pathname.new(PACKAGE_ROOT)+'test'
|
17
|
-
$rakefile_local=''
|
18
|
-
ENV['S4T_ONLY_PENDING_TESTS'] ||= 'false'
|
19
|
-
|
20
|
-
desc "Limit scope of testing to current directory."
|
21
|
-
task 'local' do
|
22
|
-
$test_search_root=Pathname.new(Rake.original_dir)
|
23
|
-
$rakefile_local='local'
|
24
|
-
end
|
25
|
-
|
26
|
-
desc "Run only pending tests. (They're normally ignored.)"
|
27
|
-
task 'pending' do
|
28
|
-
ENV['S4T_ONLY_PENDING_TESTS'] = 'true'
|
29
|
-
end
|
30
|
-
|
31
|
-
desc "Run fast tests."
|
32
|
-
task 'fast' do
|
33
|
-
run_particular_tests($test_search_root, 'fast')
|
34
|
-
end
|
35
|
-
|
36
|
-
desc "Run slow tests."
|
37
|
-
task 'slow' do
|
38
|
-
run_particular_tests($test_search_root, 'slow')
|
39
|
-
end
|
40
|
-
|
41
|
-
desc "Increment the most minor part of the version number."
|
42
|
-
task 'increment-version' do
|
43
|
-
increment_version("lib/#{MyFileSystemName}/version.rb")
|
44
|
-
end
|
45
|
-
|
46
|
-
desc 'Commit entire tree, popping up $EDITOR for comments.'
|
47
|
-
task 'commit' => 'all-tests-in-a-subprocess' do
|
48
|
-
if SvnFileTransfer.under_svn_control?("./Rakefile")
|
49
|
-
puts `svn commit`
|
50
|
-
else
|
51
|
-
puts "-> note: not under version control"
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
desc 'Update peer packages that use this one.'
|
56
|
-
task 'update-peers'
|
57
|
-
|
58
|
-
(ENV["S4T_PROJECT_HOLDERS"] || "..").split.each do | holder |
|
59
|
-
Dir.glob("#{holder}/*/lib/*/third-party/#{MyFileSystemName}").each do | peer |
|
60
|
-
dest = Pathname.new(peer).parent
|
61
|
-
taskname = update_peer_subtask_name(dest.parent.basename)
|
62
|
-
task 'update-peers' => taskname
|
63
|
-
task taskname do
|
64
|
-
SvnFileTransfer.transfer_dir(Pathname.new('lib'), dest, :keep_others)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
desc "Install into peer directory, named with peer=NAME."
|
70
|
-
task 'install-into' do
|
71
|
-
peer = ENV['peer']
|
72
|
-
third_party = Pathname.new("../#{peer}/lib/#{peer}/third-party")
|
73
|
-
if File.exist?(third_party)
|
74
|
-
SvnFileTransfer.transfer_dir(Pathname.new('lib'), third_party,
|
75
|
-
:keep_others)
|
76
|
-
else
|
77
|
-
raise "No such peer: '#{peer}'"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
desc "Test, increment version, commit, and update peers."
|
83
|
-
task 'move-on' => [
|
84
|
-
'confirm', 'all-tests-in-a-subprocess', 'increment-version',
|
85
|
-
'commit', 'update-peers'
|
86
|
-
]
|
87
|
-
|
88
|
-
desc "Install (with setup.rb) after running tests."
|
89
|
-
task 'install' => 'all-tests-in-a-subprocess' do
|
90
|
-
system('ruby setup.rb all')
|
91
|
-
end
|
92
|
-
|
93
|
-
task 'confirm' do
|
94
|
-
exit(1) unless ask('y', "Continue?") == 'y'
|
95
|
-
end
|
96
|
-
|
97
|
-
task 'all-tests-in-a-subprocess' do
|
98
|
-
subprocess('alltests')
|
99
|
-
end
|
100
|
-
|
101
|
-
require 'rake/rdoctask'
|
102
|
-
Rake::RDocTask.new do |rd|
|
103
|
-
rd.main = MyModuleName
|
104
|
-
rd.rdoc_dir = "doc/html"
|
105
|
-
rd.rdoc_files = MyRdocFiles
|
106
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
module S4tUtils
|
5
|
-
|
6
|
-
# This transfers, taking care not to copy Subversion directories
|
7
|
-
# and other things not of interest.
|
8
|
-
|
9
|
-
# These are not particularly well tested. Use at your own risk.
|
10
|
-
|
11
|
-
module SvnFileTransfer
|
12
|
-
include FileUtils
|
13
|
-
|
14
|
-
module_function
|
15
|
-
|
16
|
-
def transfer_dir(src, dest, leave_extras=false)
|
17
|
-
# puts "transfer dir #{src} to #{dest}."
|
18
|
-
unless File.exist?(dest)
|
19
|
-
svn_mkdir dest
|
20
|
-
end
|
21
|
-
src_files = interesting(Dir.chdir(src) { Dir.glob('*') }).sort
|
22
|
-
dest_files = interesting(Dir.chdir(dest) { Dir.glob('*')}).sort
|
23
|
-
# puts "src_files = #{src_files.inspect}"
|
24
|
-
# puts "dest_files = #{dest_files.inspect}"
|
25
|
-
src_files.each do | src_file |
|
26
|
-
if dest_files.delete(src_file)
|
27
|
-
update_existing_destination(src, dest, src_file)
|
28
|
-
else
|
29
|
-
create_and_transfer(src, dest, src_file)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
unless leave_extras
|
33
|
-
dest_files.each do | dest_file |
|
34
|
-
svn_rm(dest+dest_file)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def update_existing_destination(src, dest, common_name)
|
40
|
-
src = src+common_name
|
41
|
-
dest = dest+common_name
|
42
|
-
user_claims(File.directory?(src) == File.directory?(dest)) {
|
43
|
-
"#{src} is a different type of file than #{dest}."
|
44
|
-
}
|
45
|
-
if File.directory?(src)
|
46
|
-
transfer_dir(src, dest)
|
47
|
-
elsif not uptodate?(dest, [src])
|
48
|
-
cp(src, dest, :verbose=>true)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def create_and_transfer(src, dest, new_name)
|
53
|
-
src = src+new_name
|
54
|
-
dest = dest+new_name
|
55
|
-
if File.directory?(src)
|
56
|
-
transfer_dir(src, dest)
|
57
|
-
else
|
58
|
-
cp(src, dest, :verbose=>true)
|
59
|
-
svn_add(dest)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def under_svn_control?(pathname)
|
64
|
-
File.exist?(Pathname.new(pathname).parent + '.svn')
|
65
|
-
end
|
66
|
-
|
67
|
-
def svn_cmd(cmd, pathname)
|
68
|
-
cmd = "svn #{cmd} #{pathname}"
|
69
|
-
puts cmd
|
70
|
-
system(cmd)
|
71
|
-
exit if $? != 0
|
72
|
-
end
|
73
|
-
|
74
|
-
def svn_rm(pathname)
|
75
|
-
svn_cmd('rm --force', pathname) if under_svn_control?(pathname)
|
76
|
-
rm_rf pathname
|
77
|
-
end
|
78
|
-
|
79
|
-
def svn_add(pathname)
|
80
|
-
svn_cmd('add', pathname) if under_svn_control?(pathname)
|
81
|
-
end
|
82
|
-
|
83
|
-
def svn_mkdir(pathname)
|
84
|
-
if under_svn_control?(pathname)
|
85
|
-
svn_cmd('mkdir', pathname)
|
86
|
-
else
|
87
|
-
mkdir pathname
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
def interesting(basenames)
|
92
|
-
basenames.reject do | basename |
|
93
|
-
basename[0,1] == '.' or
|
94
|
-
basename =~ /^\#.*\#$/ or
|
95
|
-
basename =~ /.*~$/ or
|
96
|
-
basename == 'third-party'
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
|
2
|
-
module S4tUtils
|
3
|
-
module TestUtil
|
4
|
-
|
5
|
-
module_function
|
6
|
-
|
7
|
-
def script(name)
|
8
|
-
File.join(PACKAGE_ROOT, 'bin', name)
|
9
|
-
end
|
10
|
-
|
11
|
-
def test(filename)
|
12
|
-
File.join(PACKAGE_ROOT, 'test', filename)
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_data(filename)
|
16
|
-
File.join(PACKAGE_ROOT, 'test', 'data', filename)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|