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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 16c22a4d1df2269e16eae00cfa51c400dd174c4970bb73400ef1f253ea6dace2
4
- data.tar.gz: 7bd5fa5aefbf44736cea4ee339aafc1d0641bd95f284e86a7edad1d973822f5a
3
+ metadata.gz: e5d1bfe5d204f11280e20e5c04979e065651d03fc2eda2329be96a8168047e31
4
+ data.tar.gz: '048e6fcf5cbc5ca68993b28ced25fd17695f7dd6ccf9d25532baa39b3fd0c999'
5
5
  SHA512:
6
- metadata.gz: fc7ac1096353cb2fd0b7b9682ea405d7c23c18101509fe1e3a8752eb6038ad907a6cdc09468f68a286b85e839bf60b5bb4f1c2f099618cb59f8ea8cb6e2c4fbd
7
- data.tar.gz: fe09b05438f1c0a049bd555a1db7604f7d0bbe17b00bda84635c16de4430cffb595e4cd0ee6f60d99372a27ba5f12dae1c2eb19d2ef6f03918390f6d20f0f4e3
6
+ metadata.gz: e8782d0d7a84d2a0acc0cf090c3f556079655f9394276be080b20211ca8649d70e3bc2222eea33611e4c35f008fab2588ff37468cadddb2f09b0647ef424af56
7
+ data.tar.gz: f67aa770c93a4a97ed5660bec3f8bad09e1aab852755c416c4959bc420948317205196459bb1d08be7607f798f4573e05fc1f2ef245e02e7cbaa9e1164eeaee4
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_lepton (0.1.0)
4
+ ruby_lepton (0.1.1)
5
5
  thor
6
6
 
7
7
  GEM
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
- Generate binstubs:
32
+ Install ruby lepton:
32
33
 
33
- `bundle binstubs ruby_lepton`
34
+ $ bundle exec ruby_lepton install
34
35
 
35
- `ruby_lepton` executable will be generated under `bin/` folder
36
+ ## Usage
36
37
 
37
- Install ruby lepton:
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
- bundle exec ruby_lepton install
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
@@ -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 "Installing lepton" if options.verbose?
50
+ puts "Creating output directory" if options.verbose?
51
+ empty_directory("output")
46
52
  end
47
53
  end
48
54
  end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module RubyLepton
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_lepton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karan