rim 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,7 +1,16 @@
1
- 1.1.0 New tasks: git:tag and check_version
1
+ 1.2.0
2
+ New tasks: install, uninstall, gem:install, gem:uninstall
3
+ API extension: Rim.defaults and Rim.setup accept now a parameter in block and
4
+ yield Rim.instance in this case.
2
5
 
3
- 1.0.2 Fix typo in email
6
+ 1.1.0
7
+ New tasks: git:tag and check_version
4
8
 
5
- 1.0.1 First working public release
9
+ 1.0.2
10
+ Fix typo in email
6
11
 
7
- 1.0.0 First public release (yanked, because defect)
12
+ 1.0.1
13
+ First working public release
14
+
15
+ 1.0.0
16
+ First public release (yanked, because defect)
data/README.rdoc CHANGED
@@ -1 +1,59 @@
1
- Rim - a simple project / gem manager
1
+ == Rim a super simple ruby project / gem manager
2
+
3
+ Goal is to have a project managing that just works on many Ruby
4
+ versions as possible and is easy to extend. Feel free to dislike it. ;)
5
+
6
+ === Use for project management
7
+
8
+ Minimal Rakefile:
9
+ require 'rim'
10
+ require 'rim/gem'
11
+ # require 'rim/...'
12
+
13
+ Rim.setup do
14
+ name 'My project'
15
+ authors 'me'
16
+ version '1.0.0'
17
+ end
18
+
19
+ For advanced usuage have a look at the Rakefile of rim.
20
+
21
+
22
+ === Writing an extension
23
+
24
+ * Extend the class Rim with +attr_accessors+ for new attributes if needed.
25
+ * Set default values use +Rim.defaults+.
26
+ * Define tasks with +Rim.after_setup+.
27
+
28
+ A very simple example extension:
29
+ # require other extensions if neccessary
30
+
31
+ require 'rim/another_extension'
32
+
33
+ # Extend the class
34
+
35
+ class Rim
36
+ # Attribute for somewhat (default: 42)
37
+ attr_accessor :my_attr
38
+ end
39
+
40
+ # Setting default values
41
+
42
+ Rim.defaults do
43
+ my_attr 42
44
+ end
45
+
46
+ # Stuff to execute after setting the defaults and calling Rim.setup in Rakefile.
47
+ # Usual for defining tasks.
48
+
49
+ Rim.after_setup do
50
+ task :my_task => :another_task do
51
+ # stuff
52
+ end
53
+ end
54
+
55
+ For more examples have a look at the tasks comming with rim in lib/rim/*.rb
56
+
57
+
58
+ === License
59
+ MIT license, see file LICENSE.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ $:.unshift File.dirname(__FILE__) + '/lib'
2
+ require 'rim'
3
+ require 'rim/core'
4
+ require 'rim/check_version'
5
+ require 'rim/gem'
6
+ require 'rim/git'
7
+ require 'rim/info'
8
+ require 'rim/irb'
9
+ require 'rim/rdoc'
10
+ require 'rim/test'
11
+
12
+ Rim.setup do
13
+ name 'rim'
14
+ authors 'Jan Friedrich'
15
+ email 'janfri26@gmail.com'
16
+ homepage 'http://gitorious.org/rim'
17
+ version Rim::VERSION
18
+ summary 'A simple project / gem manager'
19
+ description <<-END
20
+ Goal is to have a project managing that just works on many Ruby
21
+ versions as possible and is easy to extend. Feel free to dislike it. ;)
22
+ END
23
+ end
data/lib/rim/core.rb CHANGED
@@ -3,13 +3,16 @@ class Rim
3
3
  # Name of the project / gem
4
4
  attr_accessor :name
5
5
 
6
- # lib directory (default +lib+)
7
- attr_accessor :lib_dir
8
-
9
6
  # Authors of the project / gem
10
7
  attr_accessor :authors
11
8
 
12
- defaults do
13
- lib_dir 'lib'
14
- end
9
+ # Project / gem version
10
+ attr_accessor :version
11
+
12
+ # Paths for require to load the lib (default: <code>['lib']</code>
13
+ attr_accessor :require_paths
14
+ end
15
+
16
+ Rim.defaults do |r|
17
+ r.require_paths = ['lib']
15
18
  end
data/lib/rim/gem.rb CHANGED
@@ -1,9 +1,7 @@
1
1
  # -- encoding: utf-8 --
2
+ require 'rim/install'
2
3
  require 'rim/release'
3
4
  class Rim
4
- # Gem version
5
- attr_accessor :version
6
-
7
5
  # Project / gem description
8
6
  attr_accessor :description
9
7
 
@@ -16,12 +14,12 @@ class Rim
16
14
  # Project homepage
17
15
  attr_accessor :homepage
18
16
 
19
- # Files included in the gem (default: <code>/^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, 'lib/**/*', 'test/**/*'</code>)
17
+ # Files included in the gem (default: <code>/^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, /^Rakefile/i, 'bin/*', 'lib/**/*', 'test/**/*'</code>)
20
18
  attr_accessor :gem_files
21
19
  end
22
20
 
23
21
  Rim.defaults do
24
- gem_files filelist(/^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, 'lib/**/*', 'test/**/*')
22
+ gem_files filelist(/^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, /^Rakefile/i, 'bin/*', 'lib/**/*', 'test/**/*')
25
23
  end
26
24
 
27
25
  Rim.after_setup do
@@ -35,6 +33,9 @@ Rim.after_setup do
35
33
  end
36
34
 
37
35
  if klass
36
+ task :gem do
37
+ puts "Building #{name}-#{version}.gem"
38
+ end
38
39
  spec = Gem::Specification.new do |s|
39
40
  s.authors = authors
40
41
  s.email = email
@@ -44,7 +45,7 @@ Rim.after_setup do
44
45
  s.name = name
45
46
  s.summary = summary
46
47
  s.version = version
47
- s.require_path = lib_dir
48
+ s.require_paths = require_paths
48
49
  s.files = gem_files
49
50
  end
50
51
 
@@ -52,14 +53,23 @@ Rim.after_setup do
52
53
  end
53
54
 
54
55
  namespace :gem do
56
+ gem_filename = format('%s/%s.gem', task_object.package_dir, task_object.name)
55
57
  desc 'Push the gem to rubygems.org'
56
58
  task :push => [:clean, :test, :gem] do
57
- gem_filename = format('%s/%s.gem', task_object.package_dir, task_object.name)
58
- puts "Push #{gem_filename} to rubygems.org"
59
59
  sh "gem push #{gem_filename}"
60
60
  end
61
+ desc "Install #{gem_filename}"
62
+ task :install => :gem do
63
+ sh "gem install #{gem_filename}"
64
+ end
65
+ desc "Uninstall gem #{name} version #{version}"
66
+ task :uninstall do
67
+ sh "gem uninstall --version #{version} #{name}"
68
+ end
61
69
  end
62
70
  task :release => :gem
71
+ task :install => 'gem:install'
72
+ task :uninstall => 'gem:uninstall'
63
73
  end
64
74
 
65
75
  end
data/lib/rim/git.rb CHANGED
@@ -11,8 +11,15 @@ Rim.after_setup do
11
11
  puts cmd
12
12
  sh cmd
13
13
  end
14
+ desc 'Check if git tree is clean'
15
+ task :check do
16
+ res = `git status`
17
+ if res !~ /nothing to commit/
18
+ raise 'Git tree is not clean'
19
+ end
20
+ end
14
21
  end
15
- task :release do
22
+ task :release => 'git:check' do
16
23
  invoke 'git:tag'
17
24
  end
18
25
  end
@@ -0,0 +1,8 @@
1
+ require 'rim'
2
+ Rim.after_setup do
3
+ desc 'Install the project'
4
+ task :install
5
+
6
+ desc 'Uninstall the project'
7
+ task :uninstall
8
+ end
data/lib/rim/irb.rb CHANGED
@@ -2,6 +2,7 @@
2
2
  Rim.after_setup do
3
3
  desc 'Start an irb session an loading lib'
4
4
  task :irb do
5
- exec "irb -I #{lib_dir} -r #{name}"
5
+ i_params = Array(require_paths).map {|e| '-I ' << e}.join(' ')
6
+ sh "irb #{i_params} -r #{name}"
6
7
  end
7
8
  end
data/lib/rim.rb CHANGED
@@ -3,10 +3,13 @@ require 'rake'
3
3
  require 'rake/clean'
4
4
  require 'singleton'
5
5
 
6
- # Rim a super simple ruby project / gem manager
6
+ # == Rim a super simple ruby project / gem manager
7
+ #
8
+ # Goal is to have a project managing that just works on many Ruby
9
+ # versions as possible and is easy to extend. Feel free to dislike it. ;)
7
10
  class Rim
8
11
 
9
- VERSION = '1.1.0'
12
+ VERSION = '1.2.0'
10
13
 
11
14
  begin
12
15
  require 'rake/dsl_definition'
@@ -16,14 +19,28 @@ class Rim
16
19
  include Singleton
17
20
 
18
21
  # Setting the default values of attributes. Useful when writing Rim extensions.
22
+ # The block is evaluated in Rim.instance when no parameter is used.
23
+ # Otherwise the method yields Rim.instance.
19
24
  def self.defaults(&blk)
20
- Rim.instance.instance_eval &blk
25
+ rim = Rim.instance
26
+ if blk.arity == 0
27
+ rim.instance_eval &blk
28
+ else
29
+ yield rim
30
+ end
21
31
  end
22
32
 
23
33
  # Setting up Rim. This method is usual used in Rakefiles to setting the project specific
24
34
  # values of the Rim instance.
35
+ # The block is evaluated in Rim.instance when no parameter is used.
36
+ # Otherwise the method yields Rim.instance.
25
37
  def self.setup(&blk)
26
- Rim.instance.instance_eval &blk
38
+ rim = Rim.instance
39
+ if blk.arity == 0
40
+ rim.instance_eval &blk
41
+ else
42
+ yield rim
43
+ end
27
44
  execute_definitions
28
45
  end
29
46
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rim
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,10 +9,13 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-12 00:00:00.000000000 Z
12
+ date: 2011-09-15 00:00:00.000000000 Z
13
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"
14
+ description: ! 'Goal is to have a project managing that just works on many Ruby
15
+
16
+ versions as possible and is easy to extend. Feel free to dislike it. ;)
17
+
18
+ '
16
19
  email: janfri26@gmail.com
17
20
  executables: []
18
21
  extensions: []
@@ -21,11 +24,13 @@ files:
21
24
  - README.rdoc
22
25
  - Changelog
23
26
  - LICENSE
27
+ - Rakefile
24
28
  - lib/rim/check_version.rb
25
29
  - lib/rim/core.rb
26
30
  - lib/rim/gem.rb
27
31
  - lib/rim/git.rb
28
32
  - lib/rim/info.rb
33
+ - lib/rim/install.rb
29
34
  - lib/rim/irb.rb
30
35
  - lib/rim/rdoc.rb
31
36
  - lib/rim/release.rb