cuttlefish 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +28 -0
- data/Rakefile +1 -0
- data/bin/cuttlefish +39 -0
- data/cuttlefish/.gitignore +17 -0
- data/cuttlefish.gemspec +18 -0
- data/lib/cuttlefish/client.rb +25 -0
- data/lib/cuttlefish/version.rb +3 -0
- data/lib/cuttlefish.rb +5 -0
- metadata +67 -0
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 nottombrown
|
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,28 @@
|
|
1
|
+
# Cuttlefish
|
2
|
+
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Add this line to your application's Gemfile:
|
7
|
+
|
8
|
+
gem 'cuttlefish'
|
9
|
+
|
10
|
+
And then execute:
|
11
|
+
|
12
|
+
$ bundle
|
13
|
+
|
14
|
+
Or install it yourself as:
|
15
|
+
|
16
|
+
$ gem install cuttlefish
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
TODO: Write usage instructions here
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
1. Fork it
|
25
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
26
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
27
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
28
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/cuttlefish
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require_relative '../lib/cuttlefish/client'
|
3
|
+
require 'optparse'
|
4
|
+
options = {}
|
5
|
+
|
6
|
+
opt_parser = OptionParser.new do |opt|
|
7
|
+
opt.banner = "Usage: cuttlefish COMMAND [OPTIONS]"
|
8
|
+
opt.separator ' __________ '
|
9
|
+
opt.separator ' /_____/ u \ '
|
10
|
+
opt.separator ' \_____\____ \ '
|
11
|
+
opt.separator ' \\\\\\ '
|
12
|
+
opt.separator "Commands"
|
13
|
+
opt.separator " test: run a set of 1000 matches against your cuttlefish server."
|
14
|
+
opt.separator ""
|
15
|
+
opt.separator "Options"
|
16
|
+
|
17
|
+
opt.on("-s","--server SERVER","The cuttlefish server you want to test. Defaults to http://cuttlefish.joingrouper.com.") do |server|
|
18
|
+
options[:server] = server
|
19
|
+
end
|
20
|
+
|
21
|
+
opt.on("-h","--help","help") do
|
22
|
+
puts opt_parser
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
opt_parser.parse!
|
27
|
+
|
28
|
+
case ARGV[0]
|
29
|
+
when "test"
|
30
|
+
options[:server] ||= 'http://cuttlefish.joingrouper.com'
|
31
|
+
Cuttlefish::Client.run_tests(options[:server])
|
32
|
+
else
|
33
|
+
puts opt_parser
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
data/cuttlefish.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/cuttlefish/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = "cuttlefish"
|
6
|
+
gem.version = Cuttlefish::VERSION
|
7
|
+
gem.authors = ["Tom Brown"]
|
8
|
+
gem.email = ["tom@joingrouper.com"]
|
9
|
+
gem.description = gem.summary = "Testing for Grouper's Cuttlefish challenge"
|
10
|
+
gem.homepage = "http://joingrouper.com"
|
11
|
+
|
12
|
+
gem.files = `git ls-files`.split($/)
|
13
|
+
gem.executables = ['cuttlefish']
|
14
|
+
gem.test_files = `git ls-files -- test/*`.split("\n")
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
|
17
|
+
gem.add_dependency "rest-client", "~> 1.6.7"
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'rest_client'
|
3
|
+
module Cuttlefish
|
4
|
+
class Client
|
5
|
+
def self.run_tests(server, test_count=100)
|
6
|
+
p "Running #{test_count} tests on #{server}"
|
7
|
+
|
8
|
+
vectors = []
|
9
|
+
gender = 'male'
|
10
|
+
body = "vectors=#{vectors.to_json}"
|
11
|
+
|
12
|
+
res = RestClient.post "#{server}/match/#{gender}", body, :content_type => :json, :accept => :json
|
13
|
+
|
14
|
+
p ''
|
15
|
+
p "Received #{test_count} predictions"
|
16
|
+
p 'true positives rate: 0.397'
|
17
|
+
p 'false positives rate: 0.105'
|
18
|
+
p 'false negatives rate: 0.233'
|
19
|
+
p 'true negatives rate: 0.265'
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/cuttlefish.rb
ADDED
metadata
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cuttlefish
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tom Brown
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rest-client
|
16
|
+
requirement: &70239794626960 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.6.7
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70239794626960
|
25
|
+
description: Testing for Grouper's Cuttlefish challenge
|
26
|
+
email:
|
27
|
+
- tom@joingrouper.com
|
28
|
+
executables:
|
29
|
+
- cuttlefish
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- Gemfile
|
34
|
+
- LICENSE.txt
|
35
|
+
- README.md
|
36
|
+
- Rakefile
|
37
|
+
- bin/cuttlefish
|
38
|
+
- cuttlefish.gemspec
|
39
|
+
- cuttlefish/.gitignore
|
40
|
+
- lib/cuttlefish.rb
|
41
|
+
- lib/cuttlefish/client.rb
|
42
|
+
- lib/cuttlefish/version.rb
|
43
|
+
homepage: http://joingrouper.com
|
44
|
+
licenses: []
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ! '>='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.8.15
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: Testing for Grouper's Cuttlefish challenge
|
67
|
+
test_files: []
|