unpack 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,6 +14,8 @@ You pass a directory and it will find all your archive files, unpack and remove
14
14
 
15
15
  Start `irb` and include the gem, `require 'unpack'`
16
16
 
17
+ ## Working with a directory
18
+
17
19
  ### Unpack everything in the current directory
18
20
 
19
21
  $ Unpack.runner!
@@ -40,7 +42,7 @@ Start `irb` and include the gem, `require 'unpack'`
40
42
 
41
43
  $ Unpack.runner!('.', depth: 3)
42
44
  => [#<Container:0x000001010ab458 @files=["dmd-tsa-cd2.avi"], @directory="/Downloads/Some.Super.Movie/CD2">]
43
-
45
+
44
46
  ### Unpack everything, even one file directories
45
47
 
46
48
  To prevent you from unarchive files in folders that contains subtitles and other nonrelevant files, the folder must contain 5 archive files or more.
@@ -49,8 +51,27 @@ If you want to unpack everything, even subtitles directories, then you will have
49
51
 
50
52
  $ Unpack.runner!('.', min_files: 0)
51
53
  => [#<Container:0x000001010ab458 @files=["english.str"], @directory="/Downloads/Subtitle/">]
54
+
55
+ ## Working with one specific file
52
56
 
53
- ### Some configure alternatives
57
+ ### Unpack a file
58
+
59
+ $ Unpack.it!(file: 'zip/my_file.zip')
60
+ => [#<Container:0x000001010ab458 @files=["file1", "file2"], @directory="/Downloads/my/files/zip">]
61
+
62
+ ### Unpack a specific file, removing it when done
63
+
64
+ $ Unpack.it!(file: 'zip/my_file.zip', remove: true)
65
+ => [#<Container:0x000001010ab458 @files=["file1", "file2"], @directory="/Downloads/my/files/zip">]
66
+
67
+ ### Unpack a specific file and move the new files to a destination directory
68
+
69
+ $ Unpack.it!(file: 'zip/my_file.zip', to: '/tmp')
70
+ => [#<Container:0x000001010ab458 @files=["file1", "file2"], @directory="/tmp">]
71
+
72
+ ## Some configure alternatives
73
+
74
+ ### The *runner!* method
54
75
 
55
76
  - ** :min_files ** (Integer) The minimum amount of files in the directory you want to archive the files in. *Default is 5*.
56
77
  - ** :depth ** (Integer) The maximum folder depth. *Default is 2*.
@@ -59,9 +80,18 @@ If you want to unpack everything, even subtitles directories, then you will have
59
80
  - ** :remove ** (Boolean) Removes archived files after they have been used. *Default is false*.
60
81
  - ** :absolute_path_to_unrar ** (String) The absolut path to the unrar binary. *Default is the [unrar](http://homepage.mac.com/pnoriega/unrar.html) binary that comes with the gem*.
61
82
 
83
+ ### The *it!* method
84
+
85
+ - **:to** (String) The absolute or relative path to the destination directory. If nothing is defined, the *:file* path will be used.
86
+ - **:file** (String) The absolute or relative path to the archive file.
87
+ - **:remove** (Boolean) See the *runner!* method above
88
+ - **:absolute_path_to_unrar** (String) See the *runner!* method above
89
+ - **:debugger** (String) See the *runner!* method above
90
+
62
91
  ## What is being returned?
63
92
 
64
- The `runner!` method returns an `Array` of `Container` objects.
93
+ The `runner!` method returns an `Array` of `Container` instances.
94
+ The `it!` method returns an instance of `Container`.
65
95
 
66
96
  These are the accessors of the `Container` class.
67
97
 
@@ -77,7 +107,8 @@ These are the accessors of the `Container` class.
77
107
 
78
108
  ## Requirements
79
109
 
80
- The gem is tested in OS X 10.6.6 using Ruby 1.9.2
110
+ The gem is tested in OS X 10.6.6 using Ruby 1.9.2.
111
+ It will not work in 1.8, due to the [new hash syntax](http://blog.peepcode.com/tutorials/2011/rip-ruby-hash-rocket-syntax).
81
112
 
82
113
  ## Thanks to ...
83
114
 
@@ -323,4 +323,8 @@ describe Unpack, "should be able to unpack" do
323
323
  it "should have some unarchived files" do
324
324
  Unpack.it!(file: "spec/data/from/test_package.rar").should have(5).files
325
325
  end
326
+
327
+ it "should contain the right directory when defining a destination path" do
328
+ Unpack.it!(file: "spec/data/from/test_package.rar", to: 'spec/data/to').directory.should match(/spec\/data\/to/)
329
+ end
326
330
  end
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "unpack"
6
- s.version = "0.1.6"
6
+ s.version = "0.1.7"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Linus Oleander"]
9
9
  s.email = ["linus@oleander.nu"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Linus Oleander
@@ -63,11 +63,6 @@ files:
63
63
  - bin/unrar
64
64
  - lib/unpack.rb
65
65
  - lib/unpack/container.rb
66
- - spec/data/from/110_real_.file.rar
67
- - spec/data/from/120_real_.file.rar
68
- - spec/data/from/167_real_.file.rar
69
- - spec/data/from/777_real_.file.rar
70
- - spec/data/from/918_real_.file.rar
71
66
  - spec/data/from/some_zip_files.zip
72
67
  - spec/data/from/test_package.rar
73
68
  - spec/data/o_files/some_zip_files.zip
@@ -174,6 +169,11 @@ files:
174
169
  - spec/data/rar/subdir/483_subtitle_.rar
175
170
  - spec/data/rar/subdir/639_subtitle_.rar
176
171
  - spec/data/rar_real/test_package.rar
172
+ - spec/data/to/110_real_.file.rar
173
+ - spec/data/to/120_real_.file.rar
174
+ - spec/data/to/167_real_.file.rar
175
+ - spec/data/to/777_real_.file.rar
176
+ - spec/data/to/918_real_.file.rar
177
177
  - spec/data/zip_real/some_zip_files.zip
178
178
  - spec/spec_helper.rb
179
179
  - spec/unpack_spec.rb
@@ -211,11 +211,6 @@ signing_key:
211
211
  specification_version: 3
212
212
  summary: An automated unrar gem
213
213
  test_files:
214
- - spec/data/from/110_real_.file.rar
215
- - spec/data/from/120_real_.file.rar
216
- - spec/data/from/167_real_.file.rar
217
- - spec/data/from/777_real_.file.rar
218
- - spec/data/from/918_real_.file.rar
219
214
  - spec/data/from/some_zip_files.zip
220
215
  - spec/data/from/test_package.rar
221
216
  - spec/data/o_files/some_zip_files.zip
@@ -322,6 +317,11 @@ test_files:
322
317
  - spec/data/rar/subdir/483_subtitle_.rar
323
318
  - spec/data/rar/subdir/639_subtitle_.rar
324
319
  - spec/data/rar_real/test_package.rar
320
+ - spec/data/to/110_real_.file.rar
321
+ - spec/data/to/120_real_.file.rar
322
+ - spec/data/to/167_real_.file.rar
323
+ - spec/data/to/777_real_.file.rar
324
+ - spec/data/to/918_real_.file.rar
325
325
  - spec/data/zip_real/some_zip_files.zip
326
326
  - spec/spec_helper.rb
327
327
  - spec/unpack_spec.rb