bpm 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.gitmodules +0 -0
- data/Gemfile +16 -0
- data/README.md +55 -0
- data/TODO.md +3 -0
- data/bin/bpm +8 -0
- data/bpm.gemspec +41 -0
- data/lib/bpm.rb +18 -0
- data/lib/bpm/cli.rb +6 -0
- data/lib/bpm/cli/base.rb +358 -0
- data/lib/bpm/cli/owner.rb +46 -0
- data/lib/bpm/credentials.rb +36 -0
- data/lib/bpm/default.json +9 -0
- data/lib/bpm/generator.rb +69 -0
- data/lib/bpm/init_generator.rb +43 -0
- data/lib/bpm/libgems_ext.rb +11 -0
- data/lib/bpm/libgems_ext/config_file.rb +33 -0
- data/lib/bpm/libgems_ext/dependency_installer.rb +150 -0
- data/lib/bpm/libgems_ext/installer.rb +39 -0
- data/lib/bpm/libgems_ext/libgems.rb +39 -0
- data/lib/bpm/libgems_ext/spec_fetcher.rb +11 -0
- data/lib/bpm/local.rb +76 -0
- data/lib/bpm/package.rb +277 -0
- data/lib/bpm/pipeline.rb +100 -0
- data/lib/bpm/pipeline/directive_processor.rb +47 -0
- data/lib/bpm/pipeline/generated_asset.rb +68 -0
- data/lib/bpm/pipeline/transport_processor.rb +32 -0
- data/lib/bpm/project.rb +427 -0
- data/lib/bpm/project_generator.rb +34 -0
- data/lib/bpm/remote.rb +104 -0
- data/lib/bpm/repository.rb +18 -0
- data/lib/bpm/server.rb +44 -0
- data/lib/bpm/version.rb +3 -0
- data/spec/cli/add_spec.rb +159 -0
- data/spec/cli/build_spec.rb +87 -0
- data/spec/cli/fetch_spec.rb +135 -0
- data/spec/cli/fetched_spec.rb +52 -0
- data/spec/cli/init_spec.rb +50 -0
- data/spec/cli/list_spec.rb +74 -0
- data/spec/cli/login_spec.rb +110 -0
- data/spec/cli/new_spec.rb +92 -0
- data/spec/cli/owner_spec.rb +114 -0
- data/spec/cli/push_spec.rb +73 -0
- data/spec/cli/remove_spec.rb +84 -0
- data/spec/cli/unpack_spec.rb +72 -0
- data/spec/cli/unyank_spec.rb +73 -0
- data/spec/cli/yank_spec.rb +73 -0
- data/spec/credentials_spec.rb +23 -0
- data/spec/fixtures/badrake-0.8.7.spd +0 -0
- data/spec/fixtures/builder-3.0.0.spd +0 -0
- data/spec/fixtures/bundler-1.1.pre.spd +0 -0
- data/spec/fixtures/coffee-1.0.1.pre.spd +0 -0
- data/spec/fixtures/core-test-0.4.9.spd +0 -0
- data/spec/fixtures/core-test/bin/cot +3 -0
- data/spec/fixtures/core-test/lib/main.js +1 -0
- data/spec/fixtures/core-test/package.json +46 -0
- data/spec/fixtures/core-test/resources/runner.css +1 -0
- data/spec/fixtures/core-test/tests/test.js +1 -0
- data/spec/fixtures/custom_generator-1.0.spd +0 -0
- data/spec/fixtures/custom_generator/lib/main.js +1 -0
- data/spec/fixtures/custom_generator/package.json +12 -0
- data/spec/fixtures/custom_generator/templates/init/project.json +19 -0
- data/spec/fixtures/custom_generator/templates/project/app.js +1 -0
- data/spec/fixtures/custom_generator/templates/project/lib/main.js +0 -0
- data/spec/fixtures/custom_generator/templates/project_generator.rb +20 -0
- data/spec/fixtures/hello_world/LICENSE +19 -0
- data/spec/fixtures/hello_world/README.md +21 -0
- data/spec/fixtures/hello_world/assets/bpm_packages.js +13 -0
- data/spec/fixtures/hello_world/assets/bpm_styles.css +14 -0
- data/spec/fixtures/hello_world/assets/papa-smurf.jpg +0 -0
- data/spec/fixtures/hello_world/hello_world.json +20 -0
- data/spec/fixtures/hello_world/lib/main.js +9 -0
- data/spec/fixtures/hello_world/packages/custom_package/assets/dummy.txt +1 -0
- data/spec/fixtures/hello_world/packages/custom_package/css/sample_styles.css +3 -0
- data/spec/fixtures/hello_world/packages/custom_package/custom_dir/basic-module.js +1 -0
- data/spec/fixtures/hello_world/packages/custom_package/lib/main.js +1 -0
- data/spec/fixtures/hello_world/packages/custom_package/package.json +22 -0
- data/spec/fixtures/hello_world/tests/main-test.js +8 -0
- data/spec/fixtures/highline-1.6.1.spd +0 -0
- data/spec/fixtures/ivory-0.0.1.spd +0 -0
- data/spec/fixtures/jquery-1.4.3.spd +0 -0
- data/spec/fixtures/optparse-1.0.1.spd +0 -0
- data/spec/fixtures/rake-0.8.6.spd +0 -0
- data/spec/fixtures/rake-0.8.7.spd +0 -0
- data/spec/fixtures/simple_hello/assets/bpm_packages.js +1 -0
- data/spec/fixtures/simple_hello/lib/main.js +1 -0
- data/spec/fixtures/spade-0.5.0.spd +0 -0
- data/spec/fixtures/src/README.txt +1 -0
- data/spec/fixtures/src/bundler-1.1.pre/.gitignore +22 -0
- data/spec/fixtures/src/bundler-1.1.pre/CHANGELOG.md +646 -0
- data/spec/fixtures/src/bundler-1.1.pre/ISSUES.md +47 -0
- data/spec/fixtures/src/bundler-1.1.pre/LICENSE +21 -0
- data/spec/fixtures/src/bundler-1.1.pre/README.md +29 -0
- data/spec/fixtures/src/bundler-1.1.pre/UPGRADING.md +103 -0
- data/spec/fixtures/src/bundler-1.1.pre/bin/bundle +20 -0
- data/spec/fixtures/src/bundler-1.1.pre/lib/bundler.js +23 -0
- data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/definition.js +14 -0
- data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/dependency.js +15 -0
- data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/dsl.js +9 -0
- data/spec/fixtures/src/bundler-1.1.pre/lib/bundler/ui.js +6 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle-config.ronn +90 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle-exec.ronn +111 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle-install.ronn +314 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle-package.ronn +59 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle-update.ronn +176 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/bundle.ronn +80 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/gemfile.5.ronn +279 -0
- data/spec/fixtures/src/bundler-1.1.pre/man/index.txt +6 -0
- data/spec/fixtures/src/bundler-1.1.pre/package.json +19 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/bin/cake +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/bin/coffee +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/lib/coffee.js +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/lib/coffee/base.js +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/lib/coffee/mocha/chai.js +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/package.json +19 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/qunit/coffee/test.js +0 -0
- data/spec/fixtures/src/coffee-1.0.1.pre/qunit/test.js +0 -0
- data/spec/fixtures/src/jquery/lib/main.js +7179 -0
- data/spec/fixtures/src/jquery/package.json +15 -0
- data/spec/fixtures/src/rake-0.8.6/CHANGES +436 -0
- data/spec/fixtures/src/rake-0.8.6/MIT-LICENSE +21 -0
- data/spec/fixtures/src/rake-0.8.6/README +196 -0
- data/spec/fixtures/src/rake-0.8.6/Rakefile +430 -0
- data/spec/fixtures/src/rake-0.8.6/TODO +20 -0
- data/spec/fixtures/src/rake-0.8.6/bin/rake +31 -0
- data/spec/fixtures/src/rake-0.8.6/doc/command_line_usage.rdoc +102 -0
- data/spec/fixtures/src/rake-0.8.6/doc/example/Rakefile1 +38 -0
- data/spec/fixtures/src/rake-0.8.6/doc/example/Rakefile2 +35 -0
- data/spec/fixtures/src/rake-0.8.6/doc/example/a.c +6 -0
- data/spec/fixtures/src/rake-0.8.6/doc/example/b.c +6 -0
- data/spec/fixtures/src/rake-0.8.6/doc/example/main.c +11 -0
- data/spec/fixtures/src/rake-0.8.6/doc/glossary.rdoc +51 -0
- data/spec/fixtures/src/rake-0.8.6/doc/jamis.rb +591 -0
- data/spec/fixtures/src/rake-0.8.6/doc/proto_rake.rdoc +127 -0
- data/spec/fixtures/src/rake-0.8.6/doc/rake.1.gz +0 -0
- data/spec/fixtures/src/rake-0.8.6/doc/rakefile.rdoc +534 -0
- data/spec/fixtures/src/rake-0.8.6/doc/rational.rdoc +151 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/spec/fixtures/src/rake-0.8.6/doc/release_notes/rake-0.8.6.rdoc +55 -0
- data/spec/fixtures/src/rake-0.8.6/install.rb +88 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake.rb +2502 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/alt_system.rb +108 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/classic_namespace.rb +8 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/clean.rb +33 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/compositepublisher.rb +24 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/ftptools.rb +153 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/publisher.rb +75 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/rubyforgepublisher.rb +18 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/sshpublisher.rb +47 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/contrib/sys.rb +209 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/gempackagetask.rb +97 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/loaders/makefile.rb +42 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/packagetask.rb +184 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/rake_test_loader.rb +5 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/rdoctask.rb +209 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/ruby182_test_unit_fix.rb +23 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/runtest.rb +23 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/tasklib.rb +23 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/testtask.rb +161 -0
- data/spec/fixtures/src/rake-0.8.6/lib/rake/win32.rb +55 -0
- data/spec/fixtures/src/rake-0.8.6/package.json +18 -0
- data/spec/fixtures/src/rake-0.8.6/test/capture_stdout.rb +26 -0
- data/spec/fixtures/src/rake-0.8.7/CHANGES +440 -0
- data/spec/fixtures/src/rake-0.8.7/MIT-LICENSE +21 -0
- data/spec/fixtures/src/rake-0.8.7/README +196 -0
- data/spec/fixtures/src/rake-0.8.7/Rakefile +430 -0
- data/spec/fixtures/src/rake-0.8.7/TODO +20 -0
- data/spec/fixtures/src/rake-0.8.7/bin/rake +31 -0
- data/spec/fixtures/src/rake-0.8.7/doc/command_line_usage.rdoc +102 -0
- data/spec/fixtures/src/rake-0.8.7/doc/example/Rakefile1 +38 -0
- data/spec/fixtures/src/rake-0.8.7/doc/example/Rakefile2 +35 -0
- data/spec/fixtures/src/rake-0.8.7/doc/example/a.c +6 -0
- data/spec/fixtures/src/rake-0.8.7/doc/example/b.c +6 -0
- data/spec/fixtures/src/rake-0.8.7/doc/example/main.c +11 -0
- data/spec/fixtures/src/rake-0.8.7/doc/glossary.rdoc +51 -0
- data/spec/fixtures/src/rake-0.8.7/doc/jamis.rb +591 -0
- data/spec/fixtures/src/rake-0.8.7/doc/proto_rake.rdoc +127 -0
- data/spec/fixtures/src/rake-0.8.7/doc/rake.1.gz +0 -0
- data/spec/fixtures/src/rake-0.8.7/doc/rakefile.rdoc +534 -0
- data/spec/fixtures/src/rake-0.8.7/doc/rational.rdoc +151 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.6.rdoc +55 -0
- data/spec/fixtures/src/rake-0.8.7/doc/release_notes/rake-0.8.7.rdoc +55 -0
- data/spec/fixtures/src/rake-0.8.7/install.rb +88 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake.rb +2506 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/alt_system.rb +108 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/classic_namespace.rb +8 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/clean.rb +33 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/compositepublisher.rb +24 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/ftptools.rb +153 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/publisher.rb +75 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/rubyforgepublisher.rb +18 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/sshpublisher.rb +47 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/contrib/sys.rb +209 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/gempackagetask.rb +97 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/loaders/makefile.rb +42 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/packagetask.rb +184 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/rake_test_loader.rb +5 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/rdoctask.rb +209 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/ruby182_test_unit_fix.rb +23 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/runtest.rb +23 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/tasklib.rb +23 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/testtask.rb +161 -0
- data/spec/fixtures/src/rake-0.8.7/lib/rake/win32.rb +55 -0
- data/spec/fixtures/src/rake-0.8.7/package.json +18 -0
- data/spec/fixtures/src/rake-0.8.7/test/capture_stdout.rb +26 -0
- data/spec/fixtures/src/spade/lib/main.js +1 -0
- data/spec/fixtures/src/spade/package.json +15 -0
- data/spec/fixtures/transporter/lib/main.js +3 -0
- data/spec/fixtures/transporter/packages/transport/lib/wrapper.js +5 -0
- data/spec/fixtures/transporter/packages/transport/package.json +21 -0
- data/spec/fixtures/transporter/transporter.json +18 -0
- data/spec/gauntlet_spec.rb +33 -0
- data/spec/package_spec.rb +319 -0
- data/spec/pipeline_spec.rb +213 -0
- data/spec/project_spec.rb +130 -0
- data/spec/spec_helper.rb +42 -0
- data/spec/support/cli.rb +93 -0
- data/spec/support/env.rb +18 -0
- data/spec/support/fake.rb +53 -0
- data/spec/support/fake_gem_server.rb +72 -0
- data/spec/support/fake_gemcutter.rb +50 -0
- data/spec/support/matchers.rb +32 -0
- data/spec/support/path.rb +63 -0
- data/spec/support/project.rb +43 -0
- data/templates/init/assets/bpm_packages.js +7 -0
- data/templates/init/assets/bpm_styles.css +7 -0
- data/templates/init/project.json +16 -0
- data/templates/project/LICENSE +19 -0
- data/templates/project/README.md +21 -0
- data/templates/project/app.js +1 -0
- data/templates/project/index.html +13 -0
- metadata +627 -0
@@ -0,0 +1,108 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2008 James M. Lawrence
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person
|
5
|
+
# obtaining a copy of this software and associated documentation files
|
6
|
+
# (the "Software"), to deal in the Software without restriction,
|
7
|
+
# including without limitation the rights to use, copy, modify, merge,
|
8
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
9
|
+
# and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
19
|
+
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
20
|
+
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
21
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
#
|
24
|
+
|
25
|
+
require 'rbconfig'
|
26
|
+
|
27
|
+
#
|
28
|
+
# Alternate implementations of system() and backticks `` on Windows
|
29
|
+
# for ruby-1.8 and earlier.
|
30
|
+
#
|
31
|
+
module Rake::AltSystem
|
32
|
+
WINDOWS = Config::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
|
33
|
+
|
34
|
+
class << self
|
35
|
+
def define_module_function(name, &block)
|
36
|
+
define_method(name, &block)
|
37
|
+
module_function(name)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
if WINDOWS and RUBY_VERSION < "1.9.0"
|
42
|
+
RUNNABLE_EXTS = %w[com exe bat cmd]
|
43
|
+
RUNNABLE_PATTERN = %r!\.(#{RUNNABLE_EXTS.join('|')})\Z!i
|
44
|
+
|
45
|
+
define_module_function :kernel_system, &Kernel.method(:system)
|
46
|
+
define_module_function :kernel_backticks, &Kernel.method(:'`')
|
47
|
+
|
48
|
+
module_function
|
49
|
+
|
50
|
+
def repair_command(cmd)
|
51
|
+
"call " + (
|
52
|
+
if cmd =~ %r!\A\s*\".*?\"!
|
53
|
+
# already quoted
|
54
|
+
cmd
|
55
|
+
elsif match = cmd.match(%r!\A\s*(\S+)!)
|
56
|
+
if match[1] =~ %r!/!
|
57
|
+
# avoid x/y.bat interpretation as x with option /y
|
58
|
+
%Q!"#{match[1]}"! + match.post_match
|
59
|
+
else
|
60
|
+
# a shell command will fail if quoted
|
61
|
+
cmd
|
62
|
+
end
|
63
|
+
else
|
64
|
+
# empty or whitespace
|
65
|
+
cmd
|
66
|
+
end
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def find_runnable(file)
|
71
|
+
if file =~ RUNNABLE_PATTERN
|
72
|
+
file
|
73
|
+
else
|
74
|
+
RUNNABLE_EXTS.each { |ext|
|
75
|
+
if File.exist?(test = "#{file}.#{ext}")
|
76
|
+
return test
|
77
|
+
end
|
78
|
+
}
|
79
|
+
nil
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def system(cmd, *args)
|
84
|
+
repaired = (
|
85
|
+
if args.empty?
|
86
|
+
[repair_command(cmd)]
|
87
|
+
elsif runnable = find_runnable(cmd)
|
88
|
+
[File.expand_path(runnable), *args]
|
89
|
+
else
|
90
|
+
# non-existent file
|
91
|
+
[cmd, *args]
|
92
|
+
end
|
93
|
+
)
|
94
|
+
kernel_system(*repaired)
|
95
|
+
end
|
96
|
+
|
97
|
+
def backticks(cmd)
|
98
|
+
kernel_backticks(repair_command(cmd))
|
99
|
+
end
|
100
|
+
|
101
|
+
define_module_function :'`', &method(:backticks)
|
102
|
+
else
|
103
|
+
# Non-Windows or ruby-1.9+: same as Kernel versions
|
104
|
+
define_module_function :system, &Kernel.method(:system)
|
105
|
+
define_module_function :backticks, &Kernel.method(:'`')
|
106
|
+
define_module_function :'`', &Kernel.method(:'`')
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# The following classes used to be in the top level namespace.
|
2
|
+
# Loading this file enables compatibility with older Rakefile that
|
3
|
+
# referenced Task from the top level.
|
4
|
+
|
5
|
+
Task = Rake::Task
|
6
|
+
FileTask = Rake::FileTask
|
7
|
+
FileCreationTask = Rake::FileCreationTask
|
8
|
+
RakeApp = Rake::Application
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# The 'rake/clean' file defines two file lists (CLEAN and CLOBBER) and
|
4
|
+
# two rake tasks (:clean and :clobber).
|
5
|
+
#
|
6
|
+
# [:clean] Clean up the project by deleting scratch files and backup
|
7
|
+
# files. Add files to the CLEAN file list to have the :clean
|
8
|
+
# target handle them.
|
9
|
+
#
|
10
|
+
# [:clobber] Clobber all generated and non-source files in a project.
|
11
|
+
# The task depends on :clean, so all the clean files will
|
12
|
+
# be deleted as well as files in the CLOBBER file list.
|
13
|
+
# The intent of this task is to return a project to its
|
14
|
+
# pristine, just unpacked state.
|
15
|
+
|
16
|
+
require 'rake'
|
17
|
+
|
18
|
+
CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
|
19
|
+
CLEAN.clear_exclude.exclude { |fn|
|
20
|
+
fn.pathmap("%f") == 'core' && File.directory?(fn)
|
21
|
+
}
|
22
|
+
|
23
|
+
desc "Remove any temporary products."
|
24
|
+
task :clean do
|
25
|
+
CLEAN.each { |fn| rm_r fn rescue nil }
|
26
|
+
end
|
27
|
+
|
28
|
+
CLOBBER = Rake::FileList.new
|
29
|
+
|
30
|
+
desc "Remove any generated file."
|
31
|
+
task :clobber => [:clean] do
|
32
|
+
CLOBBER.each { |fn| rm_r fn rescue nil }
|
33
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
module Rake
|
4
|
+
|
5
|
+
# Manage several publishers as a single entity.
|
6
|
+
class CompositePublisher
|
7
|
+
def initialize
|
8
|
+
@publishers = []
|
9
|
+
end
|
10
|
+
|
11
|
+
# Add a publisher to the composite.
|
12
|
+
def add(pub)
|
13
|
+
@publishers << pub
|
14
|
+
end
|
15
|
+
|
16
|
+
# Upload all the individual publishers.
|
17
|
+
def upload
|
18
|
+
@publishers.each { |p| p.upload }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
|
@@ -0,0 +1,153 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# = Tools for FTP uploading.
|
4
|
+
#
|
5
|
+
# This file is still under development and is not released for general
|
6
|
+
# use.
|
7
|
+
|
8
|
+
require 'date'
|
9
|
+
require 'net/ftp'
|
10
|
+
|
11
|
+
module Rake # :nodoc:
|
12
|
+
|
13
|
+
####################################################################
|
14
|
+
# <b>Note:</b> <em> Not released for general use.</em>
|
15
|
+
class FtpFile
|
16
|
+
attr_reader :name, :size, :owner, :group, :time
|
17
|
+
|
18
|
+
def self.date
|
19
|
+
@date_class ||= Date
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.time
|
23
|
+
@time_class ||= Time
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize(path, entry)
|
27
|
+
@path = path
|
28
|
+
@mode, line, @owner, @group, size, d1, d2, d3, @name = entry.split(' ')
|
29
|
+
@size = size.to_i
|
30
|
+
@time = determine_time(d1, d2, d3)
|
31
|
+
end
|
32
|
+
|
33
|
+
def path
|
34
|
+
File.join(@path, @name)
|
35
|
+
end
|
36
|
+
|
37
|
+
def directory?
|
38
|
+
@mode[0] == ?d
|
39
|
+
end
|
40
|
+
|
41
|
+
def mode
|
42
|
+
parse_mode(@mode)
|
43
|
+
end
|
44
|
+
|
45
|
+
def symlink?
|
46
|
+
@mode[0] == ?l
|
47
|
+
end
|
48
|
+
|
49
|
+
private # --------------------------------------------------------
|
50
|
+
|
51
|
+
def parse_mode(m)
|
52
|
+
result = 0
|
53
|
+
(1..9).each do |i|
|
54
|
+
result = 2*result + ((m[i]==?-) ? 0 : 1)
|
55
|
+
end
|
56
|
+
result
|
57
|
+
end
|
58
|
+
|
59
|
+
def determine_time(d1, d2, d3)
|
60
|
+
now = self.class.time.now
|
61
|
+
if /:/ =~ d3
|
62
|
+
h, m = d3.split(':')
|
63
|
+
result = Time.parse("#{d1} #{d2} #{now.year} #{d3}")
|
64
|
+
if result > now
|
65
|
+
result = Time.parse("#{d1} #{d2} #{now.year-1} #{d3}")
|
66
|
+
end
|
67
|
+
else
|
68
|
+
result = Time.parse("#{d1} #{d2} #{d3}")
|
69
|
+
end
|
70
|
+
result
|
71
|
+
# elements = ParseDate.parsedate("#{d1} #{d2} #{d3}")
|
72
|
+
# if elements[0].nil?
|
73
|
+
# today = self.class.date.today
|
74
|
+
# if elements[1] > today.month
|
75
|
+
# elements[0] = today.year - 1
|
76
|
+
# else
|
77
|
+
# elements[0] = today.year
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
# elements = elements.collect { |el| el.nil? ? 0 : el }
|
81
|
+
# Time.mktime(*elements[0,7])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
####################################################################
|
86
|
+
# Manage the uploading of files to an FTP account.
|
87
|
+
class FtpUploader
|
88
|
+
|
89
|
+
# Log uploads to standard output when true.
|
90
|
+
attr_accessor :verbose
|
91
|
+
|
92
|
+
class << FtpUploader
|
93
|
+
# Create an uploader and pass it to the given block as +up+.
|
94
|
+
# When the block is complete, close the uploader.
|
95
|
+
def connect(path, host, account, password)
|
96
|
+
up = self.new(path, host, account, password)
|
97
|
+
begin
|
98
|
+
yield(up)
|
99
|
+
ensure
|
100
|
+
up.close
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# Create an FTP uploader targetting the directory +path+ on +host+
|
106
|
+
# using the given account and password. +path+ will be the root
|
107
|
+
# path of the uploader.
|
108
|
+
def initialize(path, host, account, password)
|
109
|
+
@created = Hash.new
|
110
|
+
@path = path
|
111
|
+
@ftp = Net::FTP.new(host, account, password)
|
112
|
+
makedirs(@path)
|
113
|
+
@ftp.chdir(@path)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Create the directory +path+ in the uploader root path.
|
117
|
+
def makedirs(path)
|
118
|
+
route = []
|
119
|
+
File.split(path).each do |dir|
|
120
|
+
route << dir
|
121
|
+
current_dir = File.join(route)
|
122
|
+
if @created[current_dir].nil?
|
123
|
+
@created[current_dir] = true
|
124
|
+
puts "Creating Directory #{current_dir}" if @verbose
|
125
|
+
@ftp.mkdir(current_dir) rescue nil
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# Upload all files matching +wildcard+ to the uploader's root
|
131
|
+
# path.
|
132
|
+
def upload_files(wildcard)
|
133
|
+
Dir[wildcard].each do |fn|
|
134
|
+
upload(fn)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
# Close the uploader.
|
139
|
+
def close
|
140
|
+
@ftp.close
|
141
|
+
end
|
142
|
+
|
143
|
+
private # --------------------------------------------------------
|
144
|
+
|
145
|
+
# Upload a single file to the uploader's root path.
|
146
|
+
def upload(file)
|
147
|
+
puts "Uploading #{file}" if @verbose
|
148
|
+
dir = File.dirname(file)
|
149
|
+
makedirs(dir)
|
150
|
+
@ftp.putbinaryfile(file, file) unless File.directory?(file)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright 2003, 2004, 2005, 2006, 2007, 2008 by Jim Weirich (jim@weirichhouse.org)
|
4
|
+
# All rights reserved.
|
5
|
+
|
6
|
+
# Permission is granted for use, copying, modification, distribution,
|
7
|
+
# and distribution of modified versions of this work as long as the
|
8
|
+
# above copyright notice is included.
|
9
|
+
|
10
|
+
# Configuration information about an upload host system.
|
11
|
+
# * name :: Name of host system.
|
12
|
+
# * webdir :: Base directory for the web information for the
|
13
|
+
# application. The application name (APP) is appended to
|
14
|
+
# this directory before using.
|
15
|
+
# * pkgdir :: Directory on the host system where packages can be
|
16
|
+
# placed.
|
17
|
+
HostInfo = Struct.new(:name, :webdir, :pkgdir)
|
18
|
+
|
19
|
+
# Manage several publishers as a single entity.
|
20
|
+
class CompositePublisher
|
21
|
+
def initialize
|
22
|
+
@publishers = []
|
23
|
+
end
|
24
|
+
|
25
|
+
# Add a publisher to the composite.
|
26
|
+
def add(pub)
|
27
|
+
@publishers << pub
|
28
|
+
end
|
29
|
+
|
30
|
+
# Upload all the individual publishers.
|
31
|
+
def upload
|
32
|
+
@publishers.each { |p| p.upload }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Publish an entire directory to an existing remote directory using
|
37
|
+
# SSH.
|
38
|
+
class SshDirPublisher
|
39
|
+
def initialize(host, remote_dir, local_dir)
|
40
|
+
@host = host
|
41
|
+
@remote_dir = remote_dir
|
42
|
+
@local_dir = local_dir
|
43
|
+
end
|
44
|
+
|
45
|
+
def upload
|
46
|
+
run %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Publish an entire directory to a fresh remote directory using SSH.
|
51
|
+
class SshFreshDirPublisher < SshDirPublisher
|
52
|
+
def upload
|
53
|
+
run %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
|
54
|
+
run %{ssh #{@host} mkdir #{@remote_dir}}
|
55
|
+
super
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Publish a list of files to an existing remote directory.
|
60
|
+
class SshFilePublisher
|
61
|
+
# Create a publisher using the give host information.
|
62
|
+
def initialize(host, remote_dir, local_dir, *files)
|
63
|
+
@host = host
|
64
|
+
@remote_dir = remote_dir
|
65
|
+
@local_dir = local_dir
|
66
|
+
@files = files
|
67
|
+
end
|
68
|
+
|
69
|
+
# Upload the local directory to the remote directory.
|
70
|
+
def upload
|
71
|
+
@files.each do |fn|
|
72
|
+
run %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rake/contrib/sshpublisher'
|
4
|
+
|
5
|
+
module Rake
|
6
|
+
|
7
|
+
class RubyForgePublisher < SshDirPublisher
|
8
|
+
attr_reader :project, :proj_id, :user
|
9
|
+
|
10
|
+
def initialize(projname, user)
|
11
|
+
super(
|
12
|
+
"#{user}@rubyforge.org",
|
13
|
+
"/var/www/gforge-projects/#{projname}",
|
14
|
+
"html")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rake/contrib/compositepublisher'
|
4
|
+
|
5
|
+
module Rake
|
6
|
+
|
7
|
+
# Publish an entire directory to an existing remote directory using
|
8
|
+
# SSH.
|
9
|
+
class SshDirPublisher
|
10
|
+
def initialize(host, remote_dir, local_dir)
|
11
|
+
@host = host
|
12
|
+
@remote_dir = remote_dir
|
13
|
+
@local_dir = local_dir
|
14
|
+
end
|
15
|
+
|
16
|
+
def upload
|
17
|
+
sh %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Publish an entire directory to a fresh remote directory using SSH.
|
22
|
+
class SshFreshDirPublisher < SshDirPublisher
|
23
|
+
def upload
|
24
|
+
sh %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
|
25
|
+
sh %{ssh #{@host} mkdir #{@remote_dir}}
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Publish a list of files to an existing remote directory.
|
31
|
+
class SshFilePublisher
|
32
|
+
# Create a publisher using the give host information.
|
33
|
+
def initialize(host, remote_dir, local_dir, *files)
|
34
|
+
@host = host
|
35
|
+
@remote_dir = remote_dir
|
36
|
+
@local_dir = local_dir
|
37
|
+
@files = files
|
38
|
+
end
|
39
|
+
|
40
|
+
# Upload the local directory to the remote directory.
|
41
|
+
def upload
|
42
|
+
@files.each do |fn|
|
43
|
+
sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|