jekyll-torrent 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9a4d01558ee4ee36b110d334955aeb82f6a60b77
4
+ data.tar.gz: bbd355fe71c9cb5dc65337bde3b031720f64144a
5
+ SHA512:
6
+ metadata.gz: e29d57e5bbb7cd2f9ac8f9087528d66a6d19f222d39e88b7e47a55983b68d1e8617ac54f167ce8234c004954af25a48102166ea93102a0519e1a8a88fdb076b0
7
+ data.tar.gz: a005d7d611529d7c1ec0d6d490b64bc5fbf33a45c02897fe48e4bf0c2477c59c34c700d784c1e34baec339c5189e9caac28e4a014ba8e707c097f68f93fc5f5a
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2012 Nicolás Reynolds <fauno@endefensadelsl.org>
2
+ Mauricio Pasquier Juan <mpj@endefensadelsl.org>
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # A torrent plugin for jekyll
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`.
6
+
7
+ It's used on [En Defensa del Software Libre][0].
8
+
9
+ [0]: http://endefensadelsl.org
10
+ [1]: http://mktorrent.sourceforge.net/
11
+
12
+ ## Configuration
13
+
14
+ Default configuration (change it by superseding in `_config.yml`):
15
+
16
+ torrent:
17
+ announce: 'udp://tracker.publicbt.com:80'
18
+ file: 'site.torrent'
19
+ flags: '--verbose'
20
+ bin: 'mktorrent'
21
+
22
+ * `announce` is the URL of the tracker.
23
+
24
+ * `file` is the torrent filename.
25
+
26
+ * `flags` is a string with the flags you will normally pass to `mktorrent` on
27
+ cli, besides `--output` and `--announce`
28
+
29
+ * `bin` is the `mktorrent` binary path
30
+
31
+ ## How to run
32
+
33
+ Execute `jekyll` like always, just make sure you have `mktorrent` installed and
34
+ it's binary is accessible.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jekyll-torrent/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "jekyll-torrent"
8
+ gem.version = JekyllTorrent::VERSION
9
+ gem.authors = ["Mauricio Pasquier Juan"]
10
+ gem.email = ["mauricio@pasquierjuan.com.ar"]
11
+ gem.description = %q{A simple plugin that creates a .torrent file with your
12
+ whole site after it's generated by jekyll. It
13
+ monkeypatches `Jekyll::Site.process`.}
14
+ gem.summary = %q{Create a .torrent file with your whole site!}
15
+ gem.homepage = "https://github.com/mauriciopasquier/jekyll-torrent"
16
+
17
+ gem.files = `git ls-files`.split($/)
18
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
19
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
+ gem.require_paths = ["lib"]
21
+
22
+ gem.add_dependency('jekyll')
23
+ end
@@ -0,0 +1,49 @@
1
+ require 'jekyll-torrent/version'
2
+
3
+ # 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
+ #
14
+ module Jekyll
15
+ class Site
16
+
17
+ def process_with_torrent
18
+ # Original Site.process method
19
+ process_without_torrent
20
+ self.make_torrent
21
+ end
22
+
23
+ def make_torrent
24
+ # The torrent file is written at the root of the site
25
+ file = "#{dest}/#{torrent['file']}"
26
+
27
+ # Delete existing file since `mktorrent` doesn't overwrite it
28
+ File.delete(file) if File.exists?(file)
29
+
30
+ puts "Generating torrent file at #{file}"
31
+ puts `#{torrent['bin']} -a #{torrent['announce']} -o #{file} #{torrent['flags']} #{dest}`
32
+ end
33
+
34
+ # Alias method chain
35
+ alias_method :process_without_torrent, :process
36
+ alias_method :process, :process_with_torrent
37
+
38
+ private
39
+ # Merges config with default values
40
+ def torrent
41
+ @torrent_config ||= {
42
+ 'announce' => 'udp://tracker.publicbt.com:80',
43
+ 'file' => 'site.torrent',
44
+ 'flags' => '--verbose',
45
+ 'bin' => 'mktorrent'
46
+ }.merge(config['torrent'] || {})
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,3 @@
1
+ module JekyllTorrent
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,69 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-torrent
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mauricio Pasquier Juan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: |-
28
+ A simple plugin that creates a .torrent file with your
29
+ whole site after it's generated by jekyll. It
30
+ monkeypatches `Jekyll::Site.process`.
31
+ email:
32
+ - mauricio@pasquierjuan.com.ar
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE
40
+ - README.md
41
+ - Rakefile
42
+ - jekyll-torrent.gemspec
43
+ - lib/jekyll-torrent.rb
44
+ - lib/jekyll-torrent/version.rb
45
+ homepage: https://github.com/mauriciopasquier/jekyll-torrent
46
+ licenses: []
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.0.3
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Create a .torrent file with your whole site!
68
+ test_files: []
69
+ has_rdoc: