perus 0.1.35 → 1.0.0

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: 920f9261956a93299e59c2a0f11b75266842535e
4
- data.tar.gz: cdb22d863544628302f5471999a4104903b8da8c
3
+ metadata.gz: f016e3b18515e4389cfe25da92dea8ddcb398e46
4
+ data.tar.gz: acb9fb2cee65bcb025969eba98049b45a837713c
5
5
  SHA512:
6
- metadata.gz: a80822a97f1835b47f8920c00a1063b284ab25872f2c749def033a69868b219da139e44f6e4cd46ae39bcd2ab855b7a34c7ac1ed118541c6425a160c0640acdc
7
- data.tar.gz: 1c07505c42d1f2ace7331c845aea586fb36a5e49aaed69ef548c23b6c8a00764e586002e20588fb0a3b705d8472b319bce440bab3429415141a20353d111efc5
6
+ metadata.gz: 1e682c568e0563ffa104ac069c30bf477d83b7b405e74b31e33d25c5cb6896fa2fb9e3e631b87b2a625b20e0201af65961bc1719ae1aaa3427c82e63576581a8
7
+ data.tar.gz: aed26f25f4f4c06d5731d50edd02516d7207cfa0cc13a62d612ad741388f13702030dc66af3062a560421aa8d2f542f677c486ef6a1b9cd875d636ebe0b48fe2
@@ -22,6 +22,8 @@ body > header {
22
22
  bottom: 0px;
23
23
  left: 0px;
24
24
  width: 200px;
25
+
26
+ overflow: scroll;
25
27
  }
26
28
 
27
29
  body > header h1 {
data/lib/perus/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Perus
2
- VERSION = "0.1.35"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -0,0 +1,74 @@
1
+ # Usage: rake import:systems_csv['/usr/local/bundle/gems/perus-0.1.34/lib/tasks/import.csv','test']
2
+
3
+ # csv filename as argument
4
+
5
+ # Read csv in line by line
6
+ # assume first line is the title
7
+ # check the room name, search existing systems
8
+ # if its new, create the system
9
+ # add the 3 zones listed on the same line
10
+ # if it's existing, return the system that matches
11
+ # Add the device to the system
12
+
13
+ Name = 0
14
+ LogicalName = 1
15
+ IP = 2
16
+ Orientation = 3
17
+ Group = 4
18
+
19
+
20
+ f = '/usr/local/bundle/gems/perus-0.1.34/lib/tasks/import.csv'
21
+
22
+ do_save = true
23
+
24
+
25
+ systems = {}
26
+ devices = {}
27
+
28
+ # read line by line
29
+ File.foreach(f).with_index do |line, line_num|
30
+ next if line_num == 0 || line.strip.empty?
31
+ raw = line.strip.split(",")
32
+
33
+ # Grab the System Information
34
+ sys_name = "#{raw[Name]}"
35
+ sys_logical_name = "#{raw[LogicalName]}"
36
+ sys_ip = "#{raw[IP]}"
37
+ system = systems[sys_ip]
38
+
39
+ if system.nil?
40
+ sys = Perus::Server::System.where(ip: sys_ip).first
41
+
42
+ unless sys
43
+ sys = Perus::Server::System.new
44
+ sys.name = sys_name
45
+ sys.logical_name = sys_logical_name
46
+ sys.orientation = "#{raw[Orientation]}"
47
+ sys.group_id = "#{raw[Group]}"
48
+ sys.config_id = 1
49
+ sys.ip = sys_ip
50
+ sys.links = "TV: http://control.dhlav.local/tv-control/#/?tv=#{sys.logical_name}\nEngine: http://control.dhlav.local/backoffice/#/?system=#{sys.logical_name}"
51
+
52
+ tries = 0
53
+ begin
54
+ sys.save if do_save
55
+ puts "Created system #{sys.name}"
56
+ rescue => e
57
+ puts "error: #{e.message}"
58
+ puts sys.errors.messages if sys.errors
59
+
60
+ if tries <= 8
61
+ sleep 1
62
+ tries += 1
63
+ retry
64
+ else
65
+ puts "FAILED TO CREATE SYSTEM #{system_name}"
66
+ raise "FAILED TO CREATE SYSTEM #{system_name}"
67
+ end
68
+ end
69
+ end
70
+
71
+ system = sys
72
+ systems[sys_ip] = sys
73
+ end
74
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.35
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Cannings
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-14 00:00:00.000000000 Z
11
+ date: 2017-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -326,6 +326,7 @@ files:
326
326
  - lib/perus/server/views/systems.erb
327
327
  - lib/perus/server/views/systems/form.erb
328
328
  - lib/perus/version.rb
329
+ - lib/tasks/import.rake
329
330
  - perus.gemspec
330
331
  homepage: https://github.com/cotag/perus
331
332
  licenses:
@@ -347,7 +348,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
347
348
  version: '0'
348
349
  requirements: []
349
350
  rubyforge_project:
350
- rubygems_version: 2.5.1
351
+ rubygems_version: 2.6.10
351
352
  signing_key:
352
353
  specification_version: 4
353
354
  summary: Simple system overview server