forked from crowbar/crowbar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Guardfile.top
61 lines (59 loc) · 1.85 KB
/
Guardfile.top
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/ruby
#
# Guardfile which uses guard-rsync to sync installation scripts
# from the Crowbar top-level repo to /opt/dell/bin.
#
# The target location of the merge can be a local path or an rsync
# target such as [email protected]:/opt/dell/bin
#
# Unfortunately https://github.com/guard/listen/issues/25 breaks
# watching of releases/$RELEASE/$BRANCH/extra/ when the current
# directory is the Crowbar top-level, due to the extra/ symlink to it.
# We work around this by starting guard inside the extra/
# subdirectory.
#
# Usage
# -----
#
# First ensure you have the necessary gems by cd'ing to this directory
# and running 'bundle'. Doing this inside an rvm gemset is recommended.
#
# Then use as follows:
#
# # Optionally set the rsync target; defaults to /opt/dell/bin
# $ export [email protected]:/opt/dell/bin
#
# # Launch the guard watcher:
# $ bundle exec guard -G `pwd`/Guardfile.top -w releases/pebbles/master/extra
#
# Note that "-w extra" will *not* work here due to the above-mentioned bug.
#
# Further info
# ------------
#
# More about Guard at https://github.com/guard/guard#readme
TARGET = ENV['GUARD_RSYNC_TARGET'] || '/opt/dell/bin'
group :top do
# FIXME: The list of files to copy is release-specific, so this file
# should probably be moved to releases/$release. But by the time it
# starts mattering, hopefully we won't be doing all development on the
# master branch of this repo.
globs = [
"barclamp_*.rb",
"install-chef-suse.sh",
"bc-dns-json.rb",
"bc-network-admin-helper.rb",
]
filters = globs.map {|f| "+ #{f}"} + ["- /*"]
guard_opts = {
:input => './',
:output => TARGET,
:excludes => filters + ["- .#*#"],
}
guard('rsync', guard_opts) do
globs.each do |glob|
regexp = Regexp.new('^' + glob.gsub('.', '\.').gsub('*', '.*') + '$')
watch(regexp)
end
end
end