podoy 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +35 -0
- data/Rakefile +4 -0
- data/lib/podoy/version.rb +5 -0
- data/lib/podoy.rb +8 -0
- data/sig/podoy.rbs +4 -0
- data/vendor/bundle/ruby/3.3.0+0/bin/rake +29 -0
- data/vendor/bundle/ruby/3.3.0+0/cache/rake-13.1.0.gem +0 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/History.rdoc +2403 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/README.rdoc +155 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/command_line_usage.rdoc +158 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/example/Rakefile1 +38 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/example/Rakefile2 +35 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/example/a.c +6 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/example/b.c +6 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/example/main.c +11 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/glossary.rdoc +42 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/jamis.rb +592 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/proto_rake.rdoc +127 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/rake.1 +156 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/rakefile.rdoc +622 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/doc/rational.rdoc +151 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/exe/rake +27 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/application.rb +855 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/backtrace.rb +24 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/clean.rb +78 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/cloneable.rb +17 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/cpu_counter.rb +107 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/default_loader.rb +15 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/dsl_definition.rb +195 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/early_time.rb +22 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/ext/core.rb +26 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/ext/string.rb +176 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/file_creation_task.rb +25 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/file_list.rb +435 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/file_task.rb +58 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/file_utils.rb +132 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/file_utils_ext.rb +134 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/invocation_chain.rb +57 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/invocation_exception_mixin.rb +17 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/late_time.rb +18 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/linked_list.rb +112 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/loaders/makefile.rb +54 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/multi_task.rb +14 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/name_space.rb +38 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/packagetask.rb +222 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/phony.rb +16 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/private_reader.rb +21 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/promise.rb +100 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/pseudo_status.rb +30 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/rake_module.rb +67 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/rake_test_loader.rb +27 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/scope.rb +43 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/task.rb +434 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/task_argument_error.rb +8 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/task_arguments.rb +109 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/task_manager.rb +331 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/tasklib.rb +12 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/testtask.rb +189 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/thread_history_display.rb +49 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/thread_pool.rb +163 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/trace_output.rb +23 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/version.rb +10 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake/win32.rb +51 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/lib/rake.rb +71 -0
- data/vendor/bundle/ruby/3.3.0+0/gems/rake-13.1.0/rake.gemspec +101 -0
- data/vendor/bundle/ruby/3.3.0+0/specifications/rake-13.1.0.gemspec +26 -0
- metadata +117 -0
@@ -0,0 +1,151 @@
|
|
1
|
+
= Why rake?
|
2
|
+
|
3
|
+
Ok, let me state from the beginning that I never intended to write this
|
4
|
+
code. I'm not convinced it is useful, and I'm not convinced anyone
|
5
|
+
would even be interested in it. All I can say is that Why's onion truck
|
6
|
+
must by been passing through the Ohio valley.
|
7
|
+
|
8
|
+
What am I talking about? ... A Ruby version of Make.
|
9
|
+
|
10
|
+
See, I can sense you cringing already, and I agree. The world certainly
|
11
|
+
doesn't need yet another reworking of the "make" program. I mean, we
|
12
|
+
already have "ant". Isn't that enough?
|
13
|
+
|
14
|
+
It started yesterday. I was helping a coworker fix a problem in one of
|
15
|
+
the Makefiles we use in our project. Not a particularly tough problem,
|
16
|
+
but during the course of the conversation I began lamenting some of the
|
17
|
+
shortcomings of make. In particular, in one of my makefiles I wanted to
|
18
|
+
determine the name of a file dynamically and had to resort to some
|
19
|
+
simple scripting (in Ruby) to make it work. "Wouldn't it be nice if you
|
20
|
+
could just use Ruby inside a Makefile" I said.
|
21
|
+
|
22
|
+
My coworker (a recent convert to Ruby) agreed, but wondered what it
|
23
|
+
would look like. So I sketched the following on the whiteboard...
|
24
|
+
|
25
|
+
"What if you could specify the make tasks in Ruby, like this ..."
|
26
|
+
|
27
|
+
task "build" do
|
28
|
+
java_compile(...args, etc ...)
|
29
|
+
end
|
30
|
+
|
31
|
+
"The task function would register "build" as a target to be made,
|
32
|
+
and the block would be the action executed whenever the build
|
33
|
+
system determined that it was time to do the build target."
|
34
|
+
|
35
|
+
We agreed that would be cool, but writing make from scratch would be WAY
|
36
|
+
too much work. And that was the end of that!
|
37
|
+
|
38
|
+
... Except I couldn't get the thought out of my head. What exactly
|
39
|
+
would be needed to make the about syntax work as a make file? Hmmm, you
|
40
|
+
would need to register the tasks, you need some way of specifying
|
41
|
+
dependencies between tasks, and some way of kicking off the process.
|
42
|
+
Hey! What if we did ... and fifteen minutes later I had a working
|
43
|
+
prototype of Ruby make, complete with dependencies and actions.
|
44
|
+
|
45
|
+
I showed the code to my coworker and we had a good laugh. It was just
|
46
|
+
about a page worth of code that reproduced an amazing amount of the
|
47
|
+
functionality of make. We were both truly stunned with the power of
|
48
|
+
Ruby.
|
49
|
+
|
50
|
+
But it didn't do everything make did. In particular, it didn't have
|
51
|
+
timestamp based file dependencies (where a file is rebuilt if any of its
|
52
|
+
prerequisite files have a later timestamp). Obviously THAT would be a
|
53
|
+
pain to add and so Ruby Make would remain an interesting experiment.
|
54
|
+
|
55
|
+
... Except as I walked back to my desk, I started thinking about what
|
56
|
+
file based dependencies would really need. Rats! I was hooked again,
|
57
|
+
and by adding a new class and two new methods, file/timestamp
|
58
|
+
dependencies were implemented.
|
59
|
+
|
60
|
+
Ok, now I was really hooked. Last night (during CSI!) I massaged the
|
61
|
+
code and cleaned it up a bit. The result is a bare-bones replacement
|
62
|
+
for make in exactly 100 lines of code.
|
63
|
+
|
64
|
+
For the curious, you can see it at ...
|
65
|
+
* doc/proto_rake.rdoc
|
66
|
+
|
67
|
+
Oh, about the name. When I wrote the example Ruby Make task on my
|
68
|
+
whiteboard, my coworker exclaimed "Oh! I have the perfect name: Rake ...
|
69
|
+
Get it? Ruby-Make. Rake!" He said he envisioned the tasks as leaves
|
70
|
+
and Rake would clean them up ... or something like that. Anyways, the
|
71
|
+
name stuck.
|
72
|
+
|
73
|
+
Some quick examples ...
|
74
|
+
|
75
|
+
A simple task to delete backup files ...
|
76
|
+
|
77
|
+
task :clean do
|
78
|
+
Dir['*~'].each {|fn| rm fn rescue nil}
|
79
|
+
end
|
80
|
+
|
81
|
+
Note that task names are symbols (they are slightly easier to type
|
82
|
+
than quoted strings ... but you may use quoted string if you would
|
83
|
+
rather). Rake makes the methods of the FileUtils module directly
|
84
|
+
available, so we take advantage of the <tt>rm</tt> command. Also note
|
85
|
+
the use of "rescue nil" to trap and ignore errors in the <tt>rm</tt>
|
86
|
+
command.
|
87
|
+
|
88
|
+
To run it, just type "rake clean". Rake will automatically find a
|
89
|
+
Rakefile in the current directory (or above!) and will invoke the
|
90
|
+
targets named on the command line. If there are no targets explicitly
|
91
|
+
named, rake will invoke the task "default".
|
92
|
+
|
93
|
+
Here's another task with dependencies ...
|
94
|
+
|
95
|
+
task :clobber => [:clean] do
|
96
|
+
rm_r "tempdir"
|
97
|
+
end
|
98
|
+
|
99
|
+
Task :clobber depends upon task :clean, so :clean will be run before
|
100
|
+
:clobber is executed.
|
101
|
+
|
102
|
+
Files are specified by using the "file" command. It is similar to the
|
103
|
+
task command, except that the task name represents a file, and the task
|
104
|
+
will be run only if the file doesn't exist, or if its modification time
|
105
|
+
is earlier than any of its prerequisites.
|
106
|
+
|
107
|
+
Here is a file based dependency that will compile "hello.cc" to
|
108
|
+
"hello.o".
|
109
|
+
|
110
|
+
file "hello.cc"
|
111
|
+
file "hello.o" => ["hello.cc"] do |t|
|
112
|
+
srcfile = t.name.sub(/\.o$/, ".cc")
|
113
|
+
sh %{g++ #{srcfile} -c -o #{t.name}}
|
114
|
+
end
|
115
|
+
|
116
|
+
I normally specify file tasks with string (rather than symbols). Some
|
117
|
+
file names can't be represented by symbols. Plus it makes the
|
118
|
+
distinction between them more clear to the casual reader.
|
119
|
+
|
120
|
+
Currently writing a task for each and every file in the project would be
|
121
|
+
tedious at best. I envision a set of libraries to make this job
|
122
|
+
easier. For instance, perhaps something like this ...
|
123
|
+
|
124
|
+
require 'rake/ctools'
|
125
|
+
Dir['*.c'].each do |fn|
|
126
|
+
c_source_file(fn)
|
127
|
+
end
|
128
|
+
|
129
|
+
where "c_source_file" will create all the tasks need to compile all the
|
130
|
+
C source files in a directory. Any number of useful libraries could be
|
131
|
+
created for rake.
|
132
|
+
|
133
|
+
That's it. There's no documentation (other than whats in this
|
134
|
+
message). Does this sound interesting to anyone? If so, I'll continue
|
135
|
+
to clean it up and write it up and publish it on RAA. Otherwise, I'll
|
136
|
+
leave it as an interesting exercise and a tribute to the power of Ruby.
|
137
|
+
|
138
|
+
Why /might/ rake be interesting to Ruby programmers. I don't know,
|
139
|
+
perhaps ...
|
140
|
+
|
141
|
+
* No weird make syntax (only weird Ruby syntax :-)
|
142
|
+
* No need to edit or read XML (a la ant)
|
143
|
+
* Platform independent build scripts.
|
144
|
+
* Will run anywhere Ruby exists, so no need to have "make" installed.
|
145
|
+
If you stay away from the "sys" command and use things like
|
146
|
+
'ftools', you can have a perfectly platform independent
|
147
|
+
build script. Also rake is only 100 lines of code, so it can
|
148
|
+
easily be packaged along with the rest of your code.
|
149
|
+
|
150
|
+
So ... Sorry for the long rambling message. Like I said, I never
|
151
|
+
intended to write this code at all.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#--
|
4
|
+
# Copyright (c) 2003, 2004, 2005, 2006, 2007 Jim Weirich
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the "Software"), to
|
8
|
+
# deal in the Software without restriction, including without limitation the
|
9
|
+
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
10
|
+
# sell copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in
|
14
|
+
# all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
22
|
+
# IN THE SOFTWARE.
|
23
|
+
#++
|
24
|
+
|
25
|
+
require "rake"
|
26
|
+
|
27
|
+
Rake.application.run
|