pedophile 0.0.1 → 0.0.2
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/README.md +14 -1
- data/VERSION +1 -1
- data/lib/pedophile/downloader.rb +4 -0
- data/lib/pedophile/offline_tree.rb +8 -0
- data/lib/pedophile/wget.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f429049f6059413115470fad788fd017443fd0c6
|
|
4
|
+
data.tar.gz: 9c265460241db741f8393263c09c08b65692cbaf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6521c88a6bb19606194994746d1fc5b706277b437d6f6cb81ac6c7dd85efc61e8de6e5be05382b669fe90d12866e9322278acd28de15eba2320efa3f4a803b63
|
|
7
|
+
data.tar.gz: fdc5d140c64bed27f98bcdfad995cd4de11d46f2c72b1636c350a84f372c9a7efc81ac722b283e702a40e3f1c266dd5dd13ef987f417a2cc9aab7df2062c2af4
|
data/README.md
CHANGED
|
@@ -22,4 +22,17 @@ p.make_it_so
|
|
|
22
22
|
|
|
23
23
|
# zip into single file in tmp/site/site.zip
|
|
24
24
|
p.zip("site.zip")
|
|
25
|
-
</code></pre>
|
|
25
|
+
</code></pre>
|
|
26
|
+
|
|
27
|
+
If you would like change output directory *www.classnamer.com* to something nicer like
|
|
28
|
+
*super_site* and store in zip in different place, please remove:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
p.zip("site.zip")
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
and add:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
p.zip_with_custom_dir("/home/dude/super_offline_site.zip", "super_site")
|
|
38
|
+
```
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.2
|
data/lib/pedophile/downloader.rb
CHANGED
|
@@ -32,6 +32,14 @@ module Pedophile
|
|
|
32
32
|
`#{command}`
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
def zip_with_custom_dir(output_path_zip, output_directory_name)
|
|
36
|
+
command = "cd #{Wget::TMP_PATH}; cd #{Wget::TMP_SITE_DIRECTORY}; mv \"#{self.downloader.wget.site_last_path}\" \"#{output_directory_name}\";"
|
|
37
|
+
command += " zip -r #{output_path_zip} #{output_directory_name}"
|
|
38
|
+
|
|
39
|
+
puts command
|
|
40
|
+
`#{command}`
|
|
41
|
+
end
|
|
42
|
+
|
|
35
43
|
# Desctructive part
|
|
36
44
|
def after_process
|
|
37
45
|
load_processed
|
data/lib/pedophile/wget.rb
CHANGED
|
@@ -3,11 +3,12 @@ require 'fileutils'
|
|
|
3
3
|
|
|
4
4
|
module Pedophile
|
|
5
5
|
class Wget
|
|
6
|
+
TMP_SITE_DIRECTORY = "site"
|
|
6
7
|
TMP_PATH = "offline_tmp"
|
|
7
8
|
TMP_ABSOLUTE_PATH = File.absolute_path(TMP_PATH)
|
|
8
9
|
TMP_FILE_PATH = File.absolute_path(File.join(TMP_PATH, "tmp.tmp"))
|
|
9
10
|
COOKIES_FILE_PATH = File.absolute_path(File.join(TMP_PATH, "cookies.txt"))
|
|
10
|
-
TMP_OFFLINE_PATH = File.join(TMP_PATH,
|
|
11
|
+
TMP_OFFLINE_PATH = File.join(TMP_PATH, TMP_SITE_DIRECTORY)
|
|
11
12
|
|
|
12
13
|
WGET_PARAMS = "-v --random-wait --user-agent=Mozilla/5.0 --keep-session-cookies --load-cookies #{COOKIES_FILE_PATH} --save-cookies #{COOKIES_FILE_PATH}"
|
|
13
14
|
# http://www.gnu.org/software/wget/manual/html_node/Download-Options.html
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pedophile
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aleksander Kwiatkowski
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|