frecon 1.3.3 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +1 -0
- data/lib/frecon.rb +28 -5
- data/lib/frecon/base.rb +1 -1
- data/lib/frecon/base/bson.rb +2 -0
- data/lib/frecon/base/object.rb +4 -0
- data/lib/frecon/base/variables.rb +3 -1
- data/lib/frecon/console.rb +1 -3
- data/lib/frecon/controller.rb +6 -1
- data/lib/frecon/controllers.rb +0 -5
- data/lib/frecon/controllers/competitions_controller.rb +1 -1
- data/lib/frecon/controllers/matches_controller.rb +1 -1
- data/lib/frecon/controllers/participations_controller.rb +1 -1
- data/lib/frecon/controllers/records_controller.rb +1 -1
- data/lib/frecon/controllers/robots_controller.rb +1 -1
- data/lib/frecon/controllers/teams_controller.rb +1 -1
- data/lib/frecon/database.rb +24 -10
- data/lib/frecon/match_number.rb +4 -1
- data/lib/frecon/model.rb +1 -0
- data/lib/frecon/mongoid.yml +2 -2
- data/lib/frecon/position.rb +4 -1
- data/lib/frecon/scraper.rb +4 -4
- data/lib/frecon/server.rb +0 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76274cd22631fa8a8fec64c7f20e9fa3823a5c6c
|
4
|
+
data.tar.gz: 22e582985d03f0117c4c6c52bc9df8dd0baed5e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 642a0a6cecd69f672894e201aea4079b284664a49bb1ebc6b118cdc220dc3e2e0c53bec0453f2b15999b199dae683bb24f860a76d9caf806d2ce8ae6a24b8d67
|
7
|
+
data.tar.gz: 0bb4e0aeb6e7037a77614f4f678077e6e7824a8cc5ca37a7b0dd5197e6317be94afddbddc730bd49f2439c13c11299f1629877c1f30c150426f21d8cedf5ee98
|
data/config/default.yml
CHANGED
data/lib/frecon.rb
CHANGED
@@ -7,22 +7,45 @@
|
|
7
7
|
# license with this program. If not, please see
|
8
8
|
# <http://opensource.org/licenses/MIT>.
|
9
9
|
|
10
|
-
require '
|
11
|
-
|
10
|
+
require 'frecon/base/bson'
|
11
|
+
require 'frecon/base/environment'
|
12
|
+
require 'frecon/base/object'
|
13
|
+
require 'frecon/base/variables'
|
12
14
|
require 'frecon/base'
|
13
15
|
|
16
|
+
require 'frecon/console'
|
17
|
+
|
14
18
|
require 'frecon/controller'
|
19
|
+
require 'frecon/controllers/competitions_controller'
|
20
|
+
require 'frecon/controllers/dump_controller'
|
21
|
+
require 'frecon/controllers/matches_controller'
|
22
|
+
require 'frecon/controllers/participations_controller'
|
23
|
+
require 'frecon/controllers/records_controller'
|
24
|
+
require 'frecon/controllers/robots_controller'
|
25
|
+
require 'frecon/controllers/teams_controller'
|
15
26
|
require 'frecon/controllers'
|
27
|
+
|
28
|
+
require 'frecon/database'
|
29
|
+
require 'frecon/match_number'
|
30
|
+
|
16
31
|
require 'frecon/model'
|
32
|
+
require 'frecon/models/competition'
|
33
|
+
require 'frecon/models/match'
|
34
|
+
require 'frecon/models/participation'
|
35
|
+
require 'frecon/models/record'
|
36
|
+
require 'frecon/models/robot'
|
37
|
+
require 'frecon/models/team'
|
17
38
|
require 'frecon/models'
|
39
|
+
|
18
40
|
require 'frecon/scraper'
|
19
41
|
require 'frecon/scrapers'
|
20
42
|
|
21
|
-
require 'frecon/
|
43
|
+
require 'frecon/mongoid/criteria'
|
22
44
|
require 'frecon/position'
|
23
45
|
require 'frecon/request_error'
|
24
46
|
require 'frecon/routes'
|
25
47
|
|
26
|
-
require 'frecon/
|
48
|
+
require 'frecon/scraper'
|
49
|
+
require 'frecon/scrapers'
|
50
|
+
|
27
51
|
require 'frecon/server'
|
28
|
-
require 'frecon/console'
|
data/lib/frecon/base.rb
CHANGED
data/lib/frecon/base/bson.rb
CHANGED
@@ -11,6 +11,7 @@ require 'mongoid'
|
|
11
11
|
|
12
12
|
# Public: An extension for the BSON module.
|
13
13
|
module BSON
|
14
|
+
|
14
15
|
# Public: A monkey-patch for the BSON::ObjectId class which introduces an
|
15
16
|
# #as_json method.
|
16
17
|
class ObjectId
|
@@ -24,4 +25,5 @@ module BSON
|
|
24
25
|
to_s
|
25
26
|
end
|
26
27
|
end
|
28
|
+
|
27
29
|
end
|
data/lib/frecon/base/object.rb
CHANGED
@@ -11,9 +11,11 @@ require 'frecon/base/environment'
|
|
11
11
|
|
12
12
|
# Public: The FReCon API module.
|
13
13
|
module FReCon
|
14
|
+
|
14
15
|
# Public: A String representing the current version of FReCon.
|
15
|
-
VERSION = '1.
|
16
|
+
VERSION = '1.4.0'
|
16
17
|
|
17
18
|
# Public: An Environment representing the system execution environment.
|
18
19
|
ENVIRONMENT = Environment.new(:development)
|
20
|
+
|
19
21
|
end
|
data/lib/frecon/console.rb
CHANGED
@@ -7,9 +7,7 @@
|
|
7
7
|
# license with this program. If not, please see
|
8
8
|
# <http://opensource.org/licenses/MIT>.
|
9
9
|
|
10
|
-
require 'frecon
|
11
|
-
require 'frecon/database'
|
12
|
-
require 'frecon/server'
|
10
|
+
require 'frecon'
|
13
11
|
|
14
12
|
module FReCon
|
15
13
|
# Public: The wrapper system for a pry console.
|
data/lib/frecon/controller.rb
CHANGED
@@ -7,7 +7,12 @@
|
|
7
7
|
# license with this program. If not, please see
|
8
8
|
# <http://opensource.org/licenses/MIT>.
|
9
9
|
|
10
|
-
require '
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
require 'frecon/request_error'
|
13
|
+
|
14
|
+
require 'frecon/base/bson'
|
15
|
+
require 'frecon/base/object'
|
11
16
|
|
12
17
|
module FReCon
|
13
18
|
# Public: A base class to represent a controller.
|
data/lib/frecon/controllers.rb
CHANGED
@@ -7,11 +7,6 @@
|
|
7
7
|
# license with this program. If not, please see
|
8
8
|
# <http://opensource.org/licenses/MIT>.
|
9
9
|
|
10
|
-
require 'json'
|
11
|
-
require 'frecon/request_error'
|
12
|
-
|
13
|
-
require 'frecon/controller'
|
14
|
-
|
15
10
|
require 'frecon/controllers/competitions_controller'
|
16
11
|
require 'frecon/controllers/dump_controller'
|
17
12
|
require 'frecon/controllers/matches_controller'
|
data/lib/frecon/database.rb
CHANGED
@@ -8,31 +8,45 @@
|
|
8
8
|
# <http://opensource.org/licenses/MIT>.
|
9
9
|
|
10
10
|
require 'logger'
|
11
|
-
|
12
|
-
require 'frecon/base/variables'
|
13
|
-
|
14
11
|
require 'mongoid'
|
15
|
-
require 'frecon/mongoid/criteria'
|
16
|
-
|
17
12
|
require 'tempfile'
|
18
13
|
require 'yaml'
|
19
14
|
|
15
|
+
require 'frecon/base/bson'
|
16
|
+
require 'frecon/mongoid/criteria'
|
17
|
+
require 'frecon/base/variables'
|
20
18
|
require 'frecon/models'
|
21
19
|
|
22
20
|
module FReCon
|
23
21
|
# Public: A system to set up the database.
|
24
22
|
class Database
|
23
|
+
|
25
24
|
# Public: Set up the database.
|
26
25
|
def self.setup!
|
27
26
|
Mongoid.load!(File.join(File.dirname(__FILE__), 'mongoid.yml'), FReCon::ENVIRONMENT.variable)
|
28
27
|
|
29
|
-
|
30
|
-
|
28
|
+
level = case (configured_level = FReCon::ENVIRONMENT.console['level'])
|
29
|
+
when /^d/i
|
30
|
+
::Logger::DEBUG
|
31
|
+
when /^e/i
|
32
|
+
::Logger::ERROR
|
33
|
+
when /^f/i
|
34
|
+
::Logger::FATAL
|
35
|
+
when /^i/i
|
36
|
+
::Logger::INFO
|
37
|
+
when /^u/i
|
38
|
+
::Logger::UNKNOWN
|
39
|
+
when /^w/i
|
40
|
+
::Logger::WARN
|
41
|
+
else
|
42
|
+
::Logger::WARN
|
43
|
+
end
|
44
|
+
|
45
|
+
if !!configured_level
|
31
46
|
Mongoid.logger = Logger.new($stdout)
|
32
|
-
|
33
|
-
Moped.logger.level = Logger::DEBUG
|
34
|
-
Moped.logger = Logger.new($stdout)
|
47
|
+
Mongoid.logger.level = level
|
35
48
|
end
|
36
49
|
end
|
50
|
+
|
37
51
|
end
|
38
52
|
end
|
data/lib/frecon/match_number.rb
CHANGED
@@ -7,7 +7,10 @@
|
|
7
7
|
# license with this program. If not, please see
|
8
8
|
# <http://opensource.org/licenses/MIT>.
|
9
9
|
|
10
|
-
require 'frecon/base'
|
10
|
+
require 'frecon/base/bson'
|
11
|
+
require 'frecon/base/environment'
|
12
|
+
require 'frecon/base/object'
|
13
|
+
require 'frecon/base/variables'
|
11
14
|
|
12
15
|
module FReCon
|
13
16
|
# Public: A wrapper to handle converting match numbers and storing them.
|
data/lib/frecon/model.rb
CHANGED
data/lib/frecon/mongoid.yml
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
# <http://opensource.org/licenses/MIT>.
|
9
9
|
|
10
10
|
development:
|
11
|
-
|
11
|
+
clients:
|
12
12
|
default:
|
13
13
|
database: frecon
|
14
14
|
hosts:
|
@@ -18,7 +18,7 @@ development:
|
|
18
18
|
raise_not_found_error: false
|
19
19
|
|
20
20
|
production:
|
21
|
-
|
21
|
+
clients:
|
22
22
|
default:
|
23
23
|
database: frecon
|
24
24
|
hosts:
|
data/lib/frecon/position.rb
CHANGED
@@ -7,7 +7,10 @@
|
|
7
7
|
# license with this program. If not, please see
|
8
8
|
# <http://opensource.org/licenses/MIT>.
|
9
9
|
|
10
|
-
require 'frecon/base'
|
10
|
+
require 'frecon/base/bson'
|
11
|
+
require 'frecon/base/environment'
|
12
|
+
require 'frecon/base/object'
|
13
|
+
require 'frecon/base/variables'
|
11
14
|
|
12
15
|
module FReCon
|
13
16
|
# Public: A wrapper to handle converting team positions and storing them.
|
data/lib/frecon/scraper.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# license with this program. If not, please see
|
8
8
|
# <http://opensource.org/licenses/MIT>.
|
9
9
|
|
10
|
-
require '
|
10
|
+
require 'http'
|
11
11
|
|
12
12
|
module FReCon
|
13
13
|
# The default scraper scrapes other FReCon instances.
|
@@ -64,13 +64,13 @@ module FReCon
|
|
64
64
|
|
65
65
|
if !model && query.empty?
|
66
66
|
type = :dump
|
67
|
-
data =
|
67
|
+
data = HTTP.get("http://#{@base_uri}/dump")
|
68
68
|
elsif model && query.empty?
|
69
69
|
type = :index
|
70
|
-
data =
|
70
|
+
data = HTTP.get("http://#{@base_uri}/#{route_name}")
|
71
71
|
else
|
72
72
|
type = :single
|
73
|
-
data =
|
73
|
+
data = HTTP.get("http://#{@base_uri}/#{route_name}", { query: query })
|
74
74
|
end
|
75
75
|
|
76
76
|
read data.body, model: model, type: type
|
data/lib/frecon/server.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frecon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Craig
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2016-
|
16
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: sinatra
|
@@ -63,28 +63,28 @@ dependencies:
|
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
66
|
+
version: '5.1'
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '
|
73
|
+
version: '5.1'
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
|
-
name:
|
75
|
+
name: http
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
78
|
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: '0
|
80
|
+
version: '2.0'
|
81
81
|
type: :runtime
|
82
82
|
prerelease: false
|
83
83
|
version_requirements: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
85
|
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '0
|
87
|
+
version: '2.0'
|
88
88
|
- !ruby/object:Gem::Dependency
|
89
89
|
name: yard
|
90
90
|
requirement: !ruby/object:Gem::Requirement
|