rim 1.9.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73ae1a69fd80fb16e51ea6591de4d35e731ef022
4
- data.tar.gz: 40e8becdef14a4ec449fcd096c01f3c597fb4b0f
3
+ metadata.gz: 4e36d2436b1aa607d1c650ad7ccc4307cd6d7863
4
+ data.tar.gz: 3e50060fb3e55f52fa12d75b59b71f9ee8a0f57e
5
5
  SHA512:
6
- metadata.gz: d175c0234b96627e4357a23fa995c79697cb962fb40f2d0268f5b4baee5772c4a690577dde57b7b99df2345d0ddba8850506e1e27c0ec08e5d4196164100d17e
7
- data.tar.gz: 23f427eb60ef787e28bc988c8a95a817e8f079984e50dac37b215e20b4df54db36190578e79402adb7c6a22cb7c5d3db86c9bcdd39c1be527165f606bd1d919d
6
+ metadata.gz: 3744ff51d7fcd3e4233d41b0b2d89d9418607cb7d1778d6952e085111bb5c7cdcb7058dfbba3f0c449843bf342b79b53b492e127bac02f941cd16f88cb8d0cad
7
+ data.tar.gz: accf9d5582c9dc6b7ba3baa97ed0d3748fdad8384427e0f3a99cc554e7a0d8009501b9f74d3a3d1cafea54c49d70e476973face9d0415dbe481dae50d7045642
data/Changelog CHANGED
@@ -1,3 +1,12 @@
1
+ 2.0.0
2
+ Using gem standard to describe versions in dependencies,
3
+ this breaks backwards compatibility.
4
+ New rake tasks aspell:check and regtest.
5
+ Restructuring internals using
6
+ Rim#feature_loaded? instead of require to describe
7
+ dependencies between modules.
8
+ Optimizing some internals.
9
+
1
10
  1.9.0
2
11
  New Rake task aspell.
3
12
  Fix typos and improve some internals.
@@ -14,14 +23,14 @@ New option license for gem tasks.
14
23
  1.7.0
15
24
  Remove option git_remotes for git_push_commands.
16
25
  This brings a much more flexible way to do things
17
- in git:push. PLease update your ~/.rimrc if
26
+ in git:push. Please update your ~/.rimrc if
18
27
  necessary.
19
28
  Adding support for local .rimrc files. Now ~/.rimrc
20
29
  is first loaded if it exists and then .rimrc is
21
30
  loaded if it exists.
22
31
 
23
32
  1.6.2
24
- Make git tasks independant from current
33
+ Make git tasks independent from current
25
34
  locale and push tags.
26
35
 
27
36
  1.6.1
data/README.rdoc CHANGED
@@ -11,7 +11,7 @@ Minimal Rakefile:
11
11
  # require 'rim/...'
12
12
 
13
13
  Rim.setup do
14
- name 'My project'
14
+ name 'my_project'
15
15
  authors 'me'
16
16
  version '1.0.0'
17
17
  end
data/Rakefile CHANGED
@@ -4,7 +4,10 @@ require 'rim/aspell'
4
4
  require 'rim/check_version'
5
5
  require 'rim/gem'
6
6
  require 'rim/git'
7
+ require 'rim/info'
7
8
  require 'rim/rdoc'
9
+ require 'rim/regtest'
10
+ require 'rim/release'
8
11
  require 'rim/test'
9
12
 
10
13
  Rim.setup do
@@ -19,4 +22,5 @@ Rim.setup do
19
22
  Goal is to have a project managing that just works on many Ruby
20
23
  versions as possible and is easy to extend. Feel free to dislike it. ;)
21
24
  END
25
+ development_dependencies << 'regtest'
22
26
  end
data/lib/rim/aspell.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  # -- encoding: utf-8 --
2
- require 'rim/release'
3
-
4
2
  class Rim
5
- # Files to check via aspell (default: /^README/i)
3
+ # Files to check via aspell (default: /^README/i, /^Changelog/i)
6
4
  attr_accessor :aspell_files
7
5
 
8
6
  # Language for aspell (default: 'en')
@@ -10,7 +8,7 @@ class Rim
10
8
  end
11
9
 
12
10
  Rim.defaults do
13
- aspell_files filelist(/^README/i)
11
+ aspell_files filelist(/^README/i, /^Changelog/i)
14
12
  aspell_lang 'en'
15
13
  end
16
14
 
@@ -21,4 +19,19 @@ Rim.after_setup do
21
19
  sh "aspell -c -x -l #{aspell_lang} #{fn}"
22
20
  end
23
21
  end
22
+ namespace :aspell do
23
+ desc 'Test if there are no spellcheck errors'
24
+ task :check do
25
+ error_files = []
26
+ aspell_files.each do |fn|
27
+ unless `aspell list -l #{aspell_lang} < #{fn}`.empty?
28
+ error_files << fn
29
+ end
30
+ end
31
+ fail "There are spelling errors in #{error_files.join(', ')}" unless error_files.empty?
32
+ end
33
+ end
34
+ if feature_loaded? 'rim/release'
35
+ task :release => 'aspell:check'
36
+ end
24
37
  end
@@ -1,5 +1,4 @@
1
1
  # -- encoding: utf-8 --
2
- require 'rim/release'
3
2
  Rim.after_setup do
4
3
  changelog = filelist(/^Changelog/i).first
5
4
  desc "Check version in #{changelog} with Rim#version."
@@ -9,11 +8,13 @@ Rim.after_setup do
9
8
  end
10
9
  if line =~ /^(\d+\.\d+(?:\.\d+)+)/
11
10
  if $1 != version
12
- raise "Version error (#{changelog}: #$1, setup: #{version})"
11
+ fail "Version error (#{changelog}: #$1, setup: #{version})"
13
12
  end
14
13
  else
15
- raise "No version information in #{changelog}"
14
+ fail "No version information in #{changelog}"
16
15
  end
17
16
  end
18
- task :release => :check_version
17
+ if feature_loaded? 'rim/release'
18
+ task :release => :check_version
19
+ end
19
20
  end
data/lib/rim/gem.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  # -- encoding: utf-8 --
2
- require 'rim/install'
3
- require 'rim/release'
4
2
  class Rim
5
3
  # Project / gem description
6
4
  attr_accessor :description
@@ -20,7 +18,10 @@ class Rim
20
18
  # Files included in the gem (default: <code>/^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, /^Rakefile/i, 'bin/*', 'lib/**/*', 'test/**/*'</code>)
21
19
  attr_accessor :gem_files
22
20
 
23
- # Dependencies for development (default: <code>["rim ~> #{Rim::VERSION.split(/\./)[0..1].join('.')}"]</code>)
21
+ # Dependencies of the gem
22
+ attr_accessor :dependencies
23
+
24
+ # Dependencies for development (default: <code>[%W(rim ~>#{Rim::VERSION.split(/\./)[0..1].join('.')})]</code>)
24
25
  attr_accessor :development_dependencies
25
26
 
26
27
  # Required Ruby version
@@ -35,7 +36,7 @@ end
35
36
 
36
37
  Rim.defaults do
37
38
  gem_files filelist(/^README/i, /^Changelog/i, /^COPYING/i, /^LICENSE/i, /^Rakefile/i, 'bin/*', 'lib/**/*', 'test/**/*')
38
- development_dependencies ["rim ~> #{Rim::VERSION.split(/\./)[0..1].join('.')}"]
39
+ development_dependencies [%W(rim ~>#{Rim::VERSION.split(/\./)[0..1].join('.')})]
39
40
  requirements []
40
41
  end
41
42
 
@@ -53,6 +54,7 @@ Rim.after_setup do
53
54
  task :gem do
54
55
  puts "Building #{name}-#{version}.gem"
55
56
  end
57
+
56
58
  spec = Gem::Specification.new do |s|
57
59
  s.authors = authors
58
60
  s.email = email
@@ -68,33 +70,39 @@ Rim.after_setup do
68
70
  s.required_ruby_version = ruby_version if ruby_version
69
71
  s.post_install_message = install_message
70
72
  s.requirements = Array(requirements)
71
- Array(development_dependencies).each do |depend|
72
- g, v = depend.split(' ', 2)
73
- s.add_development_dependency *[g, v]
73
+ Array(dependencies).each do |dep|
74
+ s.add_dependency *Array(dep)
75
+ end
76
+ Array(development_dependencies).each do |dep|
77
+ s.add_development_dependency *Array(dep)
74
78
  end
75
79
  end
76
80
 
77
81
  task_object = klass.new(spec) do |pkg|
78
82
  end
79
83
 
84
+ gem_filename = format('%s/%s.gem', task_object.package_dir, task_object.name)
85
+
80
86
  namespace :gem do
81
- gem_filename = format('%s/%s.gem', task_object.package_dir, task_object.name)
82
87
  desc 'Push the gem to rubygems.org'
83
- task :push => [:clean, :test, :gem] do
88
+ task :push => :gem do
84
89
  sh "gem push #{gem_filename}"
85
90
  end
86
- desc "Install #{gem_filename}"
87
- task :install => :gem do
88
- sh "gem install #{gem_filename}"
89
- end
90
- desc "Uninstall gem #{name} version #{version}"
91
- task :uninstall do
92
- sh "gem uninstall --version #{version} #{name}"
93
- end
94
91
  end
95
- task :release => :gem
96
- task :install => 'gem:install'
97
- task :uninstall => 'gem:uninstall'
92
+
93
+ desc "Install #{gem_filename}"
94
+ task :install => :gem do
95
+ sh "gem install #{gem_filename}"
96
+ end
97
+
98
+ desc "Uninstall gem #{name} version #{version}"
99
+ task :uninstall do
100
+ sh "gem uninstall --version #{version} #{name}"
101
+ end
102
+
103
+ if feature_loaded? 'rim/release'
104
+ task :release => :gem
105
+ end
98
106
  end
99
107
 
100
108
  end
data/lib/rim/git.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  # -- encoding: utf-8 --
2
- require 'rim/release'
3
-
4
2
  class Rim
5
3
  # Git push commands (default: <tt>['--tags origin master']</tt>)
6
4
  attr_accessor :git_push_commands
@@ -23,7 +21,7 @@ Rim.after_setup do
23
21
  task :check do
24
22
  res = `git status --porcelain`
25
23
  unless res.empty?
26
- raise 'Git tree is not clean'
24
+ fail 'Git tree is not clean'
27
25
  end
28
26
  end
29
27
  desc 'Push master to git remotes'
@@ -33,8 +31,10 @@ Rim.after_setup do
33
31
  end
34
32
  end
35
33
  end
36
- task :release => 'git:check' do
37
- invoke 'git:tag'
34
+ if feature_loaded? 'rim/release'
35
+ task :release => 'git:check' do
36
+ invoke 'git:tag'
37
+ end
38
38
  end
39
39
  end
40
40
  end
@@ -0,0 +1,2 @@
1
+ # -- encoding: utf-8 --
2
+ require 'regtest/task'
data/lib/rim/release.rb CHANGED
@@ -1,7 +1,8 @@
1
1
  Rim.after_setup do
2
- task :release
3
- desc "Release version #{version}"
4
- task :release => [:clean, :test] do
2
+ desc "Release version #{version}"
3
+ task :release do
4
+ if feature_loaded? 'rim/gem'
5
5
  invoke 'gem:push'
6
6
  end
7
+ end
7
8
  end
data/lib/rim/test.rb CHANGED
@@ -20,5 +20,12 @@ Rim.after_setup do
20
20
  t.libs << test_require_paths
21
21
  end
22
22
  task :default => :test
23
+
24
+ if feature_loaded? 'rim/gem'
25
+ prepend_dep :test, :gem
26
+ end
27
+ if feature_loaded? 'rim/release'
28
+ prepend_dep :test, :release
29
+ end
23
30
  end
24
31
  end
data/lib/rim.rb CHANGED
@@ -9,7 +9,7 @@ require 'singleton'
9
9
  # versions as possible and is easy to extend. Feel free to dislike it. ;)
10
10
  class Rim
11
11
 
12
- VERSION = '1.9.0'
12
+ VERSION = '2.0.0'
13
13
 
14
14
  begin
15
15
  require 'rake/dsl_definition'
@@ -72,6 +72,17 @@ class Rim
72
72
  res
73
73
  end
74
74
 
75
+ # Helper method to check if a module is already required
76
+ # Example: feature_loaded?('rim/release')
77
+ def feature_loaded? name
78
+ ! $LOADED_FEATURES.grep(%r(/#{name}\.rb$)).empty?
79
+ end
80
+
81
+ # Helper method to prepend dependencies of tasks
82
+ def prepend_dep dep, t
83
+ task(t).prerequisites.unshift(dep)
84
+ end
85
+
75
86
  private
76
87
 
77
88
  def self.attr_accessor attr
@@ -92,4 +103,4 @@ class Rim
92
103
  end
93
104
 
94
105
  require 'rim/core'
95
- require 'rim/rimrc'
106
+ require 'rim/rimrc' unless ENV['SELFTEST']
@@ -8,19 +8,41 @@ class TestHelperMethods < Test::Unit::TestCase
8
8
  attr_accessor :some_new_attr
9
9
  end
10
10
 
11
+ def setup
12
+ @rim = Rim.instance
13
+ end
14
+
11
15
  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
16
+ assert_nil @rim.some_new_attr, 'New attribute must be nil.'
17
+ @rim.some_new_attr = :standard_setter
18
+ assert_equal :standard_setter, @rim.some_new_attr
19
+ @rim.some_new_attr :advanced_setter
20
+ assert_equal :advanced_setter, @rim.some_new_attr
18
21
  end
19
22
 
20
23
  def test_filelist
21
- rim = Rim.instance
22
- fl = rim.filelist(/^rakefile/i, 'lib')
24
+ fl = @rim.filelist(/^rakefile/i, 'lib')
23
25
  assert_equal %w(Rakefile lib), fl.to_a
24
26
  end
25
27
 
28
+ def test_feature_loaded
29
+ assert_equal false, @rim.feature_loaded?('et/http')
30
+ assert_equal false, @rim.feature_loaded?('net/htt')
31
+ assert_equal false, @rim.feature_loaded?('net/http')
32
+ require 'net/http'
33
+ assert_equal false, @rim.feature_loaded?('et/http')
34
+ assert_equal false, @rim.feature_loaded?('net/htt')
35
+ assert_equal true, @rim.feature_loaded?('net/http')
36
+ end
37
+
38
+ require 'rake'
39
+ require 'rake/dsl_definition'
40
+ include Rake::DSL
41
+
42
+ def test_prepend_dep
43
+ t = task :a => :b
44
+ @rim.prepend_dep :c, :a
45
+ assert_equal [:c, :b], task(:a).prerequisites.map {|e| e.to_sym}
46
+ end
47
+
26
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rim
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Friedrich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-13 00:00:00.000000000 Z
11
+ date: 2014-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rim
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.9'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.9'
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: regtest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: |
28
42
  Goal is to have a project managing that just works on many Ruby
29
43
  versions as possible and is easy to extend. Feel free to dislike it. ;)
@@ -43,10 +57,10 @@ files:
43
57
  - lib/rim/gem.rb
44
58
  - lib/rim/git.rb
45
59
  - lib/rim/info.rb
46
- - lib/rim/install.rb
47
60
  - lib/rim/irb.rb
48
61
  - lib/rim/pry.rb
49
62
  - lib/rim/rdoc.rb
63
+ - lib/rim/regtest.rb
50
64
  - lib/rim/release.rb
51
65
  - lib/rim/rimrc.rb
52
66
  - lib/rim/ripl.rb
data/lib/rim/install.rb DELETED
@@ -1,8 +0,0 @@
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