campy 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,11 @@
1
- ## 0.1.2 (unreleased)
1
+ ## 0.1.3.dev (unreleased)
2
+
3
+
4
+ ## 0.1.2 (April 5, 2012)
5
+
6
+ #### Bug fixes
7
+
8
+ * Add paste action to bin/campy. ([@fnichol][])
2
9
 
3
10
 
4
11
  ## 0.1.1 (April 5, 2012)
data/bin/campy CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
+ $:.unshift File.join(File.dirname(__FILE__), %w{.. lib})
4
4
  require 'campy'
5
5
  require 'yaml'
6
6
 
@@ -15,6 +15,7 @@ def usage
15
15
 
16
16
  help - Display CLI help (this output)
17
17
  speak - Speak a message into the campfire room
18
+ paste - Paste a message into the campfire room
18
19
  play - Play a sound into the campfire room
19
20
 
20
21
  USAGE
@@ -28,12 +29,14 @@ def options
28
29
  YAML.load_file(yaml_file)
29
30
  end
30
31
 
32
+ def actions
33
+ %w{speak paste play}
34
+ end
35
+
31
36
  def action
32
37
  @action ||= begin
33
38
  abort usage if ARGV.empty?
34
- action = ARGV.shift
35
- abort usage if !%w{speak play help}.include?(action)
36
- action
39
+ ARGV.shift
37
40
  end
38
41
  end
39
42
 
@@ -48,9 +51,11 @@ def message
48
51
  end
49
52
 
50
53
  case action
54
+ when *actions
55
+ Campy::Room.new(options).send(action, message)
51
56
  when "help"
52
57
  puts usage
53
58
  exit
54
59
  else
55
- Campy::Room.new(options).send(action, message)
60
+ abort usage
56
61
  end
@@ -1,6 +1,6 @@
1
+ # -*- encoding: utf-8 -*-
1
2
  require 'campy/version'
2
3
  require 'campy/room'
3
4
 
4
5
  module Campy
5
- # Your code goes here...
6
6
  end
@@ -1,4 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
+
2
3
  module Campy
3
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
4
5
  end
@@ -59,6 +59,7 @@ describe Campy::Room do
59
59
  describe "#initialize" do
60
60
  it "takes a hash of campfire configuration" do
61
61
  room = Campy::Room.new(opts)
62
+
62
63
  room.account.must_equal 'zubzub'
63
64
  room.room.must_equal 'myroom'
64
65
  end
@@ -66,6 +67,7 @@ describe Campy::Room do
66
67
  it "defaults to SSL mode enabled" do
67
68
  opts.delete(:ssl)
68
69
  room = Campy::Room.new(opts)
70
+
69
71
  room.ssl.must_equal true
70
72
  end
71
73
  end
@@ -75,29 +77,27 @@ describe Campy::Room do
75
77
 
76
78
  it "fetches the room id from the API" do
77
79
  stub_rooms!
80
+
78
81
  subject.room_id.must_equal 666666
79
82
  end
80
83
 
81
84
  it "raises NotFound if no room is found" do
82
85
  stub_rooms_no_room!
83
86
 
84
- proc { subject.room_id }.must_raise(
85
- Campy::Room::NotFound)
87
+ proc { subject.room_id }.must_raise(Campy::Room::NotFound)
86
88
  end
87
89
 
88
90
  it "raises ConnectionError if the token is invalid" do
89
91
  stub_rooms_invalid_token!
90
92
 
91
- proc { subject.room_id }.must_raise(
92
- Campy::Room::ConnectionError)
93
+ proc { subject.room_id }.must_raise(Campy::Room::ConnectionError)
93
94
  end
94
95
 
95
96
  WRAPPED_ERRORS.each do |error|
96
97
  it "wraps #{error} and raises a ConnectionError" do
97
98
  stub_rooms_error!(error)
98
99
 
99
- proc { subject.room_id }.must_raise(
100
- Campy::Room::ConnectionError)
100
+ proc { subject.room_id }.must_raise(Campy::Room::ConnectionError)
101
101
  end
102
102
  end
103
103
  end
@@ -127,8 +127,7 @@ describe Campy::Room do
127
127
  it "wraps #{error} and raises a ConnectionError" do
128
128
  stub_speak_error!(error)
129
129
 
130
- proc { subject.speak "nope" }.must_raise(
131
- Campy::Room::ConnectionError)
130
+ proc { subject.speak "nope" }.must_raise(Campy::Room::ConnectionError)
132
131
  end
133
132
  end
134
133
  end
@@ -158,8 +157,7 @@ describe Campy::Room do
158
157
  it "wraps #{error} and raises a ConnectionError" do
159
158
  stub_speak_error!(error)
160
159
 
161
- proc { subject.paste "nope" }.must_raise(
162
- Campy::Room::ConnectionError)
160
+ proc { subject.paste "nope" }.must_raise(Campy::Room::ConnectionError)
163
161
  end
164
162
  end
165
163
  end
@@ -189,8 +187,7 @@ describe Campy::Room do
189
187
  it "wraps #{error} and raises a ConnectionError" do
190
188
  stub_speak_error!(error)
191
189
 
192
- proc { subject.play "tada" }.must_raise(
193
- Campy::Room::ConnectionError)
190
+ proc { subject.play "tada" }.must_raise(Campy::Room::ConnectionError)
194
191
  end
195
192
  end
196
193
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: campy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
16
- requirement: &70142625292440 !ruby/object:Gem::Requirement
16
+ requirement: &70146366979960 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70142625292440
24
+ version_requirements: *70146366979960
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &70142625291800 !ruby/object:Gem::Requirement
27
+ requirement: &70146366979020 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.12.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70142625291800
35
+ version_requirements: *70146366979020
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: webmock
38
- requirement: &70142625290980 !ruby/object:Gem::Requirement
38
+ requirement: &70146366978320 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: 1.8.5
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70142625290980
46
+ version_requirements: *70146366978320
47
47
  description: Tiny Campfire Ruby client so you can get on with it.
48
48
  email:
49
49
  - fnichol@nichol.ca
@@ -83,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
83
  version: '0'
84
84
  segments:
85
85
  - 0
86
- hash: 3548823882607646634
86
+ hash: -3617043583867255143
87
87
  required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  none: false
89
89
  requirements:
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  segments:
94
94
  - 0
95
- hash: 3548823882607646634
95
+ hash: -3617043583867255143
96
96
  requirements: []
97
97
  rubyforge_project:
98
98
  rubygems_version: 1.8.17