rake-clone 13.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/History.rdoc +2454 -0
  3. data/MIT-LICENSE +21 -0
  4. data/README.rdoc +155 -0
  5. data/doc/command_line_usage.rdoc +171 -0
  6. data/doc/example/Rakefile1 +38 -0
  7. data/doc/example/Rakefile2 +35 -0
  8. data/doc/example/a.c +6 -0
  9. data/doc/example/b.c +6 -0
  10. data/doc/example/main.c +11 -0
  11. data/doc/glossary.rdoc +42 -0
  12. data/doc/jamis.rb +592 -0
  13. data/doc/proto_rake.rdoc +127 -0
  14. data/doc/rake.1 +156 -0
  15. data/doc/rakefile.rdoc +635 -0
  16. data/doc/rational.rdoc +151 -0
  17. data/exe/rake +27 -0
  18. data/lib/rake/application.rb +847 -0
  19. data/lib/rake/backtrace.rb +25 -0
  20. data/lib/rake/clean.rb +78 -0
  21. data/lib/rake/cloneable.rb +17 -0
  22. data/lib/rake/cpu_counter.rb +122 -0
  23. data/lib/rake/default_loader.rb +15 -0
  24. data/lib/rake/dsl_definition.rb +196 -0
  25. data/lib/rake/early_time.rb +22 -0
  26. data/lib/rake/ext/core.rb +26 -0
  27. data/lib/rake/ext/string.rb +176 -0
  28. data/lib/rake/file_creation_task.rb +25 -0
  29. data/lib/rake/file_list.rb +435 -0
  30. data/lib/rake/file_task.rb +58 -0
  31. data/lib/rake/file_utils.rb +137 -0
  32. data/lib/rake/file_utils_ext.rb +135 -0
  33. data/lib/rake/invocation_chain.rb +57 -0
  34. data/lib/rake/invocation_exception_mixin.rb +17 -0
  35. data/lib/rake/late_time.rb +18 -0
  36. data/lib/rake/linked_list.rb +112 -0
  37. data/lib/rake/loaders/makefile.rb +54 -0
  38. data/lib/rake/multi_task.rb +14 -0
  39. data/lib/rake/name_space.rb +38 -0
  40. data/lib/rake/options.rb +31 -0
  41. data/lib/rake/packagetask.rb +222 -0
  42. data/lib/rake/phony.rb +16 -0
  43. data/lib/rake/private_reader.rb +21 -0
  44. data/lib/rake/promise.rb +100 -0
  45. data/lib/rake/pseudo_status.rb +30 -0
  46. data/lib/rake/rake_module.rb +67 -0
  47. data/lib/rake/rake_test_loader.rb +27 -0
  48. data/lib/rake/rule_recursion_overflow_error.rb +20 -0
  49. data/lib/rake/scope.rb +43 -0
  50. data/lib/rake/task.rb +434 -0
  51. data/lib/rake/task_argument_error.rb +8 -0
  52. data/lib/rake/task_arguments.rb +113 -0
  53. data/lib/rake/task_manager.rb +333 -0
  54. data/lib/rake/tasklib.rb +12 -0
  55. data/lib/rake/testtask.rb +192 -0
  56. data/lib/rake/thread_history_display.rb +49 -0
  57. data/lib/rake/thread_pool.rb +157 -0
  58. data/lib/rake/trace_output.rb +23 -0
  59. data/lib/rake/version.rb +10 -0
  60. data/lib/rake/win32.rb +17 -0
  61. data/lib/rake.rb +69 -0
  62. data/rake.gemspec +102 -0
  63. metadata +121 -0
@@ -0,0 +1,157 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "promise"
4
+ require "set"
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
+ $stderr.puts t.backtrace.join("\n")
61
+ end
62
+ raise e
63
+ end
64
+ end
65
+ end
66
+
67
+ # Enable the gathering of history events.
68
+ def gather_history #:nodoc:
69
+ @history_start_time = Time.now if @history_start_time.nil?
70
+ end
71
+
72
+ # Return a array of history events for the thread pool.
73
+ #
74
+ # History gathering must be enabled to be able to see the events
75
+ # (see #gather_history). Best to call this when the job is
76
+ # complete (i.e. after ThreadPool#join is called).
77
+ def history # :nodoc:
78
+ @history_mon.synchronize { @history.dup }.
79
+ sort_by { |i| i[:time] }.
80
+ each { |i| i[:time] -= @history_start_time }
81
+ end
82
+
83
+ # Return a hash of always collected statistics for the thread pool.
84
+ def statistics # :nodoc:
85
+ {
86
+ total_threads_in_play: @total_threads_in_play,
87
+ max_active_threads: @max_active_threads,
88
+ }
89
+ end
90
+
91
+ private
92
+
93
+ # processes one item on the queue. Returns true if there was an
94
+ # item to process, false if there was no item
95
+ def process_queue_item #:nodoc:
96
+ return false if @queue.empty?
97
+
98
+ # Even though we just asked if the queue was empty, it
99
+ # still could have had an item which by this statement
100
+ # is now gone. For this reason we pass true to Queue#deq
101
+ # because we will sleep indefinitely if it is empty.
102
+ promise = @queue.deq(true)
103
+ stat :dequeued, item_id: promise.object_id
104
+ promise.work
105
+ return true
106
+
107
+ rescue ThreadError # this means the queue is empty
108
+ false
109
+ end
110
+
111
+ def start_thread # :nodoc:
112
+ @threads_mon.synchronize do
113
+ next unless @threads.count < @max_active_threads
114
+
115
+ t = Thread.new do
116
+ begin
117
+ loop do
118
+ break unless process_queue_item
119
+ end
120
+ ensure
121
+ @threads_mon.synchronize do
122
+ @threads.delete Thread.current
123
+ stat :ended, thread_count: @threads.count
124
+ @join_cond.broadcast if @threads.empty?
125
+ end
126
+ end
127
+ end
128
+
129
+ @threads << t
130
+ stat(
131
+ :spawned,
132
+ new_thread: t.object_id,
133
+ thread_count: @threads.count)
134
+ @total_threads_in_play = @threads.count if
135
+ @threads.count > @total_threads_in_play
136
+ end
137
+ end
138
+
139
+ def stat(event, data=nil) # :nodoc:
140
+ return if @history_start_time.nil?
141
+ info = {
142
+ event: event,
143
+ data: data,
144
+ time: Time.now,
145
+ thread: Thread.current.object_id,
146
+ }
147
+ @history_mon.synchronize { @history << info }
148
+ end
149
+
150
+ # for testing only
151
+
152
+ def __queue__ # :nodoc:
153
+ @queue
154
+ end
155
+ end
156
+
157
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ module Rake
3
+ module TraceOutput # :nodoc: all
4
+
5
+ # Write trace output to output stream +out+.
6
+ #
7
+ # The write is done as a single IO call (to print) to lessen the
8
+ # chance that the trace output is interrupted by other tasks also
9
+ # producing output.
10
+ def trace_on(out, *strings)
11
+ sep = $\ || "\n"
12
+ if strings.empty?
13
+ output = sep
14
+ else
15
+ output = strings.map { |s|
16
+ next if s.nil?
17
+ s.end_with?(sep) ? s : s + sep
18
+ }.join
19
+ end
20
+ out.print(output)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ module Rake
3
+ VERSION = "13.4.2"
4
+
5
+ module Version # :nodoc: all
6
+ MAJOR, MINOR, BUILD, *OTHER = Rake::VERSION.split "."
7
+
8
+ NUMBERS = [MAJOR, MINOR, BUILD, *OTHER]
9
+ end
10
+ end
data/lib/rake/win32.rb ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+ require "rbconfig"
3
+
4
+ module Rake
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
+ class << self
10
+ # True if running on a windows system.
11
+ def windows?
12
+ RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw|[Ww]indows)!
13
+ end
14
+ end
15
+
16
+ end
17
+ end
data/lib/rake.rb ADDED
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+ #--
3
+ # Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to
7
+ # deal in the Software without restriction, including without limitation the
8
+ # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9
+ # sell copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21
+ # IN THE SOFTWARE.
22
+ #++
23
+
24
+ module Rake; end
25
+
26
+ require_relative "rake/version"
27
+
28
+ require "rbconfig"
29
+ require "fileutils"
30
+ require "singleton"
31
+ require "monitor"
32
+ require "optparse"
33
+
34
+ require_relative "rake/ext/string"
35
+
36
+ require_relative "rake/win32"
37
+
38
+ require_relative "rake/linked_list"
39
+ require_relative "rake/cpu_counter"
40
+ require_relative "rake/scope"
41
+ require_relative "rake/task_argument_error"
42
+ require_relative "rake/rule_recursion_overflow_error"
43
+ require_relative "rake/rake_module"
44
+ require_relative "rake/trace_output"
45
+ require_relative "rake/pseudo_status"
46
+ require_relative "rake/options"
47
+ require_relative "rake/task_arguments"
48
+ require_relative "rake/invocation_chain"
49
+ require_relative "rake/task"
50
+ require_relative "rake/file_task"
51
+ require_relative "rake/file_creation_task"
52
+ require_relative "rake/multi_task"
53
+ require_relative "rake/dsl_definition"
54
+ require_relative "rake/file_utils_ext"
55
+ require_relative "rake/file_list"
56
+ require_relative "rake/default_loader"
57
+ require_relative "rake/early_time"
58
+ require_relative "rake/late_time"
59
+ require_relative "rake/name_space"
60
+ require_relative "rake/task_manager"
61
+ require_relative "rake/application"
62
+ require_relative "rake/backtrace"
63
+
64
+ # :stopdoc:
65
+ #
66
+ # Some top level Constants.
67
+
68
+ FileList = Rake::FileList
69
+ RakeFileUtils = Rake::FileUtilsExt
data/rake.gemspec ADDED
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/rake/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'rake-clone'
7
+ s.version = Rake::VERSION
8
+ s.authors = ["Hiroshi SHIBATA", "Eric Hodel", "Jim Weirich"]
9
+ s.email = ["hsbt@ruby-lang.org", "drbrain@segment7.net", ""]
10
+
11
+ s.summary = "Rake is a Make-like program implemented in Ruby"
12
+ s.description = <<~DESCRIPTION
13
+ Rake is a Make-like program implemented in Ruby. Tasks and dependencies are
14
+ specified in standard Ruby syntax.
15
+ Rake has the following features:
16
+ * Rakefiles (rake's version of Makefiles) are completely defined in standard Ruby syntax.
17
+ No XML files to edit. No quirky Makefile syntax to worry about (is that a tab or a space?)
18
+ * Users can specify tasks with prerequisites.
19
+ * Rake supports rule patterns to synthesize implicit tasks.
20
+ * Flexible FileLists that act like arrays but know about manipulating file names and paths.
21
+ * Supports parallel execution of tasks.
22
+ DESCRIPTION
23
+ s.homepage = "https://github.com/ruby/rake"
24
+ s.licenses = ["MIT"]
25
+
26
+ s.metadata = {
27
+ "bug_tracker_uri" => "https://github.com/ruby/rake/issues",
28
+ "changelog_uri" => "https://github.com/ruby/rake/releases",
29
+ "documentation_uri" => "https://ruby.github.io/rake",
30
+ "source_code_uri" => s.homepage
31
+ }
32
+
33
+ s.files = [
34
+ "History.rdoc",
35
+ "MIT-LICENSE",
36
+ "README.rdoc",
37
+ "doc/command_line_usage.rdoc",
38
+ "doc/example/Rakefile1",
39
+ "doc/example/Rakefile2",
40
+ "doc/example/a.c",
41
+ "doc/example/b.c",
42
+ "doc/example/main.c",
43
+ "doc/glossary.rdoc",
44
+ "doc/jamis.rb",
45
+ "doc/proto_rake.rdoc",
46
+ "doc/rake.1",
47
+ "doc/rakefile.rdoc",
48
+ "doc/rational.rdoc",
49
+ "exe/rake",
50
+ "lib/rake.rb",
51
+ "lib/rake/application.rb",
52
+ "lib/rake/backtrace.rb",
53
+ "lib/rake/clean.rb",
54
+ "lib/rake/cloneable.rb",
55
+ "lib/rake/cpu_counter.rb",
56
+ "lib/rake/default_loader.rb",
57
+ "lib/rake/dsl_definition.rb",
58
+ "lib/rake/early_time.rb",
59
+ "lib/rake/ext/core.rb",
60
+ "lib/rake/ext/string.rb",
61
+ "lib/rake/file_creation_task.rb",
62
+ "lib/rake/file_list.rb",
63
+ "lib/rake/file_task.rb",
64
+ "lib/rake/file_utils.rb",
65
+ "lib/rake/file_utils_ext.rb",
66
+ "lib/rake/invocation_chain.rb",
67
+ "lib/rake/invocation_exception_mixin.rb",
68
+ "lib/rake/late_time.rb",
69
+ "lib/rake/linked_list.rb",
70
+ "lib/rake/loaders/makefile.rb",
71
+ "lib/rake/multi_task.rb",
72
+ "lib/rake/name_space.rb",
73
+ "lib/rake/options.rb",
74
+ "lib/rake/packagetask.rb",
75
+ "lib/rake/phony.rb",
76
+ "lib/rake/private_reader.rb",
77
+ "lib/rake/promise.rb",
78
+ "lib/rake/pseudo_status.rb",
79
+ "lib/rake/rake_module.rb",
80
+ "lib/rake/rake_test_loader.rb",
81
+ "lib/rake/rule_recursion_overflow_error.rb",
82
+ "lib/rake/scope.rb",
83
+ "lib/rake/task.rb",
84
+ "lib/rake/task_argument_error.rb",
85
+ "lib/rake/task_arguments.rb",
86
+ "lib/rake/task_manager.rb",
87
+ "lib/rake/tasklib.rb",
88
+ "lib/rake/testtask.rb",
89
+ "lib/rake/thread_history_display.rb",
90
+ "lib/rake/thread_pool.rb",
91
+ "lib/rake/trace_output.rb",
92
+ "lib/rake/version.rb",
93
+ "lib/rake/win32.rb",
94
+ "rake.gemspec"
95
+ ]
96
+ s.bindir = "exe"
97
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
98
+ s.require_paths = ["lib"]
99
+
100
+ s.required_ruby_version = Gem::Requirement.new(">= 2.3")
101
+ s.rdoc_options = ["--main", "README.rdoc"]
102
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake-clone
3
+ version: !ruby/object:Gem::Version
4
+ version: 13.4.2
5
+ platform: ruby
6
+ authors:
7
+ - Hiroshi SHIBATA
8
+ - Eric Hodel
9
+ - Jim Weirich
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 1980-01-02 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: |
15
+ Rake is a Make-like program implemented in Ruby. Tasks and dependencies are
16
+ specified in standard Ruby syntax.
17
+ Rake has the following features:
18
+ * Rakefiles (rake's version of Makefiles) are completely defined in standard Ruby syntax.
19
+ No XML files to edit. No quirky Makefile syntax to worry about (is that a tab or a space?)
20
+ * Users can specify tasks with prerequisites.
21
+ * Rake supports rule patterns to synthesize implicit tasks.
22
+ * Flexible FileLists that act like arrays but know about manipulating file names and paths.
23
+ * Supports parallel execution of tasks.
24
+ email:
25
+ - hsbt@ruby-lang.org
26
+ - drbrain@segment7.net
27
+ - ''
28
+ executables:
29
+ - rake
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - History.rdoc
34
+ - MIT-LICENSE
35
+ - README.rdoc
36
+ - doc/command_line_usage.rdoc
37
+ - doc/example/Rakefile1
38
+ - doc/example/Rakefile2
39
+ - doc/example/a.c
40
+ - doc/example/b.c
41
+ - doc/example/main.c
42
+ - doc/glossary.rdoc
43
+ - doc/jamis.rb
44
+ - doc/proto_rake.rdoc
45
+ - doc/rake.1
46
+ - doc/rakefile.rdoc
47
+ - doc/rational.rdoc
48
+ - exe/rake
49
+ - lib/rake.rb
50
+ - lib/rake/application.rb
51
+ - lib/rake/backtrace.rb
52
+ - lib/rake/clean.rb
53
+ - lib/rake/cloneable.rb
54
+ - lib/rake/cpu_counter.rb
55
+ - lib/rake/default_loader.rb
56
+ - lib/rake/dsl_definition.rb
57
+ - lib/rake/early_time.rb
58
+ - lib/rake/ext/core.rb
59
+ - lib/rake/ext/string.rb
60
+ - lib/rake/file_creation_task.rb
61
+ - lib/rake/file_list.rb
62
+ - lib/rake/file_task.rb
63
+ - lib/rake/file_utils.rb
64
+ - lib/rake/file_utils_ext.rb
65
+ - lib/rake/invocation_chain.rb
66
+ - lib/rake/invocation_exception_mixin.rb
67
+ - lib/rake/late_time.rb
68
+ - lib/rake/linked_list.rb
69
+ - lib/rake/loaders/makefile.rb
70
+ - lib/rake/multi_task.rb
71
+ - lib/rake/name_space.rb
72
+ - lib/rake/options.rb
73
+ - lib/rake/packagetask.rb
74
+ - lib/rake/phony.rb
75
+ - lib/rake/private_reader.rb
76
+ - lib/rake/promise.rb
77
+ - lib/rake/pseudo_status.rb
78
+ - lib/rake/rake_module.rb
79
+ - lib/rake/rake_test_loader.rb
80
+ - lib/rake/rule_recursion_overflow_error.rb
81
+ - lib/rake/scope.rb
82
+ - lib/rake/task.rb
83
+ - lib/rake/task_argument_error.rb
84
+ - lib/rake/task_arguments.rb
85
+ - lib/rake/task_manager.rb
86
+ - lib/rake/tasklib.rb
87
+ - lib/rake/testtask.rb
88
+ - lib/rake/thread_history_display.rb
89
+ - lib/rake/thread_pool.rb
90
+ - lib/rake/trace_output.rb
91
+ - lib/rake/version.rb
92
+ - lib/rake/win32.rb
93
+ - rake.gemspec
94
+ homepage: https://github.com/ruby/rake
95
+ licenses:
96
+ - MIT
97
+ metadata:
98
+ bug_tracker_uri: https://github.com/ruby/rake/issues
99
+ changelog_uri: https://github.com/ruby/rake/releases
100
+ documentation_uri: https://ruby.github.io/rake
101
+ source_code_uri: https://github.com/ruby/rake
102
+ rdoc_options:
103
+ - "--main"
104
+ - README.rdoc
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '2.3'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubygems_version: 4.0.15
119
+ specification_version: 4
120
+ summary: Rake is a Make-like program implemented in Ruby
121
+ test_files: []