specrun 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/specrun +5 -2
  2. data/lib/specrun.rb +12 -10
  3. metadata +2 -2
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
- $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
2
+ #$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
3
+ require 'rubygems'
3
4
  require 'specrun'
4
- sr = SpecRun.new
5
+ config_file = YAML.load_file('config.yaml')
6
+ puts Dir.pwd
7
+ sr = SpecRun.new(config_file)
5
8
  sr.build
6
9
 
@@ -1,16 +1,18 @@
1
1
  require 'find'
2
+ require 'yaml'
2
3
 
3
4
  class SpecRun
4
- def initialize
5
- @spec_base = 'spec'
6
- @spec_ext = '_spec.rb'
7
- @result_dir = 'spec_results'
5
+
6
+ def initialize(config_file)
7
+ @spec_dir = config_file['spec_dir']
8
+ @spec_ext = config_file['spec_ext']
9
+ @output_dir = config_file['output_dir']
8
10
  @paths = gather_specs
9
11
  end
10
12
 
11
13
  def gather_specs
12
14
  files = []
13
- Find.find(@spec_base) do |path|
15
+ Find.find(@spec_dir) do |path|
14
16
  if FileTest.directory?(path)
15
17
  if File.basename(path)[0] == ?.
16
18
  Find.prune
@@ -27,11 +29,11 @@ class SpecRun
27
29
  end
28
30
 
29
31
  def build
30
- unless File::exists?(@result_dir)
31
- Dir.mkdir(@result_dir)
32
- puts "Creating new directory '#{@result_dir}'"
32
+ unless File::exists?(@output_dir)
33
+ Dir.mkdir(@output_dir)
34
+ puts "Creating new directory '#{@output_dir}'"
33
35
  end
34
- Dir.chdir @result_dir
36
+ Dir.chdir @output_dir
35
37
  @paths.each do |path|
36
38
  files = path.split("/")
37
39
  files.size.times do |x|
@@ -58,7 +60,7 @@ class SpecRun
58
60
  afile.puts `spec -f h "#{path}"`
59
61
  afile.close
60
62
 
61
- Dir.chdir(@result_dir)
63
+ Dir.chdir(@output_dir)
62
64
  end
63
65
  end
64
66
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specrun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoper Sean Bailey
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version:
57
57
  requirements: []
58
58
 
59
- rubyforge_project:
59
+ rubyforge_project: SpecRun
60
60
  rubygems_version: 1.3.1
61
61
  signing_key:
62
62
  specification_version: 2