cline 0.2.3 → 0.2.4

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/README.md CHANGED
@@ -1,26 +1,5 @@
1
1
  # Cline - CLI Line Notifier
2
2
 
3
- ## **Important** Data schema has changed on version 0.2.3
4
-
5
- Please try following commands:
6
-
7
- In shell:
8
-
9
- ~~~~
10
- $ sqlite3 ~/.cline/cline.sqlite3
11
- ~~~~
12
-
13
- In sqlite3 prompt:
14
- ~~~~
15
- BEGIN TRANSACTION;
16
- CREATE TABLE "tmp_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "message" text DEFAULT '' NOT NULL, "display_count" integer DEFAULT 0 NOT NULL, "notified_at" datetime NOT NULL);
17
- INSERT INTO tmp_notifications SELECT id, message, display_count, time as notified_at FROM notifications;
18
- DROP TABLE notifications;
19
- ALTER TABLE tmp_notifications RENAME TO notifications;
20
- COMMIT;
21
- .q
22
- ~~~~
23
-
24
3
  ## Installation
25
4
 
26
5
  ~~~~
data/cline.gemspec CHANGED
@@ -11,36 +11,8 @@ Gem::Specification.new do |s|
11
11
  s.summary = %q{CLI Line Notifier}
12
12
  s.description = %q{Cline - CLI Line Notifier}
13
13
 
14
- s.post_install_message = <<-EOM
15
- **Important** Some features were added.
16
-
17
- * New collector (GitHub News Feed) is available.
18
- $ echo "Cline.collectors << Cline::Collectors::Github" >> ~/.cline/config
19
- $ echo "Cline::Collectors::Github.login_name = 'your_github_login'" >> ~/.cline/config
20
-
21
- * `search` command is available.
22
- usage:
23
- $ cline search [keyword]
24
-
25
- * Garbage collector is available.
26
- Garbage collector will work after `cline collect`.
27
- It requires Cline.pool_size.
28
-
29
- example:
30
- $ echo "Cline.pool_size = 2000" >> ~/.cline/config
31
-
32
- * Data schema has changed!
33
- Please try following commands:
34
-
35
- $ sqlite3 ~/.cline/cline.sqlite3
36
- > BEGIN TRANSACTION;
37
- > CREATE TABLE "tmp_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "message" text DEFAULT '' NOT NULL, "display_count" integer DEFAULT 0 NOT NULL, "notified_at" datetime NOT NULL);
38
- > INSERT INTO tmp_notifications SELECT id, message, display_count, time as notified_at FROM notifications;
39
- > DROP TABLE notifications;
40
- > ALTER TABLE tmp_notifications RENAME TO notifications;
41
- > COMMIT;
42
- > .q
43
- EOM
14
+ #s.post_install_message = <<-EOM
15
+ #EOM
44
16
 
45
17
  #s.rubyforge_project = "cline"
46
18
 
@@ -7,6 +7,8 @@ module Cline::Collectors
7
7
  message = message.encode(Encoding::UTF_8)
8
8
  notified_at = parse_time_string_if_needed(notified_at)
9
9
 
10
+ return if oldest_notification.notified_at.to_time > notified_at
11
+
10
12
  Cline::Notification.instance_exec message, notified_at do |message, notified_at|
11
13
  create(message: message, notified_at: notified_at) unless find_by_message_and_notified_at(message, notified_at)
12
14
  end
@@ -23,6 +25,15 @@ module Cline::Collectors
23
25
  time
24
26
  end
25
27
  end
28
+
29
+ def oldest_notification
30
+ @oldest_notification ||=
31
+ Cline::Notification.order(:notified_at).limit(1).first
32
+ end
33
+
34
+ def reset_oldest_notification
35
+ @oldest_notification = nil
36
+ end
26
37
  end
27
38
  end
28
39
  end
data/lib/cline/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cline
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -2,6 +2,41 @@
2
2
 
3
3
  require_relative '../spec_helper'
4
4
 
5
+ describe Cline::Collectors::Base do
6
+ describe '.oldest_notification' do
7
+ let(:oldest_notified_at) { 100.days.ago }
8
+
9
+ before do
10
+ Cline::Collectors::Base.send :reset_oldest_notification
11
+ Cline::Notification.create(message: 'awesome', notified_at: oldest_notified_at)
12
+ end
13
+
14
+ context 'too old notification' do
15
+ before do
16
+ flunk unless Cline::Notification.count == 1
17
+
18
+ Cline::Collectors::Base.create_or_pass('too old', oldest_notified_at - 1.day)
19
+ end
20
+
21
+ subject { Cline::Notification.count }
22
+
23
+ it { should == 1 }
24
+ end
25
+
26
+ context 'newly notification' do
27
+ before do
28
+ flunk unless Cline::Notification.count == 1
29
+
30
+ Cline::Collectors::Base.create_or_pass('newly', oldest_notified_at + 1.day)
31
+ end
32
+
33
+ subject { Cline::Notification.count }
34
+
35
+ it { should == 2 }
36
+ end
37
+ end
38
+ end
39
+
5
40
  describe Cline::Collectors::Github do
6
41
  shared_examples_for 'created_at should present from github event json' do
7
42
  it { json['created_at'].should_not be_nil }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-16 00:00:00.000000000 Z
12
+ date: 2011-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70095226423100 !ruby/object:Gem::Requirement
16
+ requirement: &70277825719060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.14.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70095226423100
24
+ version_requirements: *70277825719060
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activerecord
27
- requirement: &70095226422520 !ruby/object:Gem::Requirement
27
+ requirement: &70277825718320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.1.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70095226422520
35
+ version_requirements: *70277825718320
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sqlite3
38
- requirement: &70095226421980 !ruby/object:Gem::Requirement
38
+ requirement: &70277825717480 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.3.4
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70095226421980
46
+ version_requirements: *70277825717480
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: feedzirra
49
- requirement: &70095226421500 !ruby/object:Gem::Requirement
49
+ requirement: &70277825717000 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.0.31
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70095226421500
57
+ version_requirements: *70277825717000
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: notify
60
- requirement: &70095226421020 !ruby/object:Gem::Requirement
60
+ requirement: &70277825716340 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.3.0
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70095226421020
68
+ version_requirements: *70277825716340
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
- requirement: &70095226420540 !ruby/object:Gem::Requirement
71
+ requirement: &70277825715640 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.9.2
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70095226420540
79
+ version_requirements: *70277825715640
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: ir_b
82
- requirement: &70095226420040 !ruby/object:Gem::Requirement
82
+ requirement: &70277825715060 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.4.0
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70095226420040
90
+ version_requirements: *70277825715060
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: tapp
93
- requirement: &70095226419520 !ruby/object:Gem::Requirement
93
+ requirement: &70277825714540 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 1.1.0
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70095226419520
101
+ version_requirements: *70277825714540
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rspec
104
- requirement: &70095226419040 !ruby/object:Gem::Requirement
104
+ requirement: &70277825714040 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 2.6.0
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70095226419040
112
+ version_requirements: *70277825714040
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: rr
115
- requirement: &70095226408260 !ruby/object:Gem::Requirement
115
+ requirement: &70277825713520 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: 1.0.4
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70095226408260
123
+ version_requirements: *70277825713520
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: fabrication
126
- requirement: &70095226407420 !ruby/object:Gem::Requirement
126
+ requirement: &70277825713000 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 1.2.0
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70095226407420
134
+ version_requirements: *70277825713000
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: fuubar
137
- requirement: &70095226406860 !ruby/object:Gem::Requirement
137
+ requirement: &70277825712480 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: 0.0.6
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *70095226406860
145
+ version_requirements: *70277825712480
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: simplecov
148
- requirement: &70095226406380 !ruby/object:Gem::Requirement
148
+ requirement: &70277825711680 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: 0.5.3
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *70095226406380
156
+ version_requirements: *70277825711680
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: activesupport
159
- requirement: &70095226405880 !ruby/object:Gem::Requirement
159
+ requirement: &70277825711200 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,7 +164,7 @@ dependencies:
164
164
  version: 3.1.1
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *70095226405880
167
+ version_requirements: *70277825711200
168
168
  description: Cline - CLI Line Notifier
169
169
  email:
170
170
  - celluloid.key@gmail.com
@@ -211,20 +211,7 @@ files:
211
211
  - spec/tmp/.gitkeep
212
212
  homepage: https://github.com/hibariya/cline
213
213
  licenses: []
214
- post_install_message: ! " **Important** Some features were added.\n\n * New
215
- collector (GitHub News Feed) is available.\n $ echo \"Cline.collectors << Cline::Collectors::Github\"
216
- >> ~/.cline/config\n $ echo \"Cline::Collectors::Github.login_name = 'your_github_login'\"
217
- >> ~/.cline/config\n\n * `search` command is available.\n usage:\n $
218
- cline search [keyword]\n\n * Garbage collector is available.\n Garbage collector
219
- will work after `cline collect`.\n It requires Cline.pool_size.\n\n example:\n
220
- \ $ echo \"Cline.pool_size = 2000\" >> ~/.cline/config\n\n * Data schema
221
- has changed!\n Please try following commands:\n\n $ sqlite3 ~/.cline/cline.sqlite3\n
222
- \ > BEGIN TRANSACTION;\n > CREATE TABLE \"tmp_notifications\" (\"id\" INTEGER
223
- PRIMARY KEY AUTOINCREMENT NOT NULL, \"message\" text DEFAULT '' NOT NULL, \"display_count\"
224
- integer DEFAULT 0 NOT NULL, \"notified_at\" datetime NOT NULL);\n > INSERT
225
- INTO tmp_notifications SELECT id, message, display_count, time as notified_at FROM
226
- notifications;\n > DROP TABLE notifications;\n > ALTER TABLE tmp_notifications
227
- RENAME TO notifications;\n > COMMIT;\n > .q\n"
214
+ post_install_message:
228
215
  rdoc_options: []
229
216
  require_paths:
230
217
  - lib