ritual 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/LICENSE +1 -1
- data/README.markdown +90 -28
- data/Rakefile +0 -2
- data/lib/ritual/extension/base.rb +56 -0
- data/lib/ritual/extension/base.rbc +1355 -0
- data/lib/ritual/extension/jruby.rb +31 -0
- data/lib/ritual/extension/standard.rb +29 -0
- data/lib/ritual/extension/standard.rbc +891 -0
- data/lib/ritual/extension.rb +11 -0
- data/lib/ritual/extension.rbc +297 -0
- data/lib/ritual/lib.rb +3 -0
- data/lib/ritual/lib.rbc +213 -0
- data/lib/ritual/version.rb +1 -1
- data/lib/ritual.rb +17 -0
- data/lib/ritual.rbc +3719 -0
- metadata +35 -20
data/CHANGELOG
CHANGED
data/LICENSE
CHANGED
data/README.markdown
CHANGED
@@ -1,48 +1,110 @@
|
|
1
1
|
# Ritual
|
2
2
|
|
3
|
-
|
3
|
+
Sweet, simple Rakefiles for your gem.
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
Picks up where Bundler leaves off, reducing the entire release ritual
|
6
|
+
to a single command.
|
7
7
|
|
8
|
-
|
8
|
+
## Example
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
For a plain ruby gem (no extensions), this is usually enough for your
|
11
|
+
`Rakefile`:
|
12
12
|
|
13
|
-
|
13
|
+
require 'ritual'
|
14
14
|
|
15
|
-
|
15
|
+
To release a new patch version of your gem:
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
rake patch release
|
18
|
+
|
19
|
+
The `release` task just runs these tasks:
|
20
|
+
|
21
|
+
rake repo:bump # Bump and commit the version file and changelog.
|
22
|
+
rake repo:tag # Tag the release with the current version.
|
23
|
+
rake repo:push # Push updates upstream.
|
24
|
+
rake gem:build # Build the gem.
|
25
|
+
rake gem:push # Push the gem to the gem server.
|
19
26
|
|
20
|
-
|
27
|
+
Select which component to bump with one of these:
|
21
28
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
cannot be loaded.
|
26
|
-
* `rdoc_task(*args, &block)`: Define an rdoc task.
|
29
|
+
rake patch # Select a patch version bump.
|
30
|
+
rake minor # Select a minor version bump.
|
31
|
+
rake major # Select a major version bump.
|
27
32
|
|
28
|
-
|
33
|
+
For example:
|
29
34
|
|
30
|
-
* `rake
|
31
|
-
* `rake minor release`
|
32
|
-
* `rake
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
* Push the git repo to origin.
|
38
|
-
* Build the gem from the gemspec.
|
39
|
-
* Push the gem to Gemcutter.
|
35
|
+
* `rake patch release` will bump 1.2.3 to 1.2.4 and release.
|
36
|
+
* `rake minor release` will bump 1.2.3 to 1.3.0 and release.
|
37
|
+
* `rake major release` will bump 1.2.3 to 2.0.0 and release.
|
38
|
+
|
39
|
+
"Release early, release often" has never been so easy!
|
40
|
+
|
41
|
+
## Gemspec
|
40
42
|
|
41
43
|
You [maintain the gemspec directly][using-gemspecs-as-intended], rather than via
|
42
44
|
a wrapper like Jeweler or Hoe.
|
43
45
|
|
44
46
|
[using-gemspecs-as-intended]: http://yehudakatz.com/2010/04/02/using-gemspecs-as-intended
|
45
47
|
|
48
|
+
## Extensions
|
49
|
+
|
50
|
+
Use `extension` to define an extension-building task. Use one of two
|
51
|
+
conventions.
|
52
|
+
|
53
|
+
### Unnamed extensions
|
54
|
+
|
55
|
+
If you only need a single extension, say if you're simply wrapping a C
|
56
|
+
library, then use an unnamed extension. In your Rakefile, do:
|
57
|
+
|
58
|
+
extension
|
59
|
+
|
60
|
+
This defines a task `ext` to build your extension. Source files live
|
61
|
+
in `ext/`, and the extension is named after the gem.
|
62
|
+
|
63
|
+
So if the gem is `my_gem`, then Ritual configures your extension with
|
64
|
+
`ext/extconf.rb`, runs `make`, and installs `ext/my_gem.DLEXT` to
|
65
|
+
`lib/my_gem/my_gem.DLEXT`. (`DLEXT` is the shared library extension,
|
66
|
+
which varies from system to system.) `extconf.rb` should contain:
|
67
|
+
|
68
|
+
create_makefile "my_gem"
|
69
|
+
|
70
|
+
And the extension entry point is `Init_my_gem`.
|
71
|
+
|
72
|
+
### Named extensions
|
73
|
+
|
74
|
+
If you need more than one extension, you better name them. Do:
|
75
|
+
|
76
|
+
extension :my_ext
|
77
|
+
|
78
|
+
The task is named `ext:my_ext`. Source files live in
|
79
|
+
`ext/my_ext/`. Ritual configures the extension with
|
80
|
+
`ext/my_ext/extconf.rb`, and installs `ext/my_ext/my_gem.DLEXT` to
|
81
|
+
`lib/my_gem/my_ext.DLEXT`. `extconf.rb`, should contain:
|
82
|
+
|
83
|
+
create_makefile "my_gem/my_ext"
|
84
|
+
|
85
|
+
And the extension entry point is `Init_my_ext`.
|
86
|
+
|
87
|
+
### Customizing
|
88
|
+
|
89
|
+
Both `extension` calls above can take options:
|
90
|
+
|
91
|
+
* `:build_as` - The path of the shared library that gets built.
|
92
|
+
* `:install_as` - The path the shared library is installed to.
|
93
|
+
|
94
|
+
Both are relative to the Rakefile's directory, and should omit the
|
95
|
+
shared library extension.
|
96
|
+
|
97
|
+
### JRuby extensions
|
98
|
+
|
99
|
+
JRuby doesn't support extensions in the traditional sense (using
|
100
|
+
`mkmf`). Instead, you typically build a `.jar` which is packaged into
|
101
|
+
the gem.
|
102
|
+
|
103
|
+
To build a JRuby extension, pass `:type => :jruby` to
|
104
|
+
`extension`. JRuby extensions can be named or unnamed, as above. All
|
105
|
+
`.java` files are fed to `javac` simultanously to build the `.jar`,
|
106
|
+
which is bundled into the gem by `gem:build`.
|
107
|
+
|
46
108
|
## Note on Patches/Pull Requests
|
47
109
|
|
48
110
|
* Bug reports: http://github.com/oggy/ritual/issues
|
@@ -53,4 +115,4 @@ a wrapper like Jeweler or Hoe.
|
|
53
115
|
|
54
116
|
## Copyright
|
55
117
|
|
56
|
-
Copyright (c)
|
118
|
+
Copyright (c) George Ogata. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
module Ritual
|
2
|
+
module Extension
|
3
|
+
class Base
|
4
|
+
DLEXT = Config::CONFIG['DLEXT']
|
5
|
+
|
6
|
+
def initialize(name, params={})
|
7
|
+
@name = name ? name.to_sym : nil
|
8
|
+
library_name = params[:library_name]
|
9
|
+
|
10
|
+
build_path = params[:build_as] and
|
11
|
+
@build_path = "#{build_path}.#{DLEXT}"
|
12
|
+
install_path = params[:install_as] and
|
13
|
+
@install_path = "#{install_path}.#{DLEXT}"
|
14
|
+
|
15
|
+
if name
|
16
|
+
@task_name = "ext:#{name}"
|
17
|
+
@path = params[:path] || "ext/#{name}"
|
18
|
+
@build_path ||= "#{path}/#{name}.#{DLEXT}"
|
19
|
+
@install_path ||= "lib/#{library_name}/#{name}.#{DLEXT}"
|
20
|
+
else
|
21
|
+
@task_name = 'ext'
|
22
|
+
@path = params[:path] || 'ext'
|
23
|
+
@build_path ||= "#{path}/#{library_name}.#{DLEXT}"
|
24
|
+
@install_path ||= "lib/#{library_name}/#{library_name}.#{DLEXT}"
|
25
|
+
end
|
26
|
+
|
27
|
+
CLEAN.include(compiled_paths)
|
28
|
+
CLOBBER.include(@install_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_reader :name, :task_name, :path, :build_path, :install_path
|
32
|
+
|
33
|
+
def define_tasks
|
34
|
+
raise NotImplementedError, 'abstract'
|
35
|
+
end
|
36
|
+
|
37
|
+
protected
|
38
|
+
|
39
|
+
def source_paths
|
40
|
+
raise NotImplementedError, 'abstract'
|
41
|
+
end
|
42
|
+
|
43
|
+
def compiled_path_for(source_path)
|
44
|
+
raise NotImplementedError, 'abstract'
|
45
|
+
end
|
46
|
+
|
47
|
+
def compiled_paths
|
48
|
+
@compiled_paths ||= source_paths.map { |s| compiled_path_for(s) }
|
49
|
+
end
|
50
|
+
|
51
|
+
def relative_path(absolute_path)
|
52
|
+
Pathname(absolute_path).relative_path_from(Pathname(path))
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|