fingercap 0.1

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.
data/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2008 Manfred Stienstra, Fingertips <manfred@fngtps.com>
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,4 @@
1
+ Fingercap
2
+ ---------
3
+
4
+ Fingercap is a set of recipes and tasks meant for deploying to Fingertips servers.
@@ -0,0 +1,8 @@
1
+ # Put this in $HOME/.fingercap.yml
2
+ ---
3
+ campfire:
4
+ account: fingertips
5
+ use_ssl: true
6
+ username: deployment@fngtps.com
7
+ password: secret
8
+ room: Office
@@ -0,0 +1,44 @@
1
+ require 'fingercap/recipes'
2
+
3
+ Capistrano::Configuration.instance(:must_exist).load do
4
+ default_run_options[:pty] = true
5
+
6
+ set :runner, 'app'
7
+ set :user, 'deploy'
8
+ set :domain, 'miller.fngtps.com'
9
+ set :deploy_to, "/var/www/#{application}"
10
+
11
+ role :web, domain
12
+ role :app, domain
13
+ role :db, domain, :primary => true
14
+
15
+ namespace :deploy do
16
+ desc "Stop the application (empty operation on Miller)"
17
+ task :stop do
18
+ end
19
+
20
+ desc "Start the application"
21
+ task :start do
22
+ apache.restart
23
+ end
24
+
25
+ desc "Restart the application"
26
+ task :restart do
27
+ passenger.restart
28
+ end
29
+
30
+ desc "Make sure the permissions are correct for all the directories"
31
+ task :fix_permissions do
32
+ try_sudo "chown -R #{user}:wheel #{deploy_to}"
33
+ try_sudo "chown -R #{fetch(:runner, "app")}:wheel #{shared_path}"
34
+ end
35
+
36
+ namespace :db do
37
+ desc "Create the production database defined in config/database.yml."
38
+ task :create do
39
+ rake = fetch(:rake, "rake")
40
+ run "cd #{current_path}; #{rake} RAILS_ENV=production db:create"
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,38 @@
1
+ require 'active_support'
2
+
3
+ module PersistantDirectory
4
+ # Create persistant directories in /deploy/to/shared
5
+ #
6
+ # Create /deploy/to/shared/public/assets
7
+ #
8
+ # PersistantDirectory.create('public/assets')
9
+ #
10
+ # Create multiple directories at once
11
+ #
12
+ # PersistantDirectory.create('public/icons', 'public/files')
13
+ def create(*args)
14
+ options = args.extract_options!
15
+ args.each do |directory|
16
+ try_sudo "mkdir -p -m 775 #{shared_path}/#{directory}"
17
+ try_sudo "chown #{fetch(:runner, "app")}:wheel #{shared_path}/#{directory}"
18
+ end
19
+ end
20
+
21
+ # Symlink shared persistant directories to the current deployment directory
22
+ #
23
+ # Symlink /deploy/to/shared/public/assets to /deploy/to/current/public/assets
24
+ #
25
+ # PersistantDirectory.symlink('public/assets')
26
+ #
27
+ # Symlink multiple directories at once
28
+ #
29
+ # PersistantDirectory.symlink('public/icons', 'public/files')
30
+ def symlink(*args)
31
+ options = args.extract_options!
32
+ directory = args.first
33
+
34
+ run "ln -s #{shared_path}/#{directory} #{current_path}/#{directory}"
35
+ end
36
+ end
37
+
38
+ Capistrano.plugin :persistant_directory, PersistantDirectory
@@ -0,0 +1,3 @@
1
+ require 'fingercap/recipes/apache'
2
+ require 'fingercap/recipes/notify'
3
+ require 'fingercap/recipes/passenger'
@@ -0,0 +1,8 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+ namespace :apache do
3
+ desc "Gracefully restart the Apache webserver."
4
+ task :restart do
5
+ try_sudo "/usr/sbin/apachectl graceful"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,37 @@
1
+ require 'yaml'
2
+
3
+ Capistrano::Configuration.instance(:must_exist).load do
4
+ namespace :notify do
5
+ begin
6
+ require 'tinder'
7
+ rescue LoadError
8
+ def notify(action)
9
+ fingercap = YAML.load_file(File.expand_path('~/.fingercap.yml'))
10
+ if config = fingercap['campfire']
11
+ campfire = Tinder::Campfire.new(config['account'], :ssl => (config['use_ssl']||false))
12
+ if campfire.login(config['username'], config['password'])
13
+ if room = campfire.find_room_by_name(config['room'])
14
+ room.speak "#{ENV['USER'].titlecase} just #{action} #{application}: #{repository}"
15
+ end
16
+ end
17
+ else
18
+ puts "[!] See examples/fingercap.yml on how to configure credentials for Campfire."
19
+ end
20
+ end
21
+ else
22
+ def notify(action)
23
+ puts "[!] Please `gem install tinder' to post deployment messages to Campfire."
24
+ end
25
+ end
26
+
27
+ desc "Posts a `deployed' message to Campfire"
28
+ task :deploy do
29
+ notify "deployed"
30
+ end
31
+
32
+ desc "Posts a `deployed and migrated' message to Campfire"
33
+ task :migrations do
34
+ notify "deployed and migrated"
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,8 @@
1
+ Capistrano::Configuration.instance(:must_exist).load do
2
+ namespace :passenger do
3
+ desc "Restart the Passenger application process."
4
+ task :restart do
5
+ try_sudo "touch #{current_path}/tmp/restart.txt"
6
+ end
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fingercap
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.1"
5
+ platform: ruby
6
+ authors:
7
+ - Manfred Stienstra
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-09-10 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Fingercap is a set of recipes and tasks meant for deploying to Fingertips servers.
17
+ email: manfred@fngtps.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ - LICENSE
25
+ files:
26
+ - lib/fingercap/configurations/miller.rb
27
+ - lib/fingercap/persistant_directory.rb
28
+ - lib/fingercap/recipes/apache.rb
29
+ - lib/fingercap/recipes/notify.rb
30
+ - lib/fingercap/recipes/passenger.rb
31
+ - lib/fingercap/recipes.rb
32
+ - examples/fingercap.yml
33
+ - README
34
+ - LICENSE
35
+ has_rdoc: true
36
+ homepage:
37
+ post_install_message:
38
+ rdoc_options:
39
+ - --charset=utf-8
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.2.0
58
+ signing_key:
59
+ specification_version: 2
60
+ summary: Fingercap is a set of recipes and tasks meant for deploying to Fingertips servers.
61
+ test_files: []
62
+