terminal-announce 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5d0ab6be28084c0c07dad5766f6d7e2e1c89dc32
4
+ data.tar.gz: 0fe7664fdb6fd5e1b388d3704c0053749c10da0c
5
+ SHA512:
6
+ metadata.gz: 67fb9e6322818674522c934f3264c19eb0ce0bcc7fb5f99d061d4589a82f6b586837763601645cc94c2c53bd894521a4e721af68f3ddc40c64c6214f36f99559
7
+ data.tar.gz: b86fcdefd7d9e1f6ed008f4ffbe7e553486173ddf991bffa30ecc59c78983ec047aa12f544c8c5a780aae9cd3b964cc0da1d7d351fe3eae20597fc0ee7914a62
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ vendor
4
+ coverage
5
+
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'http://rubygems.org'
2
+ gemspec
@@ -0,0 +1,33 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ terminal-announce (1.0.0)
5
+ bundler
6
+ contracts
7
+ rainbow
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ contracts (0.9)
13
+ docile (1.1.5)
14
+ json (1.8.2)
15
+ rainbow (2.0.0)
16
+ rake (10.4.2)
17
+ riot (0.12.7)
18
+ rr
19
+ rr (1.1.2)
20
+ simplecov (0.10.0)
21
+ docile (~> 1.1.0)
22
+ json (~> 1.8)
23
+ simplecov-html (~> 0.10.0)
24
+ simplecov-html (0.10.0)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ rake
31
+ riot
32
+ simplecov
33
+ terminal-announce!
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Justin Scott
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,20 @@
1
+ # terminal-announce
2
+
3
+ A simple gem to handle terminal notifications in a functional way
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ require 'terminal-announce'
9
+
10
+ Announce.success 'Gem installed!'
11
+ Announce.failure 'Look out'
12
+ Announce.warning 'Critical cool'
13
+ Announce.info 'Chilling out, please wait...'
14
+ ```
15
+
16
+ ## Possible future
17
+
18
+ - Custom types
19
+ - Custom colors
20
+ - Custom format
@@ -0,0 +1,17 @@
1
+ require 'bundler/setup'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+ require 'simplecov'
5
+
6
+ task :test do
7
+ SimpleCov.start do
8
+ add_filter "/test/"
9
+ end
10
+ Rake::TestTask.new do |t|
11
+ t.libs << "test"
12
+ t.pattern = "test/**/*_test.rb"
13
+ t.verbose = false
14
+ end
15
+ end
16
+
17
+ task :default => :test
@@ -0,0 +1,38 @@
1
+ require 'rainbow'
2
+
3
+ module Announce
4
+ def self.color_for(type)
5
+ {
6
+ success: :green,
7
+ failure: :red,
8
+ warning: :yellow,
9
+ info: :cyan
10
+ }[type]
11
+ end
12
+
13
+ def self.prefix_for(type)
14
+ color = color_for type
15
+ text = type.to_s.capitalize
16
+ "[#{Rainbow(text).color(color)}]"
17
+ end
18
+
19
+ def self.success(message)
20
+ log :success, message
21
+ end
22
+
23
+ def self.failure(message)
24
+ log :failure, message
25
+ end
26
+
27
+ def self.warning(message)
28
+ log :warning, message
29
+ end
30
+
31
+ def self.info(message)
32
+ log :info, message
33
+ end
34
+
35
+ def self.log(type, message)
36
+ puts "#{prefix_for type} #{message}"
37
+ end
38
+ end
@@ -0,0 +1,24 @@
1
+ Gem::Specification.new do |gem|
2
+ gem.name = 'terminal-announce'
3
+ gem.version = '1.0.0'
4
+ gem.licenses = 'MIT'
5
+ gem.authors = ['Justin Scott']
6
+ gem.email = 'jvscott@gmail.com'
7
+ gem.homepage = 'http://www.github.com/jscott/terminal-announce/'
8
+ gem.summary = 'Terminal notifications in a functional way'
9
+ gem.description = gem.summary
10
+
11
+ gem.files = `git ls-files`.split("\n")
12
+ gem.test_files = `git ls-files -- test/**/*`.split("\n")
13
+ gem.require_paths = ['lib']
14
+
15
+ # gem.required_ruby_version = '>= 2.1'
16
+
17
+ gem.add_runtime_dependency 'bundler'
18
+ gem.add_runtime_dependency 'rainbow'
19
+ gem.add_runtime_dependency 'contracts'
20
+
21
+ gem.add_development_dependency 'rake'
22
+ gem.add_development_dependency 'riot'
23
+ gem.add_development_dependency 'simplecov'
24
+ end
@@ -0,0 +1,19 @@
1
+ require 'teststrap'
2
+
3
+ context 'the output for' do
4
+ setup { $stdout = StringIO.new }
5
+ %w(success failure warning info).each do |method|
6
+ context "Announce##{method}" do
7
+ setup do
8
+ begin
9
+ Announce.send method.to_sym, 'hello world'
10
+ rescue NoMethodError
11
+ end
12
+ $stdout.string
13
+ end
14
+ denies_topic.empty
15
+ asserts_topic.matches /hello world/
16
+ asserts('the output is colored') { topic =~ /\e\[/ }
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'terminal-announce'
3
+ require 'riot'
metadata ADDED
@@ -0,0 +1,138 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: terminal-announce
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Justin Scott
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rainbow
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: contracts
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: riot
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Terminal notifications in a functional way
98
+ email: jvscott@gmail.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - ".gitignore"
104
+ - Gemfile
105
+ - Gemfile.lock
106
+ - LICENSE
107
+ - README.md
108
+ - Rakefile
109
+ - lib/terminal-announce.rb
110
+ - terminal-announce.gemspec
111
+ - test/announce_test.rb
112
+ - test/teststrap.rb
113
+ homepage: http://www.github.com/jscott/terminal-announce/
114
+ licenses:
115
+ - MIT
116
+ metadata: {}
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubyforge_project:
133
+ rubygems_version: 2.4.5
134
+ signing_key:
135
+ specification_version: 4
136
+ summary: Terminal notifications in a functional way
137
+ test_files: []
138
+ has_rdoc: