specrun 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2008-12-16
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
@@ -0,0 +1,13 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ bin/specrun
6
+ lib/specrun.rb
7
+ script/console
8
+ script/destroy
9
+ script/generate
10
+ spec/spec.opts
11
+ spec/spec_helper.rb
12
+ spec/specrun_spec.rb
13
+ tasks/rspec.rake
@@ -0,0 +1,49 @@
1
+ = specrun
2
+
3
+ http://specrun.rubyforge.org
4
+
5
+ == DESCRIPTION:
6
+
7
+ Specrun is designed as a simple script that will iterate through your rpsec tests, run each test
8
+ and then generate a pretty browseable rdoc like format to view the results in.
9
+
10
+ == FEATURES/PROBLEMS:
11
+
12
+ 1) None! (yet)
13
+
14
+ == SYNOPSIS:
15
+
16
+ Head to your nearest project base directory and type.... 'specrun' Tada!
17
+
18
+ == REQUIREMENTS:
19
+
20
+ Rspec
21
+
22
+ == INSTALL:
23
+
24
+ sudo gem install specrun
25
+
26
+ == LICENSE:
27
+
28
+ (The MIT License)
29
+
30
+ Copyright (c) 2008 Christopher Sean Bailey
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining
33
+ a copy of this software and associated documentation files (the
34
+ 'Software'), to deal in the Software without restriction, including
35
+ without limitation the rights to use, copy, modify, merge, publish,
36
+ distribute, sublicense, and/or sell copies of the Software, and to
37
+ permit persons to whom the Software is furnished to do so, subject to
38
+ the following conditions:
39
+
40
+ The above copyright notice and this permission notice shall be
41
+ included in all copies or substantial portions of the Software.
42
+
43
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
44
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
45
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
46
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
47
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
48
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
49
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
+ require File.dirname(__FILE__) + '/lib/specrun'
3
+
4
+ # Generate all the Rake tasks
5
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
+ $hoe = Hoe.new('specrun', Specrun::VERSION) do |p|
7
+ p.developer('FIXME full name', 'FIXME email')
8
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
+ p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
10
+ p.rubyforge_name = p.name # TODO this is default value
11
+ # p.extra_deps = [
12
+ # ['activesupport','>= 2.0.2'],
13
+ # ]
14
+ p.extra_dev_deps = [
15
+ ['newgem', ">= #{::Newgem::VERSION}"]
16
+ ]
17
+
18
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
19
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
20
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
21
+ p.rsync_args = '-av --delete --ignore-errors'
22
+ end
23
+
24
+ require 'newgem/tasks' # load /tasks/*.rake
25
+ Dir['tasks/**/*.rake'].each { |t| load t }
26
+
27
+ # TODO - want other tests/tasks run by default? Add them to the list
28
+ # task :default => [:spec, :features]
@@ -1,9 +1,8 @@
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
3
  require 'rubygems'
4
4
  require 'specrun'
5
- config_file = YAML.load_file('config.yaml')
6
- puts Dir.pwd
7
- sr = SpecRun.new(config_file)
8
- sr.build
9
-
5
+ include Specrun
6
+ index = Specrun::build_index
7
+ Specrun::build_structure(index)
8
+ Specrun::run_specs(index)
@@ -1,67 +1,77 @@
1
- require 'find'
2
- require 'yaml'
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ require 'fileutils'
3
5
 
4
- class SpecRun
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']
10
- @paths = gather_specs
6
+ module Specrun
7
+ VERSION = '0.0.5'
8
+ MODE = :debug
9
+
10
+
11
+
12
+ def build_index
13
+ Dir['**/*_spec.rb']
11
14
  end
12
-
13
- def gather_specs
14
- files = []
15
- Find.find(@spec_dir) do |path|
16
- if FileTest.directory?(path)
17
- if File.basename(path)[0] == ?.
18
- Find.prune
19
- else
20
- next
21
- end
15
+
16
+
17
+
18
+
19
+ def build_structure(paths)
20
+ unless File::exists?('specdoc')
21
+ Dir.mkdir('specdoc')
22
+ puts "DEBUG - Created Directory 'specdoc'" if MODE == :debug
23
+ end
24
+ paths.each do |path|
25
+ if FileUtils.makedirs("specdoc/#{strip_file(path)}")
26
+ puts "DEBUG - successfully created directory specdoc/#{strip_file(path)}" if MODE == :debug
22
27
  else
23
- if path.include? @spec_ext
24
- files.push path
25
- end
28
+ puts "DEBUG - unable to create directory specdoc/#{strip_file(path)}" if MODE == :debug
26
29
  end
27
30
  end
28
- return files
29
31
  end
32
+
33
+
34
+
35
+
36
+ def run_specs(paths)
37
+ paths.each do |path|
38
+ if result = `spec -f html #{path}`
39
+ puts "DEBUG - successfully ran spec #{path}." if MODE == :debug
40
+ else
41
+ puts "DEBUG - Unable to run spec #{path}." if MODE == :debug
42
+ end
43
+ build_results(result,path)
44
+ end
45
+ end
46
+
30
47
 
31
- def build
32
- unless File::exists?(@output_dir)
33
- Dir.mkdir(@output_dir)
34
- puts "Creating new directory '#{@output_dir}'"
48
+
49
+
50
+ def build_results(result,path)
51
+ if aFile = File.new("specdoc/#{path.gsub('.rb','.html')}", 'w')
52
+ aFile.puts result
53
+ aFile.close
54
+ puts "DEBUG - sucessfully created file 'specdoc/#{path.gsub('.rb','.html')}" if MODE == :debug
55
+ else
56
+ puts "DEBUG - unable to create file 'specdoc/#{path.gsub('.rb','.html')}" if MODE == :debug
35
57
  end
36
- Dir.chdir @output_dir
37
- @paths.each do |path|
38
- files = path.split("/")
39
- files.size.times do |x|
40
- unless File::exists?(files[x])
41
- if files[x].include?(@spec_ext)
42
- next
43
- else
44
- Dir.mkdir(files[x])
45
- puts "Creating new directory '#{files[x]}'"
46
- end
47
- end
48
- Dir.chdir(files[x])
49
- puts "Entering created directory '#{files[x]}'"
50
- end
51
-
52
- back_up = files.size-1
53
- back_up.times {Dir.chdir('..')}
54
-
55
- afile = File.new("#{path.gsub('.rb','.html')}", 'w')
56
- puts "Creating new File '#{path}.html'"
57
-
58
- Dir.chdir('..')
59
-
60
- afile.puts `spec -f h "#{path}"`
61
- afile.close
62
-
63
- Dir.chdir(@output_dir)
64
- end
65
58
  end
59
+
60
+
66
61
 
62
+
63
+ def write_output
64
+ end
65
+
66
+
67
+
68
+
69
+ def strip_file(path)
70
+ path = path.split('/')
71
+ path.pop
72
+ return path.join('/')
73
+ end
74
+
75
+
76
+
67
77
  end
@@ -0,0 +1,10 @@
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/specrun.rb'}"
9
+ puts "Loading specrun gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,14 @@
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)
@@ -0,0 +1,14 @@
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)
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'specrun'
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ # Time to add your specs!
4
+ # http://rspec.info/
5
+ describe "Place your specs here" do
6
+
7
+ it "find this spec in spec directory" do
8
+ violated "Be sure to write your specs"
9
+ end
10
+
11
+ end
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata CHANGED
@@ -1,45 +1,68 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specrun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
- - Christoper Sean Bailey
8
- autorequire: specrun
7
+ - FIXME full name
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-14 00:00:00 -05:00
12
+ date: 2008-12-17 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: rspec
17
- type: :runtime
16
+ name: newgem
17
+ type: :development
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: "0"
23
+ version: 1.2.1
24
24
  version:
25
- description:
26
- email: christopher.sean.bailey@gmail.com
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: Specrun is designed as a simple script that will iterate through your rpsec tests, run each test and then generate a pretty browseable rdoc like format to view the results in.
36
+ email:
37
+ - FIXME email
27
38
  executables:
28
39
  - specrun
29
40
  extensions: []
30
41
 
31
42
  extra_rdoc_files:
32
- - README
43
+ - History.txt
44
+ - Manifest.txt
45
+ - README.rdoc
33
46
  files:
47
+ - History.txt
48
+ - Manifest.txt
49
+ - README.rdoc
50
+ - Rakefile
34
51
  - bin/specrun
35
52
  - lib/specrun.rb
36
- - config.yaml
37
- - README
53
+ - script/console
54
+ - script/destroy
55
+ - script/generate
56
+ - spec/spec.opts
57
+ - spec/spec_helper.rb
58
+ - spec/specrun_spec.rb
59
+ - tasks/rspec.rake
38
60
  has_rdoc: true
39
- homepage: http://specrun.rubyforge.org
40
- post_install_message:
41
- rdoc_options: []
42
-
61
+ homepage: " http://specrun.rubyforge.org"
62
+ post_install_message: PostInstall.txt
63
+ rdoc_options:
64
+ - --main
65
+ - README.rdoc
43
66
  require_paths:
44
67
  - lib
45
68
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -56,10 +79,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
79
  version:
57
80
  requirements: []
58
81
 
59
- rubyforge_project: SpecRun
82
+ rubyforge_project: specrun
60
83
  rubygems_version: 1.3.1
61
84
  signing_key:
62
85
  specification_version: 2
63
- summary: Specrun iterates through rspec tests, run's each test and compiles the output in html.
86
+ summary: Specrun is designed as a simple script that will iterate through your rpsec tests, run each test and then generate a pretty browseable rdoc like format to view the results in.
64
87
  test_files: []
65
88
 
data/README DELETED
@@ -1,7 +0,0 @@
1
- The specrun package is intended to compile rspec results into a browseable format similar to rdoc. Currently it's features are very limited and consist only of:
2
-
3
- ) Creates a directory structure mimicing that of your spec directory.
4
- ) Runs all rspec tests.
5
- ) Compiles standard html output of rspec for each test.
6
-
7
- The todo list is too long to compile as of yet, stay tuned for future version.
@@ -1,3 +0,0 @@
1
- spec_dir: spec
2
- output_dir: spec_results
3
- spec_ext: _spec.rb