graffle 0.1.0 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/History.txt +5 -0
  2. data/LICENSE.txt +2 -2
  3. data/Manifest.txt +7 -15
  4. data/Rakefile +5 -10
  5. data/Rakefile.hoe +9 -4
  6. data/bin/bin-skeleton +1 -11
  7. data/graffle.tmproj +2 -310
  8. data/lib/graffle/stereotypes.rb +32 -19
  9. data/lib/graffle/styled-text-reader.rb +0 -5
  10. data/lib/graffle/version.rb +1 -1
  11. data/lib/grail_test.rb +16 -0
  12. data/lib/grail_test/command-interpreters.rb +78 -0
  13. data/test/grails-tests/commands-from-quoted-args-tests.rb +86 -0
  14. data/test/grails-tests/destinations-tests.rb +19 -0
  15. data/test/grails-tests/do-nothing-commands-tests.rb +18 -0
  16. data/test/grails-tests/graphic-interpreter-tests.rb +70 -0
  17. data/test/grails-tests/translation-testcase.rb +25 -0
  18. data/test/line-graphic-tests.rb +10 -0
  19. data/test/set-standalone-test-paths.rb +4 -1
  20. data/test/shaped-graphic-tests.rb +6 -2
  21. data/test/styled-text-reader-tests.rb +0 -12
  22. data/test/text-tests.rb +9 -5
  23. metadata +25 -20
  24. data/lib/graffle/third-party/s4t-utils.rb +0 -21
  25. data/lib/graffle/third-party/s4t-utils/capturing-globals.rb +0 -78
  26. data/lib/graffle/third-party/s4t-utils/claims.rb +0 -14
  27. data/lib/graffle/third-party/s4t-utils/command-line.rb +0 -15
  28. data/lib/graffle/third-party/s4t-utils/error-handling.rb +0 -20
  29. data/lib/graffle/third-party/s4t-utils/friendly-format.rb +0 -27
  30. data/lib/graffle/third-party/s4t-utils/hacks.rb +0 -32
  31. data/lib/graffle/third-party/s4t-utils/load-path-auto-adjuster.rb +0 -120
  32. data/lib/graffle/third-party/s4t-utils/more-assertions.rb +0 -29
  33. data/lib/graffle/third-party/s4t-utils/os.rb +0 -28
  34. data/lib/graffle/third-party/s4t-utils/rake-task-helpers.rb +0 -75
  35. data/lib/graffle/third-party/s4t-utils/rakefile-common.rb +0 -106
  36. data/lib/graffle/third-party/s4t-utils/svn-file-movement.rb +0 -101
  37. data/lib/graffle/third-party/s4t-utils/test-util.rb +0 -19
  38. data/lib/graffle/third-party/s4t-utils/version.rb +0 -3
@@ -65,14 +65,18 @@ class TestShapedGraphics < Test::Unit::TestCase
65
65
  # retrieve the text node.
66
66
  assert_true(g.content.behaves_like?(Graffle::Text))
67
67
  assert_equal(%Q{John follows "sign up" link}, g.content.as_plain_text)
68
- assert_equal([['John follows', 'sign up', 'link']],
69
- g.content.as_tokens_within_lines)
68
+ assert_equal(['John follows "sign up" link'],
69
+ g.content.as_lines)
70
70
  end
71
71
 
72
72
  def test_shaped_graphics_do_not_have_to_have_text
73
73
  assert_false(shaped_graphic.has_content?)
74
74
  end
75
75
 
76
+ def test_for_some_purposes_its_convenient_to_have_null_text
77
+ assert_equal([], shaped_graphic.content.as_lines)
78
+ end
79
+
76
80
 
77
81
  def test_shaped_graphics_stereotypes_its_content
78
82
  s = sheet {
@@ -68,22 +68,10 @@ class TestStyledTextReaderConversions < Test::Unit::TestCase
68
68
  assert_equal(['type: button', 'name: run', 'active: no'], text.as_lines)
69
69
  end
70
70
 
71
- def test_single_line_text_as_message_tokens
72
- text = StyledTextReader.new(ONE_LINE)
73
- assert_equal([['WELCOME']], text.as_tokens_within_lines)
74
- end
75
-
76
- def test_splitting_of_tokens_by_double_quotes
77
- text = StyledTextReader.new(TWO_ONE_LINE_PARAGRAPHS)
78
- assert_equal([['John signs up as', 'john', 'email', "john@example.com", 'password', "sloop"],
79
- ['John sees a welcome page']],
80
- text.as_tokens_within_lines)
81
- end
82
71
 
83
72
  def test_plain_text_can_stand_in_for_rtf
84
73
  orig = %Q{token "tok" en}
85
74
  text = StyledTextReader.new(orig)
86
75
  assert_equal([orig], text.as_lines)
87
- assert_equal([['token', 'tok', 'en']], text.as_tokens_within_lines)
88
76
  end
89
77
  end
data/test/text-tests.rb CHANGED
@@ -39,17 +39,21 @@ class TestText < Test::Unit::TestCase
39
39
  assert_equal("John follows \"sign up\" link\nhi", text(RTF).as_plain_text)
40
40
  end
41
41
 
42
- def test_viewing_text_as_tokens_within_lines
43
- assert_equal([["John follows", "sign up", "link"], ["hi"]],
44
- text(RTF).as_tokens_within_lines)
42
+ def test_as_lines
43
+ assert_equal(["John follows \"sign up\" link", "hi"],
44
+ text(RTF).as_lines)
45
45
  end
46
46
 
47
47
  def test_plain_text_is_more_convenient_for_testing_so_allow_it
48
48
  unrtf = %Q{John follows "sign up" link}
49
- assert_equal([["John follows", "sign up", "link"]],
50
- text(unrtf).as_tokens_within_lines)
49
+ assert_equal(['John follows "sign up" link'],
50
+ text(unrtf).as_lines)
51
51
  end
52
52
 
53
53
 
54
+ def test_null_text_just_returns_empty_lines
55
+ assert_equal([], Text::Null.new.as_lines)
56
+ end
57
+
54
58
 
55
59
  end
metadata CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: graffle
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2007-07-07 00:00:00 -05:00
8
- summary: The author was too lazy to write a summary
6
+ version: 0.1.7
7
+ date: 2007-07-11 00:00:00 -05:00
8
+ summary: Working with OmniGraffle documents, including support for Rails integration tests.
9
9
  require_paths:
10
10
  - lib
11
11
  email: marick@exampler.com
12
- homepage: http://www.zenspider.com/ZSS/Products/graffle/
12
+ homepage: http://graffle.rubyforge.org
13
13
  rubyforge_project: graffle
14
- description: Working with OmniGraffle documents.
14
+ description: Working with OmniGraffle documents, including support for Rails integration tests.
15
15
  autorequire:
16
16
  default_executable:
17
17
  bindir: bin
@@ -44,22 +44,9 @@ files:
44
44
  - lib/graffle/point.rb
45
45
  - lib/graffle/stereotypes.rb
46
46
  - lib/graffle/styled-text-reader.rb
47
- - lib/graffle/third-party/s4t-utils.rb
48
- - lib/graffle/third-party/s4t-utils/capturing-globals.rb
49
- - lib/graffle/third-party/s4t-utils/claims.rb
50
- - lib/graffle/third-party/s4t-utils/command-line.rb
51
- - lib/graffle/third-party/s4t-utils/error-handling.rb
52
- - lib/graffle/third-party/s4t-utils/friendly-format.rb
53
- - lib/graffle/third-party/s4t-utils/hacks.rb
54
- - lib/graffle/third-party/s4t-utils/load-path-auto-adjuster.rb
55
- - lib/graffle/third-party/s4t-utils/more-assertions.rb
56
- - lib/graffle/third-party/s4t-utils/os.rb
57
- - lib/graffle/third-party/s4t-utils/rake-task-helpers.rb
58
- - lib/graffle/third-party/s4t-utils/rakefile-common.rb
59
- - lib/graffle/third-party/s4t-utils/svn-file-movement.rb
60
- - lib/graffle/third-party/s4t-utils/test-util.rb
61
- - lib/graffle/third-party/s4t-utils/version.rb
62
47
  - lib/graffle/version.rb
48
+ - lib/grail_test.rb
49
+ - lib/grail_test/command-interpreters.rb
63
50
  - setup.rb
64
51
  - test/abstract-graphic-tests.rb
65
52
  - test/array-and-hash-stereotyping-tests.rb
@@ -71,6 +58,11 @@ files:
71
58
  - test/graffle-file-types/multiple-canvases.graffle
72
59
  - test/graffle-file-types/opening-tests.rb
73
60
  - test/graffle-file-types/two-boxes-and-a-line.graffle
61
+ - test/grails-tests/commands-from-quoted-args-tests.rb
62
+ - test/grails-tests/destinations-tests.rb
63
+ - test/grails-tests/do-nothing-commands-tests.rb
64
+ - test/grails-tests/graphic-interpreter-tests.rb
65
+ - test/grails-tests/translation-testcase.rb
74
66
  - test/group-tests.rb
75
67
  - test/hacks-tests.rb
76
68
  - test/line-graphic-tests.rb
@@ -95,6 +87,10 @@ test_files:
95
87
  - test/styled-text-reader-tests.rb
96
88
  - test/text-tests.rb
97
89
  - test/graffle-file-types/opening-tests.rb
90
+ - test/grails-tests/commands-from-quoted-args-tests.rb
91
+ - test/grails-tests/destinations-tests.rb
92
+ - test/grails-tests/do-nothing-commands-tests.rb
93
+ - test/grails-tests/graphic-interpreter-tests.rb
98
94
  rdoc_options:
99
95
  - --main
100
96
  - README.txt
@@ -128,6 +124,15 @@ dependencies:
128
124
  - !ruby/object:Gem::Version
129
125
  version: 3.0.0
130
126
  version:
127
+ - !ruby/object:Gem::Dependency
128
+ name: s4t-utils
129
+ version_requirement:
130
+ version_requirements: !ruby/object:Gem::Version::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 1.0.0
135
+ version:
131
136
  - !ruby/object:Gem::Dependency
132
137
  name: hoe
133
138
  version_requirement:
@@ -1,21 +0,0 @@
1
- require 's4t-utils/capturing-globals'
2
- require 's4t-utils/error-handling'
3
- require 's4t-utils/more-assertions'
4
- require 's4t-utils/claims'
5
- require 's4t-utils/friendly-format'
6
- require 's4t-utils/rake-task-helpers'
7
- require 's4t-utils/svn-file-movement'
8
- require 's4t-utils/hacks'
9
- require 's4t-utils/command-line'
10
- require 's4t-utils/test-util'
11
- require 's4t-utils/os'
12
-
13
- require 'pp'
14
-
15
- # Tolerate typos
16
- S4TUtils=S4tUtils
17
- S4tUtil=S4tUtils
18
- S4TUtil=S4tUtils
19
-
20
- module S4tUtils
21
- end
@@ -1,78 +0,0 @@
1
- require 'stringio'
2
-
3
- module S4tUtils
4
-
5
- module_function
6
-
7
- def capturing_stderr
8
- old_stderr = $stderr
9
- new_stderr = StringIO.new
10
- begin
11
- $stderr = new_stderr
12
- yield
13
- ensure
14
- $stderr = old_stderr
15
- end
16
- new_stderr.string
17
- end
18
-
19
- def with_environment_vars(settings)
20
- begin
21
- old = {}
22
- settings.each { | key, value |
23
- old[key] = ENV[key]
24
- ENV[key] = value
25
- }
26
- yield
27
- ensure
28
- settings.each_key { | key |
29
- ENV[key] = old[key]
30
- }
31
- end
32
- end
33
-
34
- def with_home_right_here
35
- begin
36
- old_home = ENV['HOME']
37
- ENV['HOME'] = '.'
38
- yield
39
- ensure
40
- ENV['HOME'] = @old_home
41
- end
42
- end
43
-
44
- def erasing_local_config_file(file)
45
- with_home_right_here {
46
- begin
47
- File.delete(file) if File.exist?(file)
48
- yield
49
- ensure
50
- File.delete(file) if File.exist?(file)
51
- end
52
- }
53
- end
54
-
55
- def with_local_config_file(file, contents)
56
- erasing_local_config_file(file) do
57
- File.open(file, 'w') do | io |
58
- io.puts(contents.to_s)
59
- end
60
- yield
61
- end
62
- end
63
-
64
- def with_command_args(string)
65
- begin
66
- old_argv = ARGV.dup
67
- ARGV.replace(string.split)
68
- yield
69
- rescue SystemExit => ex
70
- replacement = StandardError.new(ex.message)
71
- replacement.set_backtrace(ex.backtrace)
72
- raise replacement
73
- ensure
74
- ARGV.replace(old_argv)
75
- end
76
- end
77
-
78
- end
@@ -1,14 +0,0 @@
1
- module S4tUtils
2
-
3
- module_function
4
-
5
- def user_claims(fact, &block)
6
- raise StandardError.new(block.call) unless fact
7
- end
8
-
9
- def user_disputes(fact, &block)
10
- user_claims(!fact, &block)
11
- end
12
- end
13
-
14
-
@@ -1,15 +0,0 @@
1
- module S4tUtils
2
-
3
- module_function
4
-
5
- def ask(default_answer, *question_lines)
6
- puts question_lines
7
- print "[#{default_answer}] => "
8
- answer = STDIN.readline.strip
9
- answer = default_answer.to_s if answer == ''
10
- answer
11
- end
12
-
13
- end
14
-
15
-
@@ -1,20 +0,0 @@
1
- module S4tUtils
2
-
3
- module_function
4
-
5
- def with_pleasant_exceptions
6
- yield
7
- rescue SystemExit
8
- raise
9
- rescue Exception => ex
10
- $stderr.puts(ex.message)
11
- end
12
-
13
- # with_pleasant_exceptions swallows the stack trace, which you
14
- # want to see during debugging. The easy way to see it is to add
15
- # 'out' to the method, giving this:
16
- def without_pleasant_exceptions
17
- $stderr.puts "Note: exception handling turned off."
18
- yield
19
- end
20
- end
@@ -1,27 +0,0 @@
1
- # Note: see also <http://englishext.rubyforge.org/>
2
-
3
- module S4tUtils
4
-
5
- module_function
6
-
7
- def friendly_list(connector, array)
8
- quoted = array.collect { | elt | "'" + elt.to_s + "'" }
9
- case array.length
10
- when 0
11
- ""
12
- when 1
13
- quoted[0]
14
- when 2
15
- quoted[0] + " #{connector} " + quoted[1]
16
- else
17
- quoted[0...-1].join(", ") + ", #{connector} #{quoted.last}"
18
- end
19
- end
20
-
21
- # Produces a version of a string that can be typed after a :
22
- # (Can also be safely given at a command-line prompt.
23
- def symbol_safe_name(name)
24
- name.to_s.gsub(/\W/, '')
25
- end
26
- end
27
-
@@ -1,32 +0,0 @@
1
- module S4tUtils
2
-
3
- module_function
4
-
5
- def prog1(retval)
6
- yield(retval)
7
- retval
8
- end
9
-
10
- # Allow debugging like this:
11
- # x = pi y # adding pi doesn't change effect of x=y
12
- def pi(arg, leader=nil)
13
- leader = (leader == nil) ? '' : leader + ': '
14
- prog1(arg) { puts leader + arg.inspect }
15
- end
16
-
17
-
18
-
19
- class ArgForwarder
20
- def initialize(target, *added_args)
21
- @target = target
22
- @added_args = added_args
23
- end
24
-
25
- def method_missing(method, *args)
26
- @target.send(method, *(@added_args + args))
27
- end
28
- end
29
-
30
-
31
-
32
- end
@@ -1,120 +0,0 @@
1
- # This is loaded by an executable script in one of two cases:
2
- #
3
- # It's a development version living in the bin part of this directory
4
- # structure (but it can invoked from any place).
5
- #
6
- # project/
7
- # bin/
8
- # lib/
9
- # project/
10
- # third-party/
11
- # s4t-utils/
12
- # this file
13
- #
14
- # It's a deployed version living in some random place, with
15
- # the site_ruby directory in the page.
16
- #
17
- # site_ruby/1.8/
18
- # project/
19
- # third-party/
20
- # s4t-utils/
21
- # this file
22
- #
23
- #
24
- # In order for this file to have been required in both cases, the following
25
- # code is executed in the caller:
26
- #
27
- #
28
- # $:.unshift((Pathname.new(__FILE__).parent.parent + 'lib').to_s)
29
- # require 'package/third-party/s4t-utils/load-path-auto-adjuster'
30
- #
31
- # In the first case, that will put something like "../lib" on the load
32
- # path. In the second case, it will put harmless garbage on the path
33
- # (harmless because it won't contain this file, which will still be
34
- # found somewhere later in the load path).
35
- #
36
- # The first thing this file does is pop that off, it having done its job.
37
- # In the first (development) case, it puts the following on the load path:
38
- # project/lib & project/lib/project/third-party & project
39
- # ('project' is added so that <require 'test/util-file'> works.)
40
- #
41
- # In the second, it adds only the third-party library and takes care
42
- # to add it just after whatever component in the path contains this
43
- # file. (It will thus not interfere with clashing packages earlier
44
- # in the path.)
45
- # site_ruby/1.8/project/third-party
46
- # since site_ruby/1.8 (or the equivalent) is already on there.
47
-
48
- require 'rubygems'
49
- require 'pathname'
50
-
51
- module S4tUtils
52
- module Hidden # This should not interfere with any namespace.
53
-
54
- class Arranger
55
- def initialize(third_party)
56
- @third_party_lib = third_party
57
- @project_lib = third_party.parent.parent
58
- @test_util_root = @project_lib.parent
59
- end
60
-
61
- def self.arrange_path_around(third_party)
62
- new(third_party).arrange
63
- end
64
-
65
- def arrange
66
- add_third_party_gems
67
- if project_lib_already_in_path?
68
- just_add_third_party_after_project_lib
69
- else
70
- add_everything_at_front
71
- end
72
- end
73
-
74
-
75
- def add_third_party_gems
76
- # When RubyGems 0.8.11 gets clear_paths, it does not clear the
77
- # cache used by Gem's overriding version of require(), so if
78
- # this is loaded after the first Gem is required, it will have
79
- # no effect on later uses of require(). (But it does affect
80
- # require_gem.)
81
- #
82
- ENV['GEM_PATH']=(@third_party_lib+'gems').to_s
83
- Gem.clear_paths
84
- end
85
-
86
- def project_lib_already_in_path?
87
- $:.include?(@project_lib.to_s)
88
- end
89
-
90
- def just_add_third_party_after_project_lib
91
- $:.each_with_index do | path_element, index |
92
- if path_element == @project_lib.to_s
93
- $:[index+1,0] = @third_party_lib.to_s
94
- return
95
- end
96
- end
97
- fail "No place to put third_party library."
98
- end
99
-
100
- def add_everything_at_front
101
- $:.unshift(@test_util_root.to_s)
102
- $:.unshift(@third_party_lib.to_s)
103
- $:.unshift(@project_lib.to_s) # This is now first
104
- end
105
- end
106
-
107
- def self.auto_adjust_load_path
108
- $:.shift # Remove extra element used to find this file.
109
-
110
- # Having loaded us, __FILE__ is something like this:
111
- # ...lib.../package/third-party/s4t-utils/load-path-auto-adjuster.rb
112
- relative_third_party = Pathname.new(__FILE__).parent.parent
113
- # Pathname#real_path doesn't work on Windows (1.8.2). Grr.
114
- third_party = Pathname.new(File.expand_path(relative_third_party.to_s))
115
- Arranger.arrange_path_around(third_party)
116
- end
117
-
118
- auto_adjust_load_path
119
- end
120
- end