thecore_print_commons 0.1.6 → 0.1.7

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: 6e7aceabc46aadca29eed42ab86b302a444311a6
4
- data.tar.gz: 0ef5ee3eede6a4257a82907831d53c2782e3f757
3
+ metadata.gz: 42f426c2cd6981fa5951db86546e0424c138871f
4
+ data.tar.gz: 204f3ecbe1f081d61fa7d738f782042ee263ae17
5
5
  SHA512:
6
- metadata.gz: 335fcfe28866f97c7a3ac67989c15c37c6c426bdb7bcdfd00343e0084870e8537c4f19689807973c243f6111c7bd335fa1f32d38f06342b14e18c40efd955b69
7
- data.tar.gz: 82bf01902631384e717ffffb437625760b5cede8f7493b1c7c7e1f421ce84acea34e8f695cc482445d74469dbbcfa5798edfb0b110281d8502c317fa4b7cb47f
6
+ metadata.gz: 5be928b5d4d53d5407de3068d7056cb4cfeef0e5cae14cf2196843bf15035b93ba2ddde84f61b6d869b9998d2a81703e5e47c09ea840668171a2cd0243e3af11
7
+ data.tar.gz: 73765e891970d72d3257157314ea3b4dce667ec3b0cb3d506b21c957effb409952d21f998505d9e92da3d7b48c3c9582fcc7e38ab7f4b1044bcaceef10235a91
@@ -36,7 +36,13 @@ class Printer < ApplicationRecord
36
36
 
37
37
  def ip_enum
38
38
  # Getting from CUPS the list of configured printers
39
- CupsPrinter.get_all_printer_names
39
+ if Settings.ns(:printer_commons).cups_server.blank? || ['127.0.0.1', 'localhost'].contains(Settings.ns(:printer_commons).cups_server)
40
+ # Local Cups server
41
+ CupsPrinter.get_all_printer_names
42
+ else
43
+ # Remote Cups server
44
+ CupsPrinter.get_all_printer_names hostname: Settings.ns(:printer_commons).cups_server
45
+ end
40
46
  end
41
47
 
42
48
  RailsAdmin.config do |config|
@@ -3,7 +3,11 @@ class PrintWorker
3
3
  include Sidekiq::Worker
4
4
  def perform printer_cups_name, text
5
5
  begin
6
- printer = CupsPrinter.new printer_cups_name
6
+ printer = if Settings.ns(:printer_commons).cups_server.blank? || ['127.0.0.1', 'localhost'].contains(Settings.ns(:printer_commons).cups_server)
7
+ CupsPrinter.new printer_cups_name
8
+ else
9
+ CupsPrinter.new printer_cups_name, hostname: Settings.ns(:printer_commons).cups_server
10
+ end
7
11
  printer.print_data text, 'text/plain'
8
12
  rescue
9
13
  Rails.logger.debug("PRINTER #{printer_cups_name} ERROR: TIMEOUT")
@@ -0,0 +1,6 @@
1
+ class AddRemoteServerSetting < ActiveRecord::Migration[5.2]
2
+ def up
3
+ Settings.ns(:printer_commons).cups_server = 'localhost'
4
+ end
5
+ end
6
+
@@ -1,3 +1,3 @@
1
1
  module ThecorePrintCommons
2
- VERSION = '0.1.6'.freeze
2
+ VERSION = '0.1.7'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_print_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-23 00:00:00.000000000 Z
11
+ date: 2018-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore
@@ -75,6 +75,7 @@ files:
75
75
  - db/migrate/20160323152041_create_printers.rb
76
76
  - db/migrate/20160413115407_add_temperature_to_printer.rb
77
77
  - db/migrate/20160629140729_add_default_to_printer.rb
78
+ - db/migrate/20181106141858_add_remote_server_setting.rb
78
79
  - lib/tasks/thecore_print_commons_tasks.rake
79
80
  - lib/thecore_print_commons.rb
80
81
  - lib/thecore_print_commons/engine.rb