Skip to content

Commit 96b4123

Browse files
committed
Merge branch 'master' of github.com:alexch/clauses
2 parents d0cfd30 + 60af23b commit 96b4123

5 files changed

+30
-19
lines changed

README.md

+13-9
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@
22

33
A collection of useful legal clauses for coding consultants or employees to put into their contracts. Written and/or solicited by <a href="http://alexchaffee.com">Alex Chaffee</a>. Available at <https://github.com/alexch/clauses>.
44

5-
Similar clauses at <https://gist.github.com/postmodern/3242224>
6-
75
Disclaimer: I AM NOT A LAWYER. You should run all this by your own legal counsel.
86

9-
# Setup
7+
## Setup
108

11-
MacOS:
9+
### MacOS:
1210
```
1311
brew install caskroom/cask/wkhtmltopdf
1412
bundle install
1513
```
1614

17-
# Usage
15+
## Automatic contract generation
1816

19-
1. edit `contract.md`, especially the variables at the very top of the file
20-
2. `bundle exec ruby process.rb contract.md`
21-
3. open `contract-2000-11-22.pdf` (or whatever today's date is) and proofread it
17+
1. write a contract using [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)
18+
2. use [`{{mustache}}`](https://mustache.github.io/) inside your document's body
19+
3. set variables in your document's header (a bunch of `name:value` lines, terminated with a blank line)
20+
4. run them through `process.rb` like this:
2221

23-
```
22+
./process.rb contract.md
23+
24+
and like magic, a PDF version will appear!
25+
26+
## License
2427

2528
<p xmlns:dct="http://purl.org/dc/terms/">
2629
<a rel="license"
@@ -37,6 +40,7 @@ bundle install
3740

3841
## Similar Projects
3942

43+
* <https://gist.github.com/postmodern/3242224>
4044
* <https://stuffandnonsense.co.uk/projects/contract-killer/>
4145
* <http://www.docracy.com/>
4246

contract-2018-05-14.pdf

0 Bytes
Binary file not shown.

contract.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Consultant will not perform or invoice Client for Services in excess of {{max_ho
2626

2727
2. Fees & Expenses.
2828
Client shall pay Consultant at the rate of ${{rate}} per hour for the Services, and reimburse Consultant for reasonable out-of-pocket expenses incurred in connection with the Services.
29-
An initial deposit of ${{deposit}} will be due prior to the commencement of the Services, and fees will be deducted from such deposit until it is exhausted.
30-
Consultant will transmit an invoice to Client every two weeks, and Client will pay Consultant all amounts due within {{net_days}} days of receipt of such invoice.
29+
{{#deposit}}An initial deposit of ${{deposit}} will be due prior to the commencement of the Services, and fees will be deducted from such deposit until it is exhausted.
30+
{{/deposit}}Consultant will transmit an invoice to Client every two weeks, and Client will pay Consultant all amounts due within {{net_days}} days of receipt of such invoice.
3131
Late payments shall be subject to a late payment fee of {{late_fee}} of the amount due.
3232

3333
3. Intellectual Property.

contract.pdf

-67.9 KB
Binary file not shown.

process.rb

100644100755
+15-8
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,24 @@ def usage
1111

1212
source = ARGV[0] || usage
1313

14+
source = Pathname.new(source)
15+
output_path = File.join(source.dirname,
16+
source.basename.to_s.split('.')[0..-2].join('.') +
17+
'-' + Date.today.iso8601 +
18+
'.pdf')
19+
1420
body = source.is_a?(IO) ? source.read : File.read(source)
1521

22+
def false? x
23+
["false", "0", "no"].include?(x.downcase)
24+
end
25+
1626
# parse headers
1727
if body.each_line.first =~ /^\s+\w+:/
1828
headers, body = body.split("\n\n", 2)
1929
scope = Hash[headers.each_line.map do |line|
2030
line.split(':', 2).map { |x| x.strip }.
21-
map { |x| ["false", "0", "no"].include?(x.downcase) ? false : x }
31+
map { |x| false?(x) ? false : x }
2232
end]
2333
else
2434
scope = {}
@@ -71,14 +81,11 @@ def usage
7181

7282
require 'pdfkit'
7383
kit = PDFKit.new(html,
74-
page_size: 'Letter',
75-
print_media_type: true,
76-
dpi: 400)
84+
:page_size => 'Letter',
85+
:print_media_type => true,
86+
:dpi => 400)
7787
kit.stylesheets << "contract-style.css"
78-
79-
today = Date.today.iso8601
80-
file = kit.to_file("contract-#{today}.pdf")
88+
file = kit.to_file(output_path)
8189

8290
ap file
8391
`open #{file.path}`
84-

0 commit comments

Comments
 (0)