specserv 0.0.0 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0bbe4326eda1211045d8cb739abab5c8e59543b
4
- data.tar.gz: d5f2aae278824cb632e02de02484b2c97feb6ca3
3
+ metadata.gz: 516d53e1d7bd8d43a0db2c0ced42ce83e2d0af29
4
+ data.tar.gz: a7306a55aa3e190646f3ffaa2ad0bd56f4ca36bb
5
5
  SHA512:
6
- metadata.gz: 75d071902b16197e60533ef510e88a113337d867c0fd3c635985dfa887f43c0cc689cd9178a1b26769bcce6a820e7667996592b068ffb9330b1f59747ca746a5
7
- data.tar.gz: 184abd595f2bbad998502aef3eb3eda99a4d11126bad88ce37bf824da5d689d6e2ad4a96b321d2cd42fc180ba12ffc23a8a97f77a256fe79c0edad3ab8d30f9e
6
+ metadata.gz: 49c675dacd2dbdda0e575572c66889400c58cf991ee23f78a7e5e12dd18e2ad47f980d5439106bcb43d06fafc3286ff00b5c7e7bf4b2cb9101bd8310dac465a9
7
+ data.tar.gz: b6864442603e6ca9b923a2ee2abdc6fb25f1cae32ffdc483eca374999201cbea280f36945de9cd757335086f3edc247e8abbf12fd249856887cfbd849cf3d300
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in specserv.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Andy Brice
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ SpecServ
2
+ ========
3
+
4
+ Serve HTML test results from any directory to a web browser via HTTP.
5
+
6
+ Currently uses RSpec, but aims to become platform-agnostic.
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'specserv'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install specserv
23
+
24
+ ## Usage
25
+
26
+ cd into any directory and run ```specserv```
27
+ visit http://localhost:port/[spec_file_name_without_extension]
28
+
29
+ ## Contributing
30
+
31
+ 1. Fork it ( https://github.com/andybrice/specserv/fork )
32
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
33
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
34
+ 4. Push to the branch (`git push origin my-new-feature`)
35
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/specserv ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'specserv/rspec_gateway'
4
+ require 'specserv/custom_exceptions'
5
+ require 'sinatra' # possibly overkill, maybe just use thin or something?
6
+
7
+ set :run, true # not sure about this, apparently Sinatra needs it to automatically launch a server
8
+
9
+ before do
10
+ @tester = Specserv::RSpecGateway.new
11
+
12
+ def set_spec_path (spec_path)
13
+ @spec_path = "#{spec_path}.rb"
14
+ end
15
+
16
+ def spec_file_exists?
17
+ File.exists?(@spec_path)
18
+ end
19
+
20
+ def run_tests
21
+ @results = @tester.run @spec_path
22
+ end
23
+
24
+ def malformed_results?
25
+ @results.nil? || @results.strip == ""
26
+ end
27
+
28
+ def respond_with_results
29
+ @results
30
+ end
31
+
32
+ def respond_with_404
33
+ status 404
34
+ "Could not find a spec file called #{@spec_path} in #{Dir.pwd}"
35
+ end
36
+
37
+ def respond_with_500
38
+ status 500
39
+ "There was an error generating results for #{@spec_path}"
40
+ end
41
+ end
42
+
43
+
44
+ ## Index Page ##
45
+
46
+ get '/' do
47
+ 'SpecServ Test Result Server'
48
+ end
49
+
50
+
51
+ ## Result Pages ##
52
+
53
+ get "/:spec_path" do
54
+
55
+ set_spec_path( params[:spec_path] )
56
+
57
+ begin
58
+ raise Specserv::NoSpecFileError unless spec_file_exists?
59
+ run_tests
60
+ raise Specserv::MalformedResultsError if malformed_results?
61
+ respond_with_results
62
+
63
+ rescue Specserv::NoSpecFileError
64
+ respond_with_404
65
+
66
+ rescue Specserv::MalformedResultsError
67
+ respond_with_500
68
+ end
69
+ end
@@ -0,0 +1,4 @@
1
+ module Specserv
2
+ class NoSpecFileError < StandardError; end
3
+ class MalformedResultsError < StandardError; end
4
+ end
@@ -0,0 +1,7 @@
1
+ module Specserv
2
+ class RSpecGateway
3
+ def run( source_path )
4
+ `rspec --format html #{source_path}` # TODO run RSpec through RSpec::Core::Runner rather than through executable
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module Specserv
2
+ VERSION = "0.0.4"
3
+ end
data/lib/specserv.rb CHANGED
@@ -1,73 +1 @@
1
- require 'sinatra'
2
-
3
- class NoSpecFileError < StandardError; end
4
-
5
- class MalformedResultsError < StandardError; end
6
-
7
- class RSpecGateway
8
- def run( source_path )
9
- `rspec --format html #{source_path}` # TODO run RSpec through RSpec::Core::Runner rather than through executable
10
- end
11
- end
12
-
13
- before do
14
- @tester = RSpecGateway.new
15
-
16
- def set_spec_path (spec_path)
17
- @spec_path = "#{spec_path}.rb"
18
- end
19
-
20
- def spec_file_exists?
21
- File.exists?(@spec_path)
22
- end
23
-
24
- def run_tests
25
- @results = @tester.run @spec_path
26
- end
27
-
28
- def malformed_results?
29
- @results.nil? || @results.strip == ""
30
- end
31
-
32
- def respond_with_results
33
- @results
34
- end
35
-
36
- def respond_with_404
37
- status 404
38
- "Could not find a spec file called #{@spec_path}!"
39
- end
40
-
41
- def respond_with_500
42
- status 500
43
- "There was an error generating results for #{@spec_path}!"
44
- end
45
- end
46
-
47
-
48
- ## Index Page ##
49
-
50
- get '/' do
51
- 'SpecServ Test Result Server'
52
- end
53
-
54
-
55
- ## Result Pages ##
56
-
57
- get "/:spec_path" do
58
-
59
- set_spec_path( params[:spec_path] )
60
-
61
- begin
62
- raise NoSpecFileError unless spec_file_exists?
63
- run_tests
64
- raise MalformedResultsError if malformed_results?
65
- respond_with_results
66
-
67
- rescue NoSpecFileError
68
- respond_with_404
69
-
70
- rescue MalformedResultsError
71
- respond_with_500
72
- end
73
- end
1
+ require 'specserv/version' # is this actually doing anything here?
data/specserv.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'specserv/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "specserv"
8
+ spec.version = Specserv::VERSION
9
+ spec.authors = ["Andy Brice"]
10
+ spec.email = ["mail@andybrice.net"]
11
+ spec.summary = %q{Test result server}
12
+ spec.description = %q{Dynamically serves test results via HTTP from any directory.}
13
+ spec.homepage = "http://github.com/andybrice/specserv"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = ['specserv']
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+
24
+ spec.add_runtime_dependency "sinatra"
25
+ spec.add_runtime_dependency "rspec"
26
+ end
metadata CHANGED
@@ -1,23 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specserv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Brice
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-27 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2014-07-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sinatra
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
13
69
  description: Dynamically serves test results via HTTP from any directory.
14
- email:
15
- executables: []
70
+ email:
71
+ - mail@andybrice.net
72
+ executables:
73
+ - specserv
16
74
  extensions: []
17
75
  extra_rdoc_files: []
18
76
  files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/specserv
19
83
  - lib/specserv.rb
20
- homepage: https://github.com/andybrice/specserv
84
+ - lib/specserv/custom_exceptions.rb
85
+ - lib/specserv/rspec_gateway.rb
86
+ - lib/specserv/version.rb
87
+ - specserv.gemspec
88
+ homepage: http://github.com/andybrice/specserv
21
89
  licenses:
22
90
  - MIT
23
91
  metadata: {}