lease 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +15 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +196 -0
- data/LICENSE.txt +21 -0
- data/README.md +29 -0
- data/Rakefile +6 -0
- data/app/.DS_Store +0 -0
- data/app/models/lease/.DS_Store +0 -0
- data/app/models/lease/envelope.rb +63 -0
- data/app/models/lease/template.rb +10 -0
- data/app/uploaders/lease/document_uploader.rb +51 -0
- data/db/migrate/.DS_Store +0 -0
- data/db/migrate/create_lease_envelopes.rb +12 -0
- data/db/migrate/create_lease_templates.rb +8 -0
- data/lease.gemspec +34 -0
- data/lib/generators/lease/install_generator.rb +60 -0
- data/lib/lease/.DS_Store +0 -0
- data/lib/lease/active_record.rb +9 -0
- data/lib/lease/config.rb +11 -0
- data/lib/lease/engine.rb +11 -0
- data/lib/lease/version.rb +3 -0
- data/lib/lease.rb +20 -0
- metadata +206 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2be63f29aefc7beb86b4646de33e0b298a86988f207813028c2b1d20a707ea05
|
4
|
+
data.tar.gz: b9de86ef8bd2e00212c520fb70ddf00534c86d7706842a20f6ef69218939a6d5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 52d417ed5229121af07e8baf35741eba1965123792df62c515e48b77255b29476c69c72719d33a5fd1f7daea7f0d8aeefc088ccd85e5445d8fa906331f930219
|
7
|
+
data.tar.gz: 4daf8ce6eb9a4bb39dd59e92b720c15e3e90d42cd1d9020f1dea06ab97a2cd24b263b43894ac72d9995354b672bde66bcf310c504ed76ce704269e3afa9c3752
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
lease (0.1.0)
|
5
|
+
carrierwave (~> 1.0)
|
6
|
+
rails (~> 5)
|
7
|
+
wicked_pdf (~> 1.1.0)
|
8
|
+
wkhtmltopdf-binary (~> 0.12.3.1)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
actioncable (5.2.3)
|
14
|
+
actionpack (= 5.2.3)
|
15
|
+
nio4r (~> 2.0)
|
16
|
+
websocket-driver (>= 0.6.1)
|
17
|
+
actionmailer (5.2.3)
|
18
|
+
actionpack (= 5.2.3)
|
19
|
+
actionview (= 5.2.3)
|
20
|
+
activejob (= 5.2.3)
|
21
|
+
mail (~> 2.5, >= 2.5.4)
|
22
|
+
rails-dom-testing (~> 2.0)
|
23
|
+
actionpack (5.2.3)
|
24
|
+
actionview (= 5.2.3)
|
25
|
+
activesupport (= 5.2.3)
|
26
|
+
rack (~> 2.0)
|
27
|
+
rack-test (>= 0.6.3)
|
28
|
+
rails-dom-testing (~> 2.0)
|
29
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
30
|
+
actionview (5.2.3)
|
31
|
+
activesupport (= 5.2.3)
|
32
|
+
builder (~> 3.1)
|
33
|
+
erubi (~> 1.4)
|
34
|
+
rails-dom-testing (~> 2.0)
|
35
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
36
|
+
activejob (5.2.3)
|
37
|
+
activesupport (= 5.2.3)
|
38
|
+
globalid (>= 0.3.6)
|
39
|
+
activemodel (5.2.3)
|
40
|
+
activesupport (= 5.2.3)
|
41
|
+
activerecord (5.2.3)
|
42
|
+
activemodel (= 5.2.3)
|
43
|
+
activesupport (= 5.2.3)
|
44
|
+
arel (>= 9.0)
|
45
|
+
activestorage (5.2.3)
|
46
|
+
actionpack (= 5.2.3)
|
47
|
+
activerecord (= 5.2.3)
|
48
|
+
marcel (~> 0.3.1)
|
49
|
+
activesupport (5.2.3)
|
50
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
51
|
+
i18n (>= 0.7, < 2)
|
52
|
+
minitest (~> 5.1)
|
53
|
+
tzinfo (~> 1.1)
|
54
|
+
arel (9.0.0)
|
55
|
+
builder (3.2.3)
|
56
|
+
carrierwave (1.3.1)
|
57
|
+
activemodel (>= 4.0.0)
|
58
|
+
activesupport (>= 4.0.0)
|
59
|
+
mime-types (>= 1.16)
|
60
|
+
coderay (1.1.2)
|
61
|
+
concurrent-ruby (1.1.5)
|
62
|
+
coveralls (0.8.22)
|
63
|
+
json (>= 1.8, < 3)
|
64
|
+
simplecov (~> 0.16.1)
|
65
|
+
term-ansicolor (~> 1.3)
|
66
|
+
thor (~> 0.19.4)
|
67
|
+
tins (~> 1.6)
|
68
|
+
crass (1.0.4)
|
69
|
+
diff-lcs (1.3)
|
70
|
+
docile (1.3.1)
|
71
|
+
erubi (1.8.0)
|
72
|
+
factory_bot (4.11.1)
|
73
|
+
activesupport (>= 3.0.0)
|
74
|
+
factory_bot_rails (4.11.1)
|
75
|
+
factory_bot (~> 4.11.1)
|
76
|
+
railties (>= 3.0.0)
|
77
|
+
faker (1.9.3)
|
78
|
+
i18n (>= 0.7)
|
79
|
+
globalid (0.4.2)
|
80
|
+
activesupport (>= 4.2.0)
|
81
|
+
i18n (1.6.0)
|
82
|
+
concurrent-ruby (~> 1.0)
|
83
|
+
json (2.2.0)
|
84
|
+
loofah (2.2.3)
|
85
|
+
crass (~> 1.0.2)
|
86
|
+
nokogiri (>= 1.5.9)
|
87
|
+
mail (2.7.1)
|
88
|
+
mini_mime (>= 0.1.1)
|
89
|
+
marcel (0.3.3)
|
90
|
+
mimemagic (~> 0.3.2)
|
91
|
+
method_source (0.9.2)
|
92
|
+
mime-types (3.2.2)
|
93
|
+
mime-types-data (~> 3.2015)
|
94
|
+
mime-types-data (3.2019.0331)
|
95
|
+
mimemagic (0.3.3)
|
96
|
+
mini_mime (1.0.1)
|
97
|
+
mini_portile2 (2.4.0)
|
98
|
+
minitest (5.11.3)
|
99
|
+
nio4r (2.3.1)
|
100
|
+
nokogiri (1.10.3)
|
101
|
+
mini_portile2 (~> 2.4.0)
|
102
|
+
pry (0.11.3)
|
103
|
+
coderay (~> 1.1.0)
|
104
|
+
method_source (~> 0.9.0)
|
105
|
+
rack (2.0.7)
|
106
|
+
rack-test (1.1.0)
|
107
|
+
rack (>= 1.0, < 3)
|
108
|
+
rails (5.2.3)
|
109
|
+
actioncable (= 5.2.3)
|
110
|
+
actionmailer (= 5.2.3)
|
111
|
+
actionpack (= 5.2.3)
|
112
|
+
actionview (= 5.2.3)
|
113
|
+
activejob (= 5.2.3)
|
114
|
+
activemodel (= 5.2.3)
|
115
|
+
activerecord (= 5.2.3)
|
116
|
+
activestorage (= 5.2.3)
|
117
|
+
activesupport (= 5.2.3)
|
118
|
+
bundler (>= 1.3.0)
|
119
|
+
railties (= 5.2.3)
|
120
|
+
sprockets-rails (>= 2.0.0)
|
121
|
+
rails-dom-testing (2.0.3)
|
122
|
+
activesupport (>= 4.2.0)
|
123
|
+
nokogiri (>= 1.6)
|
124
|
+
rails-html-sanitizer (1.0.4)
|
125
|
+
loofah (~> 2.2, >= 2.2.2)
|
126
|
+
railties (5.2.3)
|
127
|
+
actionpack (= 5.2.3)
|
128
|
+
activesupport (= 5.2.3)
|
129
|
+
method_source
|
130
|
+
rake (>= 0.8.7)
|
131
|
+
thor (>= 0.19.0, < 2.0)
|
132
|
+
rake (12.3.2)
|
133
|
+
rspec (3.8.0)
|
134
|
+
rspec-core (~> 3.8.0)
|
135
|
+
rspec-expectations (~> 3.8.0)
|
136
|
+
rspec-mocks (~> 3.8.0)
|
137
|
+
rspec-core (3.8.0)
|
138
|
+
rspec-support (~> 3.8.0)
|
139
|
+
rspec-expectations (3.8.3)
|
140
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
141
|
+
rspec-support (~> 3.8.0)
|
142
|
+
rspec-mocks (3.8.0)
|
143
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
144
|
+
rspec-support (~> 3.8.0)
|
145
|
+
rspec-rails (3.8.2)
|
146
|
+
actionpack (>= 3.0)
|
147
|
+
activesupport (>= 3.0)
|
148
|
+
railties (>= 3.0)
|
149
|
+
rspec-core (~> 3.8.0)
|
150
|
+
rspec-expectations (~> 3.8.0)
|
151
|
+
rspec-mocks (~> 3.8.0)
|
152
|
+
rspec-support (~> 3.8.0)
|
153
|
+
rspec-support (3.8.0)
|
154
|
+
simplecov (0.16.1)
|
155
|
+
docile (~> 1.1)
|
156
|
+
json (>= 1.8, < 3)
|
157
|
+
simplecov-html (~> 0.10.0)
|
158
|
+
simplecov-html (0.10.2)
|
159
|
+
sprockets (3.7.2)
|
160
|
+
concurrent-ruby (~> 1.0)
|
161
|
+
rack (> 1, < 3)
|
162
|
+
sprockets-rails (3.2.1)
|
163
|
+
actionpack (>= 4.0)
|
164
|
+
activesupport (>= 4.0)
|
165
|
+
sprockets (>= 3.0.0)
|
166
|
+
sqlite3 (1.4.0)
|
167
|
+
term-ansicolor (1.7.1)
|
168
|
+
tins (~> 1.0)
|
169
|
+
thor (0.19.4)
|
170
|
+
thread_safe (0.3.6)
|
171
|
+
tins (1.20.2)
|
172
|
+
tzinfo (1.2.5)
|
173
|
+
thread_safe (~> 0.1)
|
174
|
+
websocket-driver (0.7.0)
|
175
|
+
websocket-extensions (>= 0.1.0)
|
176
|
+
websocket-extensions (0.1.3)
|
177
|
+
wicked_pdf (1.1.0)
|
178
|
+
wkhtmltopdf-binary (0.12.3.1)
|
179
|
+
|
180
|
+
PLATFORMS
|
181
|
+
ruby
|
182
|
+
|
183
|
+
DEPENDENCIES
|
184
|
+
bundler (~> 1.17.3)
|
185
|
+
coveralls
|
186
|
+
factory_bot_rails (~> 4.8)
|
187
|
+
faker
|
188
|
+
lease!
|
189
|
+
pry
|
190
|
+
rake (~> 12.3)
|
191
|
+
rspec (~> 3.7)
|
192
|
+
rspec-rails (~> 3.7)
|
193
|
+
sqlite3 (~> 1)
|
194
|
+
|
195
|
+
BUNDLED WITH
|
196
|
+
1.17.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Ninja Rails
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Lease
|
2
|
+
|
3
|
+
Trying to simplify the lease pdf/html management
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
On any model you want to treat as a "signer" of an envelope/template, add `leasable` to create an association to both envelopes and templates:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
class User < ApplicationRecord
|
11
|
+
|
12
|
+
leasable
|
13
|
+
|
14
|
+
end
|
15
|
+
```
|
16
|
+
## Development
|
17
|
+
|
18
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
19
|
+
|
20
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mingca/lease. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
25
|
+
|
26
|
+
## License
|
27
|
+
|
28
|
+
The gem is available as open source under the terms of the [GNU General Public License](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
29
|
+
|
data/Rakefile
ADDED
data/app/.DS_Store
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'wicked_pdf'
|
2
|
+
|
3
|
+
module Lease
|
4
|
+
class Envelope < ::ActiveRecord::Base
|
5
|
+
|
6
|
+
mount_uploader :signed_pdf, ::Lease::DocumentUploader
|
7
|
+
|
8
|
+
belongs_to :template
|
9
|
+
belongs_to :envelopable, polymorphic: true
|
10
|
+
belongs_to :signable, polymorphic: true
|
11
|
+
|
12
|
+
enum status: [:unsigned, :rejected, :signed]
|
13
|
+
|
14
|
+
def unsigned_html(vars)
|
15
|
+
interpolate(with_blank_sign(vars))
|
16
|
+
end
|
17
|
+
|
18
|
+
def with_unsigned_pdf(vars, &block)
|
19
|
+
with_generate_pdf(unsigned_html(vars), &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
def sign(vars)
|
23
|
+
return false if signed?
|
24
|
+
|
25
|
+
html = interpolate(with_sign(vars))
|
26
|
+
with_generate_pdf(html) do |temp_pdf|
|
27
|
+
update(signed_pdf: temp_pdf)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def with_generate_pdf(html, &block)
|
34
|
+
random = SecureRandom.hex(4)
|
35
|
+
pdf_string = WickedPdf.new.pdf_from_string(html, extra: '--enable-forms')
|
36
|
+
pdf_file_name = Rails.root.join('tmp', 'pdf_lease_documents', "pdf-lease-#{envelopable.id}-#{random}.pdf")
|
37
|
+
pdf_file = File.new(pdf_file_name, 'a+:ASCII-8BIT')
|
38
|
+
pdf_file.write(pdf_string)
|
39
|
+
|
40
|
+
yield pdf_file
|
41
|
+
|
42
|
+
File.delete(pdf_file_name)
|
43
|
+
end
|
44
|
+
|
45
|
+
def interpolate(vars)
|
46
|
+
page = Nokogiri::HTML(template.html_file.read)
|
47
|
+
vars.each do |id, value|
|
48
|
+
span = page.at_css("[id=\"#{id}\"]")
|
49
|
+
span.content = value
|
50
|
+
end
|
51
|
+
page.to_html
|
52
|
+
end
|
53
|
+
|
54
|
+
def with_blank_sign(vars)
|
55
|
+
vars.merge(Lease.config.lessee_sign_key => '')
|
56
|
+
end
|
57
|
+
|
58
|
+
def with_sign(vars)
|
59
|
+
vars.merge(Lease.config.lessee_sign_key => signable.full_name)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Lease
|
2
|
+
class DocumentUploader < ::CarrierWave::Uploader::Base
|
3
|
+
|
4
|
+
# Include RMagick or MiniMagick support:
|
5
|
+
# include CarrierWave::RMagick
|
6
|
+
# include CarrierWave::MiniMagick
|
7
|
+
|
8
|
+
# Choose what kind of storage to use for this uploader:
|
9
|
+
storage :file
|
10
|
+
# storage :fog
|
11
|
+
|
12
|
+
# Override the directory where uploaded files will be stored.
|
13
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
14
|
+
def store_dir
|
15
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
|
16
|
+
end
|
17
|
+
|
18
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
19
|
+
# def default_url(*args)
|
20
|
+
# # For Rails 3.1+ asset pipeline compatibility:
|
21
|
+
# # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
|
22
|
+
#
|
23
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
24
|
+
# end
|
25
|
+
|
26
|
+
# Process files as they are uploaded:
|
27
|
+
# process scale: [200, 300]
|
28
|
+
#
|
29
|
+
# def scale(width, height)
|
30
|
+
# # do something
|
31
|
+
# end
|
32
|
+
|
33
|
+
# Create different versions of your uploaded files:
|
34
|
+
# version :thumb do
|
35
|
+
# process resize_to_fit: [50, 50]
|
36
|
+
# end
|
37
|
+
|
38
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
39
|
+
# For images you might use something like this:
|
40
|
+
def extension_whitelist
|
41
|
+
%w(pdf html)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Override the filename of the uploaded files:
|
45
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
46
|
+
# def filename
|
47
|
+
# "something.jpg" if original_filename
|
48
|
+
# end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
Binary file
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateLeaseEnvelopes < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :lease_envelopes do |t|
|
4
|
+
t.integer :template_id
|
5
|
+
t.string :lessee_name
|
6
|
+
t.integer :status, default: 0
|
7
|
+
t.string :signed_pdf
|
8
|
+
t.references :envelopable, polymorphic: true, index: { name: 'index_lease_envelopes_on_envelopable_type_and_id' }
|
9
|
+
t.references :signable, polymorphic: true, index: { name: 'index_lease_envelopes_on_signable_type_and_id' }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lease.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lease/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'lease'
|
8
|
+
spec.version = Lease::VERSION
|
9
|
+
spec.authors = ['Ninja Rails']
|
10
|
+
spec.email = ['ninjarailsdev@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = %q{Lease templates and envelopes}
|
13
|
+
spec.homepage = 'https://www.github.com/lease'
|
14
|
+
spec.license = 'GPL-3.0'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = 'exe'
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_dependency 'rails', '~> 5'
|
24
|
+
spec.add_dependency 'carrierwave', '~> 1.0'
|
25
|
+
spec.add_dependency 'wicked_pdf', '~> 1.1.0'
|
26
|
+
spec.add_dependency 'wkhtmltopdf-binary', '~> 0.12.3.1'
|
27
|
+
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.17.3'
|
29
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
30
|
+
spec.add_development_dependency 'rspec', '~> 3.7'
|
31
|
+
spec.add_development_dependency 'rspec-rails', '~> 3.7'
|
32
|
+
spec.add_development_dependency 'factory_bot_rails', '~> 4.8'
|
33
|
+
spec.add_development_dependency 'sqlite3', '~> 1'
|
34
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Lease
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
source_root File.expand_path('../../../../', __FILE__)
|
6
|
+
|
7
|
+
desc 'Install Lease'
|
8
|
+
|
9
|
+
def copy_uploader
|
10
|
+
copy_file 'app/uploaders/lease/document_uploader.rb', Rails.root.join('app', 'uploaders', 'lease', 'document_uploader.rb')
|
11
|
+
end
|
12
|
+
|
13
|
+
def copy_migrations
|
14
|
+
copy_migration 'create_lease_envelopes'
|
15
|
+
copy_migration 'create_lease_templates'
|
16
|
+
end
|
17
|
+
|
18
|
+
def copy_initializer
|
19
|
+
create_file Rails.root.join('config', 'initializers', 'lease.rb'), <<-CONTENT
|
20
|
+
Lease.setup do |config|
|
21
|
+
|
22
|
+
# Tenant sign span id ( This is used to find the sign area in the document and fill in the tenant full name)
|
23
|
+
config.lessee_sign_key = :tenant_full_name
|
24
|
+
|
25
|
+
end
|
26
|
+
FileUtils.mkdir_p "#{Rails.root}/tmp/pdf_lease_documents"
|
27
|
+
CONTENT
|
28
|
+
end
|
29
|
+
|
30
|
+
protected
|
31
|
+
|
32
|
+
def copy_migration(filename)
|
33
|
+
if migration_exists?(Rails.root.join('db', 'migrate'), filename)
|
34
|
+
say_status('skipped', "Migration #{filename}.rb already exists")
|
35
|
+
else
|
36
|
+
copy_file "db/migrate/#{filename}.rb", Rails.root.join('db', 'migrate', "#{migration_number}_#{filename}.rb")
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def migration_exists?(dirname, filename)
|
41
|
+
Dir.glob("#{dirname}/[0-9]*_*.rb").grep(/\d+_#{filename}.rb$/).first
|
42
|
+
end
|
43
|
+
|
44
|
+
def migration_id_exists?(dirname, id)
|
45
|
+
Dir.glob("#{dirname}/#{id}*").length > 0
|
46
|
+
end
|
47
|
+
|
48
|
+
def migration_number
|
49
|
+
@migration_number ||= Time.now.strftime("%Y%m%d%H%M%S").to_i
|
50
|
+
|
51
|
+
while migration_id_exists?(Rails.root.join('db', 'migrate'), @migration_number) do
|
52
|
+
@migration_number += 1
|
53
|
+
end
|
54
|
+
|
55
|
+
@migration_number
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/lease/.DS_Store
ADDED
Binary file
|
data/lib/lease/config.rb
ADDED
data/lib/lease/engine.rb
ADDED
data/lib/lease.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'lease/version'
|
2
|
+
require 'lease/config'
|
3
|
+
require 'lease/active_record'
|
4
|
+
require 'carrierwave'
|
5
|
+
|
6
|
+
module Lease
|
7
|
+
|
8
|
+
class Error < StandardError; end
|
9
|
+
|
10
|
+
def self.setup
|
11
|
+
yield config
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.config
|
15
|
+
@config ||= Config.new
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'lease/engine' if defined?(Rails)
|
metadata
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lease
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ninja Rails
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-04-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: carrierwave
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: wicked_pdf
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.1.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.1.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: wkhtmltopdf-binary
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.12.3.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.12.3.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.17.3
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.17.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '12.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '12.3'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.7'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.7'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec-rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '3.7'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '3.7'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: factory_bot_rails
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '4.8'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '4.8'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sqlite3
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1'
|
153
|
+
description:
|
154
|
+
email:
|
155
|
+
- ninjarailsdev@gmail.com
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".DS_Store"
|
161
|
+
- ".gitignore"
|
162
|
+
- Gemfile
|
163
|
+
- Gemfile.lock
|
164
|
+
- LICENSE.txt
|
165
|
+
- README.md
|
166
|
+
- Rakefile
|
167
|
+
- app/.DS_Store
|
168
|
+
- app/models/lease/.DS_Store
|
169
|
+
- app/models/lease/envelope.rb
|
170
|
+
- app/models/lease/template.rb
|
171
|
+
- app/uploaders/lease/document_uploader.rb
|
172
|
+
- db/migrate/.DS_Store
|
173
|
+
- db/migrate/create_lease_envelopes.rb
|
174
|
+
- db/migrate/create_lease_templates.rb
|
175
|
+
- lease.gemspec
|
176
|
+
- lib/generators/lease/install_generator.rb
|
177
|
+
- lib/lease.rb
|
178
|
+
- lib/lease/.DS_Store
|
179
|
+
- lib/lease/active_record.rb
|
180
|
+
- lib/lease/config.rb
|
181
|
+
- lib/lease/engine.rb
|
182
|
+
- lib/lease/version.rb
|
183
|
+
homepage: https://www.github.com/lease
|
184
|
+
licenses:
|
185
|
+
- GPL-3.0
|
186
|
+
metadata: {}
|
187
|
+
post_install_message:
|
188
|
+
rdoc_options: []
|
189
|
+
require_paths:
|
190
|
+
- lib
|
191
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
196
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
requirements: []
|
202
|
+
rubygems_version: 3.0.2
|
203
|
+
signing_key:
|
204
|
+
specification_version: 4
|
205
|
+
summary: Lease templates and envelopes
|
206
|
+
test_files: []
|