jekyll-torrent 0.0.2 → 0.0.5.1
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 +4 -4
- data/LICENSE +2 -2
- data/README.md +18 -15
- data/jekyll-torrent.gemspec +3 -3
- data/lib/jekyll-torrent.rb +39 -16
- data/lib/jekyll-torrent/version.rb +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78b8a8796ee9d34ec9d2d34ac4e58336d29d57f5
|
4
|
+
data.tar.gz: 5855042ff2fa4945146716b885cb928142caadd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aed71a3e7de873105cc97eda08e200cea2d782c73cd54f21d862470b07b4125df2486da4c4b6fde17fa782d8971ac256f48e65473d4a2b235a1cf1f63c2d8104
|
7
|
+
data.tar.gz: af898d0b5588e791361757a207320e8b7e4b62efb9ad7a85d321da0d6bf473d9c3e348b0d6a569c78f05f496449e564b7f593256e05d30313faebef0b6d678c1
|
data/LICENSE
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
Copyright (c) 2012
|
2
|
-
|
1
|
+
Copyright (c) 2012-2018 Mauricio Pasquier Juan <mpj@endefensadelsl.org>
|
2
|
+
fauno <fauno@endefensadelsl.org>
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -1,34 +1,37 @@
|
|
1
1
|
# A torrent plugin for jekyll
|
2
2
|
|
3
|
-
A simple plugin that uses [
|
4
|
-
whole site after it's generated by jekyll. It
|
5
|
-
`Jekyll::Site.process`.
|
3
|
+
A simple plugin that uses [transmission-create][1] to create a .torrent
|
4
|
+
file with your whole site after it's generated by jekyll. It
|
5
|
+
monkeypatches `Jekyll::Site.process`.
|
6
6
|
|
7
|
-
It's used on [En Defensa del Software Libre][0]
|
7
|
+
It's used on [En Defensa del Software Libre][0] and [Utopía Pirata][2]
|
8
8
|
|
9
|
-
[0]:
|
10
|
-
[1]:
|
9
|
+
[0]: https://endefensadelsl.org/
|
10
|
+
[1]: https://transmissionbt.com/
|
11
|
+
[2]: https://utopia.partidopirata.com.ar/
|
11
12
|
|
12
13
|
## Configuration
|
13
14
|
|
14
15
|
Default configuration (change it by superseding in `_config.yml`):
|
15
16
|
|
16
17
|
torrent:
|
17
|
-
announce: 'udp://
|
18
|
+
announce: 'udp://9.rarbg.to:2710/announce'
|
18
19
|
file: 'site.torrent'
|
19
|
-
flags: '
|
20
|
-
bin: '
|
20
|
+
flags: ''
|
21
|
+
bin: 'transmission-create'
|
21
22
|
|
22
|
-
* `announce` is the URL of the tracker.
|
23
|
+
* `announce` is the URL of the tracker. It can also be an array. Use
|
24
|
+
the special value `'random'` if you want to use 3 random trackers from
|
25
|
+
<https://torrents.me/tracker-list/>
|
23
26
|
|
24
27
|
* `file` is the torrent filename.
|
25
28
|
|
26
|
-
* `flags` is a string with the flags you will normally pass to
|
27
|
-
cli, besides `--
|
29
|
+
* `flags` is a string with the flags you will normally pass to
|
30
|
+
`transmission-create` on cli, besides `--outfile` and `--tracker`
|
28
31
|
|
29
|
-
* `bin` is the `
|
32
|
+
* `bin` is the `transmission-create` binary path
|
30
33
|
|
31
34
|
## How to run
|
32
35
|
|
33
|
-
Execute `jekyll` like always, just make sure you have
|
34
|
-
it's binary is accessible.
|
36
|
+
Execute `jekyll` like always, just make sure you have
|
37
|
+
`transmission-create` installed and it's binary is accessible.
|
data/jekyll-torrent.gemspec
CHANGED
@@ -6,13 +6,13 @@ require 'jekyll-torrent/version'
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "jekyll-torrent"
|
8
8
|
gem.version = JekyllTorrent::VERSION
|
9
|
-
gem.authors = ["Mauricio Pasquier Juan"]
|
10
|
-
gem.email = ["mauricio@pasquierjuan.com.ar"]
|
9
|
+
gem.authors = ["Mauricio Pasquier Juan", "fauno"]
|
10
|
+
gem.email = ["mauricio@pasquierjuan.com.ar", "fauno@endefensadelsl.org"]
|
11
11
|
gem.description = %q{A simple plugin that creates a .torrent file with your
|
12
12
|
whole site after it's generated by jekyll. It
|
13
13
|
monkeypatches `Jekyll::Site.process`.}
|
14
14
|
gem.summary = %q{Create a .torrent file with your whole site!}
|
15
|
-
gem.homepage = "https://github.com/
|
15
|
+
gem.homepage = "https://github.com/edsl/jekyll-torrent"
|
16
16
|
gem.license = "MIT"
|
17
17
|
|
18
18
|
gem.files = `git ls-files`.split($/)
|
data/lib/jekyll-torrent.rb
CHANGED
@@ -1,17 +1,25 @@
|
|
1
|
+
require 'open-uri'
|
1
2
|
require 'jekyll-torrent/version'
|
2
3
|
|
3
4
|
# Creates a torrent file with your generated site. You should serve the files
|
4
|
-
# with your
|
5
|
-
#
|
6
|
-
# Default config values:
|
7
|
-
#
|
8
|
-
# torrent:
|
9
|
-
# announce: 'udp://tracker.publicbt.com:80'
|
10
|
-
# file: 'site.torrent'
|
11
|
-
# flags: '--verbose'
|
12
|
-
# bin: 'mktorrent'
|
13
|
-
#
|
5
|
+
# with your client.
|
14
6
|
module Jekyll
|
7
|
+
class RenderTorrentUrl < Liquid::Tag
|
8
|
+
def render(context)
|
9
|
+
site = context.registers[:site]
|
10
|
+
File.join site.config.fetch('baseurl'],'/'), site.config.dig('torrent', 'file')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class RenderMagnet < Liquid::Tag
|
15
|
+
def render(context)
|
16
|
+
site = context.registers[:site]
|
17
|
+
file = "#{site.dest}/#{site.config.dig('torrent', 'file')}"
|
18
|
+
|
19
|
+
`transmission-show --magnet #{file}`
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
15
23
|
class Site
|
16
24
|
|
17
25
|
def process_with_torrent
|
@@ -23,12 +31,24 @@ module Jekyll
|
|
23
31
|
def make_torrent
|
24
32
|
# The torrent file is written at the root of the site
|
25
33
|
file = "#{dest}/#{torrent['file']}"
|
34
|
+
tracker = [torrent['announce']].flatten
|
35
|
+
tracker = random_tracker if tracker.include? 'random'
|
36
|
+
trackers = tracker.join(' --tracker ')
|
26
37
|
|
27
38
|
# Delete existing file since `mktorrent` doesn't overwrite it
|
28
39
|
File.delete(file) if File.exists?(file)
|
29
40
|
|
30
41
|
puts "Generating torrent file at #{file}"
|
31
|
-
|
42
|
+
# TODO usar popen3
|
43
|
+
command = "#{torrent['bin']} --tracker #{trackers} --outfile \"#{file}\" #{torrent['flags']} \"#{dest}\""
|
44
|
+
puts command
|
45
|
+
puts `#{command}`
|
46
|
+
end
|
47
|
+
|
48
|
+
def random_tracker
|
49
|
+
open('https://torrents.me/tracker-list/?download=latest') do |l|
|
50
|
+
l.read
|
51
|
+
end.split("\n").sample(3)
|
32
52
|
end
|
33
53
|
|
34
54
|
# Alias method chain
|
@@ -39,11 +59,14 @@ module Jekyll
|
|
39
59
|
# Merges config with default values
|
40
60
|
def torrent
|
41
61
|
@torrent_config ||= {
|
42
|
-
'announce'
|
43
|
-
'file'
|
44
|
-
'flags'
|
45
|
-
'bin'
|
46
|
-
}.merge(config
|
62
|
+
'announce' => 'udp://9.rarbg.to:2710/announce',
|
63
|
+
'file' => 'site.torrent',
|
64
|
+
'flags' => '',
|
65
|
+
'bin' => 'transmission-create'
|
66
|
+
}.merge(config.fetch('torrent', {}))
|
47
67
|
end
|
48
68
|
end
|
49
69
|
end
|
70
|
+
|
71
|
+
Liquid::Template.register_tag('magnet', Jekyll::RenderMagnet)
|
72
|
+
Liquid::Template.register_tag('torrent', Jekyll::RenderTorrentUrl)
|
metadata
CHANGED
@@ -1,27 +1,28 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-torrent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mauricio Pasquier Juan
|
8
|
+
- fauno
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2018-07-18 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: jekyll
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
|
-
- -
|
18
|
+
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
20
|
version: '0'
|
20
21
|
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
|
-
- -
|
25
|
+
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
27
|
version: '0'
|
27
28
|
description: |-
|
@@ -30,11 +31,12 @@ description: |-
|
|
30
31
|
monkeypatches `Jekyll::Site.process`.
|
31
32
|
email:
|
32
33
|
- mauricio@pasquierjuan.com.ar
|
34
|
+
- fauno@endefensadelsl.org
|
33
35
|
executables: []
|
34
36
|
extensions: []
|
35
37
|
extra_rdoc_files: []
|
36
38
|
files:
|
37
|
-
- .gitignore
|
39
|
+
- ".gitignore"
|
38
40
|
- Gemfile
|
39
41
|
- LICENSE
|
40
42
|
- README.md
|
@@ -42,7 +44,7 @@ files:
|
|
42
44
|
- jekyll-torrent.gemspec
|
43
45
|
- lib/jekyll-torrent.rb
|
44
46
|
- lib/jekyll-torrent/version.rb
|
45
|
-
homepage: https://github.com/
|
47
|
+
homepage: https://github.com/edsl/jekyll-torrent
|
46
48
|
licenses:
|
47
49
|
- MIT
|
48
50
|
metadata: {}
|
@@ -52,19 +54,18 @@ require_paths:
|
|
52
54
|
- lib
|
53
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
54
56
|
requirements:
|
55
|
-
- -
|
57
|
+
- - ">="
|
56
58
|
- !ruby/object:Gem::Version
|
57
59
|
version: '0'
|
58
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
61
|
requirements:
|
60
|
-
- -
|
62
|
+
- - ">="
|
61
63
|
- !ruby/object:Gem::Version
|
62
64
|
version: '0'
|
63
65
|
requirements: []
|
64
66
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.5.2
|
66
68
|
signing_key:
|
67
69
|
specification_version: 4
|
68
70
|
summary: Create a .torrent file with your whole site!
|
69
71
|
test_files: []
|
70
|
-
has_rdoc:
|