ruby_gntp 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/ChangeLog +26 -22
  2. data/lib/ruby_gntp.rb +5 -4
  3. data/test/ruby_gntp_spec.rb +34 -2
  4. metadata +2 -2
data/ChangeLog CHANGED
@@ -1,37 +1,41 @@
1
1
  = ruby_gntp change log
2
2
 
3
- == Version 0.0.0
4
- * Create public Git repository
5
-
6
- == Version 0.0.1
7
- * Initial version
3
+ == Version 0.3.4 - 2010/02/02
4
+ * FIXED: Register doesn't work with multiple notifications.
5
+ * Modify ChangeLog order.
8
6
 
9
- == Version 0.0.2
10
- * Fixed Japanese translated MIT License page URL.
7
+ == Version 0.3.3 - 2010/01/26
8
+ * Temporary patchwork fix - The code was commented out that recognize version
9
+ of the OS causes some defects -
11
10
 
12
- == Version 0.1.0 - 2009/4/17
13
- * Add GNTP.notify method for instant notification.
14
- * Add ruby script examples.
11
+ == Version 0.3.1 - yyyy/mm/dd
15
12
 
16
- == Version 0.1.1 - 2009/4/17
17
- * Add NOTE to example directory.
13
+ == Version 0.3.0 - yyyy/mm/dd
18
14
 
19
- == Version 0.1.2 - 2009/08/15
20
- * Enabled password authentication mainly for sending notifications to a network machine.
15
+ == Version 0.2.0 - 2009/11/03
16
+ * Merge spidahman's commits. Lot of thanks, spidahman!
17
+ * Add some test(spec).
21
18
 
22
19
  == Version 0.1.3 - 2009/08/19
23
20
  * Added notification icon sending.
24
21
  * Now sends out Origin-X headers.
25
22
  * Use \r\n instead of \n in the header lines.
26
23
 
27
- == Version 0.2.0 - 2009/11/03
28
- * Merge spidahman's commits. Lot of thanks, spidahman!
29
- * Add some test(spec).
24
+ == Version 0.1.2 - 2009/08/15
25
+ * Enabled password authentication mainly for sending notifications to a network machine.
30
26
 
31
- == Version 0.3.0 - yyyy/mm/dd
27
+ == Version 0.1.1 - 2009/4/17
28
+ * Add NOTE to example directory.
32
29
 
33
- == Version 0.3.1 - yyyy/mm/dd
30
+ == Version 0.1.0 - 2009/4/17
31
+ * Add GNTP.notify method for instant notification.
32
+ * Add ruby script examples.
34
33
 
35
- == Version 0.3.2 - 2010/01/26
36
- * Temporary patchwork fix - The code was commented out that recognize version
37
- of the OS causes some defects -
34
+ == Version 0.0.2
35
+ * Fixed Japanese translated MIT License page URL.
36
+
37
+ == Version 0.0.1
38
+ * Initial version
39
+
40
+ == Version 0.0.0
41
+ * Create public Git repository
@@ -42,7 +42,7 @@ class GNTP
42
42
  attr_reader :message if $DEBUG
43
43
 
44
44
  RUBY_GNTP_NAME = 'ruby_gntp'
45
- RUBY_GNTP_VERSION = '0.3.3'
45
+ RUBY_GNTP_VERSION = '0.3.4'
46
46
 
47
47
  def initialize(app_name = 'Ruby/GNTP', host = 'localhost', password = '', port = 23053)
48
48
  @app_name = app_name
@@ -75,16 +75,17 @@ class GNTP
75
75
  icon = notification[:icon]
76
76
 
77
77
  message << "Notification-Name: #{name}\r\n"
78
- message << "Notification-Enabled: #{enabled ? 'True' : 'False'}\r\n"
79
78
  message << "Notification-Display-Name: #{disp_name}\r\n"
79
+ message << "Notification-Enabled: #{enabled ? 'True' : 'False'}\r\n"
80
80
  message << "#{handle_icon(icon, 'Notification')}\r\n" if icon
81
+ message << "\r\n"
81
82
  end
82
83
 
83
84
  @binaries.each {|binary|
84
85
  message << output_binary(binary)
86
+ message << "\r\n"
85
87
  }
86
88
 
87
- message << "\r\n"
88
89
 
89
90
  unless (ret = send_and_recieve(message))
90
91
  raise "Register failed"
@@ -238,7 +239,7 @@ class GNTP
238
239
  # platformname, platformversion = `uname -s`, `uname -r`
239
240
  #end
240
241
  platformname = "Windows"
241
- platformname = "0.0"
242
+ platformversion = "0.0"
242
243
 
243
244
  message << "Origin-Platform-Name: #{platformname.strip}\r\n"
244
245
  message << "Origin-Platform-Version: #{platformversion.strip}\r\n"
@@ -11,7 +11,9 @@ describe GNTP do
11
11
  include GNTPExampleHelperMethods
12
12
 
13
13
  DEFAULT_APP_NAME = "Ruby/GNTP"
14
- NOTIFICATION_NAME = "TestApp"
14
+ NOTIFICATION_NAME = "Notify"
15
+ NOTIFICATION_NAME2 = "Notify2"
16
+ NOTIFICATION_NAME3 = "Notify3"
15
17
 
16
18
  before do
17
19
  @sended_messages = []
@@ -19,7 +21,7 @@ describe GNTP do
19
21
  @opened_socket = create_stub_socket(@ok_response, @sended_messages)
20
22
  end
21
23
 
22
- it "can register notifications with minimum params" do
24
+ it "can register notification with minimum params" do
23
25
  @gntp = GNTP.new
24
26
  @gntp.register :notifications => [{:name => NOTIFICATION_NAME}]
25
27
 
@@ -37,6 +39,36 @@ describe GNTP do
37
39
 
38
40
  end
39
41
 
42
+ #
43
+ it "can register many notifications" do
44
+ @gntp = GNTP.new
45
+ @gntp.register :notifications => [
46
+ {:name => NOTIFICATION_NAME},
47
+ {:name => NOTIFICATION_NAME2},
48
+ ]
49
+
50
+ @sended_messages.first.should == [
51
+ "GNTP/1.0 REGISTER NONE\r\n",
52
+ "Application-Name: #{DEFAULT_APP_NAME}\r\n",
53
+ "Origin-Machine-Name: #{Socket.gethostname}\r\n",
54
+ "Origin-Software-Name: #{GNTP::RUBY_GNTP_NAME}\r\n",
55
+ "Origin-Software-Version: #{GNTP::RUBY_GNTP_VERSION}\r\n",
56
+ "Origin-Platform-Name: Windows\r\n",
57
+ "Origin-Platform-Version: 0.0\r\n",
58
+ "Notifications-Count: 2\r\n",
59
+ "\r\n",
60
+ "Notification-Name: #{NOTIFICATION_NAME}\r\n",
61
+ "Notification-Display-Name: #{NOTIFICATION_NAME}\r\n",
62
+ "Notification-Enabled: True\r\n",
63
+ "\r\n",
64
+ "Notification-Name: #{NOTIFICATION_NAME2}\r\n",
65
+ "Notification-Display-Name: #{NOTIFICATION_NAME2}\r\n",
66
+ "Notification-Enabled: True\r\n",
67
+ "\r\n",
68
+ ]
69
+
70
+ end
71
+
40
72
  it "can register notifications to remote host" do
41
73
  @gntp = GNTP.new "TestApp", "1.2.3.4", "password", 12345
42
74
  @gntp.register :notifications => [{:name => NOTIFICATION_NAME}]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_gntp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - snaka
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-01-27 00:00:00 +09:00
13
+ date: 2010-02-02 00:00:00 +09:00
14
14
  default_executable:
15
15
  dependencies: []
16
16