tin 0.0.1 → 0.0.2

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.
Files changed (5) hide show
  1. data/README.md +73 -0
  2. data/lib/sn.rb +39 -11
  3. metadata +3 -4
  4. data/README +0 -0
  5. data/lib/sn/notify.rb +0 -29
@@ -0,0 +1,73 @@
1
+ tin
2
+ ===
3
+
4
+ * (https://github.com/gamma9mu/tin)
5
+
6
+ DESCRIPTION:
7
+ ------------
8
+
9
+ tin provides a simple interface to libnotify.
10
+
11
+ FEATURES/PROBLEMS:
12
+ ------------------
13
+
14
+ * Very simple
15
+
16
+ SYNOPSIS:
17
+ ---------
18
+
19
+ require 'sn'
20
+
21
+ summary = 'tin demo'
22
+ message = 'Just a quick message from tin!'
23
+ Sn::Notification.new(summary, message).show
24
+
25
+ REQUIREMENTS:
26
+ -------------
27
+
28
+ * Ruby 1.9
29
+
30
+ INSTALL:
31
+ --------
32
+
33
+ * gem install tin
34
+
35
+ DEVELOPERS:
36
+ -----------
37
+
38
+ After checking out the source, run:
39
+
40
+ $ rake newb
41
+
42
+ This task will install any missing dependencies, run the tests/specs,
43
+ and generate the RDoc.
44
+
45
+ LICENSE:
46
+ --------
47
+
48
+ (The BSD New License)
49
+
50
+ Copyright (c) 2012 Brian A. Guthrie
51
+ All rights reserved.
52
+
53
+ Redistribution and use in source and binary forms, with or without
54
+ modification, are permitted provided that the following conditions are met:
55
+ * Redistributions of source code must retain the above copyright notice,
56
+ this list of conditions and the following disclaimer.
57
+ * Redistributions in binary form must reproduce the above copyright notice,
58
+ this list of conditions and the following disclaimer in the documentation
59
+ and/or other materials provided with the distribution.
60
+ * Neither the name of the copyright holder nor the names of its
61
+ contributors may be used to endorse or promote products derived from this
62
+ software without specific prior written permission.
63
+
64
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
65
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
66
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
67
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
68
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
69
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
70
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
71
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
72
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
73
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/lib/sn.rb CHANGED
@@ -1,18 +1,46 @@
1
- require 'sn/notify.rb'
1
+ require 'fiddle'
2
2
 
3
- Notify.start $0
3
+ module Sn
4
+ include Fiddle
4
5
 
5
- at_exit do
6
- Notify.stop
7
- end
6
+ def self.start(app_name)
7
+ @dl = DL.dlopen 'libnotify.so'
8
+ @init = Function.new(@dl['notify_init'], [TYPE_VOIDP], TYPE_INT)
9
+ @uninit = Function.new(@dl['notify_uninit'], [], TYPE_VOID)
10
+ @newnot = Function.new(@dl['notify_notification_new'],
11
+ [TYPE_VOIDP, TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
12
+ @shownot = Function.new(@dl['notify_notification_show'],
13
+ [TYPE_VOIDP, TYPE_VOIDP], TYPE_INT)
14
+ @init.call app_name
15
+ end
8
16
 
9
- class Notification
10
- def initialize(summary, message="", icon="")
11
- @notification = Notify.create summary, message, icon
17
+ def self.stop
18
+ @uninit.call
12
19
  end
13
-
14
- def show
15
- Notify.show @notification
20
+
21
+ def self.create(summary, message="", icon="")
22
+ @newnot.call summary, message, icon
16
23
  end
24
+
25
+ def self.show(notification)
26
+ @shownot.call notification, nil
27
+ end
28
+
29
+ class Notification
30
+ def initialize(summary, message="", icon="")
31
+ @notification = Sn.create summary, message, icon
32
+ end
33
+
34
+ def show
35
+ Sn.show @notification
36
+ end
37
+ end
38
+ end
39
+
40
+ Sn.start $0
41
+
42
+ at_exit do
43
+ Sn.stop
17
44
  end
18
45
 
46
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,8 +18,7 @@ extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - lib/sn.rb
21
- - lib/sn/notify.rb
22
- - README
21
+ - README.md
23
22
  - Rakefile
24
23
  homepage: http://github.com/gamma9mu/tin
25
24
  licenses: []
@@ -41,7 +40,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
41
40
  version: '0'
42
41
  requirements: []
43
42
  rubyforge_project: tin
44
- rubygems_version: 1.8.11
43
+ rubygems_version: 1.8.23
45
44
  signing_key:
46
45
  specification_version: 3
47
46
  summary: Very simple libnotify access
data/README DELETED
File without changes
@@ -1,29 +0,0 @@
1
- require 'fiddle'
2
-
3
- module Notify
4
- def Notify.start(app_name)
5
- @dl = DL.dlopen 'libnotify.so'
6
- @init = Fiddle::Function.new(@dl['notify_init'], [Fiddle::TYPE_VOIDP],
7
- Fiddle::TYPE_INT)
8
- @uninit = Fiddle::Function.new(@dl['notify_uninit'], [], Fiddle::TYPE_VOID)
9
- @newnot = Fiddle::Function.new(@dl['notify_notification_new'],
10
- [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],
11
- Fiddle::TYPE_VOIDP)
12
- @shownot = Fiddle::Function.new(@dl['notify_notification_show'],
13
- [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP],
14
- Fiddle::TYPE_INT)
15
- @init.call app_name
16
- end
17
-
18
- def Notify.stop
19
- @uninit.call
20
- end
21
-
22
- def Notify.create(summary, message="", icon="")
23
- @newnot.call summary, message, icon
24
- end
25
-
26
- def Notify.show(notification)
27
- @shownot.call notification, nil
28
- end
29
- end