spline 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/spline +11 -9
- data/lib/spline/version.rb +1 -1
- data/lib/spline.rb +1 -8
- data/vendor/bundle/ruby/2.1.0/bin/rake +23 -0
- data/vendor/bundle/ruby/2.1.0/bin/spline +23 -0
- data/vendor/bundle/ruby/2.1.0/build_info/rake-10.3.2.info +1 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.autotest +7 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.gemtest +0 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.rubocop.yml +27 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/.togglerc +7 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/CONTRIBUTING.rdoc +34 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/History.rdoc +609 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/Manifest.txt +162 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/README.rdoc +137 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/Rakefile +81 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/bin/rake +33 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/alt_system.rb +110 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb +783 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/backtrace.rb +23 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/clean.rb +76 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/cloneable.rb +16 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/.document +0 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/compositepublisher.rb +21 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/ftptools.rb +137 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/publisher.rb +81 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/rubyforgepublisher.rb +18 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/sshpublisher.rb +61 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/sys.rb +4 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/cpu_counter.rb +109 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/default_loader.rb +14 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/dsl_definition.rb +198 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/early_time.rb +21 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/core.rb +25 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/module.rb +1 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/string.rb +173 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/time.rb +15 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_creation_task.rb +24 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_list.rb +414 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_task.rb +46 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_utils.rb +116 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_utils_ext.rb +144 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/gempackagetask.rb +4 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/invocation_chain.rb +56 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/invocation_exception_mixin.rb +16 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/linked_list.rb +103 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/loaders/makefile.rb +40 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/multi_task.rb +13 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/name_space.rb +38 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/packagetask.rb +202 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/pathmap.rb +3 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/phony.rb +15 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/private_reader.rb +20 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/promise.rb +99 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/pseudo_status.rb +29 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_module.rb +38 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_test_loader.rb +22 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rdoctask.rb +4 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ruby182_test_unit_fix.rb +29 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/runtest.rb +27 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/scope.rb +42 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb +383 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_argument_error.rb +7 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_arguments.rb +98 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_manager.rb +310 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/tasklib.rb +24 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/testtask.rb +212 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/thread_history_display.rb +48 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/thread_pool.rb +164 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/trace_output.rb +22 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/version.rb +7 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/win32.rb +56 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake.rb +78 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/rakelib/publish.rake +20 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/rakelib/test_times.rake +25 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/file_creation.rb +34 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/helper.rb +127 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/support/rakefile_definitions.rb +478 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/support/ruby_runner.rb +33 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_private_reader.rb +42 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake.rb +40 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_application.rb +641 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_application_options.rb +466 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_backtrace.rb +119 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_clean.rb +55 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_cpu_counter.rb +50 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_definitions.rb +79 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_directory_task.rb +63 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_dsl.rb +40 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_early_time.rb +31 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_extension.rb +59 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_creation_task.rb +56 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_list.rb +627 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_list_path_map.rb +8 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_task.rb +186 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_utils.rb +309 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_ftp_file.rb +74 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_functional.rb +482 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_invocation_chain.rb +64 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_linked_list.rb +84 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_makefile_loader.rb +46 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_multi_task.rb +58 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_name_space.rb +57 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_package_task.rb +79 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map.rb +168 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map_explode.rb +34 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map_partial.rb +18 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_pseudo_status.rb +21 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_rake_test_loader.rb +20 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_reduce_compat.rb +26 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_require.rb +40 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_rules.rb +388 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_scope.rb +44 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task.rb +392 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_argument_parsing.rb +109 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_arguments.rb +127 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_lib.rb +9 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_manager.rb +178 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_manager_argument_resolution.rb +19 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_with_arguments.rb +171 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_test_task.rb +141 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_thread_pool.rb +142 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_top_level_functions.rb +71 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_win32.rb +72 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_thread_history_display.rb +101 -0
- data/vendor/bundle/ruby/2.1.0/gems/rake-10.3.2/test/test_trace_output.rb +52 -0
- data/vendor/bundle/ruby/2.1.0/specifications/rake-10.3.2.gemspec +45 -0
- metadata +127 -2
@@ -0,0 +1,164 @@
|
|
1
|
+
require 'thread'
|
2
|
+
require 'set'
|
3
|
+
|
4
|
+
require 'rake/promise'
|
5
|
+
|
6
|
+
module Rake
|
7
|
+
|
8
|
+
class ThreadPool # :nodoc: all
|
9
|
+
|
10
|
+
# Creates a ThreadPool object. The +thread_count+ parameter is the size
|
11
|
+
# of the pool.
|
12
|
+
def initialize(thread_count)
|
13
|
+
@max_active_threads = [thread_count, 0].max
|
14
|
+
@threads = Set.new
|
15
|
+
@threads_mon = Monitor.new
|
16
|
+
@queue = Queue.new
|
17
|
+
@join_cond = @threads_mon.new_cond
|
18
|
+
|
19
|
+
@history_start_time = nil
|
20
|
+
@history = []
|
21
|
+
@history_mon = Monitor.new
|
22
|
+
@total_threads_in_play = 0
|
23
|
+
end
|
24
|
+
|
25
|
+
# Creates a future executed by the +ThreadPool+.
|
26
|
+
#
|
27
|
+
# The args are passed to the block when executing (similarly to
|
28
|
+
# Thread#new) The return value is an object representing
|
29
|
+
# a future which has been created and added to the queue in the
|
30
|
+
# pool. Sending #value to the object will sleep the
|
31
|
+
# current thread until the future is finished and will return the
|
32
|
+
# result (or raise an exception thrown from the future)
|
33
|
+
def future(*args, &block)
|
34
|
+
promise = Promise.new(args, &block)
|
35
|
+
promise.recorder = lambda { |*stats| stat(*stats) }
|
36
|
+
|
37
|
+
@queue.enq promise
|
38
|
+
stat :queued, :item_id => promise.object_id
|
39
|
+
start_thread
|
40
|
+
promise
|
41
|
+
end
|
42
|
+
|
43
|
+
# Waits until the queue of futures is empty and all threads have exited.
|
44
|
+
def join
|
45
|
+
@threads_mon.synchronize do
|
46
|
+
begin
|
47
|
+
stat :joining
|
48
|
+
@join_cond.wait unless @threads.empty?
|
49
|
+
stat :joined
|
50
|
+
rescue Exception => e
|
51
|
+
stat :joined
|
52
|
+
$stderr.puts e
|
53
|
+
$stderr.print "Queue contains #{@queue.size} items. " +
|
54
|
+
"Thread pool contains #{@threads.count} threads\n"
|
55
|
+
$stderr.print "Current Thread #{Thread.current} status = " +
|
56
|
+
"#{Thread.current.status}\n"
|
57
|
+
$stderr.puts e.backtrace.join("\n")
|
58
|
+
@threads.each do |t|
|
59
|
+
$stderr.print "Thread #{t} status = #{t.status}\n"
|
60
|
+
# 1.8 doesn't support Thread#backtrace
|
61
|
+
$stderr.puts t.backtrace.join("\n") if t.respond_to? :backtrace
|
62
|
+
end
|
63
|
+
raise e
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Enable the gathering of history events.
|
69
|
+
def gather_history #:nodoc:
|
70
|
+
@history_start_time = Time.now if @history_start_time.nil?
|
71
|
+
end
|
72
|
+
|
73
|
+
# Return a array of history events for the thread pool.
|
74
|
+
#
|
75
|
+
# History gathering must be enabled to be able to see the events
|
76
|
+
# (see #gather_history). Best to call this when the job is
|
77
|
+
# complete (i.e. after ThreadPool#join is called).
|
78
|
+
def history # :nodoc:
|
79
|
+
@history_mon.synchronize { @history.dup }.
|
80
|
+
sort_by { |i| i[:time] }.
|
81
|
+
each { |i| i[:time] -= @history_start_time }
|
82
|
+
end
|
83
|
+
|
84
|
+
# Return a hash of always collected statistics for the thread pool.
|
85
|
+
def statistics # :nodoc:
|
86
|
+
{
|
87
|
+
:total_threads_in_play => @total_threads_in_play,
|
88
|
+
:max_active_threads => @max_active_threads,
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
# processes one item on the queue. Returns true if there was an
|
95
|
+
# item to process, false if there was no item
|
96
|
+
def process_queue_item #:nodoc:
|
97
|
+
return false if @queue.empty?
|
98
|
+
|
99
|
+
# Even though we just asked if the queue was empty, it
|
100
|
+
# still could have had an item which by this statement
|
101
|
+
# is now gone. For this reason we pass true to Queue#deq
|
102
|
+
# because we will sleep indefinitely if it is empty.
|
103
|
+
promise = @queue.deq(true)
|
104
|
+
stat :dequeued, :item_id => promise.object_id
|
105
|
+
promise.work
|
106
|
+
return true
|
107
|
+
|
108
|
+
rescue ThreadError # this means the queue is empty
|
109
|
+
false
|
110
|
+
end
|
111
|
+
|
112
|
+
def safe_thread_count
|
113
|
+
@threads_mon.synchronize do
|
114
|
+
@threads.count
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def start_thread # :nodoc:
|
119
|
+
@threads_mon.synchronize do
|
120
|
+
next unless @threads.count < @max_active_threads
|
121
|
+
|
122
|
+
t = Thread.new do
|
123
|
+
begin
|
124
|
+
while safe_thread_count <= @max_active_threads
|
125
|
+
break unless process_queue_item
|
126
|
+
end
|
127
|
+
ensure
|
128
|
+
@threads_mon.synchronize do
|
129
|
+
@threads.delete Thread.current
|
130
|
+
stat :ended, :thread_count => @threads.count
|
131
|
+
@join_cond.broadcast if @threads.empty?
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
@threads << t
|
137
|
+
stat(
|
138
|
+
:spawned,
|
139
|
+
:new_thread => t.object_id,
|
140
|
+
:thread_count => @threads.count)
|
141
|
+
@total_threads_in_play = @threads.count if
|
142
|
+
@threads.count > @total_threads_in_play
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def stat(event, data=nil) # :nodoc:
|
147
|
+
return if @history_start_time.nil?
|
148
|
+
info = {
|
149
|
+
:event => event,
|
150
|
+
:data => data,
|
151
|
+
:time => Time.now,
|
152
|
+
:thread => Thread.current.object_id,
|
153
|
+
}
|
154
|
+
@history_mon.synchronize { @history << info }
|
155
|
+
end
|
156
|
+
|
157
|
+
# for testing only
|
158
|
+
|
159
|
+
def __queue__ # :nodoc:
|
160
|
+
@queue
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Rake
|
2
|
+
module TraceOutput # :nodoc: all
|
3
|
+
|
4
|
+
# Write trace output to output stream +out+.
|
5
|
+
#
|
6
|
+
# The write is done as a single IO call (to print) to lessen the
|
7
|
+
# chance that the trace output is interrupted by other tasks also
|
8
|
+
# producing output.
|
9
|
+
def trace_on(out, *strings)
|
10
|
+
sep = $\ || "\n"
|
11
|
+
if strings.empty?
|
12
|
+
output = sep
|
13
|
+
else
|
14
|
+
output = strings.map { |s|
|
15
|
+
next if s.nil?
|
16
|
+
s =~ /#{sep}$/ ? s : s + sep
|
17
|
+
}.join
|
18
|
+
end
|
19
|
+
out.print(output)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
|
2
|
+
module Rake
|
3
|
+
require 'rake/alt_system'
|
4
|
+
|
5
|
+
# Win 32 interface methods for Rake. Windows specific functionality
|
6
|
+
# will be placed here to collect that knowledge in one spot.
|
7
|
+
module Win32 # :nodoc: all
|
8
|
+
|
9
|
+
# Error indicating a problem in locating the home directory on a
|
10
|
+
# Win32 system.
|
11
|
+
class Win32HomeError < RuntimeError
|
12
|
+
end
|
13
|
+
|
14
|
+
class << self
|
15
|
+
# True if running on a windows system.
|
16
|
+
def windows?
|
17
|
+
AltSystem::WINDOWS
|
18
|
+
end
|
19
|
+
|
20
|
+
# Run a command line on windows.
|
21
|
+
def rake_system(*cmd)
|
22
|
+
AltSystem.system(*cmd)
|
23
|
+
end
|
24
|
+
|
25
|
+
# The standard directory containing system wide rake files on
|
26
|
+
# Win 32 systems. Try the following environment variables (in
|
27
|
+
# order):
|
28
|
+
#
|
29
|
+
# * HOME
|
30
|
+
# * HOMEDRIVE + HOMEPATH
|
31
|
+
# * APPDATA
|
32
|
+
# * USERPROFILE
|
33
|
+
#
|
34
|
+
# If the above are not defined, the return nil.
|
35
|
+
def win32_system_dir #:nodoc:
|
36
|
+
win32_shared_path = ENV['HOME']
|
37
|
+
if win32_shared_path.nil? && ENV['HOMEDRIVE'] && ENV['HOMEPATH']
|
38
|
+
win32_shared_path = ENV['HOMEDRIVE'] + ENV['HOMEPATH']
|
39
|
+
end
|
40
|
+
|
41
|
+
win32_shared_path ||= ENV['APPDATA']
|
42
|
+
win32_shared_path ||= ENV['USERPROFILE']
|
43
|
+
raise Win32HomeError,
|
44
|
+
"Unable to determine home path environment variable." if
|
45
|
+
win32_shared_path.nil? or win32_shared_path.empty?
|
46
|
+
normalize(File.join(win32_shared_path, 'Rake'))
|
47
|
+
end
|
48
|
+
|
49
|
+
# Normalize a win32 path so that the slashes are all forward slashes.
|
50
|
+
def normalize(path)
|
51
|
+
path.gsub(/\\/, '/')
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to
|
6
|
+
# deal in the Software without restriction, including without limitation the
|
7
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
8
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
19
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
20
|
+
# IN THE SOFTWARE.
|
21
|
+
#++
|
22
|
+
|
23
|
+
module Rake
|
24
|
+
VERSION = '10.3.2'
|
25
|
+
end
|
26
|
+
|
27
|
+
require 'rake/version'
|
28
|
+
|
29
|
+
# :stopdoc:
|
30
|
+
# TODO: Remove in Rake 11
|
31
|
+
RAKEVERSION = Rake::VERSION
|
32
|
+
# :startdoc:
|
33
|
+
|
34
|
+
require 'rbconfig'
|
35
|
+
require 'fileutils'
|
36
|
+
require 'singleton'
|
37
|
+
require 'monitor'
|
38
|
+
require 'optparse'
|
39
|
+
require 'ostruct'
|
40
|
+
|
41
|
+
require 'rake/ext/module'
|
42
|
+
require 'rake/ext/string'
|
43
|
+
require 'rake/ext/time'
|
44
|
+
|
45
|
+
require 'rake/win32'
|
46
|
+
|
47
|
+
require 'rake/linked_list'
|
48
|
+
require 'rake/cpu_counter'
|
49
|
+
require 'rake/scope'
|
50
|
+
require 'rake/task_argument_error'
|
51
|
+
require 'rake/rule_recursion_overflow_error'
|
52
|
+
require 'rake/rake_module'
|
53
|
+
require 'rake/trace_output'
|
54
|
+
require 'rake/pseudo_status'
|
55
|
+
require 'rake/task_arguments'
|
56
|
+
require 'rake/invocation_chain'
|
57
|
+
require 'rake/task'
|
58
|
+
require 'rake/file_task'
|
59
|
+
require 'rake/file_creation_task'
|
60
|
+
require 'rake/multi_task'
|
61
|
+
require 'rake/dsl_definition'
|
62
|
+
require 'rake/file_utils_ext'
|
63
|
+
require 'rake/file_list'
|
64
|
+
require 'rake/default_loader'
|
65
|
+
require 'rake/early_time'
|
66
|
+
require 'rake/name_space'
|
67
|
+
require 'rake/task_manager'
|
68
|
+
require 'rake/application'
|
69
|
+
require 'rake/backtrace'
|
70
|
+
|
71
|
+
$trace = false
|
72
|
+
|
73
|
+
# :stopdoc:
|
74
|
+
#
|
75
|
+
# Some top level Constants.
|
76
|
+
|
77
|
+
FileList = Rake::FileList
|
78
|
+
RakeFileUtils = Rake::FileUtilsExt
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Optional publish task for Rake
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'rake/contrib/sshpublisher'
|
5
|
+
require 'rake/contrib/rubyforgepublisher'
|
6
|
+
|
7
|
+
publisher = Rake::SshDirPublisher.new(
|
8
|
+
'linode',
|
9
|
+
'htdocs/software/rake',
|
10
|
+
'html')
|
11
|
+
|
12
|
+
desc "Publish the Documentation to RubyForge."
|
13
|
+
task :publish => [:rdoc] do
|
14
|
+
publisher.upload
|
15
|
+
end
|
16
|
+
|
17
|
+
rescue LoadError => ex
|
18
|
+
puts "#{ex.message} (#{ex.class})"
|
19
|
+
puts "No Publisher Task Available"
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module TestTimes
|
2
|
+
def self.run(test_results, limit=0)
|
3
|
+
limit = limit.nonzero? || 10
|
4
|
+
tests = []
|
5
|
+
test_results.split(/\n/).each do |line|
|
6
|
+
if line =~ /^(.+?#[^:]+): ([0-9.]+) s: \.$/
|
7
|
+
tests << [$1, $2.to_f, line]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
puts "#{limit} Slowest tests"
|
12
|
+
puts tests.sort_by { |item|
|
13
|
+
item[1]
|
14
|
+
}.reverse[0...limit].map { |item|
|
15
|
+
"%6.3f: %-s\n" % [item[1], item[0]]
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
namespace :test do
|
21
|
+
desc "Find the slowest unit tests"
|
22
|
+
task :times, [:limit] do |t, args|
|
23
|
+
TestTimes.run `rake test:units TESTOPTS='--verbose'`, args.limit.to_i
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module FileCreation
|
2
|
+
OLDFILE = "old"
|
3
|
+
NEWFILE = "new"
|
4
|
+
|
5
|
+
def create_timed_files(oldfile, *newfiles)
|
6
|
+
return if (File.exist?(oldfile) &&
|
7
|
+
newfiles.all? { |newfile|
|
8
|
+
File.exist?(newfile) && File.stat(newfile).mtime > File.stat(oldfile).mtime
|
9
|
+
})
|
10
|
+
now = Time.now
|
11
|
+
|
12
|
+
create_file(oldfile, now - 60)
|
13
|
+
|
14
|
+
newfiles.each do |newfile|
|
15
|
+
create_file(newfile, now)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_dir(dirname)
|
20
|
+
FileUtils.mkdir_p(dirname) unless File.exist?(dirname)
|
21
|
+
File.stat(dirname).mtime
|
22
|
+
end
|
23
|
+
|
24
|
+
def create_file(name, file_time=nil)
|
25
|
+
create_dir(File.dirname(name))
|
26
|
+
FileUtils.touch(name) unless File.exist?(name)
|
27
|
+
File.utime(file_time, file_time, name) unless file_time.nil?
|
28
|
+
File.stat(name).mtime
|
29
|
+
end
|
30
|
+
|
31
|
+
def delete_file(name)
|
32
|
+
File.delete(name) rescue nil
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
|
4
|
+
gem 'minitest', '~> 4'
|
5
|
+
|
6
|
+
require 'minitest/autorun'
|
7
|
+
require 'rake'
|
8
|
+
require 'tmpdir'
|
9
|
+
require File.expand_path('../file_creation', __FILE__)
|
10
|
+
|
11
|
+
|
12
|
+
begin
|
13
|
+
require_relative '../ruby/envutil'
|
14
|
+
require_relative 'support/ruby_runner'
|
15
|
+
require_relative 'support/rakefile_definitions'
|
16
|
+
rescue NoMethodError, LoadError
|
17
|
+
# ruby 1.8
|
18
|
+
require 'test/support/ruby_runner'
|
19
|
+
require 'test/support/rakefile_definitions'
|
20
|
+
end
|
21
|
+
|
22
|
+
class Rake::TestCase < MiniTest::Unit::TestCase
|
23
|
+
include FileCreation
|
24
|
+
|
25
|
+
include Rake::DSL
|
26
|
+
|
27
|
+
class TaskManager
|
28
|
+
include Rake::TaskManager
|
29
|
+
end
|
30
|
+
|
31
|
+
RUBY = defined?(EnvUtil) ? EnvUtil.rubybin : Gem.ruby
|
32
|
+
|
33
|
+
def setup
|
34
|
+
ARGV.clear
|
35
|
+
|
36
|
+
test_dir = File.basename File.dirname File.expand_path __FILE__
|
37
|
+
|
38
|
+
@rake_root =
|
39
|
+
if test_dir == 'test'
|
40
|
+
# rake repository
|
41
|
+
File.expand_path '../../', __FILE__
|
42
|
+
else
|
43
|
+
# ruby repository
|
44
|
+
File.expand_path '../../../', __FILE__
|
45
|
+
end
|
46
|
+
|
47
|
+
@verbose = ENV['VERBOSE']
|
48
|
+
|
49
|
+
@rake_exec = File.join @rake_root, 'bin', 'rake'
|
50
|
+
@rake_lib = File.join @rake_root, 'lib'
|
51
|
+
@ruby_options = ["-I#{@rake_lib}", "-I."]
|
52
|
+
|
53
|
+
@orig_pwd = Dir.pwd
|
54
|
+
@orig_appdata = ENV['APPDATA']
|
55
|
+
@orig_home = ENV['HOME']
|
56
|
+
@orig_homedrive = ENV['HOMEDRIVE']
|
57
|
+
@orig_homepath = ENV['HOMEPATH']
|
58
|
+
@orig_rake_columns = ENV['RAKE_COLUMNS']
|
59
|
+
@orig_rake_system = ENV['RAKE_SYSTEM']
|
60
|
+
@orig_rakeopt = ENV['RAKEOPT']
|
61
|
+
@orig_userprofile = ENV['USERPROFILE']
|
62
|
+
ENV.delete 'RAKE_COLUMNS'
|
63
|
+
ENV.delete 'RAKE_SYSTEM'
|
64
|
+
ENV.delete 'RAKEOPT'
|
65
|
+
|
66
|
+
tmpdir = Dir.chdir Dir.tmpdir do Dir.pwd end
|
67
|
+
@tempdir = File.join tmpdir, "test_rake_#{$$}"
|
68
|
+
|
69
|
+
FileUtils.mkdir_p @tempdir
|
70
|
+
|
71
|
+
Dir.chdir @tempdir
|
72
|
+
|
73
|
+
Rake.application = Rake::Application.new
|
74
|
+
Rake::TaskManager.record_task_metadata = true
|
75
|
+
RakeFileUtils.verbose_flag = false
|
76
|
+
end
|
77
|
+
|
78
|
+
def teardown
|
79
|
+
Dir.chdir @orig_pwd
|
80
|
+
FileUtils.rm_rf @tempdir
|
81
|
+
|
82
|
+
if @orig_appdata
|
83
|
+
ENV['APPDATA'] = @orig_appdata
|
84
|
+
else
|
85
|
+
ENV.delete 'APPDATA'
|
86
|
+
end
|
87
|
+
|
88
|
+
ENV['HOME'] = @orig_home
|
89
|
+
ENV['HOMEDRIVE'] = @orig_homedrive
|
90
|
+
ENV['HOMEPATH'] = @orig_homepath
|
91
|
+
ENV['RAKE_COLUMNS'] = @orig_rake_columns
|
92
|
+
ENV['RAKE_SYSTEM'] = @orig_rake_system
|
93
|
+
ENV['RAKEOPT'] = @orig_rakeopt
|
94
|
+
ENV['USERPROFILE'] = @orig_userprofile
|
95
|
+
end
|
96
|
+
|
97
|
+
def ignore_deprecations
|
98
|
+
Rake.application.options.ignore_deprecate = true
|
99
|
+
yield
|
100
|
+
ensure
|
101
|
+
Rake.application.options.ignore_deprecate = false
|
102
|
+
end
|
103
|
+
|
104
|
+
def rake_system_dir
|
105
|
+
@system_dir = 'system'
|
106
|
+
|
107
|
+
FileUtils.mkdir_p @system_dir
|
108
|
+
|
109
|
+
open File.join(@system_dir, 'sys1.rake'), 'w' do |io|
|
110
|
+
io << <<-SYS
|
111
|
+
task "sys1" do
|
112
|
+
puts "SYS1"
|
113
|
+
end
|
114
|
+
SYS
|
115
|
+
end
|
116
|
+
|
117
|
+
ENV['RAKE_SYSTEM'] = @system_dir
|
118
|
+
end
|
119
|
+
|
120
|
+
def rakefile(contents)
|
121
|
+
open 'Rakefile', 'w' do |io|
|
122
|
+
io << contents
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
include RakefileDefinitions
|
127
|
+
end
|