chili_pdf 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -0
- data/Gemfile.lock +21 -0
- data/History.txt +4 -0
- data/LICENSE +20 -0
- data/Manifest.txt +19 -0
- data/README.md +138 -0
- data/Rakefile +36 -0
- data/app/controllers/extended_wiki_controller.rb +24 -0
- data/app/views/extended_wiki/show.pdf.html.erb +5 -0
- data/app/views/layouts/pdf.pdf.erb +23 -0
- data/assets/stylesheets/pdf.css +33 -0
- data/autotest/discover.rb +4 -0
- data/config/routes.rb +3 -0
- data/init.rb +19 -0
- data/lib/chili_pdf.rb +3 -0
- data/lib/tasks/chili_pdf_tasks.rb +77 -0
- data/lib/user_patch.rb +48 -0
- data/rails/init.rb +1 -0
- data/test/test_helper.rb +77 -0
- data.tar.gz.sig +0 -0
- metadata +142 -0
- metadata.gz.sig +0 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
ZenTest (4.5.0)
|
5
|
+
autotest-rails (4.1.0)
|
6
|
+
ZenTest
|
7
|
+
fakeweb (1.3.0)
|
8
|
+
hoe (2.8.0)
|
9
|
+
rake (>= 0.8.7)
|
10
|
+
rake (0.8.7)
|
11
|
+
wicked_pdf (0.7.0)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
ZenTest
|
18
|
+
autotest-rails (~> 4.1.0)
|
19
|
+
fakeweb
|
20
|
+
hoe (~> 2.8.0)
|
21
|
+
wicked_pdf
|
data/History.txt
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Tom Kersten
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Gemfile
|
2
|
+
Gemfile.lock
|
3
|
+
History.txt
|
4
|
+
LICENSE
|
5
|
+
Manifest.txt
|
6
|
+
README.md
|
7
|
+
Rakefile
|
8
|
+
app/controllers/extended_wiki_controller.rb
|
9
|
+
app/views/extended_wiki/show.pdf.html.erb
|
10
|
+
app/views/layouts/pdf.pdf.erb
|
11
|
+
assets/stylesheets/pdf.css
|
12
|
+
autotest/discover.rb
|
13
|
+
config/routes.rb
|
14
|
+
init.rb
|
15
|
+
lib/chili_pdf.rb
|
16
|
+
lib/tasks/chili_pdf_tasks.rb
|
17
|
+
lib/user_patch.rb
|
18
|
+
rails/init.rb
|
19
|
+
test/test_helper.rb
|
data/README.md
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
# ChiliPDF Plugin - Flexible PDF exporting for ChiliProject/Redmine
|
2
|
+
|
3
|
+
* http://github.com/tomkersten/chili_pdf
|
4
|
+
|
5
|
+
## DESCRIPTION:
|
6
|
+
|
7
|
+
ChiliProject (/Redmine) plugin which implements/enhances PDF-export functionality using the Webkit rendering engine (via the 'wkhtmltopdf' executable).
|
8
|
+
|
9
|
+
## NOTABLE ITEMS TO CONSIDER
|
10
|
+
|
11
|
+
1. This plugin is distributed as a gem, but does ship with asset files
|
12
|
+
(stylesheets, etc). Therefore, the installation procedure is not
|
13
|
+
the standard process.
|
14
|
+
1. There is a dependency on having the wkhtmltopdf binary installed.on your
|
15
|
+
server. Technically this is a dependency of the library being used to
|
16
|
+
generate the PDFs ([wicked_pdf](https://github.com/mileszs/wicked_pdf)),
|
17
|
+
but, it's something you should be aware of.
|
18
|
+
1. Requires a patch to the Redmine/ChiliProject core application in order to
|
19
|
+
prevent a 'Double render' error on the WikiController. A pull request
|
20
|
+
[has been submitted](https://github.com/chiliproject/chiliproject/pull/62)
|
21
|
+
to the ChiliProject core team. Until then, you can manually apply the (small)
|
22
|
+
patch to your app if you like. The changeset can be found
|
23
|
+
[here](https://github.com/tomkersten/chiliproject/commit/b4e345dca9d72d8af9e8326c7cd8642e550be379).
|
24
|
+
|
25
|
+
## FEATURES:
|
26
|
+
|
27
|
+
1. Provides PDF export of any project wiki page to PDF with a baseline
|
28
|
+
stylesheet. The styling can be customized by modifying the "pdf.css'
|
29
|
+
asset file that ships with the library.
|
30
|
+
|
31
|
+
## SCREENSHOTS:
|
32
|
+
|
33
|
+
You can find a few screenshots [here](http://www.flickr.com/photos/tomkersten/sets/72157626768112790/).
|
34
|
+
|
35
|
+
## PROBLEMS:
|
36
|
+
|
37
|
+
1. No other PDF exports have been implemented yet using this library, so there will
|
38
|
+
be two PDF libraries in your application if you add this plugin. This won't cause
|
39
|
+
any problems, but...just know that any other PDF exports you do are not a result
|
40
|
+
of this gem. Issues, roadmaps, and Gantt charts will likely be coming if the
|
41
|
+
wiki exports show promise.
|
42
|
+
|
43
|
+
## SYNOPSIS:
|
44
|
+
|
45
|
+
1. Install **version 0.9.9** of the [wkhtmltopdf](http://wkhtmltopdf.googlecode.com/) executable on the machine
|
46
|
+
hosting ChiliProject. You can find binaries for Mac, Windows, and Linux [here](http://code.google.com/p/wkhtmltopdf/downloads/list).
|
47
|
+
1. Install the chili\_pdf gem
|
48
|
+
1. Cycle your application servers (Mongrel, unicorn, Passenger, etc)
|
49
|
+
1. Visit any wiki page and manually add a '.pdf' extension to the URL
|
50
|
+
1. **NOTE:** You must be on an individual wiki page. Manually adding
|
51
|
+
the '.pdf' on the 'default wiki page' URL (/projects/:project_id/wiki)
|
52
|
+
will not work correctly at this time. The manual step will be removed
|
53
|
+
in a future release.
|
54
|
+
|
55
|
+
## REQUIREMENTS:
|
56
|
+
|
57
|
+
* wicked\_pdf
|
58
|
+
|
59
|
+
## INSTALL:
|
60
|
+
|
61
|
+
```
|
62
|
+
gem install chili_pdf
|
63
|
+
```
|
64
|
+
|
65
|
+
### Manual steps after gem installation
|
66
|
+
|
67
|
+
In your 'config/environment.rb', add:
|
68
|
+
|
69
|
+
``` ruby
|
70
|
+
config.gem 'chili_pdf'
|
71
|
+
```
|
72
|
+
|
73
|
+
In your 'Rakefile', add:
|
74
|
+
|
75
|
+
``` ruby
|
76
|
+
require 'chili_videos'
|
77
|
+
```
|
78
|
+
|
79
|
+
Run the installation rake task (installs assets)
|
80
|
+
|
81
|
+
```
|
82
|
+
RAILS_ENV=production rake chili_pdf:install
|
83
|
+
```
|
84
|
+
|
85
|
+
Cycle your application server (mongrel, unicorn, etc)
|
86
|
+
|
87
|
+
## UNINSTALL:
|
88
|
+
|
89
|
+
Run the uninstall rake task (reverts migrations & uninstalls assets)
|
90
|
+
|
91
|
+
```
|
92
|
+
RAILS_ENV=production rake chili_pdf:uninstall
|
93
|
+
```
|
94
|
+
|
95
|
+
In your 'Rakefile', remove:
|
96
|
+
|
97
|
+
``` ruby
|
98
|
+
require 'chili_pdf'
|
99
|
+
```
|
100
|
+
|
101
|
+
In your 'config/environment.rb', remove:
|
102
|
+
|
103
|
+
``` ruby
|
104
|
+
config.gem 'chili_pdf'
|
105
|
+
```
|
106
|
+
|
107
|
+
Cycle your application server (mongrel, unicorn, whatevs)...
|
108
|
+
|
109
|
+
Then, uninstall the chili_pdf gem:
|
110
|
+
|
111
|
+
```
|
112
|
+
gem uninstall chili_pdf
|
113
|
+
```
|
114
|
+
|
115
|
+
Done.
|
116
|
+
|
117
|
+
## CONTRIBUTING AND/OR SUPPORT:
|
118
|
+
|
119
|
+
### Found a bug? Have a feature request?
|
120
|
+
|
121
|
+
Please file a ticket on the '[Issues](https://github.com/tomkersten/chili_pdf/issues)'
|
122
|
+
page of the Github project site
|
123
|
+
|
124
|
+
You can also drop me a message on Twitter [@tomkersten](http://twitter.com/tomkersten).
|
125
|
+
|
126
|
+
### Want to contribute?
|
127
|
+
|
128
|
+
(Better instructions coming soon)
|
129
|
+
|
130
|
+
1. Fork the project
|
131
|
+
1. Create a feature branch and implement your idea (preferably with
|
132
|
+
tests)
|
133
|
+
1. Update the History.txt file in the 'Next Release' section (at the top)
|
134
|
+
1. Send a pull request
|
135
|
+
|
136
|
+
## LICENSE:
|
137
|
+
|
138
|
+
Refer to the [LICENSE](https://github.com/tomkersten/chili_pdf/blob/master/LICENSE) file
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$:.unshift('lib')
|
3
|
+
require 'redmine_plugin_support'
|
4
|
+
require 'chili_pdf'
|
5
|
+
require 'tasks/contributor_tasks'
|
6
|
+
|
7
|
+
RedminePluginSupport::Base.setup do |plugin|
|
8
|
+
plugin.project_name = 'chili_pdf'
|
9
|
+
plugin.default_task = [:test]
|
10
|
+
plugin.tasks = [:db, :doc, :release, :clean, :test]
|
11
|
+
plugin.redmine_root = File.expand_path(File.dirname(__FILE__) + '/../../../')
|
12
|
+
end
|
13
|
+
|
14
|
+
Dir["/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
|
15
|
+
|
16
|
+
task :default => [:test]
|
17
|
+
|
18
|
+
begin
|
19
|
+
require 'hoe'
|
20
|
+
Hoe.plugin :git
|
21
|
+
|
22
|
+
$hoe = Hoe.spec('chili_pdf') do
|
23
|
+
self.readme_file = 'README.md'
|
24
|
+
self.version = ChiliPDF::VERSION
|
25
|
+
self.extra_rdoc_files = FileList['README.md', 'LICENSE', 'History.txt']
|
26
|
+
self.summary = "ChiliProject (/Redmine) plugin which implements/enhances PDF-export functionality using the Webkit rendering engine."
|
27
|
+
self.extra_deps = [['wicked_pdf', '0.7.0']]
|
28
|
+
self.extra_dev_deps = []
|
29
|
+
developer('Tom Kersten', 'tom@whitespur.com')
|
30
|
+
end
|
31
|
+
|
32
|
+
ContributorTasks.new
|
33
|
+
rescue LoadError
|
34
|
+
puts "You are missing the 'hoe' gem, which is used for gem packaging & release management."
|
35
|
+
puts "Install using 'gem install hoe' if you need packaging & release rake tasks."
|
36
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class ExtendedWikiController < WikiController
|
2
|
+
unloadable
|
3
|
+
|
4
|
+
def show
|
5
|
+
super
|
6
|
+
unless performed? # Prevent double render
|
7
|
+
respond_to do |format|
|
8
|
+
format.html {render :template => 'wiki/show'}
|
9
|
+
format.pdf {
|
10
|
+
render :pdf => "#{@project.name.underscore}_#{@page.title}",
|
11
|
+
:template => 'extended_wiki/show.pdf.html.erb',
|
12
|
+
:page_size => "Letter",
|
13
|
+
:user_style_sheet => "#{Rails.root}/public/plugin_assets/chili_pdf/stylesheets/pdf.css",
|
14
|
+
:margin => {
|
15
|
+
:top => "0.5in",
|
16
|
+
:bottom => "0.5in",
|
17
|
+
:left => "0.5in",
|
18
|
+
:right => "0.5in"
|
19
|
+
}
|
20
|
+
}
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
|
3
|
+
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
|
4
|
+
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
|
5
|
+
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
6
|
+
<head>
|
7
|
+
<meta charset="utf-8">
|
8
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
9
|
+
<meta name="description" content="GN Research Organization">
|
10
|
+
<meta name="author" content="">
|
11
|
+
|
12
|
+
<%- if request.format.html? %>
|
13
|
+
<link rel="stylesheet" href="<%= root_url %>stylesheets/pdf.css">
|
14
|
+
<%- end %>
|
15
|
+
|
16
|
+
<!-- Mobile viewport optimized: j.mp/bplateviewport -->
|
17
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
18
|
+
</head>
|
19
|
+
|
20
|
+
<body>
|
21
|
+
<%= yield(:layout) %>
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/* Reset CSS. http://yui.yahooapis.com/3.2.0/build/cssreset/reset-min.css */
|
2
|
+
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,
|
3
|
+
pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}
|
4
|
+
table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,
|
5
|
+
cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}
|
6
|
+
caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}
|
7
|
+
q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}
|
8
|
+
sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,
|
9
|
+
select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,
|
10
|
+
select{*font-size:100%;}legend{color:#000;}
|
11
|
+
|
12
|
+
/* Your Base Foundation */
|
13
|
+
html,body { font-family: sans-serif; font-size:12px; }
|
14
|
+
h1 { font-size:18px; }
|
15
|
+
h2 { font-size:16px; }
|
16
|
+
h3 { font-size:14px; }
|
17
|
+
h4 { font-size:12px; }
|
18
|
+
strong { font-weight:900 !important; }
|
19
|
+
hr { border:0; margin:0; padding:0; height:1px; color:#000; background-color:#000; }
|
20
|
+
|
21
|
+
/* Page Breaks */
|
22
|
+
.pb_before { page-break-before:always !important; }
|
23
|
+
.pb_after { page-break-after:always !important; }
|
24
|
+
.pbi_avoid { page-break-inside:avoid !important; }
|
25
|
+
|
26
|
+
|
27
|
+
/* Redmine/Chili-specific formatting */
|
28
|
+
a.wiki-anchor { display:none; }
|
29
|
+
|
30
|
+
h1, h2, h3, h4 { margin: 0.5em 0; }
|
31
|
+
ul,ol {margin: 0 0 0 3em; padding: 0.1em;}
|
32
|
+
li { list-style-type: decimal; padding: 0.1em; }
|
33
|
+
h1, h2 {font-weight: bold;}
|
data/config/routes.rb
ADDED
data/init.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'redmine'
|
2
|
+
require 'chili_pdf'
|
3
|
+
require 'wicked_pdf'
|
4
|
+
require 'dispatcher'
|
5
|
+
|
6
|
+
Redmine::Plugin.register :chili_pdf do
|
7
|
+
name 'Chili PDF plugin'
|
8
|
+
author 'Tom Kersten'
|
9
|
+
description "Implements/Enhances PDF-export functionality using the Webkit rendering engine (via the 'wkhtmltopdf' executable)."
|
10
|
+
version ChiliPDF::VERSION
|
11
|
+
url 'https://github.com/tomkersten/chili_pdf'
|
12
|
+
author_url 'http://tomkersten.com/'
|
13
|
+
end
|
14
|
+
|
15
|
+
Dispatcher.to_prepare :chili_pdf do
|
16
|
+
require_dependency 'principal'
|
17
|
+
require_dependency 'user'
|
18
|
+
User.send(:include, UserPatch) unless User.included_modules.include? UserPatch
|
19
|
+
end
|
data/lib/chili_pdf.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
|
4
|
+
class ChiliPDFTasks < Rake::TaskLib
|
5
|
+
def initialize
|
6
|
+
define
|
7
|
+
end
|
8
|
+
|
9
|
+
def define
|
10
|
+
namespace :chili_pdf do
|
11
|
+
desc "Install ChiliPDF plugin (include assets, etc)"
|
12
|
+
task :install => [:symlink_assets]
|
13
|
+
|
14
|
+
desc "Uninstall ChiliPDF plugin (remove assets, etc)"
|
15
|
+
task :uninstall => [:environment] do
|
16
|
+
puts "Removing link to ChiliPDF assets (stylesheets, js, etc)..."
|
17
|
+
remove_symlink asset_destination_dir
|
18
|
+
|
19
|
+
puts post_uninstall_steps
|
20
|
+
end
|
21
|
+
|
22
|
+
task :symlink_assets => [:environment] do
|
23
|
+
# HACK: Symlinks the files from plugindir/assets to the appropriate place in
|
24
|
+
# the rails application
|
25
|
+
puts "Symlinking assets (stylesheets, etc)..."
|
26
|
+
add_symlink asset_source_dir, asset_destination_dir
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def application_root
|
33
|
+
File.expand_path(RAILS_ROOT)
|
34
|
+
end
|
35
|
+
|
36
|
+
def gem_root
|
37
|
+
@gem_root ||= File.expand_path(File.dirname(__FILE__) + "/../..")
|
38
|
+
end
|
39
|
+
|
40
|
+
def asset_destination_dir
|
41
|
+
@destination_dir ||= File.expand_path("#{application_root}/public/plugin_assets/chili_pdf")
|
42
|
+
end
|
43
|
+
|
44
|
+
def asset_source_dir
|
45
|
+
@source_dir ||= File.expand_path(gem_root + "/assets")
|
46
|
+
end
|
47
|
+
|
48
|
+
def gem_db_migrate_dir
|
49
|
+
@gem_db_migrate_dir ||= File.expand_path(gem_root + "/db/migrate")
|
50
|
+
end
|
51
|
+
|
52
|
+
def remove_symlink(symlink_file)
|
53
|
+
system("unlink #{symlink_file}") if File.exists?(symlink_file)
|
54
|
+
end
|
55
|
+
|
56
|
+
def add_symlink(source, destination)
|
57
|
+
remove_symlink destination
|
58
|
+
system("ln -s #{source} #{destination}")
|
59
|
+
end
|
60
|
+
|
61
|
+
def post_uninstall_steps
|
62
|
+
[
|
63
|
+
"!!!!! MANUAL STEPS !!!!!",
|
64
|
+
"\t1. In your 'config/environment.rb', remove:",
|
65
|
+
"\t\tconfig.gem 'chili_pdf'",
|
66
|
+
"",
|
67
|
+
"\t2. In your 'Rakefile', remove:",
|
68
|
+
"\t\trequire 'chili_pdf'",
|
69
|
+
"\t\trequire 'tasks/chili_pdf_tasks'",
|
70
|
+
"",
|
71
|
+
"\t3. Cycle your application server (mongrel, unicorn, etc)",
|
72
|
+
"\n",
|
73
|
+
].join("\n")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
ChiliPDFTasks.new
|
data/lib/user_patch.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
module UserPatch
|
2
|
+
def self.included(base)
|
3
|
+
base.send(:include, InstanceMethods)
|
4
|
+
|
5
|
+
base.class_eval do
|
6
|
+
alias_method_chain :allowed_to?, :extended_wiki_filter
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
module InstanceMethods
|
11
|
+
# Fakes authorizing a request to the original WikiController to inherit
|
12
|
+
# the permissions set on it, instead of keeping two sets of permissions
|
13
|
+
# for PDF export of a wiki page and viewing the HTML version.
|
14
|
+
def allowed_to_with_extended_wiki_filter?(action, context, options={})
|
15
|
+
if making_extended_wiki_request?(action)
|
16
|
+
allowed_to_without_extended_wiki_filter?(masqueraded_wiki_show_request(action), context, options)
|
17
|
+
else
|
18
|
+
allowed_to_without_extended_wiki_filter?(action, context, options)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def masqueraded_wiki_show_request(action)
|
24
|
+
case action
|
25
|
+
when :export_wiki_pages then :view_wiki_pages
|
26
|
+
when Hash
|
27
|
+
if action[:controller] == 'extended_wiki'
|
28
|
+
{:action => action[:action], :controller => 'wiki'}
|
29
|
+
else
|
30
|
+
action
|
31
|
+
end
|
32
|
+
else # not sure how to handle this action...just return the original
|
33
|
+
action
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def making_extended_wiki_request?(action)
|
38
|
+
case action
|
39
|
+
when Symbol
|
40
|
+
action == :export_wiki_pages
|
41
|
+
when Hash
|
42
|
+
'extended_wiki' == action[:controller]
|
43
|
+
else
|
44
|
+
false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../init'
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper')
|
2
|
+
|
3
|
+
# Ensure that we are using the temporary fixture path
|
4
|
+
Engines::Testing.set_fixture_path
|
5
|
+
|
6
|
+
|
7
|
+
require 'webrat'
|
8
|
+
require 'fakeweb'
|
9
|
+
require 'chili_videos'
|
10
|
+
|
11
|
+
FakeWeb.allow_net_connect = false
|
12
|
+
|
13
|
+
Webrat.configure do |config|
|
14
|
+
config.mode = :rails
|
15
|
+
end
|
16
|
+
|
17
|
+
module IntegrationTestHelper
|
18
|
+
def login_as(user="existing", password="existing")
|
19
|
+
visit "/login"
|
20
|
+
fill_in 'Login', :with => user
|
21
|
+
fill_in 'Password', :with => password
|
22
|
+
click_button 'login'
|
23
|
+
assert_response :success
|
24
|
+
assert User.current.logged?
|
25
|
+
end
|
26
|
+
|
27
|
+
def visit_project(project)
|
28
|
+
visit '/'
|
29
|
+
assert_response :success
|
30
|
+
|
31
|
+
click_link 'Projects'
|
32
|
+
assert_response :success
|
33
|
+
|
34
|
+
click_link project.name
|
35
|
+
assert_response :success
|
36
|
+
end
|
37
|
+
|
38
|
+
def assert_forbidden
|
39
|
+
assert_response :forbidden
|
40
|
+
assert_template 'common/403'
|
41
|
+
end
|
42
|
+
|
43
|
+
# Cleanup current_url to remove the host; sometimes it's present, sometimes it's not
|
44
|
+
def current_path
|
45
|
+
return nil if current_url.nil?
|
46
|
+
return current_url.gsub("http://www.example.com","")
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
module TransloaditServiceHelper
|
52
|
+
def workflow_results(identifier = :standard)
|
53
|
+
YAML.load(File.open("test/fixtures/#{identifier}_transloadit_response.json"))
|
54
|
+
end
|
55
|
+
|
56
|
+
def stub_assembly_url(assembly = nil, fixture_base_name = :single_video_processed)
|
57
|
+
response = "test/fixtures/#{fixture_base_name.to_s}_assembly.json"
|
58
|
+
url = assembly.blank? ? assembly_url : assembly.assembly_url
|
59
|
+
FakeWeb.register_uri(:get, url, :response => response)
|
60
|
+
end
|
61
|
+
|
62
|
+
def assembly_url
|
63
|
+
'http://fake.transload.it/assembly_url'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
class ActionController::IntegrationTest
|
68
|
+
include IntegrationTestHelper
|
69
|
+
end
|
70
|
+
|
71
|
+
class ActiveSupport::TestCase
|
72
|
+
include TransloaditServiceHelper
|
73
|
+
end
|
74
|
+
|
75
|
+
class ActionController::TestCase
|
76
|
+
include TransloaditServiceHelper
|
77
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chili_pdf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Tom Kersten
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain:
|
17
|
+
- |
|
18
|
+
-----BEGIN CERTIFICATE-----
|
19
|
+
MIIDMDCCAhigAwIBAgIBADANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDAN0b20x
|
20
|
+
GTAXBgoJkiaJk/IsZAEZFgl3aGl0ZXNwdXIxEzARBgoJkiaJk/IsZAEZFgNjb20w
|
21
|
+
HhcNMTEwNDIyMDQzOTA5WhcNMTIwNDIxMDQzOTA5WjA+MQwwCgYDVQQDDAN0b20x
|
22
|
+
GTAXBgoJkiaJk/IsZAEZFgl3aGl0ZXNwdXIxEzARBgoJkiaJk/IsZAEZFgNjb20w
|
23
|
+
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDpxozDQgVN/oZljGlI9opm
|
24
|
+
CrhNVA/lsNiXZBUmjfQC5XRPYHzmluon2Zz4050ljODKX+b/tkz/WVZ6x7a+Lop2
|
25
|
+
yCLLWLcHNgB10j3j3k6bM0l3cfCdCvzevE7Zgpw3o/bzazST5x0pNzurasS1ouQk
|
26
|
+
x/2o9E6qqJRuB51khuZKnh+Ma52/I1KQaMJ4bW6NOgquFCEIum8MJJBJWEdGm4It
|
27
|
+
vhS/daRe/ADkYlgWl1Y1k7LxuH+1VCx7zMFMe1E0CMJzhGf7zuMS0w+dqwbL5m3N
|
28
|
+
MLE8vgxwTEOsOwGz4wD6zMUdBY6FGYwRk8LGjvlokn0pZ1jyWHWSg2bUv/1GC2i9
|
29
|
+
AgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBTN61Az
|
30
|
+
ykDYheRHtzsjwE7fiLhYmzANBgkqhkiG9w0BAQUFAAOCAQEALwoInWubJXJYVH2N
|
31
|
+
XnCMT4YlxNsQoYdDSxEagNOmZjK2eKtju0V9GjZAnyYB2q2LLilvbMyVtg/6AN0I
|
32
|
+
XhCjyYZRRCADyvFGV4aBVv7yjKFQrIyXy8JT1iXxHC1N2o1DJlZUltCYNozJBhsO
|
33
|
+
VNbnSqe8YYcezsuQ2/w9iavWXCf91QPwnrfHPZTrFPOveskJctm8HinF41fKwG5B
|
34
|
+
iUHy8qVWGBCpDFYz6Kz+JtigaICcm2D4/WGLsDVOmgJ+g4xoOiCe9ZEkda8K+l/F
|
35
|
+
yXWqInRlFIlTuwFTxj26jauBoskBPoz5bfkZFjaVRhyUnRnGka66lvcDOGfkRZWQ
|
36
|
+
NVADJA==
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
|
39
|
+
date: 2011-05-20 00:00:00 -05:00
|
40
|
+
default_executable:
|
41
|
+
dependencies:
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: wicked_pdf
|
44
|
+
prerelease: false
|
45
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - "="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
hash: 3
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
- 7
|
54
|
+
- 0
|
55
|
+
version: 0.7.0
|
56
|
+
type: :runtime
|
57
|
+
version_requirements: *id001
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: hoe
|
60
|
+
prerelease: false
|
61
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
hash: 47
|
67
|
+
segments:
|
68
|
+
- 2
|
69
|
+
- 8
|
70
|
+
- 0
|
71
|
+
version: 2.8.0
|
72
|
+
type: :development
|
73
|
+
version_requirements: *id002
|
74
|
+
description: ChiliProject (/Redmine) plugin which implements/enhances PDF-export functionality using the Webkit rendering engine (via the 'wkhtmltopdf' executable).
|
75
|
+
email:
|
76
|
+
- tom@whitespur.com
|
77
|
+
executables: []
|
78
|
+
|
79
|
+
extensions: []
|
80
|
+
|
81
|
+
extra_rdoc_files:
|
82
|
+
- History.txt
|
83
|
+
- Manifest.txt
|
84
|
+
- README.md
|
85
|
+
- LICENSE
|
86
|
+
files:
|
87
|
+
- Gemfile
|
88
|
+
- Gemfile.lock
|
89
|
+
- History.txt
|
90
|
+
- LICENSE
|
91
|
+
- Manifest.txt
|
92
|
+
- README.md
|
93
|
+
- Rakefile
|
94
|
+
- app/controllers/extended_wiki_controller.rb
|
95
|
+
- app/views/extended_wiki/show.pdf.html.erb
|
96
|
+
- app/views/layouts/pdf.pdf.erb
|
97
|
+
- assets/stylesheets/pdf.css
|
98
|
+
- autotest/discover.rb
|
99
|
+
- config/routes.rb
|
100
|
+
- init.rb
|
101
|
+
- lib/chili_pdf.rb
|
102
|
+
- lib/tasks/chili_pdf_tasks.rb
|
103
|
+
- lib/user_patch.rb
|
104
|
+
- rails/init.rb
|
105
|
+
- test/test_helper.rb
|
106
|
+
has_rdoc: true
|
107
|
+
homepage: http://github.com/tomkersten/chili_pdf
|
108
|
+
licenses: []
|
109
|
+
|
110
|
+
post_install_message:
|
111
|
+
rdoc_options:
|
112
|
+
- --main
|
113
|
+
- README.md
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
hash: 3
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
version: "0"
|
125
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
hash: 3
|
131
|
+
segments:
|
132
|
+
- 0
|
133
|
+
version: "0"
|
134
|
+
requirements: []
|
135
|
+
|
136
|
+
rubyforge_project: chili_pdf
|
137
|
+
rubygems_version: 1.3.7
|
138
|
+
signing_key:
|
139
|
+
specification_version: 3
|
140
|
+
summary: ChiliProject (/Redmine) plugin which implements/enhances PDF-export functionality using the Webkit rendering engine.
|
141
|
+
test_files:
|
142
|
+
- test/test_helper.rb
|
metadata.gz.sig
ADDED
Binary file
|