device-tracker 0.2.0 → 0.2.1

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: f0bdc0c33a0e543c9539628b3f71df9fbae9865f
4
- data.tar.gz: 225a51dfa8856ad6207baef4fe71f3a457179d6a
3
+ metadata.gz: 612e4d0e8f1d36f1f8096e3190df5f7fa46105d7
4
+ data.tar.gz: 282da092fe8a8c7d8699097a18abd07597371007
5
5
  SHA512:
6
- metadata.gz: c457ce2d6e69d27b579df7347be83b4e6ced47cbe93c24c6b9341aba610dd6bc022f0755993cb55944b085170361ab5e399cc95b58fc19ce1f1fd7bca67883a6
7
- data.tar.gz: 493d8244b35570e1a741fc9b8daa8ac43ce68a644fb823e7348ba543f4dfd95435e733dd23544641452a214b89d396d638422bf774b0d6f30d2266bb2d3f9dde
6
+ metadata.gz: 71f60854460879101473fcb0ee3b9bc0385a0c47aa73047d1bf6939510ccacdfbfea65ed0df2b8af917c6d72b349160941da000a3892f4092704043e6c945ef9
7
+ data.tar.gz: 36140f6db897c69bb894585a51fcdb8f011a19fac847111620e1b0e5d5f2591344269962bc60fd505dfe7f84ab07a0ce59635680c72cd99a8946ed4729884ae4
@@ -12,7 +12,7 @@ opts = OptionParser.new do |opts|
12
12
 
13
13
  opts.separator ""
14
14
 
15
- opts.on("-c", "--config" "path to config file") do |path|
15
+ opts.on("-c", "--config" "path to config file") do |path|
16
16
  config_path = path
17
17
  end
18
18
 
@@ -40,11 +40,16 @@ config = JSON.parse(json)
40
40
  set :database, config["database"]
41
41
  Pony.options = config["email"]
42
42
  set :google_maps_api_key, config["google_maps_api_key"]
43
+ port = config["port"] || "3000"
44
+ host = config["host"] || "127.0.0.1"
45
+ name = config["admin"]["name"]
46
+ password = config["admin"]["password"]
47
+ email = config["admin"]["email"]
43
48
 
44
49
  ActiveRecord::Migrator.migrate(File.expand_path('../../lib/device/tracker/db/migrate', __FILE__))
45
50
 
46
51
  require_relative '../lib/device/tracker/dependencies'
47
52
  require_relative '../lib/device/tracker/db/seeds'
48
53
 
49
- Device::Tracker::Seed.seed(name: 'James Ruston', password: 'password', email: 'james.ruston@bbc.co.uk')
50
- Device::Tracker.start
54
+ Device::Tracker::Seed.seed(name: name, password: password, email: email)
55
+ Device::Tracker.start(host, port)
@@ -5,10 +5,10 @@ require "rack"
5
5
 
6
6
  module Device
7
7
  module Tracker
8
- def self.start
8
+ def self.start(host, port)
9
9
  options = {
10
- :Host => '127.0.0.1',
11
- :Port => '3000'
10
+ :Host => host,
11
+ :Port => port
12
12
  }
13
13
 
14
14
  Rack::Handler::Thin.run(App.new, options) do |server|
@@ -36,18 +36,76 @@
36
36
  "via_options": {
37
37
  "id": "http://jsonschema.net/email/via_options",
38
38
  "type": "object",
39
- "properties": {}
39
+ "properties": {
40
+ "address": {
41
+ "id": "http://jsonschema.net/email/via_options/address",
42
+ "type": "string"
43
+ },
44
+ "port": {
45
+ "id": "http://jsonschema.net/email/via_options/port",
46
+ "type": "string"
47
+ },
48
+ "enable_starttls_auto": {
49
+ "id": "http://jsonschema.net/email/via_options/enable_starttls_auto",
50
+ "type": "boolean"
51
+ },
52
+ "user_name": {
53
+ "id": "http://jsonschema.net/email/via_options/user_name",
54
+ "type": "string"
55
+ },
56
+ "password": {
57
+ "id": "http://jsonschema.net/email/via_options/password",
58
+ "type": "string"
59
+ },
60
+ "authentication": {
61
+ "id": "http://jsonschema.net/email/via_options/authentication",
62
+ "type": "string"
63
+ },
64
+ "domain": {
65
+ "id": "http://jsonschema.net/email/via_options/domain",
66
+ "type": "string"
67
+ }
68
+ }
40
69
  }
41
70
  }
42
71
  },
43
72
  "google_maps_api_key": {
44
73
  "id": "http://jsonschema.net/google_maps_api_key",
45
74
  "type": "string"
75
+ },
76
+ "host": {
77
+ "id": "http://jsonschema.net/host",
78
+ "type": "string"
79
+ },
80
+ "port": {
81
+ "id": "http://jsonschema.net/port",
82
+ "type": "string"
83
+ },
84
+ "admin": {
85
+ "id": "http://jsonschema.net/admin",
86
+ "type": "object",
87
+ "properties": {
88
+ "name": {
89
+ "id": "http://jsonschema.net/admin/name",
90
+ "type": "string"
91
+ },
92
+ "email": {
93
+ "id": "http://jsonschema.net/admin/email",
94
+ "type": "string"
95
+ },
96
+ "password": {
97
+ "id": "http://jsonschema.net/admin/password",
98
+ "type": "string"
99
+ }
100
+ }
46
101
  }
47
102
  },
48
103
  "required": [
49
104
  "database",
50
105
  "email",
51
- "google_maps_api_key"
106
+ "google_maps_api_key",
107
+ "host",
108
+ "port",
109
+ "admin"
52
110
  ]
53
111
  }
@@ -2,6 +2,13 @@ module Device
2
2
  module Tracker
3
3
  class Seed
4
4
  def self.seed(name: name, password: password, email: email)
5
+
6
+ user = User.where(email: email)
7
+
8
+ if user.exists?
9
+ return
10
+ end
11
+
5
12
  user = User.find_or_create_by({
6
13
  name: name,
7
14
  username: 'admin',
@@ -1,5 +1,5 @@
1
1
  module Device
2
2
  module Tracker
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: device-tracker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Ruston
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2015-11-12 00:00:00.000000000 Z
12
+ date: 2015-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler