kvetch 1.0.3

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: a413670a96d7d94f2e2c9a7bebbc6b078b7f309c
4
+ data.tar.gz: a35e524fbfe01ed6456f959890b10bf5ea0f30c3
5
+ SHA512:
6
+ metadata.gz: 6a4b8915c60ad558afb8cb7c1bd63e0f85a519de1573868768ca03e3b4c1a070d0843a0561dd8481d13d44cd2d1e0a71859b33e33e56ddf7aeb5ee53c5eb3a38
7
+ data.tar.gz: d398da8d19819d9180ca7c2666cbdee9c517a3fd6b892b4c5567e8e88dc1f07a1762de419cbf531248d5a5360899c07ae35ac455d9b0ae184a1c3d402940e02d
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .DS_Store
@@ -0,0 +1,3 @@
1
+ [submodule "vendor/terminal-notifier"]
2
+ path = vendor/terminal-notifier
3
+ url = https://github.com/JacksonGariety/terminal-notifier.git
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bitch.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jackson Gariety
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,45 @@
1
+ # Kvetch
2
+ [![Gem Version](https://badge.fury.io/rb/kvetch.png)](http://badge.fury.io/rb/kvetch)
3
+
4
+ A Ruby logger that uses native Mac/Linux notifications.
5
+
6
+ ![kvetch](https://raw.github.com/JacksonGariety/kvetch/master/kvetch.jpg)
7
+
8
+ *Gets in yo face when you write ruby.*
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile under the `:development` tree:
13
+
14
+ gem 'kvetch'
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ ## Usage
21
+
22
+ Some examples of how to use kvetch:
23
+
24
+ 1. `Kvetch.yell("yo homie there's a problem") #=> String`
25
+ 2. `Kvetch.yell("yo homie there's a problem", { :sound => "Frog" }) #=> String`
26
+ 3. `Kvetch.silence!; Kvetch.yell("yo homie there's a problem") #=> false`
27
+ 4. `Kvetch.silence!; Kvetch.unsilence!; Kvetch.yell("stop that") #=> String`
28
+
29
+ `Kvetch.yell`'s second parameter is a hash of symbols/values based on the [terminal-notifier](https://github.com/alloy/terminal-notifier) documentation.
30
+
31
+ ## Contributing
32
+
33
+ #### Cloning
34
+
35
+ This repo depends upon my fork of @alloy's `terminal-notifier` gem. To clone with submodules:
36
+
37
+ $ git clone --recursive https://github.com/JacksonGariety/terminal-notifier.git
38
+
39
+ #### GitHub for dummies
40
+
41
+ 1. Fork it
42
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
43
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
44
+ 4. Push to the branch (`git push origin my-new-feature`)
45
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kvetch/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "kvetch"
8
+ spec.version = Kvetch::VERSION
9
+ spec.authors = ["Jackson Gariety", "Colby Aley"]
10
+ spec.email = ["personal@jacksongariety.com", "colby@aley.me"]
11
+ spec.description = "A Ruby logger that uses native Mac/Linux notifications."
12
+ spec.summary = "Gets in yo face when you write ruby."
13
+ spec.homepage = "http://github.com/JacksonGariety/kvetch"
14
+ spec.license = "Apache"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ end
Binary file
@@ -0,0 +1,37 @@
1
+ require 'kvetch/version'
2
+ require 'kvetch/os'
3
+ require 'shellwords'
4
+
5
+ module Kvetch
6
+ # Main usage: Kvetch.yell(MESSAGE)
7
+ def self.yell(message, options = {})
8
+ return false if @silenced
9
+
10
+ if message.is_a? String
11
+ if OS.mac? && `sw_vers -productVersion` >= '10.8'
12
+ bin = File.expand_path('../../vendor/terminal-notifier/kvetch.app/Contents/MacOS/terminal-notifier', __FILE__)
13
+
14
+ options[:sound].capitalize! if options[:sound]
15
+ options = options.merge(:message => message).map do |argument, value|
16
+ value = value.to_s; ["-#{argument}", "#{Shellwords.escape(value[0,1])}#{value[1..-1]}"]
17
+ end
18
+
19
+ command = [bin, *options.flatten]
20
+ command = Shellwords.join(command) if RUBY_VERSION < '1.9'
21
+
22
+ IO.popen(command) # send message and options to terminal-notifier/kvetch.app
23
+ elsif OS.linux? || OS.unix?
24
+ `notify-send \"#{message}\"`
25
+ else # OS doesn't have notification support
26
+ return "Kvetch works on Linux, Unix, or Mac OS X >= 10.8."
27
+ end
28
+ else # message is not a string
29
+ return "You should give that kvetch a string. Kvetches love strings."
30
+ end
31
+ end
32
+
33
+ # Silence methods
34
+ def self.silence!() @silenced = true end
35
+ def self.unsilence!() @silenced = false end
36
+ def self.silent?() @silenced end
37
+ end
@@ -0,0 +1,34 @@
1
+ require 'rbconfig'
2
+
3
+ # An alternative would be using `RUBY_PLATFORM`.
4
+ # That would not require `rbconfig` but would
5
+ # fail on JRuby (returning `java` independently of
6
+ # the running OS).
7
+
8
+ # Finds out the current Operating System.
9
+ module OS
10
+ def self.windows?
11
+ windows = /cygwin|mswin|mingw|bccwin|wince|emx/i
12
+
13
+ (RbConfig::CONFIG['host_os'] =~ windows) != nil
14
+ end
15
+
16
+ def self.mac?
17
+ mac = /darwin|mac os/i
18
+
19
+ (RbConfig::CONFIG['host_os'] =~ mac) != nil
20
+ end
21
+
22
+ def self.unix?
23
+ unix = /solaris|bsd/i
24
+
25
+ (RbConfig::CONFIG['host_os'] =~ unix) != nil
26
+ end
27
+
28
+ def self.linux?
29
+ linux = /linux/i
30
+
31
+ (RbConfig::CONFIG['host_os'] =~ linux) != nil
32
+ end
33
+ end
34
+
@@ -0,0 +1,3 @@
1
+ module Kvetch
2
+ VERSION = "1.0.3"
3
+ end
@@ -0,0 +1,27 @@
1
+ require "kvetch"
2
+
3
+ describe Kvetch do
4
+ describe ".yell" do
5
+ it "should send a message" do
6
+ Kvetch.yell("a problem you finna resolve").should_not be_false
7
+ end
8
+
9
+ it "should not send a message" do
10
+ Kvetch.silence!
11
+ Kvetch.yell("a problem you were finna resolve but got stupid n' gave up").should_not be_true
12
+ end
13
+
14
+ it "should not send a message after toggling silence" do
15
+ Kvetch.unsilence!
16
+ Kvetch.yell("a problem you finna resolve").should_not be_false
17
+ end
18
+ end
19
+
20
+ describe ".silent?" do
21
+ it "should let you know if Kvetch is silent" do
22
+ Kvetch.silent?.should be_false
23
+ Kvetch.silence!
24
+ Kvetch.silent?.should be_true
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kvetch
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Jackson Gariety
8
+ - Colby Aley
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-10-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: '1.3'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '1.3'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rspec
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ description: A Ruby logger that uses native Mac/Linux notifications.
57
+ email:
58
+ - personal@jacksongariety.com
59
+ - colby@aley.me
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - .gitignore
65
+ - .gitmodules
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - kvetch.gemspec
71
+ - kvetch.jpg
72
+ - lib/kvetch.rb
73
+ - lib/kvetch/os.rb
74
+ - lib/kvetch/version.rb
75
+ - spec/kvetch_spec.rb
76
+ homepage: http://github.com/JacksonGariety/kvetch
77
+ licenses:
78
+ - Apache
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.0.5
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Gets in yo face when you write ruby.
100
+ test_files:
101
+ - spec/kvetch_spec.rb