capfire 0.1.1 → 0.2.0

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.
@@ -7,10 +7,30 @@ This gem adds a way to send a message to campfire after a deploy, in the message
7
7
  == Install
8
8
  `gem install capfire`
9
9
 
10
- `script/generate capfire -k "campfire_token" -r "chat_room" -a "campfire_account"`
11
- This will generate a ~/.campfire file containing these settings. Feel free to edit it by hand, or run the generator with bogus data, it's a simple yaml file.
10
+ Now either the generator:
11
+ `script/generate capfire -k "campfire_token" -r "chat_room" -a "campfire_account"`
12
+ This will create a ~/.campfire file and add a line to your config/deploy.rb file.
12
13
 
13
- If the user doesn't have a ~/.campfire file it won't try to send a message to Campfire.
14
+ Or do it by hand:
15
+ In your config/deploy.rb append `require capfire/capistrano`, in your home folder create .campfire with the following contents
16
+
17
+ campfire:
18
+ account: your_campfire_account
19
+ token: your_campfire_token
20
+ room: the_campfire_chatroom_to_post in
21
+ message: "I (#deployer#) deployed #application#
22
+ with `cap #args# (#compare_url#)"
23
+
24
+ From now on your deploys will send a message to Campfire containing the Github-compare view url.
25
+
26
+ == Multiple Projects
27
+
28
+ Either run the generator (without options since you've arleady got a ~/.campfire file it won't complain) again or append by hand the `require capfire/capistrano` line to your deploy file.
29
+
30
+ == Usage
31
+ After the install you're done. Really, do a `cap deploy` and it should post to campfire.
32
+
33
+ If anoyone on the project doesn't have Capfire installed he won't notice a difference, no message will be sent.
14
34
 
15
35
  == Note on Patches/Pull Requests
16
36
 
data/Rakefile CHANGED
@@ -5,13 +5,13 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "capfire"
8
- gem.summary = %Q{Send a notification to Campfire after a deploy}
8
+ gem.summary = %Q{Send a notification to Campfire after a cap deploy}
9
9
  gem.description = %Q{Inspired by http://github.com/blog/609-tracking-deploys-with-compare-view}
10
10
  gem.email = "junkiesxl@gmail.com"
11
11
  gem.homepage = "http://github.com/pjaspers/Capfire"
12
12
  gem.authors = ["pjaspers"]
13
- gem.files = FileList['[A-Z]*',
14
- 'generators/**/*.*',
13
+ gem.files = FileList['[A-Z]*',
14
+ 'generators/**/*.*',
15
15
  'lib/**/*.rb',
16
16
  'lib/templates/*.erb']
17
17
  gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -25,6 +25,8 @@ campfire:
25
25
  account: #{options[:campfire_account]}
26
26
  token: #{options[:campfire_token]}
27
27
  room: #{options[:chat_room]}
28
+ message: "I (#deployer#) deployed #application#
29
+ with `cap #args#` (#compare_url#)"
28
30
  CONF
29
31
  unless campfire_file_exists?
30
32
  File.open(File.join(ENV['HOME'],'.campfire'), 'w') do |out|
@@ -1,5 +1,6 @@
1
- Dir[File.join(File.dirname(__FILE__), '..', 'vendor', 'gems', 'capfire-*')].each do |vendored_notifier|
2
- $: << File.join(vendored_notifier, 'lib')
1
+ begin
2
+ require 'capfire/capistrano'
3
+ rescue Object
4
+ # Don't force other users to install Capfire.
3
5
  end
4
6
 
5
- require 'capfire/capistrano'
@@ -1,7 +1,6 @@
1
-
2
-
3
- # Gem for applications to automatically post errors to the Hoptoad of their choice.
1
+ # Gem for applications to automatically post to Campfire after an deploy.
4
2
  module Capfire
5
-
3
+ # Nothing to see here, take a gander at the generator
4
+ # or in the capistrano.rb
6
5
  end
7
6
 
@@ -1,8 +1,11 @@
1
- # Defines deploy:notify_hoptoad which will send information about the deploy to Hoptoad.
1
+ # Defines deploy:notify_campfire
2
+
3
+ require 'broach'
2
4
 
3
5
  Capistrano::Configuration.instance(:must_exist).load do
4
6
 
5
- if File.exists?(File.join(ENV['HOME'],'.campfire'))
7
+ # Don't bother users who have capfire installed but don't have a ~/.campfire file
8
+ if File.exists?(File.join(ENV['HOME'],'.campfire'))
6
9
  after "deploy:update_code", "deploy:notify_campfire"
7
10
  end
8
11
 
@@ -21,12 +24,16 @@ Capistrano::Configuration.instance(:must_exist).load do
21
24
  # Getting the github url
22
25
  github_url = repository.gsub(/git@/, 'http://').gsub(/\.com:/,'.com/').gsub(/\.git/, '')
23
26
  compare_url = "#{github_url}/compare/#{deployed}...#{deploying}"
27
+
28
+ # Reading the config file.
24
29
  config = YAML::load(File.open(File.join(ENV['HOME'],'.campfire')))
30
+
31
+ # Ugly but it does the job.
32
+ message = config["campfire"]["message"].gsub(/#deployer#/, deployer).gsub(/#application#/, application).gsub(/#args#/, ARGV.join(' ')).gsub(/#compare_url#/,compare_url)
33
+
34
+ # Posting the message.
25
35
  Broach.settings = { 'account' => config["campfire"]["account"], 'token' => config["campfire"]["token"] }
26
- Broach.speak(campfire_room,
27
- "I (#{deployer}) deployed #{application} " +
28
- "with `cap #{ARGV.join(' ')}` (#{compare_url})"
29
- )
36
+ Broach.speak(config["campfire"]["room"], message)
30
37
  end
31
38
  end
32
39
  end
@@ -1,5 +1,6 @@
1
1
  require 'helper'
2
2
 
3
+ # Don't really have an idea how to test this.
3
4
  class TestCapfire < Test::Unit::TestCase
4
5
  should "probably rename this file and start testing for real" do
5
6
  flunk "hey buddy, you should probably rename this file and start testing for real"
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - pjaspers
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-25 00:00:00 +01:00
17
+ date: 2010-03-31 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -91,7 +91,7 @@ rubyforge_project:
91
91
  rubygems_version: 1.3.6
92
92
  signing_key:
93
93
  specification_version: 3
94
- summary: Send a notification to Campfire after a deploy
94
+ summary: Send a notification to Campfire after a cap deploy
95
95
  test_files:
96
96
  - test/helper.rb
97
97
  - test/test_Capfire.rb