jota 0.8.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/INSTALL +145 -0
- data/bin/jota +12 -0
- data/bin/jotacli +12 -0
- data/lib/app_error.rb +5 -0
- data/lib/cli.rb +277 -0
- data/lib/clip.rb +137 -0
- data/lib/clip_array.rb +393 -0
- data/lib/gui.rb +792 -0
- data/lib/helper.rb +129 -0
- data/lib/jota.glade +730 -0
- data/lib/jota.rb +176 -0
- data/lib/preferences.rb +83 -0
- data/lib/svn_info.rb +16 -0
- data/lib/version.rb +59 -0
- data/tests/test_all.rb +10 -0
- data/tests/test_clip.rb +172 -0
- data/tests/test_clip_array.rb +177 -0
- data/tests/test_preferences.rb +185 -0
- metadata +81 -0
@@ -0,0 +1,185 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'preferences'
|
4
|
+
|
5
|
+
#$test_time = Time.now
|
6
|
+
# Time.now contains a usec value that cannot be saved
|
7
|
+
$test_time = Time.parse("2007-10-20 12:34:56")
|
8
|
+
$test_time_str = $test_time.ctime
|
9
|
+
|
10
|
+
|
11
|
+
def build_clip(title,data,type,wrap)
|
12
|
+
c = Clip.new
|
13
|
+
c.title = title
|
14
|
+
c.data = data # sets implicitly c.type
|
15
|
+
c.wrap = wrap
|
16
|
+
c.created = $test_time
|
17
|
+
return c
|
18
|
+
end
|
19
|
+
|
20
|
+
class TestClip < Test::Unit::TestCase
|
21
|
+
|
22
|
+
default_hash = {"autosave_seconds"=>600, "confirm_delete"=>false, "autosave_enable"=>true, "background"=>[20316, 20316, 20316], "deletesave_enable"=>true, "confirm_quit"=>true, "font"=>"Courier Bold 12", "foreground"=>[65535, 65535, 65535], "text_wrap"=>true, "deletesave_file"=>"./$f.deleted-%Y%m%d"}
|
23
|
+
|
24
|
+
def test_new
|
25
|
+
p = Preferences.new
|
26
|
+
assert_equal(default_hash,p)
|
27
|
+
|
28
|
+
def test_defaults
|
29
|
+
p = Preferences.new
|
30
|
+
d = Preferences.defaults
|
31
|
+
assert_equal(p,d)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_yaml
|
35
|
+
p = Preferences.new
|
36
|
+
yaml = p.write
|
37
|
+
q = Preferences.read(yaml)
|
38
|
+
assert_equal(p,q)
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
vvvvvvvv loeschen vvvvvvvvv
|
44
|
+
|
45
|
+
|
46
|
+
def test_data
|
47
|
+
c = Clip.new
|
48
|
+
c.data = "test"
|
49
|
+
assert_equal("test",c.data)
|
50
|
+
assert_equal("",c.title)
|
51
|
+
assert_equal(false,c.wrap)
|
52
|
+
assert_equal(:text,c.type)
|
53
|
+
assert(!c.empty?)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_title
|
57
|
+
c = Clip.new
|
58
|
+
c.title = "title"
|
59
|
+
assert_equal("",c.data)
|
60
|
+
assert_equal(false,c.wrap)
|
61
|
+
assert_equal("title",c.title)
|
62
|
+
assert_equal(:text,c.type)
|
63
|
+
assert(!c.empty?)
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_wrap
|
67
|
+
c = Clip.new
|
68
|
+
c.data = "text"
|
69
|
+
c.title = "title"
|
70
|
+
c.wrap = true
|
71
|
+
assert_equal("text",c.data)
|
72
|
+
assert_equal(true,c.wrap)
|
73
|
+
assert_equal("title",c.title)
|
74
|
+
assert_equal(:text,c.type)
|
75
|
+
assert(!c.empty?)
|
76
|
+
|
77
|
+
c.wrap = false
|
78
|
+
assert_equal("text",c.data)
|
79
|
+
assert_equal(false,c.wrap)
|
80
|
+
assert_equal("title",c.title)
|
81
|
+
assert_equal(:text,c.type)
|
82
|
+
assert(!c.empty?)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_created
|
86
|
+
c = Clip.new
|
87
|
+
c.created = $test_time
|
88
|
+
assert_equal($test_time,c.created)
|
89
|
+
assert(c.empty?)
|
90
|
+
end
|
91
|
+
|
92
|
+
$sample = [
|
93
|
+
{
|
94
|
+
:clip => build_clip("title","text\n",:text,true),
|
95
|
+
:hash => {
|
96
|
+
"type" => :text,
|
97
|
+
"wrap" => true,
|
98
|
+
"data" => "text\n",
|
99
|
+
"title" => "title",
|
100
|
+
"created" => $test_time
|
101
|
+
},
|
102
|
+
:mbox => "Date: #{$test_time_str}
|
103
|
+
Subject: title
|
104
|
+
Content-Type: text/plain
|
105
|
+
X-Wrap: true
|
106
|
+
X-Saved-By: jota
|
107
|
+
|
108
|
+
text
|
109
|
+
"
|
110
|
+
},
|
111
|
+
{
|
112
|
+
:clip => build_clip(" title ","text\n",:text,false),
|
113
|
+
:hash => {
|
114
|
+
"type" => :text,
|
115
|
+
"wrap" => false,
|
116
|
+
"data" => "text\n",
|
117
|
+
"title" => " title ",
|
118
|
+
"created" => $test_time
|
119
|
+
},
|
120
|
+
:mbox => "Date: #{$test_time_str}
|
121
|
+
Subject: title
|
122
|
+
Content-Type: text/plain
|
123
|
+
X-Wrap: false
|
124
|
+
X-Saved-By: jota
|
125
|
+
|
126
|
+
text
|
127
|
+
"
|
128
|
+
},
|
129
|
+
{
|
130
|
+
:clip => build_clip("TITLE","text \n\n",:text,false),
|
131
|
+
:hash => {
|
132
|
+
"type" => :text,
|
133
|
+
"wrap" => false,
|
134
|
+
"data" => "text \n\n",
|
135
|
+
"title" => "TITLE",
|
136
|
+
"created" => $test_time
|
137
|
+
},
|
138
|
+
:mbox => "Date: #{$test_time_str}
|
139
|
+
Subject: TITLE
|
140
|
+
Content-Type: text/plain
|
141
|
+
X-Wrap: false
|
142
|
+
X-Saved-By: jota
|
143
|
+
|
144
|
+
text
|
145
|
+
|
146
|
+
"
|
147
|
+
}
|
148
|
+
]
|
149
|
+
|
150
|
+
def test_to_hash
|
151
|
+
$sample.each do | sample |
|
152
|
+
c = sample[:clip]
|
153
|
+
h = c.to_hash
|
154
|
+
assert_equal(sample[:hash], h)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_from_hash
|
159
|
+
$sample.each do | sample |
|
160
|
+
h = sample[:hash]
|
161
|
+
c = Clip.from_hash(h)
|
162
|
+
assert_equal(sample[:clip], c)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_to_mbox
|
167
|
+
$sample.each do | sample |
|
168
|
+
c = sample[:clip]
|
169
|
+
r = c.to_mbox
|
170
|
+
assert_equal(sample[:mbox], r)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_from_mbox
|
175
|
+
$sample.each do | sample |
|
176
|
+
r = sample[:mbox]
|
177
|
+
c = Clip.from_mbox(r)
|
178
|
+
assert_equal(sample[:clip], c)
|
179
|
+
#assert_equal(sample[:clip].to_mbox, c.to_mbox)
|
180
|
+
#puts c.created.usec
|
181
|
+
#puts sample[:clip].created.usec
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
end # class
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jota
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Derik van Zuetphen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-02-09 11:11:02 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: cmd
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.7.2
|
24
|
+
version:
|
25
|
+
description: ""
|
26
|
+
email: dz@426.ch
|
27
|
+
executables:
|
28
|
+
- jota
|
29
|
+
- jotacli
|
30
|
+
extensions: []
|
31
|
+
|
32
|
+
extra_rdoc_files:
|
33
|
+
- INSTALL
|
34
|
+
files:
|
35
|
+
- lib/app_error.rb
|
36
|
+
- lib/cli.rb
|
37
|
+
- lib/version.rb
|
38
|
+
- lib/preferences.rb
|
39
|
+
- lib/jota.rb
|
40
|
+
- lib/helper.rb
|
41
|
+
- lib/gui.rb
|
42
|
+
- lib/clip.rb
|
43
|
+
- lib/clip_array.rb
|
44
|
+
- lib/svn_info.rb
|
45
|
+
- lib/jota.glade
|
46
|
+
- tests/test_preferences.rb
|
47
|
+
- tests/test_clip_array.rb
|
48
|
+
- tests/test_clip.rb
|
49
|
+
- tests/test_all.rb
|
50
|
+
- INSTALL
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: http://426.ch/jota
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
version:
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
70
|
+
requirements: []
|
71
|
+
|
72
|
+
rubyforge_project: jota
|
73
|
+
rubygems_version: 1.2.0
|
74
|
+
signing_key:
|
75
|
+
specification_version: 2
|
76
|
+
summary: A simple but powerful jotter in the style of xclipboard
|
77
|
+
test_files:
|
78
|
+
- tests/test_preferences.rb
|
79
|
+
- tests/test_clip_array.rb
|
80
|
+
- tests/test_clip.rb
|
81
|
+
- tests/test_all.rb
|