rumake 0.1.2 → 0.1.3
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.
- data/Readme.mdown +5 -4
- data/bin/rumake +38 -25
- data/lib/rumake.rb +111 -0
- metadata +6 -5
data/Readme.mdown
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
## About
|
2
2
|
|
3
|
-
Rumake is a tiny build
|
4
|
-
|
5
|
-
|
3
|
+
Rumake is a tiny build utility similar to Make and Rake. Simply run `rumake` in
|
4
|
+
a directory that contains a Rumake file (`rumakefile.rb`) and optionally specify
|
5
|
+
a target (defualt is `all`) to run.
|
6
6
|
|
7
7
|
## Example
|
8
8
|
|
@@ -23,7 +23,8 @@ that compiles a simple C program:
|
|
23
23
|
sh "rm #{BIN}"
|
24
24
|
end
|
25
25
|
|
26
|
-
The script works just like a regular Ruby script
|
26
|
+
The script works just like a regular Ruby script, except it's run using
|
27
|
+
`rumake`.
|
27
28
|
|
28
29
|
## License
|
29
30
|
|
data/bin/rumake
CHANGED
@@ -21,12 +21,40 @@
|
|
21
21
|
# THE SOFTWARE.
|
22
22
|
|
23
23
|
# Rumake version constant
|
24
|
-
RUMAKE_VERSION = 'v0.1.
|
24
|
+
RUMAKE_VERSION = 'v0.1.3'
|
25
|
+
|
26
|
+
# Used to determine whether Rumake should be used as an executable or library
|
27
|
+
RUMAKE_LIBRARY = false
|
25
28
|
|
26
29
|
# All the targets, which are Procs, are added to this global hash. Each key is
|
27
30
|
# a symbol of a target's name.
|
28
31
|
$targets = {}
|
29
32
|
|
33
|
+
# A basic startup method
|
34
|
+
def load
|
35
|
+
# Load any file called "rumakefile.rb"
|
36
|
+
begin
|
37
|
+
file = File::read('rumakefile.rb')
|
38
|
+
rescue
|
39
|
+
fail('Unable to open "rumakefile.rb"')
|
40
|
+
end
|
41
|
+
|
42
|
+
file
|
43
|
+
end
|
44
|
+
|
45
|
+
# Run a target
|
46
|
+
def run(tar = :all)
|
47
|
+
if $targets[tar].nil?
|
48
|
+
puts "Target \"#{tar}\" does not exist."
|
49
|
+
exit 1
|
50
|
+
else
|
51
|
+
$targets[tar].call
|
52
|
+
|
53
|
+
# The target should have executed successfully by now
|
54
|
+
puts 'Target executed successfully.'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
30
58
|
# A simple target generator
|
31
59
|
def target(tar, &block)
|
32
60
|
$targets[tar] = block
|
@@ -57,8 +85,6 @@ def getwd
|
|
57
85
|
Dir.getwd
|
58
86
|
end
|
59
87
|
|
60
|
-
# The following code is what actually loads and runs the Rumake file:
|
61
|
-
|
62
88
|
# Check the first argument
|
63
89
|
case ARGV[0]
|
64
90
|
when 'help'
|
@@ -70,29 +96,16 @@ when 'help'
|
|
70
96
|
when 'version'
|
71
97
|
puts "Rumake #{RUMAKE_VERSION}"
|
72
98
|
exit
|
73
|
-
when nil
|
74
|
-
tar = :all
|
75
99
|
else
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
file = File::read('rumakefile.rb')
|
82
|
-
rescue
|
83
|
-
fail('Unable to open "rumakefile.rb"')
|
100
|
+
if ARGV[0]
|
101
|
+
tar = ARGV[0].to_sym
|
102
|
+
else
|
103
|
+
tar = :all
|
104
|
+
end
|
84
105
|
end
|
85
106
|
|
86
|
-
#
|
87
|
-
eval(
|
107
|
+
# Load and run the Rumake file
|
108
|
+
eval(load()) unless RUMAKE_LIBRARY
|
88
109
|
|
89
|
-
# Now, run
|
90
|
-
|
91
|
-
puts "Target \"#{target}\" does not exist."
|
92
|
-
exit 1
|
93
|
-
else
|
94
|
-
$targets[tar].call
|
95
|
-
|
96
|
-
# The target should have executed successfully by now
|
97
|
-
puts 'Target executed successfully.'
|
98
|
-
end
|
110
|
+
# Now, run the target
|
111
|
+
run(tar) unless RUMAKE_LIBRARY
|
data/lib/rumake.rb
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright (c) 2010 Austin Gatchell
|
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 deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# 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 FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
# Rumake version constant
|
24
|
+
RUMAKE_VERSION = 'v0.1.3'
|
25
|
+
|
26
|
+
# Used to determine whether Rumake should be used as an executable or library
|
27
|
+
RUMAKE_LIBRARY = true
|
28
|
+
|
29
|
+
# All the targets, which are Procs, are added to this global hash. Each key is
|
30
|
+
# a symbol of a target's name.
|
31
|
+
$targets = {}
|
32
|
+
|
33
|
+
# A basic startup method
|
34
|
+
def load
|
35
|
+
# Load any file called "rumakefile.rb"
|
36
|
+
begin
|
37
|
+
file = File::read('rumakefile.rb')
|
38
|
+
rescue
|
39
|
+
fail('Unable to open "rumakefile.rb"')
|
40
|
+
end
|
41
|
+
|
42
|
+
file
|
43
|
+
end
|
44
|
+
|
45
|
+
# Run a target
|
46
|
+
def run(tar = :all)
|
47
|
+
if $targets[tar].nil?
|
48
|
+
puts "Target \"#{tar}\" does not exist."
|
49
|
+
exit 1
|
50
|
+
else
|
51
|
+
$targets[tar].call
|
52
|
+
|
53
|
+
# The target should have executed successfully by now
|
54
|
+
puts 'Target executed successfully.'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# A simple target generator
|
59
|
+
def target(tar, &block)
|
60
|
+
$targets[tar] = block
|
61
|
+
end
|
62
|
+
|
63
|
+
# Display an error message and stop execution of the script. This should be used
|
64
|
+
# as the standard way to show error messages and end execution of the target.
|
65
|
+
def fail(error = nil)
|
66
|
+
puts "Error: #{error}" unless error.nil?
|
67
|
+
puts 'Target failed to execute properly.'
|
68
|
+
exit 1
|
69
|
+
end
|
70
|
+
|
71
|
+
# Run a shell command
|
72
|
+
def sh(command)
|
73
|
+
if system(command) == false
|
74
|
+
fail("Shell command \"#{command}\" exited with error.")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Change the current working directory
|
79
|
+
def cd(dir)
|
80
|
+
Dir.chdir(dir)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Get the current working directory
|
84
|
+
def getwd
|
85
|
+
Dir.getwd
|
86
|
+
end
|
87
|
+
|
88
|
+
# Check the first argument
|
89
|
+
case ARGV[0]
|
90
|
+
when 'help'
|
91
|
+
puts 'Usage: rumake [target]'
|
92
|
+
puts "\nCommands:"
|
93
|
+
puts " help Print this help information."
|
94
|
+
puts " version Print the version information."
|
95
|
+
exit
|
96
|
+
when 'version'
|
97
|
+
puts "Rumake #{RUMAKE_VERSION}"
|
98
|
+
exit
|
99
|
+
else
|
100
|
+
if ARGV[0]
|
101
|
+
tar = ARGV[0].to_sym
|
102
|
+
else
|
103
|
+
tar = :all
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Load and run the Rumake file
|
108
|
+
eval(load()) unless RUMAKE_LIBRARY
|
109
|
+
|
110
|
+
# Now, run the target
|
111
|
+
run(tar) unless RUMAKE_LIBRARY
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rumake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Austin Gatchell
|
@@ -20,8 +20,8 @@ default_executable:
|
|
20
20
|
dependencies: []
|
21
21
|
|
22
22
|
description: |-
|
23
|
-
Rumake is a tiny Make/Rake-like build utility. Rumake
|
24
|
-
files are just regular Ruby scripts named "rumakefile.rb" that can be run by
|
23
|
+
Rumake is a tiny Make/Rake-like build utility. Rumake
|
24
|
+
files are just regular Ruby scripts named "rumakefile.rb" that can be run by
|
25
25
|
using "rumake" in the directory containing that file.
|
26
26
|
email: austin@ausgat.com
|
27
27
|
executables:
|
@@ -31,6 +31,7 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
|
33
33
|
files:
|
34
|
+
- lib/rumake.rb
|
34
35
|
- Readme.mdown
|
35
36
|
- bin/rumake
|
36
37
|
has_rdoc: true
|