rake 11.3.0 → 13.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/macos.yml +22 -0
- data/.github/workflows/ubuntu-rvm.yml +28 -0
- data/.github/workflows/ubuntu.yml +20 -0
- data/.github/workflows/windows.yml +20 -0
- data/CONTRIBUTING.rdoc +11 -4
- data/Gemfile +8 -1
- data/History.rdoc +171 -37
- data/README.rdoc +9 -11
- data/Rakefile +21 -13
- data/bin/bundle +105 -0
- data/bin/rake +29 -0
- data/bin/rdoc +29 -0
- data/bin/rubocop +29 -0
- data/doc/jamis.rb +1 -0
- data/doc/rake.1 +139 -124
- data/doc/rakefile.rdoc +2 -4
- data/exe/rake +1 -1
- data/lib/rake/application.rb +119 -79
- data/lib/rake/backtrace.rb +3 -2
- data/lib/rake/clean.rb +7 -5
- data/lib/rake/cloneable.rb +1 -0
- data/lib/rake/cpu_counter.rb +3 -2
- data/lib/rake/default_loader.rb +1 -0
- data/lib/rake/dsl_definition.rb +5 -4
- data/lib/rake/early_time.rb +1 -0
- data/lib/rake/ext/core.rb +1 -0
- data/lib/rake/ext/string.rb +22 -21
- data/lib/rake/file_creation_task.rb +4 -3
- data/lib/rake/file_list.rb +13 -14
- data/lib/rake/file_task.rb +12 -4
- data/lib/rake/file_utils.rb +17 -22
- data/lib/rake/file_utils_ext.rb +8 -18
- data/lib/rake/invocation_chain.rb +1 -0
- data/lib/rake/invocation_exception_mixin.rb +1 -0
- data/lib/rake/late_time.rb +2 -1
- data/lib/rake/linked_list.rb +1 -0
- data/lib/rake/loaders/makefile.rb +5 -4
- data/lib/rake/multi_task.rb +2 -1
- data/lib/rake/name_space.rb +1 -1
- data/lib/rake/packagetask.rb +28 -16
- data/lib/rake/phony.rb +2 -1
- data/lib/rake/private_reader.rb +1 -0
- data/lib/rake/promise.rb +13 -12
- data/lib/rake/pseudo_status.rb +1 -0
- data/lib/rake/rake_module.rb +30 -1
- data/lib/rake/rake_test_loader.rb +18 -12
- data/lib/rake/rule_recursion_overflow_error.rb +2 -1
- data/lib/rake/scope.rb +3 -2
- data/lib/rake/task.rb +70 -27
- data/lib/rake/task_argument_error.rb +1 -0
- data/lib/rake/task_arguments.rb +10 -4
- data/lib/rake/task_manager.rb +54 -39
- data/lib/rake/tasklib.rb +2 -1
- data/lib/rake/testtask.rb +28 -16
- data/lib/rake/thread_history_display.rb +4 -3
- data/lib/rake/thread_pool.rb +15 -14
- data/lib/rake/trace_output.rb +1 -0
- data/lib/rake/version.rb +3 -2
- data/lib/rake/win32.rb +9 -8
- data/lib/rake.rb +34 -33
- data/rake.gemspec +22 -9
- metadata +25 -108
- data/.gitignore +0 -14
- data/.rubocop.yml +0 -18
- data/.travis.yml +0 -28
- data/appveyor.yml +0 -22
- data/doc/release_notes/README.md +0 -4
- data/doc/release_notes/rake-0.4.14.rdoc +0 -23
- data/doc/release_notes/rake-0.4.15.rdoc +0 -35
- data/doc/release_notes/rake-0.5.0.rdoc +0 -53
- data/doc/release_notes/rake-0.5.3.rdoc +0 -78
- data/doc/release_notes/rake-0.5.4.rdoc +0 -46
- data/doc/release_notes/rake-0.6.0.rdoc +0 -141
- data/doc/release_notes/rake-0.7.0.rdoc +0 -119
- data/doc/release_notes/rake-0.7.1.rdoc +0 -59
- data/doc/release_notes/rake-0.7.2.rdoc +0 -121
- data/doc/release_notes/rake-0.7.3.rdoc +0 -47
- data/doc/release_notes/rake-0.8.0.rdoc +0 -114
- data/doc/release_notes/rake-0.8.2.rdoc +0 -165
- data/doc/release_notes/rake-0.8.3.rdoc +0 -112
- data/doc/release_notes/rake-0.8.4.rdoc +0 -147
- data/doc/release_notes/rake-0.8.5.rdoc +0 -53
- data/doc/release_notes/rake-0.8.6.rdoc +0 -37
- data/doc/release_notes/rake-0.8.7.rdoc +0 -55
- data/doc/release_notes/rake-0.9.0.rdoc +0 -112
- data/doc/release_notes/rake-0.9.1.rdoc +0 -52
- data/doc/release_notes/rake-0.9.2.2.rdoc +0 -55
- data/doc/release_notes/rake-0.9.2.rdoc +0 -49
- data/doc/release_notes/rake-0.9.3.rdoc +0 -102
- data/doc/release_notes/rake-0.9.4.rdoc +0 -60
- data/doc/release_notes/rake-0.9.5.rdoc +0 -55
- data/doc/release_notes/rake-0.9.6.rdoc +0 -64
- data/doc/release_notes/rake-10.0.0.rdoc +0 -178
- data/doc/release_notes/rake-10.0.1.rdoc +0 -58
- data/doc/release_notes/rake-10.0.2.rdoc +0 -53
- data/doc/release_notes/rake-10.0.3.rdoc +0 -191
- data/doc/release_notes/rake-10.1.0.rdoc +0 -61
- data/lib/rake/contrib/compositepublisher.rb +0 -21
- data/lib/rake/contrib/ftptools.rb +0 -137
- data/lib/rake/contrib/sshpublisher.rb +0 -60
- data/lib/rake/ext/pathname.rb +0 -25
@@ -1,191 +0,0 @@
|
|
1
|
-
= Rake 10.0.3 Released
|
2
|
-
|
3
|
-
"Jim, when will Rake reach version 1.0?"
|
4
|
-
|
5
|
-
Over the past several years I've been asked that question at
|
6
|
-
conferences, panels and over twitter. Due to historical reasons (or
|
7
|
-
maybe just plain laziness) Rake has (incorrectly) been treating the
|
8
|
-
second digit of the version as the major release number. So in my head
|
9
|
-
Rake was already at version 9.
|
10
|
-
|
11
|
-
Well, it's time to fix things. This next version of Rake drops old,
|
12
|
-
crufty, backwards compatibility hacks such as top level constants, DSL
|
13
|
-
methods defined in Object and numerous other features that are just no
|
14
|
-
longer desired. It's also time to drop the leading zero from the
|
15
|
-
version number as well and call this new version of rake what it
|
16
|
-
really is: Version 10.
|
17
|
-
|
18
|
-
So, welcome to Rake 10.0!
|
19
|
-
|
20
|
-
Rake 10 is actually feature identical to the latest version of Rake 9
|
21
|
-
(that would be the version spelled 0.9.3), *except* that Rake 10 drops
|
22
|
-
all the sundry deprecated features that have accumulated over the years.
|
23
|
-
|
24
|
-
If your Rakefile is up to date and current with all the new features
|
25
|
-
of Rake 10, you are ready to go. If your Rakefile still uses a few
|
26
|
-
deprecated feeatures, feel free to use Rake 9 (0.9.3) with the same
|
27
|
-
feature set. Just be aware that future features will be in Rake 10
|
28
|
-
family line.
|
29
|
-
|
30
|
-
== Changes in Version 10
|
31
|
-
|
32
|
-
As mentioned above, there are no new features in Rake 10. However,
|
33
|
-
there are a number of features missing:
|
34
|
-
|
35
|
-
* Classic namespaces are now gone. Rake is no longer able to reflect
|
36
|
-
the options settings in the global variables ($rakefile, $show_tasks,
|
37
|
-
$show_prereqs, $trace, $dryrun and $silent). The
|
38
|
-
<tt>--classic-namespace</tt> option is no longer supported.
|
39
|
-
|
40
|
-
* Global constants are no longer supported. This includes
|
41
|
-
<tt>Task</tt>, <tt>FileTask</tt>, <tt>FileCreationTask</tt> and
|
42
|
-
<tt>RakeApp</tt>). The constant missing hook to warn about using
|
43
|
-
global rake constants has been removed.
|
44
|
-
|
45
|
-
* The Rake DSL methods (task, file, directory, etc) are in their own
|
46
|
-
module (Rake::DSL). The stub versions of these methods (that printed
|
47
|
-
warnings) in Object have been removed. However, the DSL methods are
|
48
|
-
added to the top-level <tt>main</tt> object. Since <tt>main</tt> is
|
49
|
-
not in the inheritance tree, the presence of the DSL methods in main
|
50
|
-
should be low impact on other libraries.
|
51
|
-
|
52
|
-
If you want to use the Rake DSL commands from your own code, just
|
53
|
-
include <tt>Rake::DSL</tt> into your own classes and modules.
|
54
|
-
|
55
|
-
* The deprecated syntax for task arguments (the one using
|
56
|
-
<tt>:needs</tt>) has been removed.
|
57
|
-
|
58
|
-
* The <tt>--reduce-compat</tt> flag has been removed (it's not needed
|
59
|
-
anymore).
|
60
|
-
|
61
|
-
* The deprecated <tt>rake/sys.rb</tt> library has been removed.
|
62
|
-
|
63
|
-
* The deprecated <tt>rake/rdoctask.rb</tt> library has been removed.
|
64
|
-
RDoc supplies its own rake task now.
|
65
|
-
|
66
|
-
* The deprecated <tt>rake/gempackagetask.rb</tt> library has been
|
67
|
-
removed. Gem supplies its own package task now.
|
68
|
-
|
69
|
-
There is one small behavioral change:
|
70
|
-
|
71
|
-
* Non-file tasks now always report the current time as their time
|
72
|
-
stamp. This is different from the previous behavior where non-file
|
73
|
-
tasks reported current time only if there were no prerequisites, and
|
74
|
-
the max prerequisite timestamp otherwise. This lead to inconsistent
|
75
|
-
and surprising behavior when adding prerequisites to tasks that in
|
76
|
-
turn were prequisites to file tasks. The new behavior is more
|
77
|
-
consistent and predictable.
|
78
|
-
|
79
|
-
== Changes (from 0.9.3, 0.9.4, 0.9.5)
|
80
|
-
|
81
|
-
Since Rake 10 includes the changes from the last version of Rake 9,
|
82
|
-
we'll repeat the changes for versions 0.9.3 through 0.9.5 here.
|
83
|
-
|
84
|
-
=== New Features (in 0.9.3)
|
85
|
-
|
86
|
-
* Multitask tasks now use a thread pool. Use -j to limit the number of
|
87
|
-
available threads.
|
88
|
-
|
89
|
-
* Use -m to turn regular tasks into multitasks (use at your own risk).
|
90
|
-
|
91
|
-
* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
|
92
|
-
programatically add rake task libraries.
|
93
|
-
|
94
|
-
* You can specific backtrace suppression patterns (see
|
95
|
-
--supress-backtrace)
|
96
|
-
|
97
|
-
* Directory tasks can now take prerequisites and actions
|
98
|
-
|
99
|
-
* Use --backtrace to request a full backtrace without the task trace.
|
100
|
-
|
101
|
-
* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
|
102
|
-
output to standard output rather than standard error.
|
103
|
-
|
104
|
-
* Optional 'phony' target (enable with 'require 'rake/phony'") for
|
105
|
-
special purpose builds.
|
106
|
-
|
107
|
-
* Task#clear now clears task comments as well as actions and
|
108
|
-
prerequisites. Task#clear_comment will specifically target comments.
|
109
|
-
|
110
|
-
* The --all option will force -T and -D to consider all the tasks,
|
111
|
-
with and without descriptions.
|
112
|
-
|
113
|
-
=== Bug Fixes (in 0.9.3)
|
114
|
-
|
115
|
-
* Semi-colons in windows rakefile paths now work.
|
116
|
-
|
117
|
-
* Improved Control-C support when invoking multiple test suites.
|
118
|
-
|
119
|
-
* egrep method now reads files in text mode (better support for
|
120
|
-
Windows)
|
121
|
-
|
122
|
-
* Better deprecation line number reporting.
|
123
|
-
|
124
|
-
* The -W option now works with all tasks, whether they have a
|
125
|
-
description or not.
|
126
|
-
|
127
|
-
* File globs in rake should not be sorted alphabetically, independent
|
128
|
-
of file system and platform.
|
129
|
-
|
130
|
-
* Numerous internal improvements.
|
131
|
-
|
132
|
-
* Documentation typos and fixes.
|
133
|
-
|
134
|
-
=== Bug Fixes (in 0.9.4)
|
135
|
-
|
136
|
-
* Exit status with failing tests is not correctly set to non-zero.
|
137
|
-
|
138
|
-
* Simplified syntax for phony task (for older versions of RDoc).
|
139
|
-
|
140
|
-
* Stand alone FileList usage gets glob function (without loading in
|
141
|
-
extra dependencies)
|
142
|
-
|
143
|
-
=== Bug Fixes (in 0.9.5)
|
144
|
-
|
145
|
-
* --trace and --backtrace no longer swallow following task names.
|
146
|
-
|
147
|
-
== What is Rake
|
148
|
-
|
149
|
-
Rake is a build tool similar to the make program in many ways. But
|
150
|
-
instead of cryptic make recipes, Rake uses standard Ruby code to
|
151
|
-
declare tasks and dependencies. You have the full power of a modern
|
152
|
-
scripting language built right into your build tool.
|
153
|
-
|
154
|
-
== Availability
|
155
|
-
|
156
|
-
The easiest way to get and install rake is via RubyGems ...
|
157
|
-
|
158
|
-
gem install rake (you may need root/admin privileges)
|
159
|
-
|
160
|
-
Otherwise, you can get it from the more traditional places:
|
161
|
-
|
162
|
-
Home Page:: http://github.com/jimweirich/rake
|
163
|
-
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
|
164
|
-
GitHub:: git://github.com/jimweirich/rake.git
|
165
|
-
|
166
|
-
== Thanks
|
167
|
-
|
168
|
-
As usual, it was input from users that drove a lot of these changes. The
|
169
|
-
following people contributed patches, made suggestions or made
|
170
|
-
otherwise helpful comments. Thanks to ...
|
171
|
-
|
172
|
-
* Aaron Patterson
|
173
|
-
* Dylan Smith
|
174
|
-
* Jo Liss
|
175
|
-
* Jonas Pfenniger
|
176
|
-
* Kazuki Tsujimoto
|
177
|
-
* Michael Bishop
|
178
|
-
* Michael Elufimov
|
179
|
-
* NAKAMURA Usaku
|
180
|
-
* Ryan Davis
|
181
|
-
* Sam Grönblom
|
182
|
-
* Sam Phippen
|
183
|
-
* Sergio Wong
|
184
|
-
* Tay Ray Chuan
|
185
|
-
* grosser
|
186
|
-
* quix
|
187
|
-
|
188
|
-
Also, many thanks to Eric Hodel for assisting with getting this release
|
189
|
-
out the door.
|
190
|
-
|
191
|
-
-- Jim Weirich
|
@@ -1,61 +0,0 @@
|
|
1
|
-
= Rake 10.1.0 Released
|
2
|
-
|
3
|
-
== Changes in Version 10.1
|
4
|
-
|
5
|
-
=== New Features
|
6
|
-
|
7
|
-
* Add support for variable length task argument lists. If more actual
|
8
|
-
arguments are supplied than named arguments, then the extra
|
9
|
-
arguments values will be in args.extras.
|
10
|
-
|
11
|
-
* Application name is not displayed in the help banner. (Previously
|
12
|
-
"rake" was hardcoded, now rake-based applications can display their
|
13
|
-
own names).
|
14
|
-
|
15
|
-
=== Bug Fixes
|
16
|
-
|
17
|
-
Bug fixes include:
|
18
|
-
|
19
|
-
* Fix backtrace suppression issues.
|
20
|
-
|
21
|
-
* Rules now explicit get task arguments passed to them.
|
22
|
-
|
23
|
-
* Rename FileList#exclude? to FileList#exclude_from_list? to avoid
|
24
|
-
conflict with new Rails method.
|
25
|
-
|
26
|
-
* Clean / Clobber tasks now report failure to remove files.
|
27
|
-
|
28
|
-
* Plus heaps of internal code cleanup.
|
29
|
-
|
30
|
-
== What is Rake
|
31
|
-
|
32
|
-
Rake is a build tool similar to the make program in many ways. But
|
33
|
-
instead of cryptic make recipes, Rake uses standard Ruby code to
|
34
|
-
declare tasks and dependencies. You have the full power of a modern
|
35
|
-
scripting language built right into your build tool.
|
36
|
-
|
37
|
-
== Availability
|
38
|
-
|
39
|
-
The easiest way to get and install rake is via RubyGems ...
|
40
|
-
|
41
|
-
gem install rake (you may need root/admin privileges)
|
42
|
-
|
43
|
-
Otherwise, you can get it from the more from GitHub:
|
44
|
-
|
45
|
-
GitHub:: git://github.com/jimweirich/rake.git
|
46
|
-
|
47
|
-
== Thanks
|
48
|
-
|
49
|
-
As usual, it was input from users that drove a lot of these changes.
|
50
|
-
The following people contributed patches, made suggestions or made
|
51
|
-
otherwise helpful comments. Thanks to ...
|
52
|
-
|
53
|
-
* Michael Nikitochkin (general code cleanup)
|
54
|
-
* Vipul A M (general code cleanup)
|
55
|
-
* Dennis Bell (variable length task argument lists)
|
56
|
-
* Jacob Swanner (rules arguments)
|
57
|
-
* Rafael Rosa Fu (documentation typo)
|
58
|
-
* Stuart Nelson (install.rb fixes)
|
59
|
-
* Lee Hambley (application name in help banner)
|
60
|
-
|
61
|
-
-- Jim Weirich
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Rake
|
2
|
-
|
3
|
-
# Manage several publishers as a single entity.
|
4
|
-
class CompositePublisher
|
5
|
-
def initialize
|
6
|
-
@publishers = []
|
7
|
-
end
|
8
|
-
|
9
|
-
# Add a publisher to the composite.
|
10
|
-
def add(pub)
|
11
|
-
@publishers << pub
|
12
|
-
end
|
13
|
-
|
14
|
-
# Upload all the individual publishers.
|
15
|
-
def upload
|
16
|
-
@publishers.each { |p| p.upload }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
@@ -1,137 +0,0 @@
|
|
1
|
-
# = Tools for FTP uploading.
|
2
|
-
#
|
3
|
-
# This file is still under development and is not released for general
|
4
|
-
# use.
|
5
|
-
|
6
|
-
require 'date'
|
7
|
-
require 'net/ftp'
|
8
|
-
require 'rake/file_list'
|
9
|
-
|
10
|
-
module Rake # :nodoc:
|
11
|
-
|
12
|
-
class FtpFile # :nodoc: all
|
13
|
-
attr_reader :name, :size, :owner, :group, :time
|
14
|
-
|
15
|
-
def self.date
|
16
|
-
@date_class ||= Date
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.time
|
20
|
-
@time_class ||= Time
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize(path, entry)
|
24
|
-
@path = path
|
25
|
-
@mode, _, @owner, @group, size, d1, d2, d3, @name = entry.split(' ')
|
26
|
-
@size = size.to_i
|
27
|
-
@time = determine_time(d1, d2, d3)
|
28
|
-
end
|
29
|
-
|
30
|
-
def path
|
31
|
-
File.join(@path, @name)
|
32
|
-
end
|
33
|
-
|
34
|
-
def directory?
|
35
|
-
@mode[0] == ?d
|
36
|
-
end
|
37
|
-
|
38
|
-
def mode
|
39
|
-
parse_mode(@mode)
|
40
|
-
end
|
41
|
-
|
42
|
-
def symlink?
|
43
|
-
@mode[0] == ?l
|
44
|
-
end
|
45
|
-
|
46
|
-
private # --------------------------------------------------------
|
47
|
-
|
48
|
-
def parse_mode(m)
|
49
|
-
result = 0
|
50
|
-
(1..9).each do |i|
|
51
|
-
result = 2 * result + ((m[i] == ?-) ? 0 : 1)
|
52
|
-
end
|
53
|
-
result
|
54
|
-
end
|
55
|
-
|
56
|
-
def determine_time(d1, d2, d3)
|
57
|
-
now = self.class.time.now
|
58
|
-
if /:/ !~ d3
|
59
|
-
result = Time.parse("#{d1} #{d2} #{d3}")
|
60
|
-
else
|
61
|
-
result = Time.parse("#{d1} #{d2} #{now.year} #{d3}")
|
62
|
-
result = Time.parse("#{d1} #{d2} #{now.year - 1} #{d3}") if
|
63
|
-
result > now
|
64
|
-
end
|
65
|
-
result
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
##
|
70
|
-
# Manage the uploading of files to an FTP account.
|
71
|
-
class FtpUploader # :nodoc:
|
72
|
-
|
73
|
-
# Log uploads to standard output when true.
|
74
|
-
attr_accessor :verbose
|
75
|
-
|
76
|
-
class << FtpUploader
|
77
|
-
# Create an uploader and pass it to the given block as +up+.
|
78
|
-
# When the block is complete, close the uploader.
|
79
|
-
def connect(path, host, account, password)
|
80
|
-
up = self.new(path, host, account, password)
|
81
|
-
begin
|
82
|
-
yield(up)
|
83
|
-
ensure
|
84
|
-
up.close
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
# Create an FTP uploader targeting the directory +path+ on +host+
|
90
|
-
# using the given account and password. +path+ will be the root
|
91
|
-
# path of the uploader.
|
92
|
-
def initialize(path, host, account, password)
|
93
|
-
@created = Hash.new
|
94
|
-
@path = path
|
95
|
-
@ftp = Net::FTP.new(host, account, password)
|
96
|
-
makedirs(@path)
|
97
|
-
@ftp.chdir(@path)
|
98
|
-
end
|
99
|
-
|
100
|
-
# Create the directory +path+ in the uploader root path.
|
101
|
-
def makedirs(path)
|
102
|
-
route = []
|
103
|
-
File.split(path).each do |dir|
|
104
|
-
route << dir
|
105
|
-
current_dir = File.join(route)
|
106
|
-
if @created[current_dir].nil?
|
107
|
-
@created[current_dir] = true
|
108
|
-
$stderr.puts "Creating Directory #{current_dir}" if @verbose
|
109
|
-
@ftp.mkdir(current_dir) rescue nil
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
# Upload all files matching +wildcard+ to the uploader's root
|
115
|
-
# path.
|
116
|
-
def upload_files(wildcard)
|
117
|
-
FileList.glob(wildcard).each do |fn|
|
118
|
-
upload(fn)
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
# Close the uploader.
|
123
|
-
def close
|
124
|
-
@ftp.close
|
125
|
-
end
|
126
|
-
|
127
|
-
private # --------------------------------------------------------
|
128
|
-
|
129
|
-
# Upload a single file to the uploader's root path.
|
130
|
-
def upload(file)
|
131
|
-
$stderr.puts "Uploading #{file}" if @verbose
|
132
|
-
dir = File.dirname(file)
|
133
|
-
makedirs(dir)
|
134
|
-
@ftp.putbinaryfile(file, file) unless File.directory?(file)
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'rake/dsl_definition'
|
2
|
-
require 'rake/contrib/compositepublisher'
|
3
|
-
|
4
|
-
module Rake
|
5
|
-
# Publish an entire directory to an existing remote directory using
|
6
|
-
# SSH.
|
7
|
-
class SshDirPublisher
|
8
|
-
include Rake::DSL
|
9
|
-
|
10
|
-
# Creates an SSH publisher which will scp all files in +local_dir+ to
|
11
|
-
# +remote_dir+ on +host+
|
12
|
-
|
13
|
-
def initialize(host, remote_dir, local_dir)
|
14
|
-
@host = host
|
15
|
-
@remote_dir = remote_dir
|
16
|
-
@local_dir = local_dir
|
17
|
-
end
|
18
|
-
|
19
|
-
# Uploads the files
|
20
|
-
|
21
|
-
def upload
|
22
|
-
sh "scp", "-rq", "#{@local_dir}/*", "#{@host}:#{@remote_dir}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# Publish an entire directory to a fresh remote directory using SSH.
|
27
|
-
class SshFreshDirPublisher < SshDirPublisher
|
28
|
-
|
29
|
-
# Uploads the files after removing the existing remote directory.
|
30
|
-
|
31
|
-
def upload
|
32
|
-
sh "ssh", @host, "rm", "-rf", @remote_dir rescue nil
|
33
|
-
sh "ssh", @host, "mkdir", @remote_dir
|
34
|
-
super
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Publish a list of files to an existing remote directory.
|
39
|
-
class SshFilePublisher
|
40
|
-
include Rake::DSL
|
41
|
-
|
42
|
-
# Creates an SSH publisher which will scp all +files+ in +local_dir+ to
|
43
|
-
# +remote_dir+ on +host+.
|
44
|
-
|
45
|
-
def initialize(host, remote_dir, local_dir, *files)
|
46
|
-
@host = host
|
47
|
-
@remote_dir = remote_dir
|
48
|
-
@local_dir = local_dir
|
49
|
-
@files = files
|
50
|
-
end
|
51
|
-
|
52
|
-
# Uploads the files
|
53
|
-
|
54
|
-
def upload
|
55
|
-
@files.each do |fn|
|
56
|
-
sh "scp", "-q", "#{@local_dir}/#{fn}", "#{@host}:#{@remote_dir}"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|