pageflow-chart 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +15 -0
- data/Gemfile +1 -1
- data/README.md +10 -7
- data/app/models/pageflow/chart/scraped_site.rb +5 -0
- data/app/views/pageflow/chart/page_type.json.jbuilder +1 -1
- data/chart.gemspec +3 -4
- data/lib/pageflow/chart/configuration.rb +16 -2
- data/spec/pageflow/chart/configuration_spec.rb +50 -0
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzRhZTQ1NzAzMGRmYjQwN2ExODk5ZWFjZmYzNzJkNDA1NjBjZTJmYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDNhYTYzOThiOTk1Njg3ODRiNzM3ZjIzMmI1NGRjNmNjYzEwM2JkMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWQyMTEzYzhkMzkxZjgxNTdjY2Q4MWYwN2I3ODI4NmMxNjkzNzY3NGZiY2Vk
|
10
|
+
MzNhYmY2ZmQ4ZjcxYWMzZWRmODZmNDJiZjdiM2YxOTRmYjc0NmYyYmNmNTFl
|
11
|
+
OTliYTNiMTIxOGMzMWYyZmQ5N2E4NzkxZDgzN2EzZjc3ODRhYWE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzA5MzExNmQ4ZGQ1MTI0M2NmOWMyYWY4ZWUxOGJiMWFkZjMzNmZiMGVmN2Ni
|
14
|
+
ZTE3NjAxYTM2NzFmN2MxY2VlMDliZGU2YzNhNTc1Y2UwZDEwODg2ZDZkY2I1
|
15
|
+
NzM1ZTgyZDRhYTk4NWM5Mzk3MmUwZDdmMmVhOGJiNjg5OTUzNmE=
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
### Version 0.1.1
|
4
|
+
|
5
|
+
[Compare changes](https://github.com/codevise/pageflow-chart/compare/v0.1.0...v0.1.1)
|
6
|
+
|
7
|
+
- Bug fix: Support new datawrapper host name.
|
8
|
+
([#9](https://github.com/codevise/pageflow-chart/pull/9),
|
9
|
+
[#10](https://github.com/codevise/pageflow-chart/pull/10))
|
10
|
+
- Bug fix: Save correct content types for scraped files with
|
11
|
+
Paperclip 4.x.
|
12
|
+
([#7](https://github.com/codevise/pageflow-chart/pull/7))
|
13
|
+
- Bug fix: Explicitly disable Paperclip attachment validation.
|
14
|
+
([#5](https://github.com/codevise/pageflow-chart/pull/5))
|
15
|
+
- Bug fix: Do not report binstubs as executables in gemspec.
|
16
|
+
([#6](https://github.com/codevise/pageflow-chart/pull/6))
|
17
|
+
|
3
18
|
### Version 0.1.0
|
4
19
|
|
5
20
|
2015-02-03
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Pageflow Chart
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/pageflow-chart.svg)](http://badge.fury.io/rb/pageflow-chart)
|
4
|
+
|
3
5
|
Page type showing scraped svg diagramms from Datawrapper.
|
4
6
|
|
5
7
|
## Installation
|
@@ -7,7 +9,7 @@ Page type showing scraped svg diagramms from Datawrapper.
|
|
7
9
|
Add this line to your application's Gemfile:
|
8
10
|
|
9
11
|
# Gemfile
|
10
|
-
gem '
|
12
|
+
gem 'pageflow-chart'
|
11
13
|
|
12
14
|
Mount the engine:
|
13
15
|
|
@@ -27,18 +29,18 @@ Include javascript/stylesheets:
|
|
27
29
|
# app/assets/javascripts/pageflow/editor.js
|
28
30
|
//= require pageflow/chart/editor
|
29
31
|
|
30
|
-
# app/assets/stylesheets/pageflow/application.scss
|
32
|
+
# app/assets/stylesheets/pageflow/application.css.scss;
|
31
33
|
@import "pageflow/chart";
|
32
34
|
|
33
35
|
|
34
|
-
# app/assets/stylesheets/pageflow/editor.scss
|
36
|
+
# app/assets/stylesheets/pageflow/editor.css.scss;
|
35
37
|
@import "pageflow/chart/editor";
|
36
38
|
|
37
39
|
# Adding basic style to your theme
|
38
40
|
# app/assets/stylesheets/pageflow/themes/default.css.scss
|
39
41
|
@import "pageflow/chart/themes/default";
|
40
42
|
|
41
|
-
Install and run migrations:
|
43
|
+
Execute `bundle install`. Then Install and run migrations:
|
42
44
|
|
43
45
|
rake pageflow_chart:install:migrations
|
44
46
|
rake db:migrate SCOPE=pageflow_chart
|
@@ -68,11 +70,12 @@ Example:
|
|
68
70
|
|
69
71
|
Pageflow::Chart.configure do |config|
|
70
72
|
config.scraped_sites_root_url = '/datawrapper'
|
73
|
+
|
74
|
+
# Allow scraping charts from custom account URLs
|
75
|
+
config.supported_hosts << 'http://mycustom.datawrapper.de'
|
71
76
|
end
|
72
77
|
|
73
|
-
|
74
|
-
|
75
|
-
TODO: Document config options here
|
78
|
+
Also see `lib/pageflow/chart/configuration.rb` for the additional options.
|
76
79
|
|
77
80
|
## Troubleshooting
|
78
81
|
|
@@ -6,6 +6,11 @@ module Pageflow
|
|
6
6
|
has_attached_file :html_file, Chart.config.paperclip_options(extension: 'html')
|
7
7
|
has_attached_file :csv_file, Chart.config.paperclip_options(basename: 'data', extension: 'csv')
|
8
8
|
|
9
|
+
do_not_validate_attachment_file_type(:javascript_file)
|
10
|
+
do_not_validate_attachment_file_type(:stylesheet_file)
|
11
|
+
do_not_validate_attachment_file_type(:html_file)
|
12
|
+
do_not_validate_attachment_file_type(:csv_file)
|
13
|
+
|
9
14
|
state_machine initial: 'unprocessed' do
|
10
15
|
extend StateMachineJob::Macro
|
11
16
|
|
@@ -1,2 +1,2 @@
|
|
1
1
|
json.key_format! camelize: :lower
|
2
|
-
json.supported_hosts Pageflow::Chart.config.supported_hosts
|
2
|
+
json.supported_hosts Pageflow::Chart.config.supported_hosts.uniq
|
data/chart.gemspec
CHANGED
@@ -2,21 +2,20 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "pageflow-chart"
|
5
|
-
spec.version = "0.1.
|
5
|
+
spec.version = "0.1.1"
|
6
6
|
spec.authors = ["Tim Fischbach"]
|
7
7
|
spec.email = ["tfischbach@codevise.de"]
|
8
8
|
spec.summary = "Pagetype for Embedded Datawrapper Charts"
|
9
|
-
spec.homepage = ""
|
9
|
+
spec.homepage = "https://github.com/codevise/pageflow-chart"
|
10
10
|
spec.license = "MIT"
|
11
11
|
|
12
12
|
spec.files = `git ls-files`.split($/)
|
13
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
14
13
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
14
|
spec.require_paths = ["lib"]
|
16
15
|
|
17
16
|
spec.add_runtime_dependency "pageflow", "~> 0.7"
|
18
17
|
spec.add_runtime_dependency "nokogiri"
|
19
|
-
spec.add_runtime_dependency "paperclip"
|
18
|
+
spec.add_runtime_dependency "paperclip", "~> 4.2"
|
20
19
|
spec.add_runtime_dependency "state_machine"
|
21
20
|
spec.add_runtime_dependency "state_machine_job"
|
22
21
|
spec.add_runtime_dependency 'i18n-js'
|
@@ -41,7 +41,7 @@ module Pageflow
|
|
41
41
|
@paperclip_s3_default_options = {}
|
42
42
|
@paperclip_base_path = ':host'
|
43
43
|
@scraped_sites_root_url = nil
|
44
|
-
@supported_hosts = ['http://cf.datawrapper.de']
|
44
|
+
@supported_hosts = ['http://cf.datawrapper.de', 'http://datawrapper.dwcdn.de']
|
45
45
|
end
|
46
46
|
|
47
47
|
# @api private
|
@@ -55,9 +55,23 @@ module Pageflow
|
|
55
55
|
|
56
56
|
def default_paperclip_path_options(options)
|
57
57
|
{
|
58
|
-
path: File.join(paperclip_base_path, ":class/:id_partition/#{options.fetch(:basename, 'all')}.#{options.fetch(:extension)}")
|
58
|
+
path: File.join(paperclip_base_path, ":class/:id_partition/#{options.fetch(:basename, 'all')}.#{options.fetch(:extension)}"),
|
59
|
+
s3_headers: paperclip_s3_headers(options)
|
59
60
|
}
|
60
61
|
end
|
62
|
+
|
63
|
+
def paperclip_s3_headers(options)
|
64
|
+
{
|
65
|
+
'Content-Type' => CONTENT_TYPE_MAPPING[options.fetch(:extension)]
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
CONTENT_TYPE_MAPPING = {
|
70
|
+
'css' => 'text/css',
|
71
|
+
'js' => 'application/javascript',
|
72
|
+
'html' => 'text/html',
|
73
|
+
'csv' => 'text/plain'
|
74
|
+
}
|
61
75
|
end
|
62
76
|
end
|
63
77
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Pageflow
|
4
|
+
module Chart
|
5
|
+
describe Configuration do
|
6
|
+
describe 'paperclip_options' do
|
7
|
+
it 'returns hash with path option for file with given extension' do
|
8
|
+
configuration = Configuration.new
|
9
|
+
|
10
|
+
result = configuration.paperclip_options(extension: 'js')
|
11
|
+
|
12
|
+
expect(result[:path]).to eq(':host/:class/:id_partition/all.js')
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'allows to override basename of path option' do
|
16
|
+
configuration = Configuration.new
|
17
|
+
|
18
|
+
result = configuration.paperclip_options(basename: 'some', extension: 'js')
|
19
|
+
|
20
|
+
expect(result[:path]).to eq(':host/:class/:id_partition/some.js')
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'uses paperclip_base_path as prefix' do
|
24
|
+
configuration = Configuration.new
|
25
|
+
configuration.paperclip_base_path = 'main'
|
26
|
+
|
27
|
+
result = configuration.paperclip_options(basename: 'some', extension: 'js')
|
28
|
+
|
29
|
+
expect(result[:path]).to eq('main/:class/:id_partition/some.js')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'returns hash with s3_headers option with matching content type for js' do
|
33
|
+
configuration = Configuration.new
|
34
|
+
|
35
|
+
result = configuration.paperclip_options(extension: 'js')
|
36
|
+
|
37
|
+
expect(result[:s3_headers]['Content-Type']).to eq('application/javascript')
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'returns hash with s3_headers option with matching content type for css' do
|
41
|
+
configuration = Configuration.new
|
42
|
+
|
43
|
+
result = configuration.paperclip_options(extension: 'css')
|
44
|
+
|
45
|
+
expect(result[:s3_headers]['Content-Type']).to eq('text/css')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pageflow-chart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Fischbach
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pageflow
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: paperclip
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '4.2'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '4.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: state_machine
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -181,8 +181,7 @@ dependencies:
|
|
181
181
|
description:
|
182
182
|
email:
|
183
183
|
- tfischbach@codevise.de
|
184
|
-
executables:
|
185
|
-
- rails
|
184
|
+
executables: []
|
186
185
|
extensions: []
|
187
186
|
extra_rdoc_files: []
|
188
187
|
files:
|
@@ -275,6 +274,7 @@ files:
|
|
275
274
|
- spec/fixtures/datawrapper.html
|
276
275
|
- spec/jobs/pageflow/chart/scrape_site_job_spec.rb
|
277
276
|
- spec/models/pageflow/chart/scraped_site_spec.rb
|
277
|
+
- spec/pageflow/chart/configuration_spec.rb
|
278
278
|
- spec/pageflow/chart/downloader_spec.rb
|
279
279
|
- spec/pageflow/chart/scraper_spec.rb
|
280
280
|
- spec/requests/scraping_site_spec.rb
|
@@ -284,7 +284,7 @@ files:
|
|
284
284
|
- spec/support/paperclip.rb
|
285
285
|
- spec/support/resque.rb
|
286
286
|
- spec/support/webmock.rb
|
287
|
-
homepage:
|
287
|
+
homepage: https://github.com/codevise/pageflow-chart
|
288
288
|
licenses:
|
289
289
|
- MIT
|
290
290
|
metadata: {}
|
@@ -352,6 +352,7 @@ test_files:
|
|
352
352
|
- spec/fixtures/datawrapper.html
|
353
353
|
- spec/jobs/pageflow/chart/scrape_site_job_spec.rb
|
354
354
|
- spec/models/pageflow/chart/scraped_site_spec.rb
|
355
|
+
- spec/pageflow/chart/configuration_spec.rb
|
355
356
|
- spec/pageflow/chart/downloader_spec.rb
|
356
357
|
- spec/pageflow/chart/scraper_spec.rb
|
357
358
|
- spec/requests/scraping_site_spec.rb
|