ruby_lepton 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +28 -13
- data/exe/ruby_lepton +8 -2
- data/lib/ruby_lepton.rb +2 -2
- data/lib/ruby_lepton/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5d1bfe5d204f11280e20e5c04979e065651d03fc2eda2329be96a8168047e31
|
4
|
+
data.tar.gz: '048e6fcf5cbc5ca68993b28ced25fd17695f7dd6ccf9d25532baa39b3fd0c999'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8782d0d7a84d2a0acc0cf090c3f556079655f9394276be080b20211ca8649d70e3bc2222eea33611e4c35f008fab2588ff37468cadddb2f09b0647ef424af56
|
7
|
+
data.tar.gz: f67aa770c93a4a97ed5660bec3f8bad09e1aab852755c416c4959bc420948317205196459bb1d08be7607f798f4573e05fc1f2ef245e02e7cbaa9e1164eeaee4
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
|
2
|
+
|
2
3
|
# Ruby Lepton
|
3
4
|
|
4
5
|
A Ruby wrapper library for Dropbox JPEG Lepton compression tool.
|
@@ -28,38 +29,52 @@ or include inside Gemfile
|
|
28
29
|
```
|
29
30
|
gem "ruby_lepton"
|
30
31
|
```
|
31
|
-
|
32
|
+
Install ruby lepton:
|
32
33
|
|
33
|
-
|
34
|
+
$ bundle exec ruby_lepton install
|
34
35
|
|
35
|
-
|
36
|
+
## Usage
|
36
37
|
|
37
|
-
|
38
|
+
Compress method
|
39
|
+
```
|
40
|
+
RubyLepton::Base.compress(path_to_source_file, options)
|
41
|
+
```
|
42
|
+
Decompress method
|
43
|
+
```
|
44
|
+
RubyLepton::Base.decompress(path_to_source_file, options)
|
45
|
+
```
|
46
|
+
`options` can be passed as hash `{binary: true}`
|
38
47
|
|
39
|
-
|
48
|
+
Supported options:
|
49
|
+
`binary`
|
40
50
|
|
51
|
+
## Usage CLI
|
41
52
|
|
53
|
+
Generate binstubs for CLI commands:
|
54
|
+
|
55
|
+
`bundle binstubs ruby_lepton`
|
56
|
+
|
57
|
+
`ruby_lepton` executable will be generated under `bin/` folder
|
42
58
|
|
43
|
-
## Usage
|
44
59
|
|
45
60
|
To compress a file:
|
46
61
|
```
|
47
|
-
bundle exec ruby_lepton compress [PATH] [OPTIONS]
|
62
|
+
$ bundle exec ruby_lepton compress [PATH] [OPTIONS]
|
48
63
|
```
|
49
64
|
To decompress a file:
|
50
65
|
```
|
51
|
-
bundle exec ruby_lepton decompress [PATH] [OPTIONS]
|
66
|
+
$ bundle exec ruby_lepton decompress [PATH] [OPTIONS]
|
52
67
|
```
|
53
68
|
|
54
69
|
#### Options
|
55
70
|
```
|
56
|
-
bundle exec ruby_lepton compress path_to_file --verbose --binary
|
57
|
-
bundle exec ruby_lepton decompress path_to_file --no-verbose --no-binary
|
71
|
+
$ bundle exec ruby_lepton compress path_to_file --verbose --binary
|
72
|
+
$ bundle exec ruby_lepton decompress path_to_file --no-verbose --no-binary
|
58
73
|
```
|
59
74
|
or you can pass alias for binary
|
60
75
|
```
|
61
|
-
bundle exec ruby_lepton compress path_to_file -b
|
62
|
-
bundle exec ruby_lepton decompress path_to_file -b
|
76
|
+
$ bundle exec ruby_lepton compress path_to_file -b
|
77
|
+
$ bundle exec ruby_lepton decompress path_to_file -b
|
63
78
|
```
|
64
79
|
## Output
|
65
80
|
|
@@ -69,7 +84,7 @@ By default, file is generated for compression and decompression under `output/`
|
|
69
84
|
#### Binary data
|
70
85
|
Binary data will be returned instead of file by passing `--binary` option
|
71
86
|
```
|
72
|
-
bundle exec ruby_lepton compress path_to_file --binary
|
87
|
+
$ bundle exec ruby_lepton compress path_to_file --binary
|
73
88
|
```
|
74
89
|
|
75
90
|
File is not generated when `--binary` option is passed
|
data/exe/ruby_lepton
CHANGED
@@ -5,9 +5,14 @@ require 'thor'
|
|
5
5
|
|
6
6
|
module RubyLepton
|
7
7
|
class CLI < Thor
|
8
|
+
include Thor::Actions
|
8
9
|
check_unknown_options!
|
9
10
|
class_option 'verbose', :type => :boolean, :default => false
|
10
11
|
|
12
|
+
def self.source_root
|
13
|
+
File.dirname(__FILE__)
|
14
|
+
end
|
15
|
+
|
11
16
|
def self.exit_on_failure?
|
12
17
|
true
|
13
18
|
end
|
@@ -40,9 +45,10 @@ module RubyLepton
|
|
40
45
|
RubyLepton::Base.decompress(path, opts)
|
41
46
|
end
|
42
47
|
|
43
|
-
desc "Install", "Install lepton"
|
48
|
+
desc "Install", "Install ruby lepton"
|
44
49
|
def install
|
45
|
-
puts "
|
50
|
+
puts "Creating output directory" if options.verbose?
|
51
|
+
empty_directory("output")
|
46
52
|
end
|
47
53
|
end
|
48
54
|
end
|
data/lib/ruby_lepton.rb
CHANGED
@@ -5,7 +5,7 @@ module RubyLepton
|
|
5
5
|
class Error < StandardError; end
|
6
6
|
class Base
|
7
7
|
class << self
|
8
|
-
def compress(source_file, options)
|
8
|
+
def compress(source_file, options={})
|
9
9
|
generated_file = "output/"+SecureRandom.hex(4)+".lep"
|
10
10
|
`lepton -memory=1024M -threadmemory=128M #{source_file} #{generated_file}`
|
11
11
|
if File.exist? generated_file
|
@@ -21,7 +21,7 @@ module RubyLepton
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def decompress(source_file, options)
|
24
|
+
def decompress(source_file, options={})
|
25
25
|
generated_file = "output/"+SecureRandom.hex(4)+".jpeg"
|
26
26
|
`lepton -memory=1024M -threadmemory=128M #{source_file} #{generated_file}`
|
27
27
|
if File.exist? generated_file
|
data/lib/ruby_lepton/version.rb
CHANGED