yamltest 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,25 +1,40 @@
1
- %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
- require File.dirname(__FILE__) + '/lib/yamltest'
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rake/testtask'
3
4
 
4
- # Generate all the Rake tasks
5
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
- $hoe = Hoe.new('yamltest', Yamltest::VERSION) do |p|
7
- p.developer('Gaspard Bucher', 'gaspard@teti.ch')
8
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
- p.rubyforge_name = p.name
10
-
11
- p.extra_dev_deps = [
12
- ['newgem', ">= #{::Newgem::VERSION}"]
13
- ]
5
+ require 'lib/yamltest/version'
6
+
7
+ task :default => :test
8
+
9
+ spec = Gem::Specification.new do |s|
10
+ s.name = 'yamltest'
11
+ s.version = Yamltest::Version.to_s
12
+ s.has_rdoc = true
13
+ s.extra_rdoc_files = %w(README.rdoc)
14
+ s.rdoc_options = %w(--main README.rdoc)
15
+ s.summary = "yamltest lets you configure unit test with yaml documents"
16
+ s.author = 'Gaspard Bucher'
17
+ s.email = 'gaspard@teti.ch'
18
+ s.homepage = 'http://github.com/zena/yamltest/tree'
19
+ s.files = %w(README.rdoc Rakefile) + Dir.glob("{lib,test}/**/*")
20
+ # s.executables = ['yamltest']
14
21
 
15
- p.clean_globs |= %w[**/.DS_Store tmp *.log]
16
- path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
17
- p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
18
- p.rsync_args = '-av --delete --ignore-errors'
22
+ # s.add_dependency('gem_name', '~> 0.0.1')
19
23
  end
20
24
 
21
- require 'newgem/tasks' # load /tasks/*.rake
22
- Dir['tasks/**/*.rake'].each { |t| load t }
25
+ Rake::GemPackageTask.new(spec) do |pkg|
26
+ pkg.gem_spec = spec
27
+ end
28
+
29
+ Rake::TestTask.new do |t|
30
+ t.libs << 'test'
31
+ t.test_files = FileList["test/*_test.rb"]
32
+ t.verbose = true
33
+ end
23
34
 
24
- # TODO - want other tests/tasks run by default? Add them to the list
25
- # task :default => [:spec, :features]
35
+ desc 'Generate the gemspec to serve this Gem from Github'
36
+ task :github do
37
+ file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
38
+ File.open(file, 'w') {|f| f << spec.to_ruby }
39
+ puts "Created gemspec: #{file}"
40
+ end
@@ -0,0 +1,13 @@
1
+ module Yamltest
2
+ module Version
3
+
4
+ MAJOR = 0
5
+ MINOR = 5
6
+ TINY = 1
7
+
8
+ def self.to_s # :nodoc:
9
+ [MAJOR, MINOR, TINY].join('.')
10
+ end
11
+
12
+ end
13
+ end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,7 @@
1
+ # http://sneaq.net/textmate-wtf
2
+ $:.reject! { |e| e.include? 'TextMate' }
3
+
4
+ require 'rubygems'
1
5
  require 'stringio'
2
6
  require 'test/unit'
3
7
  require File.dirname(__FILE__) + '/../lib/yamltest'
@@ -1,55 +1,55 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- # patch Hash to sort keys on inspect for consistency
4
- class Hash
5
- def inspect
6
- res = []
7
- keys.map{|k| [k, k.to_s]}.sort{|a,b| a[1] <=> b[1]}.each do |k, ks|
8
- res << "#{k.inspect} => #{self[k].inspect}"
9
- end
10
- "{#{res.join(', ')}}"
11
- end
12
- end
13
-
14
- class TestDefaultFolder < Test::Unit::TestCase
15
- yamltest
16
-
17
- def yt_parse(key, source, context)
18
- eval(source)
19
- end
20
-
21
- def test_to_make_sure_tests_are_valid
22
- assert (respond_to?('test_simple_default') and
23
- (method('test_simple_default').arity == 0 ||
24
- method('test_simple_default').arity == -1))
25
- end
26
-
27
- yt_make
28
- end
29
-
30
- class TestCustomKeys < Test::Unit::TestCase
31
- yamltest :directory => 'zoo'
32
-
33
- def yt_parse(key, source, context)
34
- res = source.gsub('o', 'a')
35
- case key
36
- when 'res'
37
- res
38
- when 'len'
39
- res.length
40
- when 'foo'
41
- context['foo']
42
- else
43
- "bad test key #{key.inspect}"
44
- end
45
- end
46
-
47
- # This test will not be redefined by 'make_tests'
48
- def test_complicated_animal
49
- context = yt_get('context', 'complicated', 'animal')
50
- context['foo'] = 'bozo'
51
- yt_do_test('complicated', 'animal', context)
52
- end
53
-
54
- yt_make
55
- end
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ # patch Hash to sort keys on inspect for consistency
4
+ class Hash
5
+ def inspect
6
+ res = []
7
+ keys.map{|k| [k, k.to_s]}.sort{|a,b| a[1] <=> b[1]}.each do |k, ks|
8
+ res << "#{k.inspect} => #{self[k].inspect}"
9
+ end
10
+ "{#{res.join(', ')}}"
11
+ end
12
+ end
13
+
14
+ class TestDefaultFolder < Test::Unit::TestCase
15
+ yamltest
16
+
17
+ def yt_parse(key, source, context)
18
+ eval(source)
19
+ end
20
+
21
+ def test_to_make_sure_tests_are_valid
22
+ assert (respond_to?('test_simple_default') and
23
+ (method('test_simple_default').arity == 0 ||
24
+ method('test_simple_default').arity == -1))
25
+ end
26
+
27
+ yt_make
28
+ end
29
+
30
+ class TestCustomKeys < Test::Unit::TestCase
31
+ yamltest :directory => 'zoo'
32
+
33
+ def yt_parse(key, source, context)
34
+ res = source.gsub('o', 'a')
35
+ case key
36
+ when 'res'
37
+ res
38
+ when 'len'
39
+ res.length
40
+ when 'foo'
41
+ context['foo']
42
+ else
43
+ "bad test key #{key.inspect}"
44
+ end
45
+ end
46
+
47
+ # This test will not be redefined by 'make_tests'
48
+ def test_complicated_animal
49
+ context = yt_get('context', 'complicated', 'animal')
50
+ context['foo'] = 'bozo'
51
+ yt_do_test('complicated', 'animal', context)
52
+ end
53
+
54
+ yt_make
55
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yamltest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gaspard Bucher
@@ -9,55 +9,32 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-22 00:00:00 +01:00
12
+ date: 2009-02-02 00:00:00 +01:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: newgem
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.2.3
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: hoe
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.8.0
34
- version:
35
- description: yamltest lets you configure unit test with yaml documents. Simply define a "yt_parse" method that will transform your "src" (source) into a "res" (result).
36
- email:
37
- - gaspard@teti.ch
14
+ dependencies: []
15
+
16
+ description:
17
+ email: gaspard@teti.ch
38
18
  executables: []
39
19
 
40
20
  extensions: []
41
21
 
42
22
  extra_rdoc_files:
43
- - History.txt
44
- - Manifest.txt
45
23
  - README.rdoc
46
24
  files:
47
- - History.txt
48
- - Manifest.txt
49
25
  - README.rdoc
50
26
  - Rakefile
27
+ - lib/yamltest
28
+ - lib/yamltest/version.rb
51
29
  - lib/yamltest.rb
52
- - script/console
53
- - script/destroy
54
- - script/generate
55
30
  - test/gem_test
56
31
  - test/gem_test/foo.yml
57
32
  - test/gem_test/simple_test.rb
58
33
  - test/test_helper.rb
59
- - test/test_yamltest.rb
34
+ - test/yamltest
60
35
  - test/yamltest/simple.yml
36
+ - test/yamltest_test.rb
37
+ - test/zoo
61
38
  - test/zoo/complicated.yml
62
39
  has_rdoc: true
63
40
  homepage: http://github.com/zena/yamltest/tree
@@ -81,11 +58,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
58
  version:
82
59
  requirements: []
83
60
 
84
- rubyforge_project: yamltest
61
+ rubyforge_project:
85
62
  rubygems_version: 1.3.1
86
63
  signing_key:
87
64
  specification_version: 2
88
65
  summary: yamltest lets you configure unit test with yaml documents
89
- test_files:
90
- - test/test_helper.rb
91
- - test/test_yamltest.rb
66
+ test_files: []
67
+
data/History.txt DELETED
@@ -1,4 +0,0 @@
1
- == yamltest 0.5 2009-01-21
2
-
3
- * 1 major improvement
4
- * First release after extraction from zena (http://zenadmin.org). [gaspard]
data/Manifest.txt DELETED
@@ -1,15 +0,0 @@
1
- History.txt
2
- Manifest.txt
3
- README.rdoc
4
- Rakefile
5
- lib/yamltest.rb
6
- script/console
7
- script/destroy
8
- script/generate
9
- test/gem_test
10
- test/gem_test/foo.yml
11
- test/gem_test/simple_test.rb
12
- test/test_helper.rb
13
- test/test_yamltest.rb
14
- test/yamltest/simple.yml
15
- test/zoo/complicated.yml
data/script/console DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # File: script/console
3
- irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
-
5
- libs = " -r irb/completion"
6
- # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
- # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
- libs << " -r #{File.dirname(__FILE__) + '/../lib/yamltest.rb'}"
9
- puts "Loading yamltest gem"
10
- exec "#{irb} #{libs} --simple-prompt"
data/script/destroy DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/destroy'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
-
4
- begin
5
- require 'rubigen'
6
- rescue LoadError
7
- require 'rubygems'
8
- require 'rubigen'
9
- end
10
- require 'rubigen/scripts/generate'
11
-
12
- ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
- RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
- RubiGen::Scripts::Generate.new.run(ARGV)