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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58387796046e8701cec240419090e6ee551f7579
4
- data.tar.gz: b69de0f4af45d87a8ad47b36d1b55dee79ce8166
3
+ metadata.gz: 76274cd22631fa8a8fec64c7f20e9fa3823a5c6c
4
+ data.tar.gz: 22e582985d03f0117c4c6c52bc9df8dd0baed5e1
5
5
  SHA512:
6
- metadata.gz: 6895028dc88806ec1f183c74cd1426f86035641ce9823c9f449860fe9da5459efe20a5dfda62d53e8cf5e8659118a67390d554267c26f3c60580a2d0f9246603
7
- data.tar.gz: b11ff7aafd87d88cebc58dcf9180b81ba8dc0b02bc519016b9fda94a7a89197906443058d62b2b0bb7b57b1d977f9d01e454904a0537cbcec69ff9a3e32c3b66
6
+ metadata.gz: 642a0a6cecd69f672894e201aea4079b284664a49bb1ebc6b118cdc220dc3e2e0c53bec0453f2b15999b199dae683bb24f860a76d9caf806d2ce8ae6a24b8d67
7
+ data.tar.gz: 0bb4e0aeb6e7037a77614f4f678077e6e7824a8cc5ca37a7b0dd5197e6317be94afddbddc730bd49f2439c13c11299f1629877c1f30c150426f21d8cedf5ee98
data/config/default.yml CHANGED
@@ -3,6 +3,7 @@ server:
3
3
  port: 5080
4
4
 
5
5
  console:
6
+ level: info
6
7
 
7
8
  database:
8
9
  mongoid:
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 'mongoid'
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/match_number'
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/database'
48
+ require 'frecon/scraper'
49
+ require 'frecon/scrapers'
50
+
27
51
  require 'frecon/server'
28
- require 'frecon/console'
data/lib/frecon/base.rb CHANGED
@@ -8,6 +8,6 @@
8
8
  # <http://opensource.org/licenses/MIT>.
9
9
 
10
10
  require 'frecon/base/bson'
11
- require 'frecon/base/object'
12
11
  require 'frecon/base/environment'
12
+ require 'frecon/base/object'
13
13
  require 'frecon/base/variables'
@@ -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
@@ -8,5 +8,9 @@
8
8
  # <http://opensource.org/licenses/MIT>.
9
9
 
10
10
  class Object
11
+
12
+ # Alias #is_a? to #is_an?. This allows us to write more
13
+ # proper-English-y code.
11
14
  alias_method :is_an?, :is_a?
15
+
12
16
  end
@@ -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.3.3'
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
@@ -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/base/variables'
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.
@@ -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 'frecon/base'
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.
@@ -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'
@@ -7,8 +7,8 @@
7
7
  # license with this program. If not, please see
8
8
  # <http://opensource.org/licenses/MIT>.
9
9
 
10
- require 'json'
11
10
  require 'frecon/models/competition'
11
+ require 'frecon/controller'
12
12
 
13
13
  module FReCon
14
14
  # Public: The Competitions controller.
@@ -7,8 +7,8 @@
7
7
  # license with this program. If not, please see
8
8
  # <http://opensource.org/licenses/MIT>.
9
9
 
10
- require 'json'
11
10
  require 'frecon/models/match'
11
+ require 'frecon/controller'
12
12
 
13
13
  module FReCon
14
14
  # Public: The Matches controller.
@@ -7,8 +7,8 @@
7
7
  # license with this program. If not, please see
8
8
  # <http://opensource.org/licenses/MIT>.
9
9
 
10
- require 'json'
11
10
  require 'frecon/models/participation'
11
+ require 'frecon/controller'
12
12
 
13
13
  module FReCon
14
14
  # Public: The Participations controller.
@@ -7,8 +7,8 @@
7
7
  # license with this program. If not, please see
8
8
  # <http://opensource.org/licenses/MIT>.
9
9
 
10
- require 'json'
11
10
  require 'frecon/models/record'
11
+ require 'frecon/controller'
12
12
 
13
13
  module FReCon
14
14
  # Public: The Records controller.
@@ -7,8 +7,8 @@
7
7
  # license with this program. If not, please see
8
8
  # <http://opensource.org/licenses/MIT>.
9
9
 
10
- require 'json'
11
10
  require 'frecon/models/robot'
11
+ require 'frecon/controller'
12
12
 
13
13
  module FReCon
14
14
  # Public: The Robots controller.
@@ -7,8 +7,8 @@
7
7
  # license with this program. If not, please see
8
8
  # <http://opensource.org/licenses/MIT>.
9
9
 
10
- require 'json'
11
10
  require 'frecon/models/team'
11
+ require 'frecon/controller'
12
12
 
13
13
  module FReCon
14
14
  # Public: The Teams controller.
@@ -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
- if FReCon::ENVIRONMENT.console['level']
30
- Mongoid.logger.level = Logger::DEBUG
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
@@ -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
@@ -9,6 +9,7 @@
9
9
 
10
10
  require 'mongoid'
11
11
  require 'frecon/mongoid/criteria'
12
+ require 'frecon/base/bson'
12
13
 
13
14
  module FReCon
14
15
  # Public: A base class designed to assist with creating MongoDB Models
@@ -8,7 +8,7 @@
8
8
  # <http://opensource.org/licenses/MIT>.
9
9
 
10
10
  development:
11
- sessions:
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
- sessions:
21
+ clients:
22
22
  default:
23
23
  database: frecon
24
24
  hosts:
@@ -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.
@@ -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 'httparty'
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 = HTTParty.get("http://#{@base_uri}/dump")
67
+ data = HTTP.get("http://#{@base_uri}/dump")
68
68
  elsif model && query.empty?
69
69
  type = :index
70
- data = HTTParty.get("http://#{@base_uri}/#{route_name}")
70
+ data = HTTP.get("http://#{@base_uri}/#{route_name}")
71
71
  else
72
72
  type = :single
73
- data = HTTParty.get("http://#{@base_uri}/#{route_name}", { query: query })
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
@@ -12,7 +12,6 @@ require 'sinatra/base'
12
12
  require 'frecon/base/variables'
13
13
  require 'frecon/database'
14
14
  require 'frecon/routes'
15
- require 'frecon/controllers'
16
15
 
17
16
  module FReCon
18
17
  # Public: The Sinatra web server.
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.3.3
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-03-19 00:00:00.000000000 Z
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: '4.0'
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: '4.0'
73
+ version: '5.1'
74
74
  - !ruby/object:Gem::Dependency
75
- name: httparty
75
+ name: http
76
76
  requirement: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: '0.13'
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.13'
87
+ version: '2.0'
88
88
  - !ruby/object:Gem::Dependency
89
89
  name: yard
90
90
  requirement: !ruby/object:Gem::Requirement