rim 1.0.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.
- data/Changelog +3 -0
- data/LICENSE +20 -0
- data/README.rdoc +1 -0
- data/lib/rim/core.rb +15 -0
- data/lib/rim/gem.rb +61 -0
- data/lib/rim/git.rb +14 -0
- data/lib/rim/info.rb +8 -0
- data/lib/rim/irb.rb +7 -0
- data/lib/rim/rdoc.rb +36 -0
- data/lib/rim/test.rb +19 -0
- data/lib/rim.rb +67 -0
- data/test/test_helper_methods.rb +26 -0
- metadata +57 -0
data/Changelog
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Jan Friedrich
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
20
|
+
|
data/README.rdoc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Rim - a simple project / gem manager
|
data/lib/rim/core.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# -- encoding: utf-8 --
|
2
|
+
class Rim
|
3
|
+
# Name of the project / gem
|
4
|
+
attr_accessor :name
|
5
|
+
|
6
|
+
# lib directory (default +lib+)
|
7
|
+
attr_accessor :lib_dir
|
8
|
+
|
9
|
+
# Authors of the project / gem
|
10
|
+
attr_accessor :authors
|
11
|
+
|
12
|
+
defaults do
|
13
|
+
lib_dir 'lib'
|
14
|
+
end
|
15
|
+
end
|
data/lib/rim/gem.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# -- encoding: utf-8 --
|
2
|
+
class Rim
|
3
|
+
# Gem version
|
4
|
+
attr_accessor :version
|
5
|
+
|
6
|
+
# Project / gem description
|
7
|
+
attr_accessor :description
|
8
|
+
|
9
|
+
# Project / gem summary
|
10
|
+
attr_accessor :summary
|
11
|
+
|
12
|
+
# E-Mail address
|
13
|
+
attr_accessor :email
|
14
|
+
|
15
|
+
# Project homepage
|
16
|
+
attr_accessor :homepage
|
17
|
+
|
18
|
+
# Files included in the gem (default: <code>/^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, 'lib/**/*', 'test/**/*'</code>)
|
19
|
+
attr_accessor :gem_files
|
20
|
+
end
|
21
|
+
|
22
|
+
Rim.defaults do
|
23
|
+
gem_files filelist(/^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, 'lib/**/*', 'test/**/*')
|
24
|
+
end
|
25
|
+
|
26
|
+
Rim.after_setup do
|
27
|
+
klass = nil
|
28
|
+
begin
|
29
|
+
require 'rubygems/package_task'
|
30
|
+
klass = Gem::PackageTask
|
31
|
+
rescue LoadError
|
32
|
+
require 'rake/gempackagetask'
|
33
|
+
klass = Rake::GemPackageTask
|
34
|
+
end
|
35
|
+
|
36
|
+
if klass
|
37
|
+
spec = Gem::Specification.new do |s|
|
38
|
+
s.authors = authors
|
39
|
+
s.email = email
|
40
|
+
s.platform = Gem::Platform::RUBY
|
41
|
+
s.description = description
|
42
|
+
s.homepage = homepage
|
43
|
+
s.name = name
|
44
|
+
s.summary = summary
|
45
|
+
s.version = version
|
46
|
+
s.require_path = lib_dir
|
47
|
+
s.files = gem_files
|
48
|
+
end
|
49
|
+
|
50
|
+
task_object = klass.new(spec) do |pkg|
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'Push the gem to rubygems.org'
|
54
|
+
task :release => [:test, :gem] do
|
55
|
+
gem_filename = format('%s/%s.gem', task_object.package_dir, task_object.name)
|
56
|
+
puts "Push #{gem_filename} to rubygems.org"
|
57
|
+
system "gem push #{gem_filename}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/lib/rim/git.rb
ADDED
data/lib/rim/info.rb
ADDED
data/lib/rim/irb.rb
ADDED
data/lib/rim/rdoc.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# -- encoding: utf-8 --
|
2
|
+
class Rim
|
3
|
+
# Directory for rdoc output
|
4
|
+
attr_accessor :rdoc_dir
|
5
|
+
|
6
|
+
# RDoc files (default: <code>/README(.rdoc)?/i</code>, <code>lib/\*\*/\*</code>)
|
7
|
+
attr_accessor :rdoc_files
|
8
|
+
|
9
|
+
# Main file for RDoc (default: <code>/README(.rdoc)?/i</code>)
|
10
|
+
attr_accessor :rdoc_main
|
11
|
+
end
|
12
|
+
|
13
|
+
Rim.defaults do
|
14
|
+
rdoc_dir 'doc'
|
15
|
+
rdoc_files filelist(/^README(\.rdoc)?$/i, 'lib/**/*')
|
16
|
+
rdoc_main filelist(/^README(\.rdoc)?$/i).first
|
17
|
+
end
|
18
|
+
|
19
|
+
Rim.after_setup do
|
20
|
+
klass = nil
|
21
|
+
begin
|
22
|
+
require 'rdoc/task'
|
23
|
+
klass = RDoc::Task
|
24
|
+
rescue LoadError
|
25
|
+
require 'rake/rdoctask'
|
26
|
+
klass = Rake::RDocTask
|
27
|
+
end
|
28
|
+
|
29
|
+
if klass
|
30
|
+
klass.new do |rd|
|
31
|
+
rd.rdoc_dir = rdoc_dir
|
32
|
+
rd.rdoc_files = rdoc_files
|
33
|
+
rd.main = rdoc_main
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/rim/test.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -- encoding: utf-8 --
|
2
|
+
class Rim
|
3
|
+
# Test files (default: <code>'test/\*\*/\*.rb')</code>
|
4
|
+
attr_accessor :test_files
|
5
|
+
end
|
6
|
+
|
7
|
+
Rim.defaults do
|
8
|
+
test_files filelist('test/**/*.rb')
|
9
|
+
end
|
10
|
+
|
11
|
+
Rim.after_setup do
|
12
|
+
unless Array(test_files).empty?
|
13
|
+
require 'rake/testtask'
|
14
|
+
Rake::TestTask.new do |t|
|
15
|
+
t.test_files = test_files
|
16
|
+
end
|
17
|
+
task :default => :test
|
18
|
+
end
|
19
|
+
end
|
data/lib/rim.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# -- encoding: utf-8 --
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'singleton'
|
5
|
+
|
6
|
+
# Rim a super simple ruby project / gem manager
|
7
|
+
class Rim
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'rake/dsl_definition'
|
11
|
+
include Rake::DSL
|
12
|
+
rescue LoadError
|
13
|
+
end
|
14
|
+
include Singleton
|
15
|
+
|
16
|
+
# Setting the default values of attributes. Useful when writing Rim extensions.
|
17
|
+
def self.defaults(&blk)
|
18
|
+
Rim.instance.instance_eval &blk
|
19
|
+
end
|
20
|
+
|
21
|
+
# Setting up Rim. This method is usual used in Rakefiles to setting the project specific
|
22
|
+
# values of the Rim instance.
|
23
|
+
def self.setup(&blk)
|
24
|
+
Rim.instance.instance_eval &blk
|
25
|
+
execute_definitions
|
26
|
+
end
|
27
|
+
|
28
|
+
# The block is executed after setup is completed.
|
29
|
+
# Useful when writing rim extensions.
|
30
|
+
# At execution time the Rim instance is coplete initialized.
|
31
|
+
def self.after_setup(&blk)
|
32
|
+
@definitions << blk
|
33
|
+
end
|
34
|
+
|
35
|
+
# Helper method to generate Rake::FileList objects.
|
36
|
+
# Main difference between Rake::FileList.new and this method is
|
37
|
+
# the possibility to use Regexp objects as parameters.
|
38
|
+
def filelist(*args)
|
39
|
+
res = FileList.new
|
40
|
+
args.each do |arg|
|
41
|
+
if arg.kind_of?(Regexp)
|
42
|
+
res += FileList.new('**/*').grep(arg)
|
43
|
+
else
|
44
|
+
res += FileList.new(arg)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
res
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def self.attr_accessor attr
|
53
|
+
attr_writer attr
|
54
|
+
self.class_eval "def #{attr}(arg=nil); arg.nil? ? @#{attr} : @#{attr} = arg; end"
|
55
|
+
end
|
56
|
+
|
57
|
+
@definitions = []
|
58
|
+
|
59
|
+
def self.execute_definitions
|
60
|
+
@definitions.each do |blk|
|
61
|
+
Rim.instance.instance_eval &blk
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
require 'rim/core'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -- encoding: utf-8 --
|
2
|
+
require 'rim'
|
3
|
+
require 'test/unit'
|
4
|
+
|
5
|
+
class TestHelperMethods < Test::Unit::TestCase
|
6
|
+
|
7
|
+
class ::Rim
|
8
|
+
attr_accessor :some_new_attr
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_attr_accessor
|
12
|
+
rim = Rim.instance
|
13
|
+
assert_nil rim.some_new_attr, 'New attribute must be nil.'
|
14
|
+
rim.some_new_attr = :standard_setter
|
15
|
+
assert_equal :standard_setter, rim.some_new_attr
|
16
|
+
rim.some_new_attr :advanced_setter
|
17
|
+
assert_equal :advanced_setter, rim.some_new_attr
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_filelist
|
21
|
+
rim = Rim.instance
|
22
|
+
fl = rim.filelist(/rakefile/i, 'lib')
|
23
|
+
assert_equal %w(Rakefile lib), fl.to_a
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rim
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jan Friedrich
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-09-12 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: ! " Goal is to have a project managing that just works on many Ruby\n
|
15
|
+
\ versions as possible and is easy to extend. Feel free to dislike it. ;)\n"
|
16
|
+
email: janfri26@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- README.rdoc
|
22
|
+
- Changelog
|
23
|
+
- LICENSE
|
24
|
+
- lib/rim/core.rb
|
25
|
+
- lib/rim/gem.rb
|
26
|
+
- lib/rim/git.rb
|
27
|
+
- lib/rim/info.rb
|
28
|
+
- lib/rim/irb.rb
|
29
|
+
- lib/rim/rdoc.rb
|
30
|
+
- lib/rim/test.rb
|
31
|
+
- lib/rim.rb
|
32
|
+
- test/test_helper_methods.rb
|
33
|
+
homepage: http://gitorious.org/rim
|
34
|
+
licenses: []
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
requirements: []
|
52
|
+
rubyforge_project:
|
53
|
+
rubygems_version: 1.8.6.1
|
54
|
+
signing_key:
|
55
|
+
specification_version: 3
|
56
|
+
summary: A simple project / gem manager
|
57
|
+
test_files: []
|