thecore_print_commons 0.1.12 → 2.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
- SHA1:
3
- metadata.gz: d76e9416ec4e1cbc10a87b927cb211fcd07f9b42
4
- data.tar.gz: 91028fc14cd84f204ebae675aff061d31dab4409
2
+ SHA256:
3
+ metadata.gz: 43120d7f8257628cb1b1f6162b37e1ad70b46f331ecd385e38b4c538cfd9c18f
4
+ data.tar.gz: 037604d88fc72c486f7d211bc5ad740cbd9c5de505142a932898a3657878ca2d
5
5
  SHA512:
6
- metadata.gz: fb8574caf0b73b56e525b5f799c58b6ec3465b01cb212861bec63ed434e797a208b12f3f91ba955cc49448f19b69127417a3884acd3a7cf612d78f36be98f515
7
- data.tar.gz: 0277de4dbac6f75f6dcadf9864c22bcdb27c90e7672054f67d119f538c4dba7a264f6c8afbabf07bec9ce90b820f7fcbdd5d5a0844bf0c0c0d38541410f5399f
6
+ metadata.gz: 83fe9c65c3781f0b14c428e5981c524ecd88cf4f38975a5b06855369cb38e76a5318cf6d0b8a4a370cc7d17de1de03b2633d4daa81ab33c8b765198cffbe9952
7
+ data.tar.gz: 481cb7c93d20c569795cd93d605552fb87071b4554393f57825db783f7161548b892974ceec0e87bc9568c4e63eb39457595163a836d841c796bf58522201093
data/README.md CHANGED
@@ -27,7 +27,7 @@ echo "Printer ip or netbios address:";read SHARE_IP_ADDRESS_OR_NETBIOS_NAME;
27
27
  echo "Printer share name:";read SHARENAME;
28
28
  echo "Printer share username:"; read USERNAME;
29
29
  echo "Printer share password:"; read PASSWORD;
30
- lpadmin -p "$PRINTERLABEL" -E -v "smb://$(urlencode $USERNAME):$(urlencode $PASSWORD)@$(urlencode $WORKGROUP)/$(urlencode $SHARE_IP_ADDRESS_OR_NETBIOS_NAME)/$(urlencode $SHARENAME)" -m everywhere
30
+ lpadmin -p "$PRINTERLABEL" -E -v "beh://1/1/1/smb://$(urlencode $USERNAME):$(urlencode $PASSWORD)@$(urlencode $WORKGROUP)/$(urlencode $SHARE_IP_ADDRESS_OR_NETBIOS_NAME)/$(urlencode $SHARENAME)" -m everywhere
31
31
  ```
32
32
 
33
33
  To list shares on that remote machine:
@@ -1,18 +1,22 @@
1
1
  require 'ipaddr'
2
2
  class PrintWorker
3
3
  include Sidekiq::Worker
4
+ sidekiq_options retry: false
5
+
4
6
  def perform printer_cups_name, text
5
- if Settings.ns(:printer_commons).cups_server.blank? || ['127.0.0.1', 'localhost'].contains(Settings.ns(:printer_commons).cups_server)
6
- printer = CupsPrinter.new printer_cups_name
7
- printer.print_data text, 'text/plain'
8
- printer.close
9
- else
10
- print_file = "/tmp/print-#{printer_cups_name}-#{Time.now.strftime '%Y%m%d%H%M%S%L'}"
11
- IO.write(print_file, text)
12
- # CupsPrinter.new printer_cups_name, hostname: Settings.ns(:printer_commons).cups_server
13
- # printer.print_data text, 'text/plain', hostname: Settings.ns(:printer_commons).cups_server
14
- `lp -d "#{printer_cups_name}" -h "#{Settings.ns(:printer_commons).cups_server}" -o raw "#{print_file}"`
15
- File.delete print_file
16
- end
7
+ # if Settings.ns(:printer_commons).cups_server.blank? || ['127.0.0.1', 'localhost'].contains(Settings.ns(:printer_commons).cups_server)
8
+ # printer = CupsPrinter.new printer_cups_name
9
+ # printer.print_data text, 'text/plain'
10
+ # printer.close
11
+ # else
12
+ print_file = "/tmp/print-#{printer_cups_name}-#{Time.now.strftime '%Y%m%d%H%M%S%L'}"
13
+ puts "Creating temp file: #{print_file}"
14
+ IO.write(print_file, text)
15
+ # CupsPrinter.new printer_cups_name, hostname: Settings.ns(:printer_commons).cups_server
16
+ # printer.print_data text, 'text/plain', hostname: Settings.ns(:printer_commons).cups_server
17
+ puts "Printing with lp command on #{printer_cups_name} of #{Settings.ns(:printer_commons).cups_server} "
18
+ `cupsenable "#{printer_cups_name}";lp -d "#{printer_cups_name}" -h "#{Settings.ns(:printer_commons).cups_server}" -o raw "#{print_file}"`
19
+ File.delete print_file
20
+ # end
17
21
  end
18
22
  end
@@ -1,7 +1,6 @@
1
- require "thecore_print_commons/engine"
2
- require 'thecore'
3
1
  require 'thecore_background_jobs'
4
2
  require 'cupsffi'
3
+ require "thecore_print_commons/engine"
5
4
 
6
5
  require 'thecore'
7
6
  module ThecorePrintCommons
@@ -2,7 +2,7 @@ module ThecorePrintCommons
2
2
  class Engine < ::Rails::Engine
3
3
 
4
4
  initializer 'thecore_print_commons.add_to_migrations' do |app|
5
- unless app.root.to_s == root.to_s
5
+ unless app.root.to_s.match root.to_s
6
6
  # APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
7
7
  config.paths['db/migrate'].expanded.each do |expanded_path|
8
8
  app.config.paths['db/migrate'] << expanded_path
@@ -1,3 +1,3 @@
1
1
  module ThecorePrintCommons
2
- VERSION = '0.1.12'.freeze
2
+ VERSION = '2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_print_commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: '2.0'
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-11-07 00:00:00.000000000 Z
11
+ date: 2020-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: thecore
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.4'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.4'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: thecore_background_jobs
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '1.1'
19
+ version: '2.0'
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: '1.1'
26
+ version: '2.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: cupsffi
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -99,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
85
  - !ruby/object:Gem::Version
100
86
  version: '0'
101
87
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.6.14
88
+ rubygems_version: 3.0.3
104
89
  signing_key:
105
90
  specification_version: 4
106
91
  summary: Thecorized thecore_print_commons