timelog4r 0.0.1

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/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'timelog4r'
@@ -0,0 +1,412 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ describe Timelog4r, ' when first created' do
4
+ before do
5
+ @accessor = Timelog4r.new
6
+ @dummy_image = '
7
+ <image>
8
+ <normal>http://a.com</normal>
9
+ <thumb>http://a.com</thumb>
10
+ <small>http://a.com</small>
11
+ </image>'
12
+ @dummy_author_a = '
13
+ <author>
14
+ <id>a</id>
15
+ <name>a</name>
16
+ <statflag>1</statflag>' +
17
+ @dummy_image +
18
+ '</author>'
19
+ @dummy_author_b = '
20
+ <author>
21
+ <id>b</id>
22
+ <name>b</name>
23
+ <statflag>2</statflag>' +
24
+ @dummy_image +
25
+ '</author>'
26
+ @dummy_tag = '<tag>hoge,fuga,</tag>'
27
+ @dummy_entry_a = '
28
+ <entry>
29
+ <id>a</id>
30
+ <memo>a</memo>
31
+ <dispflag>0</dispflag>' +
32
+ @dummy_tag +
33
+ '<tododate> </tododate>
34
+ <toid>a</toid>
35
+ <toname>a</toname>
36
+ <replyid>a</replyid>
37
+ <link href="http://a.com" />
38
+ <modified>200201220122</modified>' +
39
+ @dummy_author_a +
40
+ '</entry>'
41
+ @dummy_entry_b = '
42
+ <entry>
43
+ <id>b</id>
44
+ <memo>b</memo>
45
+ <dispflag>1</dispflag>' +
46
+ @dummy_tag +
47
+ '<tododate>200202011010</tododate>
48
+ <toid></toid>
49
+ <toname></toname>
50
+ <replyid></replyid>
51
+ <link href="http://a.com" />
52
+ <modified>200201220122</modified>
53
+ <fromid>b</fromid>
54
+ <fromname>b</fromname>' +
55
+ @dummy_author_b +
56
+ '</entry>'
57
+ @dummy_entry_c = '
58
+ <entry>
59
+ <id>c</id>
60
+ <memo>c</memo>
61
+ <dispflag>2</dispflag>' +
62
+ @dummy_tag +
63
+ '<tododate> </tododate>
64
+ <toid>a</toid>
65
+ <toname>a</toname>
66
+ <replyid>a</replyid>
67
+ <link href="http://a.com" />
68
+ <modified>200201220122</modified>' +
69
+ @dummy_author_a +
70
+ '</entry>'
71
+ @dummy_timeline = '
72
+ <memos>
73
+ <title>hoge</title>
74
+ <link href="http://hoge.com/" />
75
+ <modified>200202020101</modified>' +
76
+ @dummy_author_a +
77
+ @dummy_entry_a +
78
+ @dummy_entry_b +
79
+ @dummy_entry_c +
80
+ '</memos>'
81
+ @dummy_user_list = '
82
+ <friends>
83
+ <title>a</title>
84
+ <link href="http://a.com" />
85
+ <modified>200210202020</modified>
86
+ <recordcount>10</recordcount>' +
87
+ @dummy_author_a +
88
+ '<entry>
89
+ <id>a</id>
90
+ <name>a</name>
91
+ <modified>200503050607</modified>' +
92
+ @dummy_image +
93
+ '</entry>
94
+ </friends>'
95
+ @dummy_tag_list = '
96
+ <tags>
97
+ <title>a</title>
98
+ <link href="http://a.com" />
99
+ <modified>200405060708</modified>
100
+ <tagdata>
101
+ <tag>hoge</tag>
102
+ <cnt>10</cnt>
103
+ </tagdata>
104
+ </tags>'
105
+ @dummy_profile = '
106
+ <show>
107
+ <title>a</title>
108
+ <link href="http://a.com" />
109
+ <modified>200510111213</modified>
110
+ <user>
111
+ <id>a</id>
112
+ <name>a</name>
113
+ <url>http://a.com</url>
114
+ <prof_url>http://a.com</prof_url>
115
+ <prof_msg>a</prof_msg>
116
+ <tags>hoge,fuga,</tags>' +
117
+ @dummy_image +
118
+ '</user>
119
+ </show>'
120
+ end
121
+
122
+ it 'should be have a user agent "timelog4r"' do
123
+ @accessor.user_agent.should be_eql('timelog4r')
124
+ end
125
+
126
+ it 'should not have a user id' do
127
+ @accessor.user_id.should be_nil
128
+ end
129
+
130
+ it 'should not have a password' do
131
+ @accessor.password.should be_nil
132
+ end
133
+
134
+ describe ' when get public timeline' do
135
+ before do
136
+ doc = REXML::Document.new(@dummy_timeline)
137
+ @accessor.user_id = 'dummy'
138
+ @accessor.password = 'dummy'
139
+ @accessor.should_receive(:http_access).once.and_return(doc)
140
+ end
141
+
142
+ it 'successful should be a kind of Hash' do
143
+ @accessor.get_public_timeline.should be_a_kind_of(Hash)
144
+ end
145
+
146
+ after do
147
+ @accessor.user_id = nil
148
+ @accessor.password = nil
149
+ end
150
+ end
151
+
152
+ describe ' when get my timeline' do
153
+ before do
154
+ doc = REXML::Document.new(@dummy_timeline)
155
+ @accessor.user_id = 'dummy'
156
+ @accessor.password = 'dummy'
157
+ @accessor.should_receive(:http_access).once.and_return(doc)
158
+ end
159
+
160
+ it 'success should be a kind of Hash' do
161
+ @accessor.get_my_timeline.should be_a_kind_of(Hash)
162
+ end
163
+
164
+ after do
165
+ @accessor.user_id = nil
166
+ @accessor.password = nil
167
+ end
168
+ end
169
+
170
+ describe ' when get reply list' do
171
+ before do
172
+ doc = REXML::Document.new(@dummy_timeline)
173
+ @accessor.user_id = 'dummy'
174
+ @accessor.password = 'dummy'
175
+ @accessor.should_receive(:http_access).once.and_return(doc)
176
+ end
177
+
178
+ it 'success should be a kind of Hash' do
179
+ @accessor.get_reply_list.should be_a_kind_of(Hash)
180
+ end
181
+
182
+ after do
183
+ @accessor.user_id = nil
184
+ @accessor.password = nil
185
+ end
186
+ end
187
+
188
+ describe ' when get direct messages' do
189
+ before do
190
+ doc = REXML::Document.new(@dummy_timeline)
191
+ @accessor.user_id = 'dummy'
192
+ @accessor.password = 'dummy'
193
+ @accessor.should_receive(:http_access).once.and_return(doc)
194
+ end
195
+
196
+ it 'success should be a kind of Hash' do
197
+ @accessor.get_direct_messages.should be_a_kind_of(Hash)
198
+ end
199
+
200
+ after do
201
+ @accessor.user_id = nil
202
+ @accessor.password = nil
203
+ end
204
+ end
205
+
206
+ describe ' when get friends timeline' do
207
+ before do
208
+ doc = REXML::Document.new(@dummy_timeline)
209
+ @accessor.should_receive(:http_access).once.and_return(doc)
210
+ end
211
+
212
+ it 'successful should be a kind of Hash' do
213
+ @accessor.get_friends_timeline.should be_a_kind_of(Hash)
214
+ end
215
+ end
216
+
217
+ describe ' when get tag list' do
218
+ before do
219
+ doc = REXML::Document.new(@dummy_tag_list)
220
+ @accessor.user_id = 'dummy'
221
+ @accessor.password = 'dummy'
222
+ @accessor.should_receive(:http_access).once.and_return(doc)
223
+ end
224
+
225
+ it 'success should be a kind of Hash' do
226
+ @accessor.get_tag_list.should be_a_kind_of(Hash)
227
+ end
228
+
229
+ after do
230
+ @accessor.user_id = nil
231
+ @accessor.password = nil
232
+ end
233
+ end
234
+
235
+ describe ' when get profile' do
236
+ before do
237
+ doc = REXML::Document.new(@dummy_profile)
238
+ @accessor.user_id = 'dummy'
239
+ @accessor.password = 'dummy'
240
+ @accessor.should_receive(:http_access).once.and_return(doc)
241
+ end
242
+
243
+ it 'success should be a kind of Hash' do
244
+ @accessor.get_profile.should be_a_kind_of(Hash)
245
+ end
246
+
247
+ after do
248
+ @accessor.user_id = nil
249
+ @accessor.password = nil
250
+ end
251
+ end
252
+
253
+ describe ' when get friend list' do
254
+ before do
255
+ doc = REXML::Document.new(@dummy_user_list)
256
+ @accessor.user_id = 'dummy'
257
+ @accessor.user_id = 'dummy'
258
+ @accessor.should_receive(:http_access).once.and_return(doc)
259
+ end
260
+
261
+ it 'success should be a kind of Hash' do
262
+ @accessor.get_friend_list.should be_a_kind_of(Hash)
263
+ end
264
+
265
+ after do
266
+ @accessor.user_id = nil
267
+ @accessor.password = nil
268
+ end
269
+ end
270
+
271
+ describe ' when get fan list' do
272
+ before do
273
+ doc = REXML::Document.new(@dummy_user_list)
274
+ @accessor.user_id = 'dummy'
275
+ @accessor.password = 'dummy'
276
+ @accessor.should_receive(:http_access).once.and_return(doc)
277
+ end
278
+
279
+ it 'success should be a kind of Hash' do
280
+ @accessor.get_fan_list.should be_a_kind_of(Hash)
281
+ end
282
+
283
+ after do
284
+ @accessor.user_id = nil
285
+ @accessor.password = nil
286
+ end
287
+ end
288
+
289
+ describe ' when update' do
290
+ before do
291
+ @accessor.user_id = 'dummy'
292
+ @accessor.password = 'dummy'
293
+ @accessor.should_receive(:http_access).once.and_return(true)
294
+ end
295
+
296
+ it 'success should be true' do
297
+ @accessor.update('hoge').should be_true
298
+ end
299
+
300
+ after do
301
+ @accessor.user_id = nil
302
+ @accessor.password = nil
303
+ end
304
+ end
305
+
306
+ describe ' when send direct message' do
307
+ before do
308
+ @accessor.user_id = 'dummy'
309
+ @accessor.password = 'dummy'
310
+ @accessor.should_receive(:http_access).once.and_return(true)
311
+ end
312
+
313
+ it 'success should be true' do
314
+ @accessor.send_message('hoge', 'fuga').should be_true
315
+ end
316
+
317
+ after do
318
+ @accessor.user_id = nil
319
+ @accessor.password = nil
320
+ end
321
+ end
322
+
323
+ describe ' when set todo' do
324
+ before do
325
+ @accessor.user_id = 'dummy'
326
+ @accessor.password = 'dummy'
327
+ @accessor.should_receive(:http_access).once.and_return(true)
328
+ end
329
+
330
+ it 'success should be true' do
331
+ @accessor.set_todo('hoge', Time.new).should be_true
332
+ end
333
+
334
+ after do
335
+ @accessor.user_id = nil
336
+ @accessor.password = nil
337
+ end
338
+ end
339
+
340
+ describe ' when update bookmark' do
341
+ before do
342
+ @accessor.user_id = 'dummy'
343
+ @accessor.password = 'dummy'
344
+ @accessor.should_receive(:http_access).once.and_return(true)
345
+ end
346
+
347
+ it 'success should be true' do
348
+ @accessor.update_bookmark('hoge', URI.parse('http://a.com')).should be_true
349
+ end
350
+
351
+ after do
352
+ @accessor.user_id = nil
353
+ @accessor.password = nil
354
+ end
355
+ end
356
+
357
+ describe ' when update good' do
358
+ before do
359
+ @accessor.user_id = 'dummy'
360
+ @accessor.password = 'dummy'
361
+ @accessor.should_receive(:http_access).once.and_return(true)
362
+ end
363
+
364
+ it 'success should be true' do
365
+ @accessor.update_good('hoge', 'fuga', ['moge']).should be_true
366
+ end
367
+
368
+ after do
369
+ @accessor.user_id = nil
370
+ @accessor.password = nil
371
+ end
372
+ end
373
+
374
+ describe ' when update news' do
375
+ before do
376
+ @accessor.user_id = 'dummy'
377
+ @accessor.password = 'dummy'
378
+ @accessor.should_receive(:http_access).once.and_return(true)
379
+ end
380
+
381
+ it 'success should be true' do
382
+ @accessor.update_news('hoge').should be_true
383
+ end
384
+
385
+ after do
386
+ @accessor.user_id = nil
387
+ @accessor.password = nil
388
+ end
389
+ end
390
+
391
+ describe ' when update vote' do
392
+ before do
393
+ @accessor.user_id = 'dummy'
394
+ @accessor.password = 'dummy'
395
+ @accessor.should_receive(:http_access).once.and_return(true)
396
+ end
397
+
398
+ it 'success should be true' do
399
+ @accessor.update_vote('hoge').should be_true
400
+ end
401
+
402
+ after do
403
+ @accessor.user_id = nil
404
+ @accessor.password = nil
405
+ end
406
+ end
407
+
408
+ after do
409
+ @accessor = nil
410
+ end
411
+ end
412
+
@@ -0,0 +1,34 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
28
+
29
+ namespace :manifest do
30
+ desc 'Recreate Manifest.txt to include ALL files'
31
+ task :refresh do
32
+ `rake check_manifest | patch -p0 > Manifest.txt`
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
@@ -0,0 +1,17 @@
1
+ desc 'Generate website files'
2
+ task :website_generate => :ruby_env do
3
+ (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
+ sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
+ end
6
+ end
7
+
8
+ desc 'Upload website files to rubyforge'
9
+ task :website_upload do
10
+ host = "#{rubyforge_username}@rubyforge.org"
11
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
+ local_dir = 'website'
13
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
14
+ end
15
+
16
+ desc 'Generate and upload website files'
17
+ task :website => [:website_generate, :website_upload, :publish_docs]
@@ -0,0 +1,72 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
+ <title>
8
+ timelog4r
9
+ </title>
10
+ <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
+ <style>
12
+
13
+ </style>
14
+ <script type="text/javascript">
15
+ window.onload = function() {
16
+ settings = {
17
+ tl: { radius: 10 },
18
+ tr: { radius: 10 },
19
+ bl: { radius: 10 },
20
+ br: { radius: 10 },
21
+ antiAlias: true,
22
+ autoPad: true,
23
+ validTags: ["div"]
24
+ }
25
+ var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
+ versionBox.applyCornersToAll();
27
+ }
28
+ </script>
29
+ </head>
30
+ <body>
31
+ <div id="main">
32
+
33
+ <h1>timelog4r</h1>
34
+ <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/timelog4r"; return false'>
35
+ <p>Get Version</p>
36
+ <a href="http://rubyforge.org/projects/timelog4r" class="numbers">0.0.1</a>
37
+ </div>
38
+ <h1>&amp;#x2192; &#8216;timelog4r&#8217;</h1>
39
+ <h2>What</h2>
40
+ <h2>Installing</h2>
41
+ <p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">timelog4r</span></pre></p>
42
+ <h2>The basics</h2>
43
+ <h2>Demonstration of usage</h2>
44
+ <p><span class="caps">TODO</span> &#8211; pick <span class="caps">SVN</span> or Git instructions</p>
45
+ <p>The trunk repository is <code>svn://rubyforge.org/var/svn/timelog4r/trunk</code> for anonymous access.</p>
46
+ <p><span class="caps">OOOORRRR</span></p>
47
+ <p>You can fetch the source from either:</p>
48
+ <ul>
49
+ <li>rubyforge: <span class="caps">MISSING</span> IN <span class="caps">ACTION</span></li>
50
+ </ul>
51
+ <p><span class="caps">TODO</span> &#8211; You can not created a RubyForge project, OR have not run <code>rubyforge config</code><br />
52
+ yet to refresh your local rubyforge data with this projects&#8217; id information.</p>
53
+ <p>When you do this, this message will magically disappear!</p>
54
+ <p>Or you can hack website/index.txt and make it all go away!!</p>
55
+ <h3>Build and test instructions</h3>
56
+ <pre>cd timelog4r
57
+ rake spec
58
+ rake install_gem</pre>
59
+ <h2>License</h2>
60
+ <p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
61
+ <h2>Contact</h2>
62
+ <p>Comments are welcome. Send an email to <a href="mailto:jamneco">saronpasu</a> at gmail dot com mail</p>
63
+ <p class="coda">
64
+ <a href="FIXME email">FIXME full name</a>, 29th September 2008<br>
65
+ Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
66
+ </p>
67
+ </div>
68
+
69
+ <!-- insert site tracking codes here, like Google Urchin -->
70
+
71
+ </body>
72
+ </html>
data/website/index.txt ADDED
@@ -0,0 +1,60 @@
1
+ h1. timelog4r
2
+
3
+ h1. &#x2192; 'timelog4r'
4
+
5
+
6
+ h2. What
7
+
8
+
9
+ h2. Installing
10
+
11
+ <pre syntax="ruby">sudo gem install timelog4r</pre>
12
+
13
+ h2. The basics
14
+
15
+
16
+ h2. Demonstration of usage
17
+
18
+
19
+ TODO - pick SVN or Git instructions
20
+
21
+ The trunk repository is <code>svn://rubyforge.org/var/svn/timelog4r/trunk</code> for anonymous access.
22
+
23
+ OOOORRRR
24
+
25
+ You can fetch the source from either:
26
+
27
+ <% if rubyforge_project_id %>
28
+
29
+ * rubyforge: "http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>":http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>
30
+
31
+ <pre>git clone git://rubyforge.org/timelog4r.git</pre>
32
+
33
+ <% else %>
34
+
35
+ * rubyforge: MISSING IN ACTION
36
+
37
+ TODO - You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
38
+ yet to refresh your local rubyforge data with this projects' id information.
39
+
40
+ When you do this, this message will magically disappear!
41
+
42
+ Or you can hack website/index.txt and make it all go away!!
43
+
44
+ <% end %>
45
+
46
+ h3. Build and test instructions
47
+
48
+ <pre>cd timelog4r
49
+ rake spec
50
+ rake install_gem</pre>
51
+
52
+
53
+ h2. License
54
+
55
+ This code is free to use under the terms of the MIT license.
56
+
57
+ h2. Contact
58
+
59
+ Comments are welcome. Send an email to "saronpasu":mailto:jamneco at gmail dot com mail
60
+