r5 0.2.5 → 0.2.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/r5/installations/default.rb +1 -0
- data/lib/r5/recipes/add_rack_mini_profiler.rb +6 -0
- data/lib/r5/recipes/gemfile.rb +2 -0
- data/lib/r5/recipes/wicked_pdf.rb +26 -1
- data/lib/r5/starter.rb +9 -0
- data/lib/r5/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26550595f90b7f41ecbdbdf365551a9425e0ad78
|
4
|
+
data.tar.gz: 2955c93cfea238c2fa006341ea2c900240376196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4f4c5f4ad3cd380971df462adb4d96c8d53f2c1e62fde59177bb181919c5b2ac23aede0c24d3ca11efb683d5aa9f3ccf9f93e46c5012cbde3ce456977ba3664
|
7
|
+
data.tar.gz: 452d9a2be352275440e8a0b4a1f4cd873c9c9cf35cca38402559f06fbbc743c690df890f9c9711995fe69e77db17ae6930914b1a8383874796029e5579209ad2
|
@@ -41,6 +41,7 @@ remove 'app/views/layouts/application.html.erb'
|
|
41
41
|
copy 'app/views/layouts/application.html.erb'
|
42
42
|
apply 'recipes/mail_settings.rb'
|
43
43
|
apply 'recipes/timepress_specifics.rb'
|
44
|
+
apply 'recipes/add_rack_mini_profiler.rb'
|
44
45
|
gsub_file layout_file, 'PROJECT_NAME', @project_name
|
45
46
|
apply 'recipes/gitignore.rb'
|
46
47
|
run 'git init'
|
data/lib/r5/recipes/gemfile.rb
CHANGED
@@ -7,7 +7,32 @@ add_gem 'wkhtmltopdf-binary'
|
|
7
7
|
run 'bundle install'
|
8
8
|
run 'rails generate wicked_pdf'
|
9
9
|
|
10
|
-
|
10
|
+
instructions = <<-TXT
|
11
|
+
INSTRUCTIONS:
|
12
|
+
Quick test: add 'render pdf: "file_name"' to your controller action
|
13
|
+
(show action is usually the easiest bet) )
|
14
|
+
|
15
|
+
More advanced example:
|
16
|
+
footer_html = render_to_string('offers/footer.html.erb', layout: 'layouts/pdf.html')
|
17
|
+
header_html = render_to_string('offers/header.html.erb', layout: 'layouts/pdf.html')
|
18
|
+
body_html = render_to_string('offers/print.html.erb', layout: 'layouts/pdf.html')
|
19
|
+
|
20
|
+
pdf = WickedPdf.new.pdf_from_string(
|
21
|
+
body_html,
|
22
|
+
header: {content: header_html, spacing: 5},
|
23
|
+
footer: {content: footer_html},
|
24
|
+
page_size: 'A4',
|
25
|
+
margin: {top: 25, bottom: 45, left: 10, right: 10},
|
26
|
+
|
27
|
+
)
|
28
|
+
send_data pdf, filename: "offer_number.pdf",
|
29
|
+
type: 'application/pdf',
|
30
|
+
disposition: 'inline'
|
31
|
+
|
32
|
+
FOR MORE INFORMATION: https://github.com/mileszs/wicked_pdf
|
33
|
+
TXT
|
34
|
+
|
35
|
+
say instructions, :green
|
11
36
|
say "For server - find binary with which wkhtmltopdf and used it as exe_path in config/initializers/wicked_pdf.rb", :red
|
12
37
|
|
13
38
|
|
data/lib/r5/starter.rb
CHANGED
@@ -68,6 +68,11 @@ class Starter < Thor
|
|
68
68
|
apply 'recipes/timepress_specifics.rb'
|
69
69
|
end
|
70
70
|
|
71
|
+
desc 'add_rack_mini_profiler', 'add profiling tool to help you keep an eye on performance'
|
72
|
+
def add_rack_mini_profiler
|
73
|
+
apply 'recipes/add_rack_mini_profiler.rb'
|
74
|
+
end
|
75
|
+
|
71
76
|
desc 'add_wicked_pdf', 'add pdf generation to project'
|
72
77
|
def add_wicked_pdf
|
73
78
|
apply 'recipes/wicked_pdf.rb'
|
@@ -158,6 +163,10 @@ class Starter < Thor
|
|
158
163
|
"\ngem '#{name}'"
|
159
164
|
end
|
160
165
|
end
|
166
|
+
|
167
|
+
def check_gem_existence name
|
168
|
+
File.read("#{@project_path}/Gemfile") =~ /#{name}/
|
169
|
+
end
|
161
170
|
end
|
162
171
|
|
163
172
|
end
|
data/lib/r5/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r5
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.5
|
4
|
+
version: 0.2.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mousse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/r5/installations/default.rb
|
74
74
|
- lib/r5/installations/testing.rb
|
75
75
|
- lib/r5/odin.rb
|
76
|
+
- lib/r5/recipes/add_rack_mini_profiler.rb
|
76
77
|
- lib/r5/recipes/bootstrap.rb
|
77
78
|
- lib/r5/recipes/bootstrap_app.rb
|
78
79
|
- lib/r5/recipes/devise.rb
|