printr 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/.gitignore +1 -0
  2. data/README +13 -0
  3. data/lib/printr.rb +4 -2
  4. data/printr.gemspec +1 -1
  5. metadata +4 -12
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ log/*.log
4
4
  tmp/
5
5
  *~
6
6
  *.gem
7
+ commit
data/README CHANGED
@@ -10,6 +10,15 @@ gem 'printr'
10
10
 
11
11
  Then run bundle install
12
12
 
13
+ The rails g printr:install
14
+
15
+ and rails g printr:views
16
+
17
+ If you pass in a :scope, it will set that to the view directory. Normally it is: app/views/printr/view.prnt.erb,
18
+ if you don't want it to be that, you can set the :scope rails g printr:views printer_views would install the
19
+ views to app/views/printer_views/#{view}.prnt.erb
20
+
21
+
13
22
  The default source for printer configurations is :yaml, and expects a printrs.yml file to be present in
14
23
  RAILS_ROOT/config/, you can also feed it off of an ActiveRecord, in initializers/printr.rb
15
24
 
@@ -19,6 +28,10 @@ config.printr_source = {:active_record => {
19
28
  :path => :attribute_name }
20
29
  }
21
30
 
31
+ If you set the scope, make sure to add:
32
+
33
+ config.scope = 'the_scope_you_passed'
34
+
22
35
  Where:
23
36
 
24
37
  :name must be an attribute of the active record object, and the value it resolves to must be
data/lib/printr.rb CHANGED
@@ -4,6 +4,8 @@ require 'erb'
4
4
  require 'serialport'
5
5
  module Printr
6
6
  require 'printr/engine' if defined?(Rails)
7
+ mattr_accessor :scope
8
+ @@scope = 'printr'
7
9
  mattr_accessor :printr_source #:yaml or :active_record
8
10
  @@printr_source = :yaml
9
11
  # :active_record => {:class_name => ClassName, :name => :model_field_name, :path => :model_path_name
@@ -163,9 +165,9 @@ module Printr
163
165
  return text
164
166
  end
165
167
  def template(name,bndng)
166
- puts "[Printr] attempting to print with template #{RAILS_ROOT}/app/views/printr/#{name}.prnt.erb"
168
+ puts "[Printr] attempting to print with template #{RAILS_ROOT}/app/views/#{Printr.scope}/#{name}.prnt.erb"
167
169
  begin
168
- erb = ERB.new(File.new("#{RAILS_ROOT}/app/views/printr/#{name}.prnt.erb",'r').read)
170
+ erb = ERB.new(File.new("#{RAILS_ROOT}/app/views/#{Printr.scope}/#{name}.prnt.erb",'r').read)
169
171
  rescue Exception => e
170
172
  puts "[Printr] Exception in view: " + e.inspect
171
173
 
data/printr.gemspec CHANGED
@@ -4,7 +4,7 @@ require "printr/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "printr"
7
- s.version = '0.1.5'
7
+ s.version = '0.1.6'
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Michael Franzl","Jason Martin"]
10
10
  s.email = ["jason@jason-knight-martin.com"]
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: printr
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 5
9
- version: 0.1.5
4
+ prerelease:
5
+ version: 0.1.6
10
6
  platform: ruby
11
7
  authors:
12
8
  - Michael Franzl
@@ -15,7 +11,7 @@ autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
13
 
18
- date: 2011-05-19 00:00:00 +02:00
14
+ date: 2011-05-22 00:00:00 +02:00
19
15
  default_executable:
20
16
  dependencies: []
21
17
 
@@ -64,21 +60,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
64
60
  requirements:
65
61
  - - ">="
66
62
  - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
63
  version: "0"
70
64
  required_rubygems_version: !ruby/object:Gem::Requirement
71
65
  none: false
72
66
  requirements:
73
67
  - - ">="
74
68
  - !ruby/object:Gem::Version
75
- segments:
76
- - 0
77
69
  version: "0"
78
70
  requirements: []
79
71
 
80
72
  rubyforge_project: printr
81
- rubygems_version: 1.3.7
73
+ rubygems_version: 1.6.2
82
74
  signing_key:
83
75
  specification_version: 3
84
76
  summary: An engine for interfacing with printers.