stickynotifications 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
- data/bin/stickynotifications +1 -1
- data/lib/stickynotifications/cli.rb +15 -0
- data/lib/stickynotifications/note.rb +19 -0
- data/lib/stickynotifications/version.rb +1 -1
- data/lib/stickynotifications.rb +2 -24
- data/spec/stickynotifications_spec.rb +2 -7
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4aeb62d61d9df1ebc0d647e1ae510f552a3b7ab6
|
4
|
+
data.tar.gz: 1de94278d7c9266a6249e4b553d1a6d64e61322d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33035d1ed873e4399b72ddf65cb438ed9986f8ad89662105e5e85540a7dd96c4800abc0beb536ca95fd8d8cf6df6171b8c3ec1be677927b108087258390c70fa
|
7
|
+
data.tar.gz: 06e0bf14986cb7104aee9ba819f71f4639044a5190a0194132c10adb4782b769284d6401841f7d3a1102f6103150d62100539296c7855934af5f9a2750a45b3b
|
data/bin/stickynotifications
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'stickynotifications/note'
|
3
|
+
|
4
|
+
module StickyNotifications
|
5
|
+
class Cli < Thor
|
6
|
+
|
7
|
+
desc "new TEXT", "create new Sticky Notification with TEXT"
|
8
|
+
# Creates a new Sticky Notification
|
9
|
+
# @param text [String] the text of the Sticky Notification
|
10
|
+
def new(text)
|
11
|
+
note = StickyNotifications::Note.new
|
12
|
+
note.create(text)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module StickyNotifications
|
4
|
+
class Note
|
5
|
+
# @param text [String] text to be used as reminder
|
6
|
+
# @return [Nil]
|
7
|
+
def create(text)
|
8
|
+
%x{open "sticky-notifications://note?message=#{escape_string(text)}"}
|
9
|
+
end
|
10
|
+
|
11
|
+
# Escapes the Sticky Notification text for URLs. URI produces %20 for
|
12
|
+
# spaces instead of CGI's +.
|
13
|
+
# @param string_to_escape [String] the text to be escaped
|
14
|
+
# @return [String] parsed URL
|
15
|
+
def escape_string(string_to_escape)
|
16
|
+
URI.escape(string_to_escape)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/stickynotifications.rb
CHANGED
@@ -1,25 +1,3 @@
|
|
1
1
|
require "stickynotifications/version"
|
2
|
-
require
|
3
|
-
require
|
4
|
-
|
5
|
-
# @author "Brandon Pittman"
|
6
|
-
# All logic for StickyNotifications
|
7
|
-
class StickyNotifications < Thor
|
8
|
-
|
9
|
-
desc "new TEXT", "create new Sticky Notification with TEXT"
|
10
|
-
# Creates a new Sticky Notification
|
11
|
-
# @param sticky_text [String] the text of the Sticky Notification
|
12
|
-
def new(sticky_text)
|
13
|
-
%x{open "sticky-notifications://note?message=#{escape_string(sticky_text)}"}
|
14
|
-
end
|
15
|
-
|
16
|
-
no_commands do
|
17
|
-
# Escapes the Sticky Notification text for URLs. URI produces %20 for
|
18
|
-
# spaces instead of CGI's +.
|
19
|
-
# @param string_to_escape [String] the text to be escaped
|
20
|
-
# @return [String] parsed URL
|
21
|
-
def escape_string(string_to_escape)
|
22
|
-
URI.escape(string_to_escape)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
2
|
+
require "stickynotifications/cli"
|
3
|
+
require "stickynotifications/note"
|
@@ -5,13 +5,8 @@ describe Stickynotifications do
|
|
5
5
|
expect(Stickynotifications::VERSION).not_to be nil
|
6
6
|
end
|
7
7
|
|
8
|
-
# it 'creates a new Sticky Notification' do
|
9
|
-
# base = StickyNotifications.new
|
10
|
-
# expect(base.new('hi there')).to be_true
|
11
|
-
# end
|
12
|
-
|
13
8
|
it 'returns an escaped string' do
|
14
|
-
base = StickyNotifications.new
|
15
|
-
expect(base.escape_string
|
9
|
+
base = StickyNotifications::Note.new('Hello, world!')
|
10
|
+
expect(base.escape_string).to be_a String
|
16
11
|
end
|
17
12
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stickynotifications
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- brandonpittman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,6 +82,8 @@ files:
|
|
82
82
|
- Rakefile
|
83
83
|
- bin/stickynotifications
|
84
84
|
- lib/stickynotifications.rb
|
85
|
+
- lib/stickynotifications/cli.rb
|
86
|
+
- lib/stickynotifications/note.rb
|
85
87
|
- lib/stickynotifications/version.rb
|
86
88
|
- spec/spec_helper.rb
|
87
89
|
- spec/stickynotifications_spec.rb
|
@@ -106,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
108
|
version: '0'
|
107
109
|
requirements: []
|
108
110
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.4.
|
111
|
+
rubygems_version: 2.4.2
|
110
112
|
signing_key:
|
111
113
|
specification_version: 4
|
112
114
|
summary: A gem for creating Sticky Notifications.
|