rutema 1.1.1 → 1.1.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/Manifest.txt CHANGED
@@ -42,4 +42,5 @@ test/test_reporter.rb
42
42
  test/test_specification.rb
43
43
  test/test_system.rb
44
44
  test/test_couchdb.rb
45
+ test/test_rake.rb
45
46
 
data/lib/rutema/rake.rb CHANGED
@@ -1,10 +1,21 @@
1
1
  require 'rutema/system'
2
2
  require 'optparse'
3
+ require 'rake'
3
4
 
4
5
  module Rutema
5
- #Integrates rutema with rake
6
+ #Integrates rutema with rake.
7
+ #
8
+ #You can pass a hash with the parameters or use the block syntax:
9
+ # RakeTask.new do |rt|
10
+ # rt.config_file="config.rutema"
11
+ # rt.dependencies=[]
12
+ # rt.add_dependency("some_other_task")
13
+ # rt.name="name"
14
+ # rt.log_file="."
15
+ # end
6
16
  class RakeTask
7
17
  attr_accessor :config_file, :log_file, :name
18
+ attr_reader :rake_task
8
19
  #Params is a parameter hash.
9
20
  #
10
21
  #Valid parameters are:
@@ -14,13 +25,16 @@ module Rutema
14
25
  #:log_file => path to the file where the log is saved. If missing then the logger prints in stdout
15
26
  #
16
27
  #:name => the name for the rutema task. If missing then the task is named rutema, otherwise it will be rutema:name
28
+ #
29
+ #:dependencies => an array of dependencies for the task
17
30
  def initialize params=nil
18
31
  params||={}
19
32
  @config_file=params[:config_file]
20
33
  @log_file=params[:log]
21
34
  @name=params[:name]
35
+ @dependencies=params[:dependencies]
22
36
  yield self if block_given?
23
-
37
+ @dependencies||=[]
24
38
  raise "No rutema configuration given, :config_file is nil" unless @config_file
25
39
  args=['-c',@config_file]
26
40
  args+=['-l',@log_file] if @log_file
@@ -28,15 +42,19 @@ module Rutema
28
42
  OptionParser::Arguable.extend_object(args)
29
43
  if @name
30
44
  desc "Executes the tests in #{File.basename(@config_file)}"
31
- task :"rutema:#{@name}" do
45
+ @rake_task=task :"rutema:#{@name}" do
32
46
  Rutema::RutemaX.new(args)
33
47
  end
34
48
  else
35
49
  desc "Executes the tests in #{File.basename(@config_file)}"
36
- task :rutema do
50
+ @rake_task=task :rutema do
37
51
  Rutema::RutemaX.new(args)
38
52
  end
39
53
  end
40
54
  end
55
+ #Adds a dependency to the rutema task created
56
+ def add_dependency dependency
57
+ task @rake_task => [dependency]
58
+ end
41
59
  end
42
60
  end
data/lib/rutema/system.rb CHANGED
@@ -13,7 +13,7 @@ module Rutema
13
13
  module Version
14
14
  MAJOR=1
15
15
  MINOR=1
16
- TINY=1
16
+ TINY=2
17
17
  STRING=[ MAJOR, MINOR, TINY ].join( "." )
18
18
  end
19
19
  #The Elements module provides the namespace for the various modules adding parser functionality
data/test/test_rake.rb ADDED
@@ -0,0 +1,32 @@
1
+ $:.unshift File.join(File.dirname(__FILE__),"..","lib")
2
+ require 'rubygems'
3
+ require 'rutema/gems'
4
+ require 'test/unit'
5
+ require 'rutema/rake'
6
+
7
+ module TestRutema
8
+ class TestRakeTask<Test::Unit::TestCase
9
+ def test_rake_task
10
+ t=nil
11
+ assert_nothing_raised() { t=Rutema::RakeTask.new(:config_file=>"rutema.rutema") }
12
+ assert_not_nil(t)
13
+ assert_equal("rutema", t.rake_task.name)
14
+ assert_equal([], t.rake_task.prerequisites)
15
+ assert_nothing_raised() { t.add_dependency("some_task") }
16
+ assert_equal(["some_task"], t.rake_task.prerequisites)
17
+
18
+ end
19
+
20
+ def test_rake_task_block
21
+ t=nil
22
+ assert_nothing_raised() { t=Rutema::RakeTask.new do |rt|
23
+ rt.name="test"
24
+ rt.config_file="rutema.rutema"
25
+ rt.add_dependency("some_task")
26
+ end }
27
+ assert_equal("rutema:test", t.rake_task.name)
28
+ assert_nothing_raised() { t.add_dependency("some_task") }
29
+ assert_equal(["some_task"], t.rake_task.prerequisites)
30
+ end
31
+ end
32
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rutema
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 1
10
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vassilis Rizopoulos
@@ -227,6 +227,7 @@ files:
227
227
  - test/test_specification.rb
228
228
  - test/test_system.rb
229
229
  - test/test_couchdb.rb
230
+ - test/test_rake.rb
230
231
  has_rdoc: true
231
232
  homepage:
232
233
  licenses: []
@@ -266,6 +267,7 @@ test_files:
266
267
  - test/test_configuration.rb
267
268
  - test/test_couchdb.rb
268
269
  - test/test_model.rb
270
+ - test/test_rake.rb
269
271
  - test/test_reporter.rb
270
272
  - test/test_specification.rb
271
273
  - test/test_system.rb