Class: Rim
- Inherits:
-
Object
- Object
- Rim
- Includes:
- Singleton
- Defined in:
- lib/rim.rb,
lib/rim/gem.rb,
lib/rim/git.rb,
lib/rim/irb.rb,
lib/rim/core.rb,
lib/rim/rdoc.rb,
lib/rim/test.rb,
lib/rim/rspec.rb,
lib/rim/aspell.rb,
lib/rim/regtest.rb
Overview
Rim a super simple ruby project / gem manager
Goal is to have a project managing that just works on many Ruby versions as possible and is easy to extend. Feel free to dislike it. ;)
Constant Summary collapse
- VERSION =
'2.17.0'
Instance Attribute Summary collapse
-
#aspell_encoding ⇒ Object
Encoding of spell checked files (default: ‘UTF-8’).
-
#aspell_files ⇒ Object
Files to check via aspell (default: /^README/i, /^Changelog/i).
-
#aspell_lang ⇒ Object
Language for aspell (default: ‘en’).
-
#aspell_word_list ⇒ Object
File to store the word list of the project (default: ‘./.aspell.pws’).
-
#authors ⇒ Object
(also: #author)
Authors of the project / gem.
-
#dependencies ⇒ Object
Dependencies of the gem.
-
#description ⇒ Object
Project / gem description.
-
#development_dependencies ⇒ Object
Dependencies for development (default:
['rake', %W(rim ~>#{Rim::VERSION.scan(/[^.]+\.[^.]+/).first})]
). -
#email ⇒ Object
E-Mail address.
-
#gem_files ⇒ Object
Files included in the gem (default:
/^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, /^Rakefile/i, /^Gemfile$/, '*.gemspec', 'bin/*', 'lib/*/', 'test/*/'
). -
#git_push_commands ⇒ Object
Git push commands (default:
['--tags origin master']
). -
#homepage ⇒ Object
Project homepage.
-
#install_message ⇒ Object
Installation message.
-
#irb_requires ⇒ Object
Required files for irb (default: Rim#name).
-
#licenses ⇒ Object
(also: #license)
License imformation.
-
#name ⇒ Object
Name of the project / gem.
-
#rdoc_dir ⇒ Object
Directory for rdoc output.
-
#rdoc_files ⇒ Object
RDoc files (default:
/README(.rdoc)?/i
,lib/*\/
). -
#rdoc_main ⇒ Object
Main file for RDoc (default:
/README(.rdoc)?/i
). -
#regtest_files ⇒ Object
ALL regtest files incl.
-
#regtest_files_rb ⇒ Object
Sample files (Ruby files) for regtest (default:
REGTEST_FILES_RB
). -
#require_paths ⇒ Object
Paths for require to load the lib (default:
['lib']
. -
#requirements ⇒ Object
Requirements (external to rubygems).
-
#rspec_files ⇒ Object
RSpec files (default:
'spec/*/.rb')
. -
#rspec_require_paths ⇒ Object
Require dirs for tests (default:
%w(lib spec)
). -
#ruby_version ⇒ Object
Required Ruby version.
-
#run_regtest_before_release ⇒ Object
Flag if task regtest is invoked before releasing this means it is a precondition for tasks prepare_release and release (default:
true
). -
#summary ⇒ Object
Project / gem summary.
-
#test_files ⇒ Object
Test files (default:
'test/*/.rb')
. -
#test_require_paths ⇒ Object
Require dirs for tests (default:
%w(lib test)
). -
#test_verbose ⇒ Object
Verbose option for test task (default
true
). -
#test_warning ⇒ Object
Warning option for test task (default
true
). -
#version ⇒ Object
Project / gem version.
Class Method Summary collapse
-
.after_setup(&blk) ⇒ Object
The block is executed after setup is completed.
-
.defaults(&blk) ⇒ Object
Setting the default values of attributes.
-
.setup(&blk) ⇒ Object
Setting up Rim.
Instance Method Summary collapse
- #aspell_errors?(fn) ⇒ Boolean
-
#feature_loaded?(name) ⇒ Boolean
Helper method to check if a module is already required Example: feature_loaded?(‘rim/release’).
-
#filelist(*args) ⇒ Object
Helper method to generate Rake::FileList objects.
-
#invoke(name) ⇒ Object
Invoke task
name
if defined raise an error otherwise.
Instance Attribute Details
#aspell_encoding ⇒ Object
Encoding of spell checked files (default: ‘UTF-8’)
4 5 6 |
# File 'lib/rim/aspell.rb', line 4 def aspell_encoding @aspell_encoding end |
#aspell_files ⇒ Object
Files to check via aspell (default: /^README/i, /^Changelog/i)
7 8 9 |
# File 'lib/rim/aspell.rb', line 7 def aspell_files @aspell_files end |
#aspell_lang ⇒ Object
Language for aspell (default: ‘en’)
10 11 12 |
# File 'lib/rim/aspell.rb', line 10 def aspell_lang @aspell_lang end |
#aspell_word_list ⇒ Object
File to store the word list of the project (default: ‘./.aspell.pws’)
13 14 15 |
# File 'lib/rim/aspell.rb', line 13 def aspell_word_list @aspell_word_list end |
#authors ⇒ Object Also known as:
Authors of the project / gem
7 8 9 |
# File 'lib/rim/core.rb', line 7 def @authors end |
#dependencies ⇒ Object
Dependencies of the gem
22 23 24 |
# File 'lib/rim/gem.rb', line 22 def dependencies @dependencies end |
#description ⇒ Object
Project / gem description
4 5 6 |
# File 'lib/rim/gem.rb', line 4 def description @description end |
#development_dependencies ⇒ Object
Dependencies for development (default: ['rake', %W(rim ~>#{Rim::VERSION.scan(/[^.]+\.[^.]+/).first})]
)
25 26 27 |
# File 'lib/rim/gem.rb', line 25 def development_dependencies @development_dependencies end |
#email ⇒ Object
E-Mail address
10 11 12 |
# File 'lib/rim/gem.rb', line 10 def email @email end |
#gem_files ⇒ Object
Files included in the gem (default: /^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, /^Rakefile/i, /^Gemfile$/, '*.gemspec', 'bin/*', 'lib/*/', 'test/*/'
)
19 20 21 |
# File 'lib/rim/gem.rb', line 19 def gem_files @gem_files end |
#git_push_commands ⇒ Object
Git push commands (default: ['--tags origin master']
)
4 5 6 |
# File 'lib/rim/git.rb', line 4 def git_push_commands @git_push_commands end |
#homepage ⇒ Object
Project homepage
16 17 18 |
# File 'lib/rim/gem.rb', line 16 def homepage @homepage end |
#install_message ⇒ Object
Installation message
31 32 33 |
# File 'lib/rim/gem.rb', line 31 def @install_message end |
#irb_requires ⇒ Object
Required files for irb (default: Rim#name)
4 5 6 |
# File 'lib/rim/irb.rb', line 4 def irb_requires @irb_requires end |
#licenses ⇒ Object Also known as: license
License imformation
13 14 15 |
# File 'lib/rim/gem.rb', line 13 def licenses @licenses end |
#name ⇒ Object
Name of the project / gem
4 5 6 |
# File 'lib/rim/core.rb', line 4 def name @name end |
#rdoc_dir ⇒ Object
Directory for rdoc output
4 5 6 |
# File 'lib/rim/rdoc.rb', line 4 def rdoc_dir @rdoc_dir end |
#rdoc_files ⇒ Object
RDoc files (default: /README(.rdoc)?/i
, lib/*\/
)
7 8 9 |
# File 'lib/rim/rdoc.rb', line 7 def rdoc_files @rdoc_files end |
#rdoc_main ⇒ Object
Main file for RDoc (default: /README(.rdoc)?/i
)
10 11 12 |
# File 'lib/rim/rdoc.rb', line 10 def rdoc_main @rdoc_main end |
#regtest_files ⇒ Object
ALL regtest files incl. sample files, results files and maybe other files (default: REGTEST_FILES
)
7 8 9 |
# File 'lib/rim/regtest.rb', line 7 def regtest_files @regtest_files end |
#regtest_files_rb ⇒ Object
Sample files (Ruby files) for regtest (default: REGTEST_FILES_RB
)
10 11 12 |
# File 'lib/rim/regtest.rb', line 10 def regtest_files_rb @regtest_files_rb end |
#require_paths ⇒ Object
Paths for require to load the lib (default: ['lib']
13 14 15 |
# File 'lib/rim/core.rb', line 13 def require_paths @require_paths end |
#requirements ⇒ Object
Requirements (external to rubygems)
34 35 36 |
# File 'lib/rim/gem.rb', line 34 def requirements @requirements end |
#rspec_files ⇒ Object
RSpec files (default: 'spec/*/.rb')
4 5 6 |
# File 'lib/rim/rspec.rb', line 4 def rspec_files @rspec_files end |
#rspec_require_paths ⇒ Object
Require dirs for tests (default: %w(lib spec)
)
7 8 9 |
# File 'lib/rim/rspec.rb', line 7 def rspec_require_paths @rspec_require_paths end |
#ruby_version ⇒ Object
Required Ruby version
28 29 30 |
# File 'lib/rim/gem.rb', line 28 def ruby_version @ruby_version end |
#run_regtest_before_release ⇒ Object
Flag if task regtest is invoked before releasing this means it is a precondition for tasks prepare_release and release (default: true
)
14 15 16 |
# File 'lib/rim/regtest.rb', line 14 def run_regtest_before_release @run_regtest_before_release end |
#summary ⇒ Object
Project / gem summary
7 8 9 |
# File 'lib/rim/gem.rb', line 7 def summary @summary end |
#test_files ⇒ Object
Test files (default: 'test/*/.rb')
4 5 6 |
# File 'lib/rim/test.rb', line 4 def test_files @test_files end |
#test_require_paths ⇒ Object
Require dirs for tests (default: %w(lib test)
)
7 8 9 |
# File 'lib/rim/test.rb', line 7 def test_require_paths @test_require_paths end |
#test_verbose ⇒ Object
Verbose option for test task (default true
)
13 14 15 |
# File 'lib/rim/test.rb', line 13 def test_verbose @test_verbose end |
#test_warning ⇒ Object
Warning option for test task (default true
)
10 11 12 |
# File 'lib/rim/test.rb', line 10 def test_warning @test_warning end |
#version ⇒ Object
Project / gem version
10 11 12 |
# File 'lib/rim/core.rb', line 10 def version @version end |
Class Method Details
.after_setup(&blk) ⇒ Object
The block is executed after setup is completed. Useful when writing rim extensions. At execution time the Rim instance is complete initialized.
51 52 53 |
# File 'lib/rim.rb', line 51 def self.after_setup(&blk) @definitions << blk end |
.defaults(&blk) ⇒ Object
Setting the default values of attributes. Useful when writing Rim extensions. The block is evaluated in Rim.instance when no parameter is used. Otherwise the method yields Rim.instance.
25 26 27 28 29 30 31 32 |
# File 'lib/rim.rb', line 25 def self.defaults(&blk) rim = Rim.instance if blk.arity < 1 rim.instance_eval(&blk) else yield rim end end |
.setup(&blk) ⇒ Object
Setting up Rim. This method is usual used in Rakefiles to setting the project specific values of the Rim instance. The block is evaluated in Rim.instance when no parameter is used. Otherwise the method yields Rim.instance.
38 39 40 41 42 43 44 45 46 |
# File 'lib/rim.rb', line 38 def self.setup(&blk) rim = Rim.instance if blk.arity < 1 rim.instance_eval(&blk) else yield rim end execute_definitions end |
Instance Method Details
#aspell_errors?(fn) ⇒ Boolean
15 16 17 |
# File 'lib/rim/aspell.rb', line 15 def aspell_errors? fn ! `aspell list --encoding=#{aspell_encoding} -l #{aspell_lang} -p #{aspell_word_list} < #{fn}`.empty? end |
#feature_loaded?(name) ⇒ Boolean
Helper method to check if a module is already required Example: feature_loaded?(‘rim/release’)
77 78 79 |
# File 'lib/rim.rb', line 77 def feature_loaded? name ! $LOADED_FEATURES.grep(%r((^|/)#{name}\.rb$)).empty? end |
#filelist(*args) ⇒ Object
Helper method to generate Rake::FileList objects. Main difference between Rake::FileList.new and this method is the possibility to use Regexp objects as parameters.
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/rim.rb', line 63 def filelist(*args) res = FileList.new args.each do |arg| if arg.kind_of?(Regexp) res += FileList.new('**/*').grep(arg) else res += FileList.new(arg) end end res end |
#invoke(name) ⇒ Object
Invoke task name
if defined raise an error otherwise.
56 57 58 |
# File 'lib/rim.rb', line 56 def invoke name Rake::Task[name].invoke end |