jekyll-autoscout24 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a877e3f223382c05fc6f30e6399c77df82908e9c35ef95efde376c41d89b814f
4
- data.tar.gz: d3dced66a8ebc1cd44cfb8b2f7fafe0eee055087f7a135b9634a9505c7966867
3
+ metadata.gz: eb5b16e86312c55df97316b4ae0b691a2a27bbce0760613cbd469709da42c8d5
4
+ data.tar.gz: 5325a1f86b312f5a70ffb71e0cc28679672163d765816c3fa5144160dc6d9ed6
5
5
  SHA512:
6
- metadata.gz: c437ab61ef2453d4820d08980372925391c38256417b7bae67cdd0e68234c075b473307040f1de58b1b18c084a00df6d594ef53dba97315c9574332cd6738bd5
7
- data.tar.gz: bf4e1481cf313b031d92fcddbf2f85ecfc7a85f195f23d469f86f2d3fd37d61e49b4bbf27fd17ff698574265ea8e7e3514030e1f860882f1004b519c1bf43f39
6
+ metadata.gz: 5b92adf4a76dbd64c11228a2f3bddedab083db079565fa2d782d978bc4dc42b0a7478965ff06849e6218263fbf4f171e42fafdfc360bb8f5f2f53003838af16a
7
+ data.tar.gz: 8dc41c6e84b54abb11c628c2f91087116b9ce9a0be51b40ea4369f4919dd187d1795416bbb1caec10e76a3eee36d6094e31792d2e9006f30bc397c0458297ecb
data/.gitignore CHANGED
@@ -7,3 +7,36 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.code-workspace
11
+
12
+ # Created by https://www.gitignore.io/api/osx
13
+
14
+ ### OSX ###
15
+ *.DS_Store
16
+ .AppleDouble
17
+ .LSOverride
18
+
19
+ # Icon must end with two \r
20
+ Icon
21
+
22
+ # Thumbnails
23
+ ._*
24
+
25
+ # Files that might appear in the root of a volume
26
+ .DocumentRevisions-V100
27
+ .fseventsd
28
+ .Spotlight-V100
29
+ .TemporaryItems
30
+ .Trashes
31
+ .VolumeIcon.icns
32
+ .com.apple.timemachine.donotpresent
33
+
34
+ # Directories potentially created on remote AFP share
35
+ .AppleDB
36
+ .AppleDesktop
37
+ Network Trash Folder
38
+ Temporary Items
39
+ .apdisk
40
+
41
+
42
+ # End of https://www.gitignore.io/api/osx
@@ -0,0 +1,2 @@
1
+ run:
2
+ @docker-compose run jekyll /bin/bash
data/README.md CHANGED
@@ -24,12 +24,17 @@ Or install it yourself as:
24
24
 
25
25
  TODO: Write usage instructions here
26
26
 
27
+ The plugin jekyll-autoscout24 add to your jekyll project a folder called *autoscout24backup* in which you must put the *autoscout24backup.xml* file previously downloaded from your account AutoScout24.
28
+ Soon continued..
29
+
27
30
  ## Development
28
31
 
29
32
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
33
 
31
34
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
35
 
36
+ To validate changes end-2-end, run `bundle install` in test/test-site and then run `bundle exec theme-specs` to exercise plugin's code using Jekyll functional specifications declared in `features` folder.
37
+
33
38
  ## Contributing
34
39
 
35
40
  Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll-autoscout24. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -4,10 +4,13 @@ services:
4
4
  network_mode: bridge
5
5
  image: "jekyll/jekyll:3.6.2"
6
6
  command: "jekyll server"
7
+ environment:
8
+ - JEKYLL_ENV=production
7
9
  volumes:
8
- - "$PWD:/srv/jekyll"
10
+ - "$PWD/test/test-site:/srv/jekyll"
11
+ - "$PWD:/srv/jekyll-autoscout24"
9
12
  labels:
10
- - "traefik.frontend.rule=Host:pabloduo.com"
13
+ - "traefik.frontend.rule=Host:testme.io"
11
14
  - "traefik.enable=true"
12
15
  depends_on:
13
16
  - "reverse-proxy"
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'jekyll/autoscout24/version'
4
+ require 'jekyll-autoscout24/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "jekyll-autoscout24"
@@ -19,7 +19,12 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.11"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency "minitest", "~> 5.0"
22
+ spec.add_dependency "ox", "2.9.0"
23
+ spec.add_dependency "liquid", "4.0.0"
24
+ spec.add_dependency "jekyll", ENV["JEKYLL_VERSION"] ? "~> #{ENV["JEKYLL_VERSION"]}" : "~> 3.1"
25
+
26
+ spec.add_development_dependency "bundler", "1.16.1"
27
+ spec.add_development_dependency "rake", "12.3.0"
28
+ spec.add_development_dependency "minitest", "~> 5.11.3"
29
+ spec.add_development_dependency "gem-release", "1.0.0"
25
30
  end
@@ -0,0 +1,6 @@
1
+ require "ox"
2
+ require "liquid"
3
+ require "jekyll"
4
+
5
+ require "jekyll-autoscout24/backup_reader"
6
+ require "jekyll-autoscout24/version"
@@ -0,0 +1,51 @@
1
+
2
+ module Jekyll
3
+ module AutoScout24
4
+ class BackupReader
5
+ attr_reader :site, :content
6
+
7
+ # ctor
8
+ def initialize(site)
9
+ @site = site
10
+ end
11
+
12
+ def read!(dir)
13
+ # Load XML data from the backup file
14
+ backup = Ox.load_file("#{dir}/autoscout24.xml")
15
+ # Locate all vehicle nodes in the backup document
16
+ vehicles, nodes = [], backup.locate("stx3/vehicle_data/vehicles/vehicle")
17
+ # Transform each node found into an instance of Vehicle drop
18
+ nodes.each { |n| vehicles << Vehicle.new(n) }
19
+ # Merge current site data with the list of vehicles from the backup
20
+ @site.data.merge!("autoscout24" => vehicles) unless vehicles.empty?
21
+ end
22
+ end
23
+
24
+ # A drop in liquid is a class which allows you to export DOM like things to liquid.
25
+ # Methods of drops are callable.
26
+ # The main use for liquid drops is to implement lazy loaded objects.
27
+ # If you would like to make data available to the web designers which you don't want loaded unless needed then
28
+ # a drop is a great way to do that.
29
+ class Vehicle < Liquid::Drop
30
+ attr_reader :node
31
+
32
+ # ctor
33
+ def initialize(node)
34
+ @node = node
35
+ end
36
+
37
+ # Catch all method to be flexible and adaptable based on the XML structure provided.
38
+ def liquid_method_missing(name)
39
+ found = @node.locate(name)
40
+ return nil if found.empty?
41
+ found.first.text
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ # Plugin is activated after site data has been read and loaded from disk
48
+ Jekyll::Hooks.register :site, :post_read do |site|
49
+ # We modify site.data collection in-place
50
+ Jekyll::AutoScout24::BackupReader.new(site).read!(site.config["data_dir"])
51
+ end
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module Autoscout24
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-autoscout24
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Enrico Caputo
@@ -9,50 +9,106 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-03-13 00:00:00.000000000 Z
12
+ date: 2018-03-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: bundler
15
+ name: ox
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 2.9.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '='
26
+ - !ruby/object:Gem::Version
27
+ version: 2.9.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: liquid
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '='
33
+ - !ruby/object:Gem::Version
34
+ version: 4.0.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '='
40
+ - !ruby/object:Gem::Version
41
+ version: 4.0.0
42
+ - !ruby/object:Gem::Dependency
43
+ name: jekyll
16
44
  requirement: !ruby/object:Gem::Requirement
17
45
  requirements:
18
46
  - - "~>"
19
47
  - !ruby/object:Gem::Version
20
- version: '1.11'
21
- type: :development
48
+ version: 3.6.2
49
+ type: :runtime
22
50
  prerelease: false
23
51
  version_requirements: !ruby/object:Gem::Requirement
24
52
  requirements:
25
53
  - - "~>"
26
54
  - !ruby/object:Gem::Version
27
- version: '1.11'
55
+ version: 3.6.2
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.16.1
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '='
68
+ - !ruby/object:Gem::Version
69
+ version: 1.16.1
28
70
  - !ruby/object:Gem::Dependency
29
71
  name: rake
30
72
  requirement: !ruby/object:Gem::Requirement
31
73
  requirements:
32
- - - "~>"
74
+ - - '='
33
75
  - !ruby/object:Gem::Version
34
- version: '10.0'
76
+ version: 12.3.0
35
77
  type: :development
36
78
  prerelease: false
37
79
  version_requirements: !ruby/object:Gem::Requirement
38
80
  requirements:
39
- - - "~>"
81
+ - - '='
40
82
  - !ruby/object:Gem::Version
41
- version: '10.0'
83
+ version: 12.3.0
42
84
  - !ruby/object:Gem::Dependency
43
85
  name: minitest
44
86
  requirement: !ruby/object:Gem::Requirement
45
87
  requirements:
46
88
  - - "~>"
47
89
  - !ruby/object:Gem::Version
48
- version: '5.0'
90
+ version: 5.11.3
49
91
  type: :development
50
92
  prerelease: false
51
93
  version_requirements: !ruby/object:Gem::Requirement
52
94
  requirements:
53
95
  - - "~>"
54
96
  - !ruby/object:Gem::Version
55
- version: '5.0'
97
+ version: 5.11.3
98
+ - !ruby/object:Gem::Dependency
99
+ name: gem-release
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '='
103
+ - !ruby/object:Gem::Version
104
+ version: 1.0.0
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '='
110
+ - !ruby/object:Gem::Version
111
+ version: 1.0.0
56
112
  description: A Jekyll plugin to transform AutoScout24's backup XML into a data file
57
113
  email:
58
114
  - enricocaputo.1972@gmail.com
@@ -66,14 +122,16 @@ files:
66
122
  - CODE_OF_CONDUCT.md
67
123
  - Gemfile
68
124
  - LICENSE.txt
125
+ - Makefile
69
126
  - README.md
70
127
  - Rakefile
71
128
  - bin/console
72
129
  - bin/setup
73
130
  - docker-compose.yml
74
131
  - jekyll-autoscout24.gemspec
75
- - lib/jekyll/autoscout24.rb
76
- - lib/jekyll/autoscout24/version.rb
132
+ - lib/jekyll-autoscout24.rb
133
+ - lib/jekyll-autoscout24/backup_reader.rb
134
+ - lib/jekyll-autoscout24/version.rb
77
135
  homepage: https://github.com/staticpagesio/jekyll-autoscout24
78
136
  licenses:
79
137
  - MIT
@@ -1,7 +0,0 @@
1
- require "jekyll/autoscout24/version"
2
-
3
- module Jekyll
4
- module Autoscout24
5
- # Your code goes here...
6
- end
7
- end