capistrano-basecamp 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +27 -0
- data/README.markdown +33 -0
- data/Rakefile +2 -0
- data/capistrano-basecamp.gemspec +22 -0
- data/lib/capistrano-basecamp.rb +73 -0
- data/lib/capistrano-basecamp/version.rb +5 -0
- metadata +90 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
capistrano-basecamp (0.0.1)
|
5
|
+
basecamp (= 0.0.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.2.4)
|
11
|
+
basecamp (0.0.2)
|
12
|
+
oauth2 (~> 0.0.8)
|
13
|
+
faraday (0.4.6)
|
14
|
+
addressable (>= 2.1.1)
|
15
|
+
rack (>= 1.0.1)
|
16
|
+
multi_json (0.0.5)
|
17
|
+
oauth2 (0.0.13)
|
18
|
+
faraday (~> 0.4.1)
|
19
|
+
multi_json (>= 0.0.4)
|
20
|
+
rack (1.2.1)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
basecamp (= 0.0.2)
|
27
|
+
capistrano-basecamp!
|
data/README.markdown
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
Capistrano plugin that posts change logs to Basecamp after deploy.
|
2
|
+
|
3
|
+
Currently, only Git SCM is supported. Before deploy, this plugin finds out the version SHA on the server and compares it to the version to be deployed. Difference in git log will be posted to Basecamp project.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
gem install capistrano-basecamp
|
8
|
+
|
9
|
+
In your capistrano recipe just require this plugin:
|
10
|
+
|
11
|
+
require 'capistrano-basecamp'
|
12
|
+
|
13
|
+
Capistrano configuration
|
14
|
+
|
15
|
+
set :basecamp_host, 'foo.basecamphq.com' # Basecamp account url
|
16
|
+
set :basecamp_project, 4873268 # Project ID in Basecamp to post message to
|
17
|
+
|
18
|
+
Optional configuration options
|
19
|
+
|
20
|
+
set :basecamp_username, 'john' # Basecamp username
|
21
|
+
set :basecamp_password, 'secret' # Basecamp account password
|
22
|
+
set :basecamp_category, 53721442 # Category under project in Basecamp
|
23
|
+
set :basecamp_ssl, true # true by default, set to false if you do not use SSL
|
24
|
+
|
25
|
+
If username and password are not provided in configuration, they will be asked on the first go and stored in PLAIN TEXT to `~/.basecamp.capistrano` file.
|
26
|
+
|
27
|
+
## TODO:
|
28
|
+
|
29
|
+
* Proper support for basecamp_post configuration option. Should support these values:
|
30
|
+
* `'auto'` -- message will be posted automatically
|
31
|
+
* `'ask'` -- ask for user confirmation before posting each message
|
32
|
+
* Add support for other SCM's than Git
|
33
|
+
* Do not store basecamp account information in plain text in `~/.basecamp.capistrano`
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
require 'capistrano-basecamp/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'capistrano-basecamp'
|
6
|
+
s.version = Capistrano::Basecamp::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ['Priit Haamer']
|
9
|
+
s.email = ['priit@fraktal.ee']
|
10
|
+
s.homepage = 'http://rubygems.org/gems/capistrano-basecamp'
|
11
|
+
s.summary = %q{Posts change logs to Basecamp after Capistrano deploy.}
|
12
|
+
s.description = %q{Capistrano plugin that posts change logs to Basecamp after deploy.}
|
13
|
+
|
14
|
+
s.rubyforge_project = 'capistrano-basecamp'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
|
21
|
+
s.add_dependency(%q<basecamp>, ["= 0.0.2"])
|
22
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'basecamp'
|
3
|
+
|
4
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
5
|
+
|
6
|
+
# Before starting with deploy, get the current version from the server
|
7
|
+
before 'deploy' do
|
8
|
+
set(:git_initial_sha, capture("cd #{current_path}; git rev-parse --verify HEAD").strip)
|
9
|
+
end
|
10
|
+
|
11
|
+
# After deploy, post the message to basecamp.
|
12
|
+
after 'deploy' do
|
13
|
+
post = self.fetch(:basecamp_post) do
|
14
|
+
if Capistrano::CLI.ui.ask("Post changelog to Basecamp? (Y)") == 'Y'
|
15
|
+
'auto'
|
16
|
+
else
|
17
|
+
false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
if 'auto' == post
|
22
|
+
basecamp.post_message
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
namespace :basecamp do
|
27
|
+
desc <<-DESC
|
28
|
+
After deploy, post changelog message to basecamp.
|
29
|
+
|
30
|
+
set :basecamp_host, 'mycompany.basecamp.com'
|
31
|
+
DESC
|
32
|
+
task :post_message do
|
33
|
+
set(:git_final_sha, capture("cd #{release_path}; git rev-parse --verify HEAD").strip)
|
34
|
+
|
35
|
+
if git_initial_sha != git_final_sha
|
36
|
+
basecamp_host = self.fetch(:basecamp_host)
|
37
|
+
logger.info "Posting message to Basecamp (#{basecamp_host})"
|
38
|
+
|
39
|
+
user_data = Hash.new
|
40
|
+
|
41
|
+
if File.exists?(File.join(ENV['HOME'], '.basecamp.capistrano'))
|
42
|
+
user_data = YAML::load(File.read(File.join(ENV['HOME'], '.basecamp.capistrano'))).fetch(basecamp_host) rescue nil
|
43
|
+
end
|
44
|
+
|
45
|
+
unless user_data
|
46
|
+
logger.info "Please enter your Basecamp username and password for #{basecamp_host} future reference"
|
47
|
+
user_data = {
|
48
|
+
:username => Capistrano::CLI.ui.ask("Username:").strip,
|
49
|
+
:password => Capistrano::CLI.ui.ask("Password:").strip
|
50
|
+
}
|
51
|
+
File.open(File.join(ENV['HOME'], '.basecamp.capistrano'), 'w') { |f| f.write({basecamp_host => user_data}.to_yaml) }
|
52
|
+
logger.debug "Your Basecamp credentials have been written to #{File.join(ENV['HOME'], '.basecamp.capistrano')}"
|
53
|
+
end
|
54
|
+
|
55
|
+
basecamp_username = self.fetch(:basecamp_username, user_data[:username])
|
56
|
+
basecamp_password = self.fetch(:basecamp_password, user_data[:password])
|
57
|
+
basecamp_ssl = self.fetch(:basecamp_ssl, true)
|
58
|
+
basecamp_project = self.fetch(:basecamp_project)
|
59
|
+
|
60
|
+
git_log = `git log --pretty=oneline --abbrev-commit #{git_initial_sha}..#{git_final_sha} #{branch}`
|
61
|
+
|
62
|
+
Basecamp.establish_connection!(basecamp_host, basecamp_username, basecamp_password, basecamp_ssl)
|
63
|
+
message = Basecamp::Message.new(:project_id => basecamp_project)
|
64
|
+
message.title = "#{rails_env.capitalize} update #{DateTime.now.strftime('%d.%m.%Y %H:%M')}"
|
65
|
+
message.body = git_log.split("\n").inject('') { |memo, row| memo << "* #{row}\n" }
|
66
|
+
if self.exists?(:basecamp_category)
|
67
|
+
message.category_id = self.fetch(:basecamp_category)
|
68
|
+
end
|
69
|
+
message.save
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-basecamp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Priit Haamer
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-03-11 00:00:00 +05:30
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: basecamp
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - "="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 27
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 0
|
33
|
+
- 2
|
34
|
+
version: 0.0.2
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Capistrano plugin that posts change logs to Basecamp after deploy.
|
38
|
+
email:
|
39
|
+
- priit@fraktal.ee
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- .gitignore
|
48
|
+
- Gemfile
|
49
|
+
- Gemfile.lock
|
50
|
+
- README.markdown
|
51
|
+
- Rakefile
|
52
|
+
- capistrano-basecamp.gemspec
|
53
|
+
- lib/capistrano-basecamp.rb
|
54
|
+
- lib/capistrano-basecamp/version.rb
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: http://rubygems.org/gems/capistrano-basecamp
|
57
|
+
licenses: []
|
58
|
+
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 3
|
70
|
+
segments:
|
71
|
+
- 0
|
72
|
+
version: "0"
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
hash: 3
|
79
|
+
segments:
|
80
|
+
- 0
|
81
|
+
version: "0"
|
82
|
+
requirements: []
|
83
|
+
|
84
|
+
rubyforge_project: capistrano-basecamp
|
85
|
+
rubygems_version: 1.3.7
|
86
|
+
signing_key:
|
87
|
+
specification_version: 3
|
88
|
+
summary: Posts change logs to Basecamp after Capistrano deploy.
|
89
|
+
test_files: []
|
90
|
+
|