capistrano-campout 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +16 -6
- data/bin/campout +40 -0
- data/lib/capistrano-campout/core.rb +0 -2
- data/lib/capistrano-campout/defaults.yml +0 -16
- data/lib/capistrano-campout/version.rb +1 -1
- data/lib/cli.rb +98 -0
- data/templates/campout.local.yml +10 -0
- data/templates/campout.yml +104 -0
- metadata +13 -8
data/README.md
CHANGED
@@ -36,16 +36,24 @@ Or install it yourself as:
|
|
36
36
|
|
37
37
|
$ gem install capistrano-campout
|
38
38
|
|
39
|
-
##
|
39
|
+
## Setup
|
40
40
|
|
41
|
-
|
41
|
+
You can generate a configuration by running
|
42
|
+
|
43
|
+
campout generate_config
|
44
|
+
|
45
|
+
This will prompt you for your campfire configuration settings and create config/campout.yml and config/campout.local.yml files for you, adding config/campout.local.yml to your .gitignore file (if present) and adding a require 'capistrano-campout' to your config/deploy.rb file.
|
46
|
+
|
47
|
+
## Manual Setup
|
48
|
+
|
49
|
+
Alternatively add a:
|
42
50
|
|
43
51
|
require "capistrano-campout"
|
44
52
|
|
45
53
|
to your capistrano deploy.rb and create a config/campout.yml and/or a config/campout.local.yml with your campfire settings (required)
|
46
54
|
|
47
55
|
campfire:
|
48
|
-
domain:
|
56
|
+
domain: your_campfire_domain
|
49
57
|
room: room_id_to_post_to
|
50
58
|
token: your_campfire_api_token
|
51
59
|
|
@@ -53,9 +61,11 @@ to your capistrano deploy.rb and create a config/campout.yml and/or a config/cam
|
|
53
61
|
|
54
62
|
"config/campout.local.yml" is meant as a local/private configuration file - I'd recommend adding the file to the .gitignore
|
55
63
|
|
56
|
-
##
|
64
|
+
## Settings
|
65
|
+
|
66
|
+
Run the 'campout generate_config' command - and the config/campout.yml file will have a list of all the known settings.
|
57
67
|
|
58
|
-
|
68
|
+
Otherwise, use the source, Luke.
|
59
69
|
|
60
70
|
## Known Limitations
|
61
71
|
|
@@ -63,7 +73,7 @@ I'll write those up one day. Until that day, use the source, Luke.
|
|
63
73
|
|
64
74
|
Capistrano::Campout requires [Tinder](https://github.com/collectiveidea/tinder) - which requires [ActiveSupport](https://github.com/rails/rails/tree/master/activesupport)
|
65
75
|
|
66
|
-
Apparently, Capistrano's "deploy:cleanup" task breaks due to conflicts between Capistrano and ActiveSupport
|
76
|
+
Apparently, Capistrano's "deploy:cleanup" task breaks in some situations due to conflicts between Capistrano and ActiveSupport
|
67
77
|
|
68
78
|
See:
|
69
79
|
|
data/bin/campout
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Copyright (c) 2012 Jason Adam Young
|
3
|
+
#
|
4
|
+
# MIT License
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
# a copy of this software and associated documentation files (the
|
8
|
+
# "Software"), to deal in the Software without restriction, including
|
9
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
# the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be
|
15
|
+
# included in all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
#
|
25
|
+
# Additional Copyrights
|
26
|
+
# =====================
|
27
|
+
#
|
28
|
+
# This code also contains code from the following people:
|
29
|
+
#
|
30
|
+
# rails_config : Copyright (c) 2010 Jacques Crocker
|
31
|
+
# deep_merge : Copyright (c) 2008 Steve Midgley, now mainted by Daniel DeLeo
|
32
|
+
# eycap : Copyright (c) 2008-2011 Engine Yard
|
33
|
+
# capfire : Copyright (c) 2010 Piet Jaspers 10to1
|
34
|
+
# capistrano-mountaintop : Copyright (c) 2010 Joshua Nichols.
|
35
|
+
|
36
|
+
source_root = File.expand_path(File.dirname(__FILE__) + "/..")
|
37
|
+
$LOAD_PATH.unshift("#{source_root}/lib")
|
38
|
+
require 'rubygems' rescue nil
|
39
|
+
require 'cli'
|
40
|
+
Campout::CLI.start
|
@@ -1,22 +1,6 @@
|
|
1
|
-
## campfire settings
|
2
|
-
# campfire:
|
3
|
-
# domain: 'your_campfire_domain'
|
4
|
-
# room: your_room_id
|
5
|
-
# token: your_campfire_token
|
6
|
-
|
7
|
-
## global action settings
|
8
|
-
# copy_log_to_server: false
|
9
|
-
# suppress_sounds: false
|
10
|
-
# suppress_deploy_time: false
|
11
|
-
# suppress_github_compare: false
|
12
|
-
|
13
|
-
## deployment settings
|
14
1
|
pre_deploy:
|
15
2
|
message: "<%= campout_deployer %> is starting to deploy <%= application %> to <%= whereto %>"
|
16
|
-
# play: 'pushit'
|
17
3
|
post_deploy_success:
|
18
4
|
message: "<%= campout_deployer %> deployed <%= application %> to <%= whereto %>"
|
19
|
-
# play: 'yeah'
|
20
5
|
post_deploy_failure:
|
21
6
|
message: "The deploy of <%= application %> to <%= whereto %> by <%= campout_deployer %> has failed."
|
22
|
-
# play: 'drama'
|
data/lib/cli.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
# === COPYRIGHT:
|
2
|
+
# Copyright (c) 2012 Jason Adam Young
|
3
|
+
# === LICENSE:
|
4
|
+
# see LICENSE file
|
5
|
+
require 'thor'
|
6
|
+
require 'yaml'
|
7
|
+
require 'capistrano-campout/version'
|
8
|
+
|
9
|
+
module Campout
|
10
|
+
class CLI < Thor
|
11
|
+
include Thor::Actions
|
12
|
+
|
13
|
+
# these are not the tasks that you seek
|
14
|
+
def self.source_root
|
15
|
+
File.expand_path(File.dirname(__FILE__) + "/..")
|
16
|
+
end
|
17
|
+
|
18
|
+
no_tasks do
|
19
|
+
|
20
|
+
def copy_configs
|
21
|
+
# campout.yml
|
22
|
+
destination = "./config/campout.yml"
|
23
|
+
if(!File.exists?(destination))
|
24
|
+
copy_file('templates/campout.yml',destination)
|
25
|
+
end
|
26
|
+
#
|
27
|
+
destination = "./config/campout.local.yml"
|
28
|
+
if(!File.exists?(destination))
|
29
|
+
copy_file('templates/campout.local.yml',destination)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_campfire_settings(open_repository,campfire_settings)
|
34
|
+
if(open_repository)
|
35
|
+
settings_file = "./config/campout.local.yml"
|
36
|
+
else
|
37
|
+
settings_file = "./config/campout.yml"
|
38
|
+
end
|
39
|
+
|
40
|
+
# has campfire settings?
|
41
|
+
has_campfire_settings = false
|
42
|
+
if(existing_settings = YAML.load(IO.read(settings_file)))
|
43
|
+
if(!existing_settings['campfire'].nil?)
|
44
|
+
has_campfire_settings = true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
if(!has_campfire_settings)
|
49
|
+
append_file(settings_file,campfire_settings.to_yaml)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def add_local_to_gitignore
|
54
|
+
gitignore_file = './.gitignore'
|
55
|
+
if(File.exists?(gitignore_file))
|
56
|
+
if(!(File.read(gitignore_file) =~ %r{config/campout.local.yml}))
|
57
|
+
append_file(gitignore_file,"config/campout.local.yml\n")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def add_campout_to_deploy
|
63
|
+
cap_deploy_script = './config/deploy.rb'
|
64
|
+
if(File.exists?(cap_deploy_script))
|
65
|
+
if(!(File.read(cap_deploy_script) =~ %r{require ['|"]capistrano-campout["|']}))
|
66
|
+
prepend_file(cap_deploy_script,"require 'capistrano-campout'\n")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
desc "about", "about campout"
|
74
|
+
def about
|
75
|
+
puts "Campout Version #{Capistrano::Campout::VERSION}: Post messages and paste logs from a capistrano deployment to a campfire room."
|
76
|
+
end
|
77
|
+
|
78
|
+
desc "generate_config", "generate campout configuration files"
|
79
|
+
def generate_config
|
80
|
+
open_repository = yes?("Is this an open/public repository?")
|
81
|
+
if(open_repository)
|
82
|
+
say "Your campout settings will be added to ./config/campout.local.yml"
|
83
|
+
else
|
84
|
+
say "Your campout settings will be added to ./config/campout.yml"
|
85
|
+
end
|
86
|
+
campfire_settings = {'campfire' => {'domain' => 'domain', 'room' => 'room', 'token' => 'token'}}
|
87
|
+
campfire_settings['campfire']['domain'] = ask("Your campfire domain:")
|
88
|
+
campfire_settings['campfire']['room'] = ask("Your campfire room ID:").to_i
|
89
|
+
campfire_settings['campfire']['token'] = ask("Your campfire api token:")
|
90
|
+
|
91
|
+
copy_configs
|
92
|
+
add_campfire_settings(open_repository,campfire_settings)
|
93
|
+
add_local_to_gitignore
|
94
|
+
add_campout_to_deploy
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#### config/campout.local.yml
|
2
|
+
## User this file for local/private campout settings for the project. This
|
3
|
+
## file should be excluded from your SCM.
|
4
|
+
##
|
5
|
+
## If your SCM repository is open it's strongly recommended that
|
6
|
+
## your campfire settings into this local configuration file
|
7
|
+
## particularly the campfire API token
|
8
|
+
##
|
9
|
+
## shared settings can be placed within a config/campout.yml file.
|
10
|
+
## see config/campout.yml for the settings
|
@@ -0,0 +1,104 @@
|
|
1
|
+
#### config/campout.yml
|
2
|
+
## User this file for shared campout settings for the project. It's
|
3
|
+
## recommended that you add this file to your SCM.
|
4
|
+
##
|
5
|
+
## personal overrides or other settings can be placed
|
6
|
+
## within a config/campout.local.yml file. If your SCM repository
|
7
|
+
## is open it's strongly recommended that your campfire settings
|
8
|
+
## into the local configuration file, particularly the campfire API token
|
9
|
+
##
|
10
|
+
### campfire settings
|
11
|
+
##
|
12
|
+
## The campfire configuration settings should be added as
|
13
|
+
## a yaml hash keyed to "campfire" e.g.
|
14
|
+
##
|
15
|
+
## campfire:
|
16
|
+
## domain: 'your_campfire_domain'
|
17
|
+
## room: your_room_id
|
18
|
+
## token: your_campfire_token
|
19
|
+
##
|
20
|
+
## The following campfire settings are required
|
21
|
+
##
|
22
|
+
## domain:
|
23
|
+
## The "subdomain" for your campfire site
|
24
|
+
## e.g. for https://yourdomain.campfirenow.com/ it will be "yourdomain"
|
25
|
+
## room:
|
26
|
+
## The id of the room you want to post messages to. Click on the campfire
|
27
|
+
## room that you want and get the id from the URL.
|
28
|
+
## e.g. for https://yourdomain.campfirenow.com/room/123456
|
29
|
+
## the room id is 123456
|
30
|
+
## token:
|
31
|
+
## The API authentication token for your account. You can get your token
|
32
|
+
## by clicking "My Info" in the top right of the campfirewnow site - or
|
33
|
+
## going directly to https://yourdomain.campfirenow.com/member/edit
|
34
|
+
##
|
35
|
+
## The following campfire settings are optional
|
36
|
+
##
|
37
|
+
## ssl:
|
38
|
+
## If false, specifies that Tinder should not use an SSL connection
|
39
|
+
## ssl_verify:
|
40
|
+
## If false, specified that Tinder should not try to verify the SSL
|
41
|
+
## certificate.
|
42
|
+
##
|
43
|
+
### global action settings
|
44
|
+
##
|
45
|
+
## copy_log_to_server:
|
46
|
+
## If set to true - the cap deployment log will be copied to a "deploy_logs"
|
47
|
+
## subdirectory of your #{shared_path}. The filename will be in the format:
|
48
|
+
## deploy-#{release_name}-#{successful? ? "success" : "failure"}.log
|
49
|
+
## default:
|
50
|
+
# copy_log_to_server: false
|
51
|
+
##
|
52
|
+
## suppress_sounds:
|
53
|
+
## If set to true, will supress the playing sounds specified in the "play"
|
54
|
+
## settings for the pre_deploy, post_deploy_success, and
|
55
|
+
## post_deploy_failure sections
|
56
|
+
## default:
|
57
|
+
# suppress_sounds: false
|
58
|
+
##
|
59
|
+
## suppress_deploy_time:
|
60
|
+
## If set to true, will supress the output of the benchmark timing for the
|
61
|
+
## deployment.
|
62
|
+
## default:
|
63
|
+
# suppress_deploy_time: false
|
64
|
+
##
|
65
|
+
## suppress_github_compare:
|
66
|
+
## Campout will attempt to display a github url (if the capistrano
|
67
|
+
## repository is a github repository) that will show the comparison
|
68
|
+
## of previous_revision with latest_revision (as determined by
|
69
|
+
## capistrano)
|
70
|
+
## default:
|
71
|
+
# suppress_github_compare: false
|
72
|
+
|
73
|
+
### deployment settings
|
74
|
+
##
|
75
|
+
## There are three deployment hashes with the following keys:
|
76
|
+
## pre_deploy: settings applied before the capistrano deploy action
|
77
|
+
## post_deploy_success: settings applied after a successful capistrano deploy action
|
78
|
+
## post_deploy_failure: settings applied after a failed capistrano deploy action
|
79
|
+
##
|
80
|
+
## Each hash can include the following settings
|
81
|
+
## message:
|
82
|
+
## The message to post to the specified campfire room. The message can include
|
83
|
+
## ERB - and all of the capistrano variables are available - with the addition
|
84
|
+
## of "campout_deployer" - which attempts to use the git user.name setting and
|
85
|
+
## falls back to ENV['USER'] and "whereto" - which attempts to use the stage
|
86
|
+
## and falls back to ENV['SERVER'] or 'production'
|
87
|
+
## play:
|
88
|
+
## specifies a campfire sound to play when the message is posted.
|
89
|
+
##
|
90
|
+
## defaults:
|
91
|
+
# pre_deploy:
|
92
|
+
# message: "<%= campout_deployer %> is starting to deploy <%= application %> to <%= whereto %>"
|
93
|
+
# post_deploy_success:
|
94
|
+
# message: "<%= campout_deployer %> deployed <%= application %> to <%= whereto %>"
|
95
|
+
# post_deploy_failure:
|
96
|
+
# message: "The deploy of <%= application %> to <%= whereto %> by <%= campout_deployer %> has failed."
|
97
|
+
##
|
98
|
+
## recommended sounds:
|
99
|
+
# pre_deploy:
|
100
|
+
# play: "pushit"
|
101
|
+
# post_deploy_success:
|
102
|
+
# play: "yeah"
|
103
|
+
# post_deploy_failure:
|
104
|
+
# play: "drama"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-campout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-04-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &70347365888740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.11'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70347365888740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: tinder
|
27
|
-
requirement: &
|
27
|
+
requirement: &70347365887720 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '1.8'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70347365887720
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: grit
|
38
|
-
requirement: &
|
38
|
+
requirement: &70347365885720 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '2.4'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70347365885720
|
47
47
|
description: ! " Capistrano::Campout is a gem extension to capistrano to post/speak
|
48
48
|
messages and paste logs from a capistrano deployment \n to a campfire room. Settings
|
49
49
|
are configurable using ERB in a \"config/campout.yml\" or \"config/campout.local.yml\"
|
@@ -51,7 +51,8 @@ description: ! " Capistrano::Campout is a gem extension to capistrano to post
|
|
51
51
|
success or failure message. Event sounds\n are also supported.\n"
|
52
52
|
email:
|
53
53
|
- jay@outfielding.net
|
54
|
-
executables:
|
54
|
+
executables:
|
55
|
+
- campout
|
55
56
|
extensions: []
|
56
57
|
extra_rdoc_files: []
|
57
58
|
files:
|
@@ -60,6 +61,7 @@ files:
|
|
60
61
|
- LICENSE
|
61
62
|
- README.md
|
62
63
|
- Rakefile
|
64
|
+
- bin/campout
|
63
65
|
- capistrano-campout.gemspec
|
64
66
|
- lib/capistrano-campout.rb
|
65
67
|
- lib/capistrano-campout/core.rb
|
@@ -71,6 +73,9 @@ files:
|
|
71
73
|
- lib/capistrano-campout/recipes/campout.rb
|
72
74
|
- lib/capistrano-campout/recipes/deploy.rb
|
73
75
|
- lib/capistrano-campout/version.rb
|
76
|
+
- lib/cli.rb
|
77
|
+
- templates/campout.local.yml
|
78
|
+
- templates/campout.yml
|
74
79
|
homepage: https://github.com/jasonadamyoung/capistrano-campout
|
75
80
|
licenses:
|
76
81
|
- MIT
|