campfire-say 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ *.gem
2
+ /Gemfile.lock
3
+ /tmp
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Daniel Brockman
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.
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require "bundler/gem_tasks"
data/bin/campfire-say ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'campfire-say'
4
+
5
+ begin
6
+ if ARGV.size === 0
7
+ Campfire::Say.paste(STDIN.read)
8
+ else
9
+ Campfire::Say.say(ARGV.join(' '))
10
+ end
11
+ rescue Campfire::Say::Error => error
12
+ puts [$0, error.message] * ': '
13
+ exit 1
14
+ end
@@ -0,0 +1,12 @@
1
+ # -*- ruby; encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = 'campfire-say'
5
+ gem.summary = 'Post to Campfire from the command line'
6
+ gem.version = '0.0.1'
7
+ gem.author = 'Daniel Brockman'
8
+ gem.email = 'daniel@brockman.se'
9
+ gem.files = `git ls-files`.split($\)
10
+ gem.executable = 'campfire-say'
11
+ gem.add_dependency 'tinder', '~> 1.8.0'
12
+ end
@@ -0,0 +1,36 @@
1
+ require 'tinder'
2
+
3
+ module Campfire
4
+ module Say
5
+ extend self
6
+
7
+ def say(message)
8
+ room.speak(message)
9
+ end
10
+
11
+ def paste(message)
12
+ room.paste(message)
13
+ end
14
+
15
+ def room
16
+ @room ||= campfire.find_room_by_name(room_name)
17
+ end
18
+
19
+ def campfire
20
+ @campfire ||= Tinder::Campfire.new(account, token: token)
21
+ end
22
+
23
+ %w(account token room).each do |word|
24
+ define_method(word == 'room' ? 'room_name' : word) do
25
+ name = 'CAMPFIRE_%s' % word.upcase
26
+ if ENV[name].to_s.size == 0
27
+ raise Say::Error, 'missing $%s' % name
28
+ else
29
+ ENV[name]
30
+ end
31
+ end
32
+ end
33
+
34
+ class Error < StandardError; end
35
+ end
36
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: campfire-say
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Daniel Brockman
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: tinder
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.8.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.8.0
30
+ description:
31
+ email: daniel@brockman.se
32
+ executables:
33
+ - campfire-say
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE
40
+ - Rakefile
41
+ - bin/campfire-say
42
+ - campfire-say.gemspec
43
+ - lib/campfire-say.rb
44
+ homepage:
45
+ licenses: []
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 1.8.24
65
+ signing_key:
66
+ specification_version: 3
67
+ summary: Post to Campfire from the command line
68
+ test_files: []