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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 571656fc523f4b806bf9e31b9f1a8787d5e488e2
4
- data.tar.gz: 1b9a81c93ad1afb4a2ff373942cb73e6e356e9ee
3
+ metadata.gz: f429049f6059413115470fad788fd017443fd0c6
4
+ data.tar.gz: 9c265460241db741f8393263c09c08b65692cbaf
5
5
  SHA512:
6
- metadata.gz: f72d504018fb3a14cbc0ec976f7399eef56d5dd1f55a8609557f809dc2d28615b15f496ed285904d882550813444c1690888cd03018a4998864725fadb9cf139
7
- data.tar.gz: c708bf87c45d93b2f63cb94c7a987cf6d582ae4095994b27e0229c7c019d8444275da0b13ac493411ea1fbedaa9b4d611f6fc55dbbb67fcc8cf36d5c411d2d24
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
1
+ 0.0.2
@@ -21,5 +21,9 @@ module Pedophile
21
21
  offline_tree.zip(name)
22
22
  end
23
23
 
24
+ def zip_with_custom_dir(output_path_zip, output_directory_name)
25
+ offline_tree.zip_with_custom_dir(output_path_zip, output_directory_name)
26
+ end
27
+
24
28
  end
25
29
  end
@@ -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
@@ -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, "site")
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.1
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-04-09 00:00:00.000000000 Z
11
+ date: 2015-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport