caracal-rails 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +26 -0
- data/Appraisals +17 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +99 -0
- data/Rakefile +2 -0
- data/caracal-rails.gemspec +27 -0
- data/gemfiles/rails_3.2.gemfile +8 -0
- data/gemfiles/rails_4.0.gemfile +8 -0
- data/gemfiles/rails_4.1.gemfile +8 -0
- data/lib/caracal-rails.rb +29 -0
- data/lib/caracal/rails/template_handler.rb +11 -0
- data/lib/caracal/rails/version.rb +5 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/statics_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/statics/show.docx.caracal +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +8 -0
- data/spec/dummy/bin/rake +8 -0
- data/spec/dummy/bin/spring +18 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +4 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +83 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/robots.txt +5 -0
- data/spec/lib/caracal-rails_spec.rb +59 -0
- data/spec/lib/caracal/rails/template_handler_spec.rb +21 -0
- data/spec/lib/caracal/rails/version.rb +3 -0
- data/spec/spec_helper.rb +40 -0
- metadata +219 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<style>
|
7
|
+
body {
|
8
|
+
background-color: #EFEFEF;
|
9
|
+
color: #2E2F30;
|
10
|
+
text-align: center;
|
11
|
+
font-family: arial, sans-serif;
|
12
|
+
margin: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
div.dialog {
|
16
|
+
width: 95%;
|
17
|
+
max-width: 33em;
|
18
|
+
margin: 4em auto 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
div.dialog > div {
|
22
|
+
border: 1px solid #CCC;
|
23
|
+
border-right-color: #999;
|
24
|
+
border-left-color: #999;
|
25
|
+
border-bottom-color: #BBB;
|
26
|
+
border-top: #B00100 solid 4px;
|
27
|
+
border-top-left-radius: 9px;
|
28
|
+
border-top-right-radius: 9px;
|
29
|
+
background-color: white;
|
30
|
+
padding: 7px 12% 0;
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
32
|
+
}
|
33
|
+
|
34
|
+
h1 {
|
35
|
+
font-size: 100%;
|
36
|
+
color: #730E15;
|
37
|
+
line-height: 1.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
div.dialog > p {
|
41
|
+
margin: 0 0 1em;
|
42
|
+
padding: 1em;
|
43
|
+
background-color: #F7F7F7;
|
44
|
+
border: 1px solid #CCC;
|
45
|
+
border-right-color: #999;
|
46
|
+
border-left-color: #999;
|
47
|
+
border-bottom-color: #999;
|
48
|
+
border-bottom-left-radius: 4px;
|
49
|
+
border-bottom-right-radius: 4px;
|
50
|
+
border-top-color: #DADADA;
|
51
|
+
color: #666;
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
53
|
+
}
|
54
|
+
</style>
|
55
|
+
</head>
|
56
|
+
|
57
|
+
<body>
|
58
|
+
<!-- This file lives in public/500.html -->
|
59
|
+
<div class="dialog">
|
60
|
+
<div>
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
62
|
+
</div>
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
64
|
+
</div>
|
65
|
+
</body>
|
66
|
+
</html>
|
File without changes
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Caracal::Rails::Railtie do
|
4
|
+
|
5
|
+
#--------------------------------------------------------
|
6
|
+
# Tilt Integration
|
7
|
+
#--------------------------------------------------------
|
8
|
+
|
9
|
+
describe 'tilt integration tests' do
|
10
|
+
|
11
|
+
# new
|
12
|
+
describe '#new' do
|
13
|
+
let(:actual) { Tilt.new("#{ Rails.root }/app/views/statics/show.docx.caracal") }
|
14
|
+
|
15
|
+
it { expect(actual).to be_a(Tilt::CaracalTemplate) }
|
16
|
+
end
|
17
|
+
|
18
|
+
# registration
|
19
|
+
describe '#registered?' do
|
20
|
+
let(:actual) { Tilt.registered?('caracal') }
|
21
|
+
|
22
|
+
it { expect(actual).to eq true }
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
#--------------------------------------------------------
|
29
|
+
# Mime Type Registration
|
30
|
+
#--------------------------------------------------------
|
31
|
+
|
32
|
+
describe 'mime type tests' do
|
33
|
+
|
34
|
+
# .lookup_by_extension
|
35
|
+
describe '#lookup_by_extension' do
|
36
|
+
let(:actual) { Mime::Type.lookup_by_extension(:docx) }
|
37
|
+
|
38
|
+
it { expect(actual).to be_a(Mime::Type) }
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
#--------------------------------------------------------
|
45
|
+
# Template Handler Registration
|
46
|
+
#--------------------------------------------------------
|
47
|
+
|
48
|
+
describe 'template handler tests' do
|
49
|
+
|
50
|
+
# .handler_for_extension
|
51
|
+
describe '#handler_for_extension' do
|
52
|
+
let(:actual) { ActionView::Template.handler_for_extension(:caracal) }
|
53
|
+
|
54
|
+
it { expect(actual).to eq Caracal::Rails::TemplateHandler }
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Caracal::Rails::TemplateHandler do
|
4
|
+
|
5
|
+
#--------------------------------------------------------
|
6
|
+
# Class Methods
|
7
|
+
#--------------------------------------------------------
|
8
|
+
|
9
|
+
describe 'class method tests' do
|
10
|
+
|
11
|
+
# .call
|
12
|
+
describe '#call' do
|
13
|
+
let(:template) { double('template', identifier: 'show.docx.caracal') }
|
14
|
+
let(:actual) { Caracal::Rails::TemplateHandler.call(template) }
|
15
|
+
|
16
|
+
it { expect(actual).to eq "Tilt.new('show.docx.caracal').render(self)" }
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
ENV["RAILS_ENV"] ||= 'test'
|
2
|
+
|
3
|
+
# Load the app
|
4
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
5
|
+
|
6
|
+
# Load the test stack
|
7
|
+
require 'rspec/rails'
|
8
|
+
|
9
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
10
|
+
# in spec/support/ and its subdirectories.
|
11
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
# ## Mock Framework
|
15
|
+
#
|
16
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
17
|
+
#
|
18
|
+
# config.mock_with :mocha
|
19
|
+
# config.mock_with :flexmock
|
20
|
+
# config.mock_with :rr
|
21
|
+
|
22
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
23
|
+
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
24
|
+
|
25
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
26
|
+
# examples within a transaction, remove the following line or assign false
|
27
|
+
# instead of true.
|
28
|
+
# config.use_transactional_fixtures = true
|
29
|
+
|
30
|
+
# If true, the base class of anonymous controllers will be inferred
|
31
|
+
# automatically. This will be the default behavior in future versions of
|
32
|
+
# rspec-rails.
|
33
|
+
config.infer_base_class_for_anonymous_controllers = false
|
34
|
+
|
35
|
+
# Run specs in random order to surface order dependencies. If you find an
|
36
|
+
# order dependency and want to debug it, you can fix the order by providing
|
37
|
+
# the seed, which is printed after each run.
|
38
|
+
# --seed 1234
|
39
|
+
config.order = 'random'
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: caracal-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Trade Informatics
|
8
|
+
- John Dugan
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-08-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: caracal
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0.1'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rails
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '3.2'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '3.2'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: appraisal
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: bundler
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '1.6'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.6'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec-rails
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '3.0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '3.0'
|
84
|
+
description: " Caracal::Rails takes care of registering Microsoft Word output with
|
85
|
+
Rails. Essentially, this involves registering the mime type, establishing a template
|
86
|
+
handler for .docx formats, and establishing sane defaults for generating professional
|
87
|
+
quality Word documents. "
|
88
|
+
email:
|
89
|
+
- jpdugan@gmail.com
|
90
|
+
executables: []
|
91
|
+
extensions: []
|
92
|
+
extra_rdoc_files: []
|
93
|
+
files:
|
94
|
+
- ".gitignore"
|
95
|
+
- Appraisals
|
96
|
+
- Gemfile
|
97
|
+
- LICENSE.txt
|
98
|
+
- README.md
|
99
|
+
- Rakefile
|
100
|
+
- caracal-rails.gemspec
|
101
|
+
- gemfiles/rails_3.2.gemfile
|
102
|
+
- gemfiles/rails_4.0.gemfile
|
103
|
+
- gemfiles/rails_4.1.gemfile
|
104
|
+
- lib/caracal-rails.rb
|
105
|
+
- lib/caracal/rails/template_handler.rb
|
106
|
+
- lib/caracal/rails/version.rb
|
107
|
+
- spec/dummy/Rakefile
|
108
|
+
- spec/dummy/app/assets/images/.keep
|
109
|
+
- spec/dummy/app/assets/javascripts/application.js
|
110
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
111
|
+
- spec/dummy/app/controllers/application_controller.rb
|
112
|
+
- spec/dummy/app/controllers/concerns/.keep
|
113
|
+
- spec/dummy/app/controllers/statics_controller.rb
|
114
|
+
- spec/dummy/app/helpers/application_helper.rb
|
115
|
+
- spec/dummy/app/mailers/.keep
|
116
|
+
- spec/dummy/app/models/.keep
|
117
|
+
- spec/dummy/app/models/concerns/.keep
|
118
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
119
|
+
- spec/dummy/app/views/statics/show.docx.caracal
|
120
|
+
- spec/dummy/bin/bundle
|
121
|
+
- spec/dummy/bin/rails
|
122
|
+
- spec/dummy/bin/rake
|
123
|
+
- spec/dummy/bin/spring
|
124
|
+
- spec/dummy/config.ru
|
125
|
+
- spec/dummy/config/application.rb
|
126
|
+
- spec/dummy/config/boot.rb
|
127
|
+
- spec/dummy/config/database.yml
|
128
|
+
- spec/dummy/config/environment.rb
|
129
|
+
- spec/dummy/config/environments/development.rb
|
130
|
+
- spec/dummy/config/environments/production.rb
|
131
|
+
- spec/dummy/config/environments/test.rb
|
132
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
133
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
134
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
135
|
+
- spec/dummy/config/initializers/inflections.rb
|
136
|
+
- spec/dummy/config/initializers/mime_types.rb
|
137
|
+
- spec/dummy/config/initializers/session_store.rb
|
138
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
139
|
+
- spec/dummy/config/locales/en.yml
|
140
|
+
- spec/dummy/config/routes.rb
|
141
|
+
- spec/dummy/config/secrets.yml
|
142
|
+
- spec/dummy/public/404.html
|
143
|
+
- spec/dummy/public/422.html
|
144
|
+
- spec/dummy/public/500.html
|
145
|
+
- spec/dummy/public/favicon.ico
|
146
|
+
- spec/dummy/public/robots.txt
|
147
|
+
- spec/lib/caracal-rails_spec.rb
|
148
|
+
- spec/lib/caracal/rails/template_handler_spec.rb
|
149
|
+
- spec/lib/caracal/rails/version.rb
|
150
|
+
- spec/spec_helper.rb
|
151
|
+
homepage: https://github.com/ibpinc/caracal-rails
|
152
|
+
licenses:
|
153
|
+
- MIT
|
154
|
+
metadata: {}
|
155
|
+
post_install_message:
|
156
|
+
rdoc_options: []
|
157
|
+
require_paths:
|
158
|
+
- lib
|
159
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
requirements: []
|
170
|
+
rubyforge_project:
|
171
|
+
rubygems_version: 2.2.2
|
172
|
+
signing_key:
|
173
|
+
specification_version: 4
|
174
|
+
summary: Caracal::Rails makes using Caracal in Rails a no-brainer.
|
175
|
+
test_files:
|
176
|
+
- spec/dummy/Rakefile
|
177
|
+
- spec/dummy/app/assets/images/.keep
|
178
|
+
- spec/dummy/app/assets/javascripts/application.js
|
179
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
180
|
+
- spec/dummy/app/controllers/application_controller.rb
|
181
|
+
- spec/dummy/app/controllers/concerns/.keep
|
182
|
+
- spec/dummy/app/controllers/statics_controller.rb
|
183
|
+
- spec/dummy/app/helpers/application_helper.rb
|
184
|
+
- spec/dummy/app/mailers/.keep
|
185
|
+
- spec/dummy/app/models/.keep
|
186
|
+
- spec/dummy/app/models/concerns/.keep
|
187
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
188
|
+
- spec/dummy/app/views/statics/show.docx.caracal
|
189
|
+
- spec/dummy/bin/bundle
|
190
|
+
- spec/dummy/bin/rails
|
191
|
+
- spec/dummy/bin/rake
|
192
|
+
- spec/dummy/bin/spring
|
193
|
+
- spec/dummy/config.ru
|
194
|
+
- spec/dummy/config/application.rb
|
195
|
+
- spec/dummy/config/boot.rb
|
196
|
+
- spec/dummy/config/database.yml
|
197
|
+
- spec/dummy/config/environment.rb
|
198
|
+
- spec/dummy/config/environments/development.rb
|
199
|
+
- spec/dummy/config/environments/production.rb
|
200
|
+
- spec/dummy/config/environments/test.rb
|
201
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
202
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
203
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
204
|
+
- spec/dummy/config/initializers/inflections.rb
|
205
|
+
- spec/dummy/config/initializers/mime_types.rb
|
206
|
+
- spec/dummy/config/initializers/session_store.rb
|
207
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
208
|
+
- spec/dummy/config/locales/en.yml
|
209
|
+
- spec/dummy/config/routes.rb
|
210
|
+
- spec/dummy/config/secrets.yml
|
211
|
+
- spec/dummy/public/404.html
|
212
|
+
- spec/dummy/public/422.html
|
213
|
+
- spec/dummy/public/500.html
|
214
|
+
- spec/dummy/public/favicon.ico
|
215
|
+
- spec/dummy/public/robots.txt
|
216
|
+
- spec/lib/caracal-rails_spec.rb
|
217
|
+
- spec/lib/caracal/rails/template_handler_spec.rb
|
218
|
+
- spec/lib/caracal/rails/version.rb
|
219
|
+
- spec/spec_helper.rb
|