rake-sh 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/BANNER +6 -0
- data/VERSION +1 -1
- data/bin/rake-sh +25 -1
- data/lib/rake/sh.rb +24 -3
- data/rake-sh.gemspec +2 -1
- metadata +3 -2
data/BANNER
ADDED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/bin/rake-sh
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
$:.unshift File.expand_path('../../lib', __FILE__)
|
4
|
+
require 'optparse'
|
4
5
|
require 'rake/sh'
|
5
|
-
|
6
|
+
|
7
|
+
version = File.read(File.expand_path('../../VERSION', __FILE__))
|
8
|
+
no_eager_tasks = false
|
9
|
+
|
10
|
+
opt = OptionParser.new
|
11
|
+
opt.banner = "Usage: #{opt.program_name} [options] [eager_tasks]\n" +
|
12
|
+
"(By default, the task named 'environment' will be invoked eagerly.)"
|
13
|
+
opt.version = version
|
14
|
+
opt.on('-n', '--no-eager-task', 'specify no eager task') { no_eager_tasks = true }
|
15
|
+
opt.parse!(ARGV)
|
16
|
+
|
17
|
+
if no_eager_tasks
|
18
|
+
eager_tasks = []
|
19
|
+
else
|
20
|
+
if ARGV.empty?
|
21
|
+
eager_tasks = ['environment']
|
22
|
+
else
|
23
|
+
eager_tasks = ARGV
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
puts "\e[31m" + File.read(File.expand_path('../../BANNER', __FILE__)) + " v#{version}\e[0m\n\n"
|
28
|
+
|
29
|
+
Rake::Sh.start(eager_tasks)
|
data/lib/rake/sh.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'readline'
|
2
2
|
require 'rake'
|
3
|
+
require 'stringio'
|
3
4
|
require 'rake/sh/command'
|
4
5
|
require 'rake/sh/commands'
|
5
6
|
|
@@ -8,7 +9,7 @@ module Rake
|
|
8
9
|
class << self
|
9
10
|
def start(eager_tasks = [])
|
10
11
|
rake_init
|
11
|
-
eager_tasks.each { |task|
|
12
|
+
eager_tasks.each { |task| invoke_eager_tasks(task) }
|
12
13
|
setup_readline
|
13
14
|
|
14
15
|
while buf = Readline.readline("rake> ", true)
|
@@ -45,14 +46,34 @@ module Rake
|
|
45
46
|
end
|
46
47
|
|
47
48
|
def rake_init
|
49
|
+
$stdout = StringIO.new
|
48
50
|
Rake.application = Rake::Application.new
|
49
51
|
Rake.application.init
|
50
52
|
Rake.application.load_rakefile
|
53
|
+
ensure
|
54
|
+
$stdout = STDOUT
|
51
55
|
end
|
52
56
|
|
53
|
-
def
|
57
|
+
def invoke_eager_tasks(name)
|
58
|
+
Rake.application[name].invoke
|
59
|
+
puts "\e[44mInvoke task eagerly: `#{name}`\e[0m"
|
60
|
+
rescue
|
61
|
+
end
|
62
|
+
|
63
|
+
def invoke(line)
|
54
64
|
start = Time.now
|
55
|
-
|
65
|
+
|
66
|
+
name, *args = line.split(/\s+/)
|
67
|
+
pid = fork do
|
68
|
+
args.each do |arg|
|
69
|
+
env, value = arg.split('=')
|
70
|
+
next unless env && !env.empty? && value && !value.empty?
|
71
|
+
ENV[env] = value
|
72
|
+
end
|
73
|
+
Rake.application[name].invoke
|
74
|
+
end
|
75
|
+
Process.waitpid(pid)
|
76
|
+
|
56
77
|
puts "\e[34m#{Time.now - start}sec\e[0m"
|
57
78
|
end
|
58
79
|
end
|
data/rake-sh.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rake-sh}
|
8
|
-
s.version = "1.0
|
8
|
+
s.version = "1.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["jugyo"]
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
23
|
".rspec",
|
24
|
+
"BANNER",
|
24
25
|
"Gemfile",
|
25
26
|
"Gemfile.lock",
|
26
27
|
"LICENSE.txt",
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rake-sh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0
|
5
|
+
version: 1.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- jugyo
|
@@ -69,6 +69,7 @@ extra_rdoc_files:
|
|
69
69
|
files:
|
70
70
|
- .document
|
71
71
|
- .rspec
|
72
|
+
- BANNER
|
72
73
|
- Gemfile
|
73
74
|
- Gemfile.lock
|
74
75
|
- LICENSE.txt
|
@@ -96,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
97
|
requirements:
|
97
98
|
- - ">="
|
98
99
|
- !ruby/object:Gem::Version
|
99
|
-
hash:
|
100
|
+
hash: 1919542078481597180
|
100
101
|
segments:
|
101
102
|
- 0
|
102
103
|
version: "0"
|