Class: Rim

Inherits:
Object
  • Object
show all
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.9.0'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aspell_encodingObject

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_filesObject

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_langObject

Language for aspell (default: ‘en’)



10
11
12
# File 'lib/rim/aspell.rb', line 10

def aspell_lang
  @aspell_lang
end

#aspell_word_listObject

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

#authorsObject

Authors of the project / gem



7
8
9
# File 'lib/rim/core.rb', line 7

def authors
  @authors
end

#dependenciesObject

Dependencies of the gem



22
23
24
# File 'lib/rim/gem.rb', line 22

def dependencies
  @dependencies
end

#descriptionObject

Project / gem description



4
5
6
# File 'lib/rim/gem.rb', line 4

def description
  @description
end

#development_dependenciesObject

Dependencies for development (default: [%W(rim ~>#{Rim::VERSION.split(/\./)[0..1].join('.')})])



25
26
27
# File 'lib/rim/gem.rb', line 25

def development_dependencies
  @development_dependencies
end

#emailObject

E-Mail address



10
11
12
# File 'lib/rim/gem.rb', line 10

def email
  @email
end

#gem_filesObject

Files included in the gem (default: /^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, /^Rakefile/i, 'bin/*', 'lib/*/', 'test/*/')



19
20
21
# File 'lib/rim/gem.rb', line 19

def gem_files
  @gem_files
end

#git_push_commandsObject

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

#homepageObject

Project homepage



16
17
18
# File 'lib/rim/gem.rb', line 16

def homepage
  @homepage
end

#install_messageObject

Installation message



31
32
33
# File 'lib/rim/gem.rb', line 31

def install_message
  @install_message
end

#irb_requiresObject

Required files for irb (default: Rim#name)



4
5
6
# File 'lib/rim/irb.rb', line 4

def irb_requires
  @irb_requires
end

#licenseObject

License imformation



13
14
15
# File 'lib/rim/gem.rb', line 13

def license
  @license
end

#nameObject

Name of the project / gem



4
5
6
# File 'lib/rim/core.rb', line 4

def name
  @name
end

#rdoc_dirObject

Directory for rdoc output



4
5
6
# File 'lib/rim/rdoc.rb', line 4

def rdoc_dir
  @rdoc_dir
end

#rdoc_filesObject

RDoc files (default: /README(.rdoc)?/i, lib/*\/)



7
8
9
# File 'lib/rim/rdoc.rb', line 7

def rdoc_files
  @rdoc_files
end

#rdoc_mainObject

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_filesObject

Files to handle with regtest (default: REGTEST_FILES)



6
7
8
# File 'lib/rim/regtest.rb', line 6

def regtest_files
  @regtest_files
end

#require_pathsObject

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

#requirementsObject

Requirements (external to rubygems)



34
35
36
# File 'lib/rim/gem.rb', line 34

def requirements
  @requirements
end

#rspec_filesObject

RSpec files (default: 'spec/*/.rb')



4
5
6
# File 'lib/rim/rspec.rb', line 4

def rspec_files
  @rspec_files
end

#rspec_require_pathsObject

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_versionObject

Required Ruby version



28
29
30
# File 'lib/rim/gem.rb', line 28

def ruby_version
  @ruby_version
end

#summaryObject

Project / gem summary



7
8
9
# File 'lib/rim/gem.rb', line 7

def summary
  @summary
end

#test_filesObject

Test files (default: 'test/*/.rb')



4
5
6
# File 'lib/rim/test.rb', line 4

def test_files
  @test_files
end

#test_require_pathsObject

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_verboseObject

Verbose option for test task (default true)



13
14
15
# File 'lib/rim/test.rb', line 13

def test_verbose
  @test_verbose
end

#test_warningObject

Warning option for test task (default true)



10
11
12
# File 'lib/rim/test.rb', line 10

def test_warning
  @test_warning
end

#versionObject

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

Returns:

  • (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’)

Returns:

  • (Boolean)


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