jekyll-torrent 0.0.2 → 0.0.5.1

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
  SHA1:
3
- metadata.gz: 1a8878c50d2ff4bc118fe78494a2c5e7c7a3312c
4
- data.tar.gz: 5778f580e15e82cdbef330f835531dbb6c33ef18
3
+ metadata.gz: 78b8a8796ee9d34ec9d2d34ac4e58336d29d57f5
4
+ data.tar.gz: 5855042ff2fa4945146716b885cb928142caadd0
5
5
  SHA512:
6
- metadata.gz: c8dc62f14358a9dc14c131b5e569db96fb1ce05e4383b78598738d2adc563ad006cf4a16f55e1cae3c48f178c64ad15ad59f2211d0c74f086fc6ec79f78cc691
7
- data.tar.gz: 9229244bb7111a2d161726f68301c498172fb09be1168f2b193613138e9a81213e87fe8212036ba36d9fd458527d86e6dc5d335a56cdf8675c0a4b8f599e9ca1
6
+ metadata.gz: aed71a3e7de873105cc97eda08e200cea2d782c73cd54f21d862470b07b4125df2486da4c4b6fde17fa782d8971ac256f48e65473d4a2b235a1cf1f63c2d8104
7
+ data.tar.gz: af898d0b5588e791361757a207320e8b7e4b62efb9ad7a85d321da0d6bf473d9c3e348b0d6a569c78f05f496449e564b7f593256e05d30313faebef0b6d678c1
data/LICENSE CHANGED
@@ -1,5 +1,5 @@
1
- Copyright (c) 2012 Nicolás Reynolds <fauno@endefensadelsl.org>
2
- Mauricio Pasquier Juan <mpj@endefensadelsl.org>
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 [mktorrent][1] to create a .torrent file with your
4
- whole site after it's generated by jekyll. It monkeypatches
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]: http://endefensadelsl.org
10
- [1]: http://mktorrent.sourceforge.net/
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://tracker.publicbt.com:80'
18
+ announce: 'udp://9.rarbg.to:2710/announce'
18
19
  file: 'site.torrent'
19
- flags: '--verbose'
20
- bin: 'mktorrent'
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 `mktorrent` on
27
- cli, besides `--output` and `--announce`
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 `mktorrent` binary path
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 `mktorrent` installed and
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.
@@ -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/mauriciopasquier/jekyll-torrent"
15
+ gem.homepage = "https://github.com/edsl/jekyll-torrent"
16
16
  gem.license = "MIT"
17
17
 
18
18
  gem.files = `git ls-files`.split($/)
@@ -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 cliente.
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
- puts `#{torrent['bin']} -a #{torrent['announce']} -o #{file} #{torrent['flags']} #{dest}`
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' => 'udp://tracker.publicbt.com:80',
43
- 'file' => 'site.torrent',
44
- 'flags' => '--verbose',
45
- 'bin' => 'mktorrent'
46
- }.merge(config['torrent'] || {})
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)
@@ -1,3 +1,3 @@
1
1
  module JekyllTorrent
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.5.1"
3
3
  end
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.2
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: 2013-11-15 00:00:00.000000000 Z
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/mauriciopasquier/jekyll-torrent
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.0.3
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: