whisk_deploy 0.6.26
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/CHANGELOG +292 -0
- data/MIT-LICENSE +20 -0
- data/README.integration_specs +24 -0
- data/README.markdown +832 -0
- data/Rakefile +105 -0
- data/VERSION +1 -0
- data/WHY.txt +45 -0
- data/bin/wd +61 -0
- data/bin/wd_role +42 -0
- data/examples/deploy-configs.yml +13 -0
- data/examples/deploy-local.yml +4 -0
- data/examples/deploy-multiple-remotes.yml +26 -0
- data/examples/deploy-staging.yml +8 -0
- data/examples/deploy.rake +11 -0
- data/examples/deploy.yml +16 -0
- data/init.rb +1 -0
- data/install.rb +5 -0
- data/lib/whiskey_disk.rb +327 -0
- data/lib/whiskey_disk/config.rb +127 -0
- data/lib/whiskey_disk/config/abstract_filter.rb +19 -0
- data/lib/whiskey_disk/config/filter.rb +48 -0
- data/lib/whiskey_disk/config/filters/add_environment_name_filter.rb +11 -0
- data/lib/whiskey_disk/config/filters/add_project_name_filter.rb +11 -0
- data/lib/whiskey_disk/config/filters/check_for_duplicate_domains_filter.rb +21 -0
- data/lib/whiskey_disk/config/filters/convert_role_strings_to_list_filter.rb +20 -0
- data/lib/whiskey_disk/config/filters/default_config_target_filter.rb +12 -0
- data/lib/whiskey_disk/config/filters/default_domain_filter.rb +12 -0
- data/lib/whiskey_disk/config/filters/drop_empty_domain_roles_filter.rb +32 -0
- data/lib/whiskey_disk/config/filters/environment_scope_filter.rb +20 -0
- data/lib/whiskey_disk/config/filters/hashify_domain_entries_filter.rb +29 -0
- data/lib/whiskey_disk/config/filters/localize_domains_filter.rb +24 -0
- data/lib/whiskey_disk/config/filters/modules/scope_helper.rb +11 -0
- data/lib/whiskey_disk/config/filters/normalize_ssh_options_filter.rb +29 -0
- data/lib/whiskey_disk/config/filters/project_scope_filter.rb +34 -0
- data/lib/whiskey_disk/config/filters/select_project_and_environment_filter.rb +12 -0
- data/lib/whiskey_disk/config/filters/stringify_hash_keys_filter.rb +25 -0
- data/lib/whiskey_disk/helpers.rb +50 -0
- data/lib/whiskey_disk/rake.rb +47 -0
- data/scenarios/git_repositories/config.git/HEAD +1 -0
- data/scenarios/git_repositories/config.git/config +5 -0
- data/scenarios/git_repositories/config.git/description +1 -0
- data/scenarios/git_repositories/config.git/git-daemon-export-ok +0 -0
- data/scenarios/git_repositories/config.git/hooks/applypatch-msg.sample +15 -0
- data/scenarios/git_repositories/config.git/hooks/commit-msg.sample +24 -0
- data/scenarios/git_repositories/config.git/hooks/post-commit.sample +8 -0
- data/scenarios/git_repositories/config.git/hooks/post-receive.sample +15 -0
- data/scenarios/git_repositories/config.git/hooks/post-update.sample +8 -0
- data/scenarios/git_repositories/config.git/hooks/pre-applypatch.sample +14 -0
- data/scenarios/git_repositories/config.git/hooks/pre-commit.sample +46 -0
- data/scenarios/git_repositories/config.git/hooks/pre-rebase.sample +169 -0
- data/scenarios/git_repositories/config.git/hooks/prepare-commit-msg.sample +36 -0
- data/scenarios/git_repositories/config.git/hooks/update.sample +128 -0
- data/scenarios/git_repositories/config.git/info/exclude +6 -0
- data/scenarios/git_repositories/config.git/objects/0d/b14dd6ddc54017c0a11960dcda82ed802cde69 +0 -0
- data/scenarios/git_repositories/config.git/objects/0e/e781f5ce80d64db32a74a7aae7b5248dafe112 +3 -0
- data/scenarios/git_repositories/config.git/objects/17/6bf54cf17d1d1c24556dc059c4144a5df230e8 +0 -0
- data/scenarios/git_repositories/config.git/objects/20/e9ff3feaa8ede30f707e5f1b4356e3c02bb7ec +0 -0
- data/scenarios/git_repositories/config.git/objects/45/117b1c775f0de415478dbf08ed9d667ab17d13 +0 -0
- data/scenarios/git_repositories/config.git/objects/51/3954c9aca090e6ce40359f0e9fde30ea78eb8c +0 -0
- data/scenarios/git_repositories/config.git/objects/66/947a7a11a6f5d3d561fe95de284ced3010819a +0 -0
- data/scenarios/git_repositories/config.git/objects/6b/bc79311bfac47d3ed724aa82a4814e0dda4c67 +0 -0
- data/scenarios/git_repositories/config.git/objects/71/eb5df52676e8e6efba471050b46978173af110 +1 -0
- data/scenarios/git_repositories/config.git/objects/84/17d2fe3e8fcc0825249c517b29b0f9ea8b8b31 +2 -0
- data/scenarios/git_repositories/config.git/objects/8b/384fcfcf7c0dee7c3c1d5636bee9e645d9cf38 +0 -0
- data/scenarios/git_repositories/config.git/objects/bb/59da633ba74296b0c2f9ff70784ac155ddb599 +0 -0
- data/scenarios/git_repositories/config.git/objects/cc/b86b26189afbf45d8eb9165812ab86dbdfca63 +0 -0
- data/scenarios/git_repositories/config.git/objects/d1/0bcd51fec41f854001e4d61f99d9e282a695d3 +0 -0
- data/scenarios/git_repositories/config.git/objects/d8/a8b0f5b1fd66844efb141d9544965ea0065f2d +0 -0
- data/scenarios/git_repositories/config.git/objects/e6/b02c66ad632e6b8535c4630cb8fe07732a72fc +0 -0
- data/scenarios/git_repositories/config.git/objects/e8/b8bfeeba735c0a1a873082554cb4d7256ac125 +0 -0
- data/scenarios/git_repositories/config.git/objects/f9/0181466a1a60b793ca9cc9abd584c18d4e3887 +0 -0
- data/scenarios/git_repositories/config.git/objects/f9/49d5d8a4f12c91471e34d4e277239c35ebd10d +0 -0
- data/scenarios/git_repositories/config.git/refs/heads/master +1 -0
- data/scenarios/git_repositories/project.git/HEAD +1 -0
- data/scenarios/git_repositories/project.git/config +5 -0
- data/scenarios/git_repositories/project.git/description +1 -0
- data/scenarios/git_repositories/project.git/git-daemon-export-ok +0 -0
- data/scenarios/git_repositories/project.git/hooks/applypatch-msg.sample +15 -0
- data/scenarios/git_repositories/project.git/hooks/commit-msg.sample +24 -0
- data/scenarios/git_repositories/project.git/hooks/post-commit.sample +8 -0
- data/scenarios/git_repositories/project.git/hooks/post-receive.sample +15 -0
- data/scenarios/git_repositories/project.git/hooks/post-update.sample +8 -0
- data/scenarios/git_repositories/project.git/hooks/pre-applypatch.sample +14 -0
- data/scenarios/git_repositories/project.git/hooks/pre-commit.sample +46 -0
- data/scenarios/git_repositories/project.git/hooks/pre-rebase.sample +169 -0
- data/scenarios/git_repositories/project.git/hooks/prepare-commit-msg.sample +36 -0
- data/scenarios/git_repositories/project.git/hooks/update.sample +128 -0
- data/scenarios/git_repositories/project.git/info/exclude +6 -0
- data/scenarios/git_repositories/project.git/objects/04/26e152e66c8cd42974279bdcae09be9839c172 +0 -0
- data/scenarios/git_repositories/project.git/objects/04/f4de85eaf72ef1631dc6d7424045c0a749b757 +1 -0
- data/scenarios/git_repositories/project.git/objects/06/13fe277280cbcdb2856e1eefc70bdaff011b20 +0 -0
- data/scenarios/git_repositories/project.git/objects/06/7aca89b86265eee211387434c3e50f37ccf009 +0 -0
- data/scenarios/git_repositories/project.git/objects/09/445dacc4822722612d60833c9948219ecdd8f5 +0 -0
- data/scenarios/git_repositories/project.git/objects/11/c4ec64326de35462f4e79d0f4229bf8e26e0c5 +0 -0
- data/scenarios/git_repositories/project.git/objects/20/1c7641c2e42b0b904e5c1f793489d8b858e4da +2 -0
- data/scenarios/git_repositories/project.git/objects/23/979639da60d2d31e9744468df1c1221b101e64 +0 -0
- data/scenarios/git_repositories/project.git/objects/27/a3fff2c4c45ab5513a405f694c0a042cb5d417 +1 -0
- data/scenarios/git_repositories/project.git/objects/2c/0c33cfba8e1af15df88522c0db2b10a6a94138 +2 -0
- data/scenarios/git_repositories/project.git/objects/38/b574660305ecb5fec6b2daa7ee1e0dbf1b6003 +0 -0
- data/scenarios/git_repositories/project.git/objects/4a/57abb5e4e426cfc9101b3af22ac83ccbd8e2ad +0 -0
- data/scenarios/git_repositories/project.git/objects/4c/77ebdd985e57afe7988480720c5dc77ec525c9 +0 -0
- data/scenarios/git_repositories/project.git/objects/51/c94da6f1b8aa9d2346088d3d362475b60c7f32 +0 -0
- data/scenarios/git_repositories/project.git/objects/5b/a96acf9cc9b87babe37c032676f53bf1ba9ae7 +2 -0
- data/scenarios/git_repositories/project.git/objects/5d/f555601d60f1c2a84d2364af0ad640612c3ba5 +0 -0
- data/scenarios/git_repositories/project.git/objects/71/03b5ac94940d596c2160a5cfcd55ca4ccac41f +0 -0
- data/scenarios/git_repositories/project.git/objects/73/3fc331098b03523f414f3509b9ae6e637c6866 +0 -0
- data/scenarios/git_repositories/project.git/objects/80/26076649ceccbe96a6292f2432652f08483035 +0 -0
- data/scenarios/git_repositories/project.git/objects/86/d1ef0976be4567de562224e1b51fbf9820c53a +1 -0
- data/scenarios/git_repositories/project.git/objects/87/a9d8b09b3401d21b23d90253332d6b28b47db2 +0 -0
- data/scenarios/git_repositories/project.git/objects/8b/030ba688255c917d189ae3f87d7c5ccd226bc2 +0 -0
- data/scenarios/git_repositories/project.git/objects/95/c9d5ad9b1c90e4c805516783105fc2037dedeb +2 -0
- data/scenarios/git_repositories/project.git/objects/95/d82d043af35a80eabfd56c0d705abfa3488787 +2 -0
- data/scenarios/git_repositories/project.git/objects/96/0bf34bb0b46d0aeb0be87f688f4ef06a4b35e1 +0 -0
- data/scenarios/git_repositories/project.git/objects/a3/860106dc1d148c7831cd45ae38829b4ed47702 +2 -0
- data/scenarios/git_repositories/project.git/objects/a8/506d6439b71784a72ac72d284b2ad53088f573 +0 -0
- data/scenarios/git_repositories/project.git/objects/ad/22ea6c7563777936ecfbe50d8e2cf8120fd525 +0 -0
- data/scenarios/git_repositories/project.git/objects/ae/3900de54aff557c61c81146d00f9d38e55a265 +1 -0
- data/scenarios/git_repositories/project.git/objects/bf/5e3740d52b80abb0378b3f85f93a53b1294521 +1 -0
- data/scenarios/git_repositories/project.git/objects/bf/b59811cdbc069418dee14b171e6e7e979784b7 +0 -0
- data/scenarios/git_repositories/project.git/objects/cc/5ac0afb24e727d5de344cc26a425f4fb7fd17d +3 -0
- data/scenarios/git_repositories/project.git/objects/d1/091aa2dd76885108461110c639e6b33a297fce +0 -0
- data/scenarios/git_repositories/project.git/objects/d8/913f6650eb2b7bf2a633732d8452008ca23dcb +0 -0
- data/scenarios/git_repositories/project.git/objects/db/d1b9667f1b26b13331ac0c321dced8be1aeab0 +3 -0
- data/scenarios/git_repositories/project.git/objects/e4/3b9107e9b1908ce415025e64eb83a493d329b7 +0 -0
- data/scenarios/git_repositories/project.git/objects/ef/2a88894d5421920b9dfe67a9a4d8043830e62e +0 -0
- data/scenarios/git_repositories/project.git/objects/f4/0123a1ff20c65d8dc15a38a83222647908e6f7 +0 -0
- data/scenarios/git_repositories/project.git/objects/f5/0af315b75ca0b12c720dec6d916b76b968c319 +0 -0
- data/scenarios/git_repositories/project.git/objects/f6/0215709b7b23f3738e9cbaf634b1c86bbd376a +0 -0
- data/scenarios/git_repositories/project.git/refs/heads/bad_rakefile +1 -0
- data/scenarios/git_repositories/project.git/refs/heads/hook_with_changed +1 -0
- data/scenarios/git_repositories/project.git/refs/heads/master +1 -0
- data/scenarios/git_repositories/project.git/refs/heads/no_rake_hooks +1 -0
- data/scenarios/git_repositories/project.git/refs/heads/post_rake_tasks +1 -0
- data/scenarios/invalid/deploy.yml +1 -0
- data/scenarios/local/deploy.yml.erb +17 -0
- data/scenarios/remote/deploy.yml +119 -0
- data/scenarios/setup/vagrant/.gitignore +3 -0
- data/scenarios/setup/vagrant/Vagrantfile +10 -0
- data/scenarios/setup/vagrant/manifests/integration.pp +32 -0
- data/scenarios/setup/vagrant/pids/.gitignore +1 -0
- data/spec/.bacon +0 -0
- data/spec/init_spec.rb +9 -0
- data/spec/install_spec.rb +43 -0
- data/spec/integration/branch_switching_spec.rb +41 -0
- data/spec/integration/deployment_failures_spec.rb +106 -0
- data/spec/integration/helper_spec.rb +90 -0
- data/spec/integration/invalid_configuration_spec.rb +39 -0
- data/spec/integration/local_deployments_spec.rb +230 -0
- data/spec/integration/post_rake_tasks_spec.rb +226 -0
- data/spec/integration/post_scripts_spec.rb +246 -0
- data/spec/integration/remote_deployments_spec.rb +166 -0
- data/spec/integration/staleness_checks_spec.rb +72 -0
- data/spec/spec_helper.rb +117 -0
- data/spec/wd_command_spec.rb +986 -0
- data/spec/wd_role_command_spec.rb +49 -0
- data/spec/whiskey_disk/config/filter_spec.rb +77 -0
- data/spec/whiskey_disk/config/filters/add_environment_name_filter_spec.rb +20 -0
- data/spec/whiskey_disk/config/filters/add_project_name_filter_spec.rb +19 -0
- data/spec/whiskey_disk/config/filters/check_for_duplicate_domains_filter_spec.rb +29 -0
- data/spec/whiskey_disk/config/filters/convert_role_strings_to_list_filter_spec.rb +48 -0
- data/spec/whiskey_disk/config/filters/default_config_target_filter_spec.rb +19 -0
- data/spec/whiskey_disk/config/filters/default_domain_filter_spec.rb +18 -0
- data/spec/whiskey_disk/config/filters/drop_empty_domain_roles_filter_spec.rb +60 -0
- data/spec/whiskey_disk/config/filters/environment_scope_filter_spec.rb +32 -0
- data/spec/whiskey_disk/config/filters/hashify_domain_entries_filter_spec.rb +41 -0
- data/spec/whiskey_disk/config/filters/localize_domains_filter_spec.rb +30 -0
- data/spec/whiskey_disk/config/filters/normalize_ssh_options_filter_spec.rb +56 -0
- data/spec/whiskey_disk/config/filters/project_scope_filter_spec.rb +75 -0
- data/spec/whiskey_disk/config/filters/select_project_and_environment_filter_spec.rb +30 -0
- data/spec/whiskey_disk/config/filters/stringify_hash_keys_filter_spec.rb +40 -0
- data/spec/whiskey_disk/config_spec.rb +754 -0
- data/spec/whiskey_disk/helpers_spec.rb +443 -0
- data/spec/whiskey_disk/rake_spec.rb +261 -0
- data/spec/whiskey_disk_spec.rb +1224 -0
- data/tasks/deploy.rake +2 -0
- data/whisk_deploy.gemspec +215 -0
- metadata +241 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'whiskey_disk/config/abstract_filter'
|
|
2
|
+
require 'whiskey_disk/config/filters/modules/scope_helper'
|
|
3
|
+
|
|
4
|
+
class WhiskeyDisk
|
|
5
|
+
class Config
|
|
6
|
+
class ProjectScopeFilter < AbstractFilter
|
|
7
|
+
include ScopeHelper
|
|
8
|
+
|
|
9
|
+
def repository_depth(data, depth = 0)
|
|
10
|
+
raise 'no repository found' unless data.respond_to?(:has_key?)
|
|
11
|
+
return depth if data.has_key?('repository')
|
|
12
|
+
repository_depth(data.values.first, depth + 1)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# is this data hash an environment data hash without a project name?
|
|
16
|
+
def needs_project_scoping?(data)
|
|
17
|
+
repository_depth(data) == 1
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# TODO: why do we continue to need override_project_name! ?
|
|
21
|
+
# TODO: this is invasive into Config's implementation
|
|
22
|
+
def override_project_name!(data)
|
|
23
|
+
return if ENV['to'] && ENV['to'] =~ /:/
|
|
24
|
+
ENV['to'] = data[environment_name]['project'] + ':' + ENV['to'] if data[environment_name]['project']
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def filter(data)
|
|
28
|
+
return data unless needs_project_scoping?(data)
|
|
29
|
+
override_project_name!(data)
|
|
30
|
+
{ project_name => data }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'whiskey_disk/config/abstract_filter'
|
|
2
|
+
|
|
3
|
+
class WhiskeyDisk
|
|
4
|
+
class Config
|
|
5
|
+
class SelectProjectAndEnvironmentFilter < AbstractFilter
|
|
6
|
+
def filter(data)
|
|
7
|
+
raise "No configuration file defined data for project `#{project_name}`, environment `#{environment_name}`" unless data and data[project_name] and data[project_name][environment_name]
|
|
8
|
+
data[project_name][environment_name]
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'whiskey_disk/config/abstract_filter'
|
|
2
|
+
|
|
3
|
+
class WhiskeyDisk
|
|
4
|
+
class Config
|
|
5
|
+
class StringifyHashKeysFilter < AbstractFilter
|
|
6
|
+
def stringify_hash(data)
|
|
7
|
+
result = {}
|
|
8
|
+
data.each_pair do |key, value|
|
|
9
|
+
result[key.to_s] = stringify(value)
|
|
10
|
+
end
|
|
11
|
+
result
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def stringify(structure)
|
|
15
|
+
return structure.clone unless structure.respond_to? :keys
|
|
16
|
+
stringify_hash(structure)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def filter(data)
|
|
20
|
+
stringify(data)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
# is the current deployment domain in the specified role?
|
|
3
|
+
def role?(role)
|
|
4
|
+
return false unless ENV['WD_ROLES'] and ENV['WD_ROLES'] != ''
|
|
5
|
+
ENV['WD_ROLES'].split(':').include?(role.to_s)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# have files of interest changed on this deployment?
|
|
9
|
+
def changed?(path)
|
|
10
|
+
return true unless gc = git_changes
|
|
11
|
+
cleaned = Regexp.escape(path.sub(%r{/+$}, ''))
|
|
12
|
+
[ gc, rsync_changes ].flatten.compact.any? { |p| p =~ %r<^#{cleaned}(?:$|/)> }
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# list of changed paths, according to git
|
|
16
|
+
def git_changes
|
|
17
|
+
changes = read_git_changes_file.split("\n").uniq
|
|
18
|
+
rescue Exception
|
|
19
|
+
nil
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def rsync_changes
|
|
23
|
+
changes = read_rsync_changes_file.split("\n")
|
|
24
|
+
changes.map {|c| c.sub(/^[^ ]* [^ ]* [^ ]* /, '') }.
|
|
25
|
+
grep(/^[^ ]{9,} /).map {|c| c.sub(/^[^ ]{9,} /, '') }.
|
|
26
|
+
map {|s| s.sub(%r{/$}, '') } - ['.']
|
|
27
|
+
rescue Exception
|
|
28
|
+
nil
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def read_git_changes_file
|
|
32
|
+
File.read(git_changes_path)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def read_rsync_changes_file
|
|
36
|
+
File.read(rsync_changes_path)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def changes_file_root
|
|
40
|
+
path = IO.popen("git rev-parse --show-toplevel").read
|
|
41
|
+
path == '' ? Dir.pwd : path.chomp
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def git_changes_path
|
|
45
|
+
File.join(changes_file_root, '.whiskey_disk_git_changes')
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def rsync_changes_path
|
|
49
|
+
File.join(changes_file_root, '.whiskey_disk_rsync_changes')
|
|
50
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'whiskey_disk'))
|
|
3
|
+
|
|
4
|
+
namespace :deploy do
|
|
5
|
+
desc "Perform initial setup for deployment"
|
|
6
|
+
task :setup do
|
|
7
|
+
@whiskey_disk = WhiskeyDisk.new
|
|
8
|
+
@whiskey_disk.ensure_main_parent_path_is_present
|
|
9
|
+
@whiskey_disk.ensure_config_parent_path_is_present if @whiskey_disk.has_config_repo?
|
|
10
|
+
@whiskey_disk.checkout_main_repository
|
|
11
|
+
@whiskey_disk.checkout_configuration_repository if @whiskey_disk.has_config_repo?
|
|
12
|
+
@whiskey_disk.update_main_repository_checkout
|
|
13
|
+
@whiskey_disk.update_configuration_repository_checkout if @whiskey_disk.has_config_repo?
|
|
14
|
+
@whiskey_disk.refresh_configuration if @whiskey_disk.has_config_repo?
|
|
15
|
+
@whiskey_disk.initialize_all_changes
|
|
16
|
+
@whiskey_disk.run_post_setup_hooks
|
|
17
|
+
@whiskey_disk.flush
|
|
18
|
+
@whiskey_disk.summarize
|
|
19
|
+
|
|
20
|
+
exit(1) unless @whiskey_disk.success?
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
desc "Deploy now."
|
|
24
|
+
task :now do
|
|
25
|
+
@whiskey_disk = WhiskeyDisk.new(:staleness_checks => true)
|
|
26
|
+
@whiskey_disk.update_main_repository_checkout
|
|
27
|
+
@whiskey_disk.update_configuration_repository_checkout if @whiskey_disk.has_config_repo?
|
|
28
|
+
@whiskey_disk.refresh_configuration if @whiskey_disk.has_config_repo?
|
|
29
|
+
@whiskey_disk.run_post_deploy_hooks
|
|
30
|
+
@whiskey_disk.flush
|
|
31
|
+
@whiskey_disk.summarize
|
|
32
|
+
|
|
33
|
+
exit(1) unless @whiskey_disk.success?
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
task :post_setup do
|
|
37
|
+
@whiskey_disk = WhiskeyDisk.new
|
|
38
|
+
env = @whiskey_disk.setting(:environment)
|
|
39
|
+
Rake::Task["deploy:#{env}:post_setup"].invoke if Rake::Task.task_defined? "deploy:#{env}:post_setup"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
task :post_deploy do
|
|
43
|
+
@whiskey_disk = WhiskeyDisk.new
|
|
44
|
+
env = @whiskey_disk.setting(:environment)
|
|
45
|
+
Rake::Task["deploy:#{env}:post_deploy"].invoke if Rake::Task.task_defined? "deploy:#{env}:post_deploy"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ref: refs/heads/master
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Unnamed repository; edit this file 'description' to name the repository.
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to check the commit log message taken by
|
|
4
|
+
# applypatch from an e-mail message.
|
|
5
|
+
#
|
|
6
|
+
# The hook should exit with non-zero status after issuing an
|
|
7
|
+
# appropriate message if it wants to stop the commit. The hook is
|
|
8
|
+
# allowed to edit the commit message file.
|
|
9
|
+
#
|
|
10
|
+
# To enable this hook, rename this file to "applypatch-msg".
|
|
11
|
+
|
|
12
|
+
. git-sh-setup
|
|
13
|
+
test -x "$GIT_DIR/hooks/commit-msg" &&
|
|
14
|
+
exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
|
|
15
|
+
:
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to check the commit log message.
|
|
4
|
+
# Called by git-commit with one argument, the name of the file
|
|
5
|
+
# that has the commit message. The hook should exit with non-zero
|
|
6
|
+
# status after issuing an appropriate message if it wants to stop the
|
|
7
|
+
# commit. The hook is allowed to edit the commit message file.
|
|
8
|
+
#
|
|
9
|
+
# To enable this hook, rename this file to "commit-msg".
|
|
10
|
+
|
|
11
|
+
# Uncomment the below to add a Signed-off-by line to the message.
|
|
12
|
+
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
|
|
13
|
+
# hook is more suited to it.
|
|
14
|
+
#
|
|
15
|
+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
|
16
|
+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
|
17
|
+
|
|
18
|
+
# This example catches duplicate Signed-off-by lines.
|
|
19
|
+
|
|
20
|
+
test "" = "$(grep '^Signed-off-by: ' "$1" |
|
|
21
|
+
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
|
|
22
|
+
echo >&2 Duplicate Signed-off-by lines.
|
|
23
|
+
exit 1
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script for the "post-receive" event.
|
|
4
|
+
#
|
|
5
|
+
# The "post-receive" script is run after receive-pack has accepted a pack
|
|
6
|
+
# and the repository has been updated. It is passed arguments in through
|
|
7
|
+
# stdin in the form
|
|
8
|
+
# <oldrev> <newrev> <refname>
|
|
9
|
+
# For example:
|
|
10
|
+
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
|
|
11
|
+
#
|
|
12
|
+
# see contrib/hooks/ for a sample, or uncomment the next line and
|
|
13
|
+
# rename the file to "post-receive".
|
|
14
|
+
|
|
15
|
+
#. /usr/share/doc/git-core/contrib/hooks/post-receive-email
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to verify what is about to be committed
|
|
4
|
+
# by applypatch from an e-mail message.
|
|
5
|
+
#
|
|
6
|
+
# The hook should exit with non-zero status after issuing an
|
|
7
|
+
# appropriate message if it wants to stop the commit.
|
|
8
|
+
#
|
|
9
|
+
# To enable this hook, rename this file to "pre-applypatch".
|
|
10
|
+
|
|
11
|
+
. git-sh-setup
|
|
12
|
+
test -x "$GIT_DIR/hooks/pre-commit" &&
|
|
13
|
+
exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
|
|
14
|
+
:
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# An example hook script to verify what is about to be committed.
|
|
4
|
+
# Called by git-commit with no arguments. The hook should
|
|
5
|
+
# exit with non-zero status after issuing an appropriate message if
|
|
6
|
+
# it wants to stop the commit.
|
|
7
|
+
#
|
|
8
|
+
# To enable this hook, rename this file to "pre-commit".
|
|
9
|
+
|
|
10
|
+
if git-rev-parse --verify HEAD >/dev/null 2>&1
|
|
11
|
+
then
|
|
12
|
+
against=HEAD
|
|
13
|
+
else
|
|
14
|
+
# Initial commit: diff against an empty tree object
|
|
15
|
+
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# If you want to allow non-ascii filenames set this variable to true.
|
|
19
|
+
allownonascii=$(git config hooks.allownonascii)
|
|
20
|
+
|
|
21
|
+
# Cross platform projects tend to avoid non-ascii filenames; prevent
|
|
22
|
+
# them from being added to the repository. We exploit the fact that the
|
|
23
|
+
# printable range starts at the space character and ends with tilde.
|
|
24
|
+
if [ "$allownonascii" != "true" ] &&
|
|
25
|
+
# Note that the use of brackets around a tr range is ok here, (it's
|
|
26
|
+
# even required, for portability to Solaris 10's /usr/bin/tr), since
|
|
27
|
+
# the square bracket bytes happen to fall in the designated range.
|
|
28
|
+
test "$(git diff --cached --name-only --diff-filter=A -z $against |
|
|
29
|
+
LC_ALL=C tr -d '[ -~]\0')"
|
|
30
|
+
then
|
|
31
|
+
echo "Error: Attempt to add a non-ascii file name."
|
|
32
|
+
echo
|
|
33
|
+
echo "This can cause problems if you want to work"
|
|
34
|
+
echo "with people on other platforms."
|
|
35
|
+
echo
|
|
36
|
+
echo "To be portable it is advisable to rename the file ..."
|
|
37
|
+
echo
|
|
38
|
+
echo "If you know what you are doing you can disable this"
|
|
39
|
+
echo "check using:"
|
|
40
|
+
echo
|
|
41
|
+
echo " git config hooks.allownonascii true"
|
|
42
|
+
echo
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
exec git diff-index --check --cached $against --
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2006, 2008 Junio C Hamano
|
|
4
|
+
#
|
|
5
|
+
# The "pre-rebase" hook is run just before "git-rebase" starts doing
|
|
6
|
+
# its job, and can prevent the command from running by exiting with
|
|
7
|
+
# non-zero status.
|
|
8
|
+
#
|
|
9
|
+
# The hook is called with the following parameters:
|
|
10
|
+
#
|
|
11
|
+
# $1 -- the upstream the series was forked from.
|
|
12
|
+
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
|
13
|
+
#
|
|
14
|
+
# This sample shows how to prevent topic branches that are already
|
|
15
|
+
# merged to 'next' branch from getting rebased, because allowing it
|
|
16
|
+
# would result in rebasing already published history.
|
|
17
|
+
|
|
18
|
+
publish=next
|
|
19
|
+
basebranch="$1"
|
|
20
|
+
if test "$#" = 2
|
|
21
|
+
then
|
|
22
|
+
topic="refs/heads/$2"
|
|
23
|
+
else
|
|
24
|
+
topic=`git symbolic-ref HEAD` ||
|
|
25
|
+
exit 0 ;# we do not interrupt rebasing detached HEAD
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
case "$topic" in
|
|
29
|
+
refs/heads/??/*)
|
|
30
|
+
;;
|
|
31
|
+
*)
|
|
32
|
+
exit 0 ;# we do not interrupt others.
|
|
33
|
+
;;
|
|
34
|
+
esac
|
|
35
|
+
|
|
36
|
+
# Now we are dealing with a topic branch being rebased
|
|
37
|
+
# on top of master. Is it OK to rebase it?
|
|
38
|
+
|
|
39
|
+
# Does the topic really exist?
|
|
40
|
+
git show-ref -q "$topic" || {
|
|
41
|
+
echo >&2 "No such branch $topic"
|
|
42
|
+
exit 1
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
# Is topic fully merged to master?
|
|
46
|
+
not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
|
|
47
|
+
if test -z "$not_in_master"
|
|
48
|
+
then
|
|
49
|
+
echo >&2 "$topic is fully merged to master; better remove it."
|
|
50
|
+
exit 1 ;# we could allow it, but there is no point.
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# Is topic ever merged to next? If so you should not be rebasing it.
|
|
54
|
+
only_next_1=`git-rev-list ^master "^$topic" ${publish} | sort`
|
|
55
|
+
only_next_2=`git-rev-list ^master ${publish} | sort`
|
|
56
|
+
if test "$only_next_1" = "$only_next_2"
|
|
57
|
+
then
|
|
58
|
+
not_in_topic=`git-rev-list "^$topic" master`
|
|
59
|
+
if test -z "$not_in_topic"
|
|
60
|
+
then
|
|
61
|
+
echo >&2 "$topic is already up-to-date with master"
|
|
62
|
+
exit 1 ;# we could allow it, but there is no point.
|
|
63
|
+
else
|
|
64
|
+
exit 0
|
|
65
|
+
fi
|
|
66
|
+
else
|
|
67
|
+
not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
|
|
68
|
+
perl -e '
|
|
69
|
+
my $topic = $ARGV[0];
|
|
70
|
+
my $msg = "* $topic has commits already merged to public branch:\n";
|
|
71
|
+
my (%not_in_next) = map {
|
|
72
|
+
/^([0-9a-f]+) /;
|
|
73
|
+
($1 => 1);
|
|
74
|
+
} split(/\n/, $ARGV[1]);
|
|
75
|
+
for my $elem (map {
|
|
76
|
+
/^([0-9a-f]+) (.*)$/;
|
|
77
|
+
[$1 => $2];
|
|
78
|
+
} split(/\n/, $ARGV[2])) {
|
|
79
|
+
if (!exists $not_in_next{$elem->[0]}) {
|
|
80
|
+
if ($msg) {
|
|
81
|
+
print STDERR $msg;
|
|
82
|
+
undef $msg;
|
|
83
|
+
}
|
|
84
|
+
print STDERR " $elem->[1]\n";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
' "$topic" "$not_in_next" "$not_in_master"
|
|
88
|
+
exit 1
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
exit 0
|
|
92
|
+
|
|
93
|
+
################################################################
|
|
94
|
+
|
|
95
|
+
This sample hook safeguards topic branches that have been
|
|
96
|
+
published from being rewound.
|
|
97
|
+
|
|
98
|
+
The workflow assumed here is:
|
|
99
|
+
|
|
100
|
+
* Once a topic branch forks from "master", "master" is never
|
|
101
|
+
merged into it again (either directly or indirectly).
|
|
102
|
+
|
|
103
|
+
* Once a topic branch is fully cooked and merged into "master",
|
|
104
|
+
it is deleted. If you need to build on top of it to correct
|
|
105
|
+
earlier mistakes, a new topic branch is created by forking at
|
|
106
|
+
the tip of the "master". This is not strictly necessary, but
|
|
107
|
+
it makes it easier to keep your history simple.
|
|
108
|
+
|
|
109
|
+
* Whenever you need to test or publish your changes to topic
|
|
110
|
+
branches, merge them into "next" branch.
|
|
111
|
+
|
|
112
|
+
The script, being an example, hardcodes the publish branch name
|
|
113
|
+
to be "next", but it is trivial to make it configurable via
|
|
114
|
+
$GIT_DIR/config mechanism.
|
|
115
|
+
|
|
116
|
+
With this workflow, you would want to know:
|
|
117
|
+
|
|
118
|
+
(1) ... if a topic branch has ever been merged to "next". Young
|
|
119
|
+
topic branches can have stupid mistakes you would rather
|
|
120
|
+
clean up before publishing, and things that have not been
|
|
121
|
+
merged into other branches can be easily rebased without
|
|
122
|
+
affecting other people. But once it is published, you would
|
|
123
|
+
not want to rewind it.
|
|
124
|
+
|
|
125
|
+
(2) ... if a topic branch has been fully merged to "master".
|
|
126
|
+
Then you can delete it. More importantly, you should not
|
|
127
|
+
build on top of it -- other people may already want to
|
|
128
|
+
change things related to the topic as patches against your
|
|
129
|
+
"master", so if you need further changes, it is better to
|
|
130
|
+
fork the topic (perhaps with the same name) afresh from the
|
|
131
|
+
tip of "master".
|
|
132
|
+
|
|
133
|
+
Let's look at this example:
|
|
134
|
+
|
|
135
|
+
o---o---o---o---o---o---o---o---o---o "next"
|
|
136
|
+
/ / / /
|
|
137
|
+
/ a---a---b A / /
|
|
138
|
+
/ / / /
|
|
139
|
+
/ / c---c---c---c B /
|
|
140
|
+
/ / / \ /
|
|
141
|
+
/ / / b---b C \ /
|
|
142
|
+
/ / / / \ /
|
|
143
|
+
---o---o---o---o---o---o---o---o---o---o---o "master"
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
A, B and C are topic branches.
|
|
147
|
+
|
|
148
|
+
* A has one fix since it was merged up to "next".
|
|
149
|
+
|
|
150
|
+
* B has finished. It has been fully merged up to "master" and "next",
|
|
151
|
+
and is ready to be deleted.
|
|
152
|
+
|
|
153
|
+
* C has not merged to "next" at all.
|
|
154
|
+
|
|
155
|
+
We would want to allow C to be rebased, refuse A, and encourage
|
|
156
|
+
B to be deleted.
|
|
157
|
+
|
|
158
|
+
To compute (1):
|
|
159
|
+
|
|
160
|
+
git-rev-list ^master ^topic next
|
|
161
|
+
git-rev-list ^master next
|
|
162
|
+
|
|
163
|
+
if these match, topic has not merged in next at all.
|
|
164
|
+
|
|
165
|
+
To compute (2):
|
|
166
|
+
|
|
167
|
+
git-rev-list master..topic
|
|
168
|
+
|
|
169
|
+
if this is empty, it is fully merged to "master".
|