capistrano-campfire 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source :rubygems
2
+
3
+ gem 'capistrano'
4
+ gem 'tinder'
5
+
6
+ group :development do
7
+ gem 'rspec', '~> 1.2.9'
8
+ gem 'jeweler'
9
+ gem 'capistrano-spec'
10
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,61 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ capistrano (2.12.0)
5
+ highline
6
+ net-scp (>= 1.0.0)
7
+ net-sftp (>= 2.0.0)
8
+ net-ssh (>= 2.0.14)
9
+ net-ssh-gateway (>= 1.1.0)
10
+ capistrano-spec (0.1.0)
11
+ eventmachine (1.0.0)
12
+ faraday (0.8.4)
13
+ multipart-post (~> 1.1)
14
+ faraday_middleware (0.8.8)
15
+ faraday (>= 0.7.4, < 0.9)
16
+ git (1.2.5)
17
+ hashie (1.2.0)
18
+ highline (1.6.14)
19
+ http_parser.rb (0.5.3)
20
+ jeweler (1.6.4)
21
+ bundler (~> 1.0)
22
+ git (>= 1.2.5)
23
+ rake
24
+ json (1.7.5)
25
+ mime-types (1.19)
26
+ multi_json (1.3.6)
27
+ multipart-post (1.1.5)
28
+ net-scp (1.0.4)
29
+ net-ssh (>= 1.99.1)
30
+ net-sftp (2.0.5)
31
+ net-ssh (>= 2.0.9)
32
+ net-ssh (2.5.2)
33
+ net-ssh-gateway (1.1.0)
34
+ net-ssh (>= 1.99.1)
35
+ rake (0.9.2.2)
36
+ rspec (1.2.9)
37
+ simple_oauth (0.1.9)
38
+ tinder (1.9.1)
39
+ eventmachine (>= 0.12.0, < 2)
40
+ faraday (~> 0.8)
41
+ faraday_middleware (~> 0.8)
42
+ hashie (~> 1.0)
43
+ json (~> 1.6)
44
+ mime-types (~> 1.16)
45
+ multi_json (~> 1.0)
46
+ multipart-post (~> 1.1)
47
+ twitter-stream (~> 0.1)
48
+ twitter-stream (0.1.16)
49
+ eventmachine (>= 0.12.8)
50
+ http_parser.rb (~> 0.5.1)
51
+ simple_oauth (~> 0.1.4)
52
+
53
+ PLATFORMS
54
+ ruby
55
+
56
+ DEPENDENCIES
57
+ capistrano
58
+ capistrano-spec
59
+ jeweler
60
+ rspec (~> 1.2.9)
61
+ tinder
data/README.rdoc CHANGED
@@ -22,6 +22,28 @@ And here's a quick example for your `config/deploy.rb`:
22
22
  campfire_room.speak 'o hai'
23
23
  end
24
24
 
25
+
26
+ You can also be posting to multiple campfire rooms/accounts.
27
+
28
+ require 'capistrano/campfire'
29
+
30
+ set :campfire_options, :rooms => [{
31
+ :account => 'zim',
32
+ :room => 'World Conquest',
33
+ :token => '001000101110101001011112',
34
+ }, {
35
+ :account => 'swolleneyeballnetwork',
36
+ :room => 'Agents',
37
+ :token => '2001000101110101001011110',
38
+ }],
39
+ :ssl => true
40
+
41
+
42
+ task :ohai do
43
+ campfire_rooms.speak 'o hai'
44
+ end
45
+
46
+
25
47
  == Note on Patches/Pull Requests
26
48
 
27
49
  * Fork the project.
data/Rakefile CHANGED
@@ -10,8 +10,6 @@ begin
10
10
  gem.email = "josh@technicalpickles.com"
11
11
  gem.homepage = "http://github.com/technicalpickles/capistrano-campfire"
12
12
  gem.authors = ["Joshua Nichols"]
13
- gem.add_dependency "tinder"
14
- gem.add_development_dependency "rspec", ">= 1.2.9"
15
13
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
14
  end
17
15
  Jeweler::GemcutterTasks.new
@@ -31,8 +29,6 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
31
29
  spec.rcov = true
32
30
  end
33
31
 
34
- task :spec => :check_dependencies
35
-
36
32
  task :default => :spec
37
33
 
38
34
  require 'rake/rdoctask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.2.0
@@ -4,20 +4,22 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{capistrano-campfire}
8
- s.version = "0.1.3"
7
+ s.name = "capistrano-campfire"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joshua Nichols"]
12
- s.date = %q{2011-10-03}
13
- s.description = %q{ capistrano-tinder is a very simple library for making a Campfire room accessible from capistrano. All it does is provide said access, and nothing more, preferring to let other gems do that trickery. }
14
- s.email = %q{josh@technicalpickles.com}
12
+ s.date = "2012-10-15"
13
+ s.description = " capistrano-tinder is a very simple library for making a Campfire room accessible from capistrano. All it does is provide said access, and nothing more, preferring to let other gems do that trickery. "
14
+ s.email = "josh@technicalpickles.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
21
23
  "LICENSE",
22
24
  "README.rdoc",
23
25
  "Rakefile",
@@ -30,24 +32,33 @@ Gem::Specification.new do |s|
30
32
  "spec/spec.opts",
31
33
  "spec/spec_helper.rb"
32
34
  ]
33
- s.homepage = %q{http://github.com/technicalpickles/capistrano-campfire}
35
+ s.homepage = "http://github.com/technicalpickles/capistrano-campfire"
34
36
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.4.2}
36
- s.summary = %q{Post to Campfire from capistrano}
37
+ s.rubygems_version = "1.8.10"
38
+ s.summary = "Post to Campfire from capistrano"
37
39
 
38
40
  if s.respond_to? :specification_version then
39
41
  s.specification_version = 3
40
42
 
41
43
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_runtime_dependency(%q<capistrano>, [">= 0"])
42
45
  s.add_runtime_dependency(%q<tinder>, [">= 0"])
43
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
46
+ s.add_development_dependency(%q<rspec>, ["~> 1.2.9"])
47
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
48
+ s.add_development_dependency(%q<capistrano-spec>, [">= 0"])
44
49
  else
50
+ s.add_dependency(%q<capistrano>, [">= 0"])
45
51
  s.add_dependency(%q<tinder>, [">= 0"])
46
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
52
+ s.add_dependency(%q<rspec>, ["~> 1.2.9"])
53
+ s.add_dependency(%q<jeweler>, [">= 0"])
54
+ s.add_dependency(%q<capistrano-spec>, [">= 0"])
47
55
  end
48
56
  else
57
+ s.add_dependency(%q<capistrano>, [">= 0"])
49
58
  s.add_dependency(%q<tinder>, [">= 0"])
50
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
59
+ s.add_dependency(%q<rspec>, ["~> 1.2.9"])
60
+ s.add_dependency(%q<jeweler>, [">= 0"])
61
+ s.add_dependency(%q<capistrano-spec>, [">= 0"])
51
62
  end
52
63
  end
53
64
 
@@ -3,26 +3,63 @@ require 'tinder'
3
3
 
4
4
  module Capistrano
5
5
  module Campfire
6
- def self.extended(configuration)
7
- configuration.load do
8
- set :campfire_options, {}
6
+ class RoomCollection
7
+ def initialize(campfire_options)
8
+ rooms_options = campfire_options[:rooms]
9
9
 
10
- set :campfire_room do
10
+ # if no rooms specified, let's assume the campfire_options has everything
11
+ # so let's fake it
12
+ unless rooms_options
13
+ rooms_options = [{}]
14
+ end
15
+
16
+ @rooms = rooms_options.map do |room_options|
17
+ account = room_options[:account] || campfire_options[:account]
18
+ token = room_options[:token] || campfire_options[:token]
19
+ ssl = room_options[:ssl] || campfire_options[:ssl]
20
+ ssl_verify = room_options[:ssl_verify] || campfire_options[:ssl_verify]
21
+ room_name = room_options[:room] || campfire_options[:room]
11
22
 
12
- account = campfire_options[:account]
13
- token = campfire_options[:token]
14
- ssl = campfire_options[:ssl]
15
- ssl_verify = campfire_options[:ssl_verify]
16
- room_name = campfire_options[:room]
17
23
 
18
24
  campfire = ::Tinder::Campfire.new account,
19
25
  :token => token,
20
26
  :ssl => ssl,
21
27
  :ssl_verify => ssl_verify
22
-
23
28
  campfire.find_room_by_name(room_name)
24
29
  end
25
30
  end
31
+
32
+ def speak(message)
33
+ @rooms.each do |room|
34
+ room.speak message
35
+ end
36
+ end
37
+
38
+ def paste(message)
39
+ @rooms.each do |room|
40
+ room.paste message
41
+ end
42
+ end
43
+
44
+ def play(message)
45
+ @rooms.each do |room|
46
+ room.play message
47
+ end
48
+ end
49
+ end
50
+
51
+ def self.extended(configuration)
52
+ configuration.load do
53
+ set :campfire_options, {}
54
+
55
+ set :campfire_room do
56
+ RoomCollection.new(campfire_options)
57
+ end
58
+
59
+ set :campfire_rooms do
60
+ RoomCollection.new(campfire_options)
61
+ end
62
+ end
26
63
  end
27
64
 
28
65
  end
@@ -16,23 +16,89 @@ describe Capistrano::Campfire do
16
16
  configuration.campfire_options.should == {}
17
17
  end
18
18
 
19
- it "gives access to a room, given correct campfire options" do
20
- configuration.set :campfire_options, {
21
- :account => "awesomellc",
22
- :token => "yyz123",
23
- :ssl => true,
24
- :room => "General Awesomeness"
25
- }
19
+ context "with configuration for a single room" do
20
+ before do
21
+ configuration.set :campfire_options, {
22
+ :account => "awesomellc",
23
+ :token => "yyz123",
24
+ :ssl => true,
25
+ :room => "General Awesomeness"
26
+ }
26
27
 
27
- campfire = stub("campfire")
28
- ::Tinder::Campfire.should_receive(:new).with("awesomellc", :token => "yyz123", :ssl => true).and_return(campfire)
28
+ @campfire = stub("campfire")
29
+ ::Tinder::Campfire.should_receive(:new).with("awesomellc", :token => "yyz123", :ssl => true, :ssl_verify => nil).and_return(@campfire)
29
30
 
30
- room = stub("room")
31
- campfire.should_receive(:find_room_by_name).with("General Awesomeness").and_return(room)
31
+ @room = stub("room")
32
+ @campfire.should_receive(:find_room_by_name).with("General Awesomeness").and_return(@room)
33
+
34
+ end
35
+
36
+ it "speaks in a single room using `campfire_room.speak`" do
37
+ @room.should_receive(:speak).with("IMPENDING DOOM")
38
+
39
+ configuration.campfire_room.speak "IMPENDING DOOM"
40
+ end
41
+
42
+ it "pastes in a single room using `campfire_room.paste`" do
43
+ @room.should_receive(:paste).with("IMPENDING DOOM")
44
+
45
+ configuration.campfire_room.paste "IMPENDING DOOM"
46
+ end
47
+
48
+ it "plays in a single room using `campfire_room.play`" do
49
+ @room.should_receive(:play).with("IMPENDING DOOM")
50
+
51
+ configuration.campfire_room.play "IMPENDING DOOM"
52
+ end
32
53
 
33
- configuration.campfire_room.should == room
34
54
  end
35
55
 
56
+ context "with configuration for multiple rooms" do
57
+ before do
58
+ configuration.set :campfire_options, :rooms => [{
59
+ :account => 'zim',
60
+ :room => 'World Conquest',
61
+ :token => '001000101110101001011112'
62
+ }, {
63
+ :account => 'swolleneyeballnetwork',
64
+ :room => 'Agents',
65
+ :token => '2001000101110101001011110'
66
+ }],
67
+ :ssl => true
68
+ @zim_campfire = stub("zim_campfire")
69
+ ::Tinder::Campfire.should_receive(:new).with('zim', :token => '001000101110101001011112', :ssl => true, :ssl_verify => nil).and_return(@zim_campfire)
70
+
71
+ @world_conquest_room = stub("world_conquest_room")
72
+ @zim_campfire.should_receive(:find_room_by_name).with("World Conquest").and_return(@world_conquest_room)
73
+
74
+ @swolleneyeballnetwork_campfire = stub("swolleneyeballnetwork_campfire")
75
+ ::Tinder::Campfire.should_receive(:new).with('swolleneyeballnetwork', :token => '2001000101110101001011110', :ssl => true, :ssl_verify => nil).and_return(@swolleneyeballnetwork_campfire)
76
+
77
+ @agents_room = stub("agents_room")
78
+ @swolleneyeballnetwork_campfire.should_receive(:find_room_by_name).with("Agents").and_return(@agents_room)
79
+ end
80
+
81
+ it "speaks in all rooms using `campfire_rooms.speak`" do
82
+ @world_conquest_room.should_receive(:speak).with("DOOM IMPENDING")
83
+ @agents_room.should_receive(:speak).with("DOOM IMPENDING")
84
+
85
+ configuration.campfire_rooms.speak "DOOM IMPENDING"
86
+ end
87
+
88
+ it "pastes in all rooms using `campfire_rooms.paste`" do
89
+ @world_conquest_room.should_receive(:paste).with("DOOM IMPENDING")
90
+ @agents_room.should_receive(:paste).with("DOOM IMPENDING")
91
+
92
+ configuration.campfire_rooms.paste "DOOM IMPENDING"
93
+ end
94
+
95
+ it "plays in all rooms using `campfire_rooms.plays`" do
96
+ @world_conquest_room.should_receive(:play).with("DOOM IMPENDING")
97
+ @agents_room.should_receive(:play).with("DOOM IMPENDING")
98
+
99
+ configuration.campfire_rooms.play "DOOM IMPENDING"
100
+ end
101
+ end
36
102
  end
37
103
 
38
104
  end
metadata CHANGED
@@ -1,64 +1,84 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: capistrano-campfire
3
- version: !ruby/object:Gem::Version
4
- hash: 29
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 3
10
- version: 0.1.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Joshua Nichols
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-10-03 00:00:00 -04:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: tinder
12
+ date: 2012-10-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: capistrano
16
+ requirement: &70225647408000 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
23
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: *70225647408000
25
+ - !ruby/object:Gem::Dependency
26
+ name: tinder
27
+ requirement: &70225647406840 !ruby/object:Gem::Requirement
25
28
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
33
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rspec
37
34
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
35
+ version_requirements: *70225647406840
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &70225647405420 !ruby/object:Gem::Requirement
39
39
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 13
44
- segments:
45
- - 1
46
- - 2
47
- - 9
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
48
43
  version: 1.2.9
49
44
  type: :development
50
- version_requirements: *id002
51
- description: " capistrano-tinder is a very simple library for making a Campfire room accessible from capistrano. All it does is provide said access, and nothing more, preferring to let other gems do that trickery. "
45
+ prerelease: false
46
+ version_requirements: *70225647405420
47
+ - !ruby/object:Gem::Dependency
48
+ name: jeweler
49
+ requirement: &70225647549080 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70225647549080
58
+ - !ruby/object:Gem::Dependency
59
+ name: capistrano-spec
60
+ requirement: &70225647548260 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70225647548260
69
+ description: ! ' capistrano-tinder is a very simple library for making a Campfire
70
+ room accessible from capistrano. All it does is provide said access, and nothing
71
+ more, preferring to let other gems do that trickery. '
52
72
  email: josh@technicalpickles.com
53
73
  executables: []
54
-
55
74
  extensions: []
56
-
57
- extra_rdoc_files:
75
+ extra_rdoc_files:
58
76
  - LICENSE
59
77
  - README.rdoc
60
- files:
78
+ files:
61
79
  - .document
80
+ - Gemfile
81
+ - Gemfile.lock
62
82
  - LICENSE
63
83
  - README.rdoc
64
84
  - Rakefile
@@ -70,39 +90,31 @@ files:
70
90
  - spec/capistrano-campfire_spec.rb
71
91
  - spec/spec.opts
72
92
  - spec/spec_helper.rb
73
- has_rdoc: true
74
93
  homepage: http://github.com/technicalpickles/capistrano-campfire
75
94
  licenses: []
76
-
77
95
  post_install_message:
78
96
  rdoc_options: []
79
-
80
- require_paths:
97
+ require_paths:
81
98
  - lib
82
- required_ruby_version: !ruby/object:Gem::Requirement
99
+ required_ruby_version: !ruby/object:Gem::Requirement
83
100
  none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ segments:
89
106
  - 0
90
- version: "0"
91
- required_rubygems_version: !ruby/object:Gem::Requirement
107
+ hash: -4379137590683155220
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
109
  none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- hash: 3
97
- segments:
98
- - 0
99
- version: "0"
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
100
114
  requirements: []
101
-
102
115
  rubyforge_project:
103
- rubygems_version: 1.4.2
116
+ rubygems_version: 1.8.10
104
117
  signing_key:
105
118
  specification_version: 3
106
119
  summary: Post to Campfire from capistrano
107
120
  test_files: []
108
-