bt_jpegoptim 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 729f2c4699670c6e067b005777b4c581b8b9ff0d7bc3ce48aac1579a982f5265
4
+ data.tar.gz: 3272a82c82c6582407eb7f9a5b74ca25771d1744e896be28640cada27a2aa36a
5
+ SHA512:
6
+ metadata.gz: 514264c5c2b4c17b1ff9412e18db2b46c391317bd6c8b9f10ff4e2cddaca36ad078a1c2e222775be6515656cdb6d4dd5553c16bd3cb49c9c1d7d3378f6f253b7
7
+ data.tar.gz: 1f8650d2b05d8d33d2d1572de52eb6557dfc344b0f0167bfd36a1f4c5304550b5eef983d4302dd872a7395c7df2b0b7cb05ed0dd436c6b5273e77c8bf4d2e13b
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .idea/*
10
+ !.idea/runConfigurations
11
+ !.idea/*.iml
12
+ !.idea/*.xml
13
+ .idea/workspace.xml
14
+ .idea/vcs.xml
15
+ # rspec failure tracking
16
+ .rspec_status
17
+ *.gem
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,35 @@
1
+ stages:
2
+ - test
3
+ - build
4
+ - publish
5
+
6
+ Unit Test:
7
+ stage: test
8
+ tags:
9
+ - rubygem
10
+ script:
11
+ - bundle install
12
+ - bundle exec rspec
13
+ Build:
14
+ stage: build
15
+ tags:
16
+ - rubygem
17
+ script: gem build $GEM_NAME
18
+ artifacts:
19
+ paths:
20
+ - ./*.gem
21
+ Publish:
22
+ stage: publish
23
+ tags:
24
+ - rubygem
25
+ script:
26
+ - mkdir ~/.gem
27
+ - "echo \":rubygems_api_key: $API_KEY\" > ~/.gem/credentials"
28
+ - chmod 0600 ~/.gem/credentials
29
+ - gem push $GEM_NAME-*.gem
30
+ after_script:
31
+ - shred -vfu ~/.gem/credentials
32
+ only:
33
+ - /v[0-9\.]*/
34
+ except:
35
+ - branches
@@ -0,0 +1,75 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared>
5
+ <configuration default="false" name="Local Install" type="RakeRunConfigurationType" factoryName="Rake">
6
+ <module name="bt_jpeg_optim" />
7
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
8
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
9
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
10
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
11
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
12
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
13
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
14
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
15
+ <EXTENSION ID="net.ashald.envfile">
16
+ <option name="IS_ENABLED" value="false" />
17
+ <option name="IS_SUBST" value="false" />
18
+ <option name="IS_PATH_MACRO_SUPPORTED" value="false" />
19
+ <option name="IS_IGNORE_MISSING_FILES" value="false" />
20
+ <ENTRIES>
21
+ <ENTRY IS_ENABLED="true" PARSER="runconfig" />
22
+ </ENTRIES>
23
+ </EXTENSION>
24
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="install" />
25
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
26
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE="" />
27
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
28
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
29
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
30
+ <method v="2" />
31
+ </configuration>
32
+ <configuration default="false" name="Unit Test" type="RakeRunConfigurationType" factoryName="Rake">
33
+ <module name="bt_jpeg_optim" />
34
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
35
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
36
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
37
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
38
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
39
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
40
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
41
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
42
+ <EXTENSION ID="net.ashald.envfile">
43
+ <option name="IS_ENABLED" value="false" />
44
+ <option name="IS_SUBST" value="false" />
45
+ <option name="IS_PATH_MACRO_SUPPORTED" value="false" />
46
+ <option name="IS_IGNORE_MISSING_FILES" value="false" />
47
+ <ENTRIES>
48
+ <ENTRY IS_ENABLED="true" PARSER="runconfig" />
49
+ </ENTRIES>
50
+ </EXTENSION>
51
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
52
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
53
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
54
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
55
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
56
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
57
+ <method v="2" />
58
+ </configuration>
59
+ </shared>
60
+ </component>
61
+ <component name="NewModuleRootManager">
62
+ <content url="file://$MODULE_DIR$" />
63
+ <orderEntry type="inheritedJdk" />
64
+ <orderEntry type="sourceFolder" forTests="false" />
65
+ <orderEntry type="library" scope="PROVIDED" name="binary_transformer (v0.1.0, ruby-2.6.0-p0) [gem]" level="application" />
66
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.2, ruby-2.6.0-p0) [gem]" level="application" />
67
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, ruby-2.6.0-p0) [gem]" level="application" />
68
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.6.0-p0) [gem]" level="application" />
69
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
70
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
71
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.8.2, ruby-2.6.0-p0) [gem]" level="application" />
72
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
73
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
74
+ </component>
75
+ </module>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" addBOMForNewFiles="with NO BOM" />
4
+ </project>
data/.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.6.0-p0" project-jdk-type="RUBY_SDK" />
7
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/bt_jpeg_optim.iml" filepath="$PROJECT_DIR$/.idea/bt_jpeg_optim.iml" />
6
+ <module fileurl="file://$PROJECT_DIR$/.idea/bt_jpeg_optim.iml" filepath="$PROJECT_DIR$/.idea/bt_jpeg_optim.iml" />
7
+ </modules>
8
+ </component>
9
+ </project>
@@ -0,0 +1,29 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="Local Install" type="RakeRunConfigurationType" factoryName="Rake">
3
+ <module name="bt_jpeg_optim" />
4
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
5
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
6
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
7
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
8
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
9
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
10
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
11
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
12
+ <EXTENSION ID="net.ashald.envfile">
13
+ <option name="IS_ENABLED" value="false" />
14
+ <option name="IS_SUBST" value="false" />
15
+ <option name="IS_PATH_MACRO_SUPPORTED" value="false" />
16
+ <option name="IS_IGNORE_MISSING_FILES" value="false" />
17
+ <ENTRIES>
18
+ <ENTRY IS_ENABLED="true" PARSER="runconfig" />
19
+ </ENTRIES>
20
+ </EXTENSION>
21
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="install" />
22
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
23
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE="" />
24
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
25
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
26
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
27
+ <method v="2" />
28
+ </configuration>
29
+ </component>
@@ -0,0 +1,29 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="Unit Test" type="RakeRunConfigurationType" factoryName="Rake">
3
+ <module name="bt_jpeg_optim" />
4
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
5
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
6
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
7
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
8
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
9
+ <EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
10
+ <EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
11
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" />
12
+ <EXTENSION ID="net.ashald.envfile">
13
+ <option name="IS_ENABLED" value="false" />
14
+ <option name="IS_SUBST" value="false" />
15
+ <option name="IS_PATH_MACRO_SUPPORTED" value="false" />
16
+ <option name="IS_IGNORE_MISSING_FILES" value="false" />
17
+ <ENTRIES>
18
+ <ENTRY IS_ENABLED="true" PARSER="runconfig" />
19
+ </ENTRIES>
20
+ </EXTENSION>
21
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_NAME" VALUE="spec" />
22
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ARGS" VALUE="" />
23
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_ATTACHED_TEST_FRAMEWORKS" VALUE=":rspec " />
24
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_TRACE" VALUE="false" />
25
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_DRYRUN" VALUE="false" />
26
+ <RAKE_RUN_CONFIG_SETTINGS_ID NAME="RAKE_TASK_OPTION_PREREQS" VALUE="false" />
27
+ <method v="2" />
28
+ </configuration>
29
+ </component>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/CONTRIBUTING.MD ADDED
@@ -0,0 +1,95 @@
1
+ # Contributing
2
+
3
+ When contributing to this repository, please first discuss the change you wish to make via issue,
4
+ email, or any other method with the owners of this repository before making a change.
5
+
6
+ Please note we have a code of conduct, please follow it in all your interactions with the project.
7
+
8
+ ## Pull Request Process
9
+
10
+ 1. Ensure any install or build dependencies are removed before the end of the layer when doing a
11
+ build.
12
+ 2. Update the README.md with details of changes to the interface, this includes new environment
13
+ variables, exposed ports, useful file locations and container parameters.
14
+ 3. Increase the version numbers in any examples files and the README.md to the new version that this
15
+ Pull Request would represent.
16
+
17
+ The versioning scheme we use is [SemVer](http://semver.org/).
18
+
19
+ 4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
20
+ do not have permission to do that, you may request the second reviewer to merge it for you.
21
+
22
+ ## Code of Conduct
23
+
24
+ ### Our Pledge
25
+
26
+ In the interest of fostering an open and welcoming environment, we as
27
+ contributors and maintainers pledge to making participation in our project and
28
+ our community a harassment-free experience for everyone, regardless of age, body
29
+ size, disability, ethnicity, gender identity and expression, level of experience,
30
+ nationality, personal appearance, race, religion, or sexual identity and
31
+ orientation.
32
+
33
+ ### Our Standards
34
+
35
+ Examples of behavior that contributes to creating a positive environment
36
+ include:
37
+
38
+ * Using welcoming and inclusive language
39
+ * Being respectful of differing viewpoints and experiences
40
+ * Gracefully accepting constructive criticism
41
+ * Focusing on what is best for the community
42
+ * Showing empathy towards other community members
43
+
44
+ Examples of unacceptable behavior by participants include:
45
+
46
+ * The use of sexualized language or imagery and unwelcome sexual attention or
47
+ advances
48
+ * Trolling, insulting/derogatory comments, and personal or political attacks
49
+ * Public or private harassment
50
+ * Publishing others' private information, such as a physical or electronic
51
+ address, without explicit permission
52
+ * Other conduct which could reasonably be considered inappropriate in a
53
+ professional setting
54
+
55
+ ### Our Responsibilities
56
+
57
+ Project maintainers are responsible for clarifying the standards of acceptable
58
+ behavior and are expected to take appropriate and fair corrective action in
59
+ response to any instances of unacceptable behavior.
60
+
61
+ Project maintainers have the right and responsibility to remove, edit, or
62
+ reject comments, commits, code, wiki edits, issues, and other contributions
63
+ that are not aligned to this Code of Conduct, or to ban temporarily or
64
+ permanently any contributor for other behaviors that they deem inappropriate,
65
+ threatening, offensive, or harmful.
66
+
67
+ ### Scope
68
+
69
+ This Code of Conduct applies both within project spaces and in public spaces
70
+ when an individual is representing the project or its community. Examples of
71
+ representing a project or community include using an official project e-mail
72
+ address, posting via an official social media account, or acting as an appointed
73
+ representative at an online or offline event. Representation of a project may be
74
+ further defined and clarified by project maintainers.
75
+
76
+ ### Enforcement
77
+
78
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
79
+ reported by contacting the project team at [kirinnee](kirinnee@gmail.com). All
80
+ complaints will be reviewed and investigated and will result in a response that
81
+ is deemed necessary and appropriate to the circumstances. The project team is
82
+ obligated to maintain confidentiality with regard to the reporter of an incident.
83
+ Further details of specific enforcement policies may be posted separately.
84
+
85
+ Project maintainers who do not follow or enforce the Code of Conduct in good
86
+ faith may face temporary or permanent repercussions as determined by other
87
+ members of the project's leadership.
88
+
89
+ ### Attribution
90
+
91
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
92
+ available at [http://contributor-covenant.org/version/1/4][version]
93
+
94
+ [homepage]: http://contributor-covenant.org
95
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bt_jpegoptim (0.1.0)
5
+ binary_transformer (~> 0.1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ binary_transformer (0.1.0)
11
+ kirinnee_core (~> 0.2.1)
12
+ mimemagic (~> 0.3.3)
13
+ diff-lcs (1.3)
14
+ kirinnee_core (0.2.1)
15
+ mimemagic (0.3.3)
16
+ rake (10.5.0)
17
+ rspec (3.8.0)
18
+ rspec-core (~> 3.8.0)
19
+ rspec-expectations (~> 3.8.0)
20
+ rspec-mocks (~> 3.8.0)
21
+ rspec-core (3.8.0)
22
+ rspec-support (~> 3.8.0)
23
+ rspec-expectations (3.8.2)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.8.0)
26
+ rspec-mocks (3.8.0)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.8.0)
29
+ rspec-support (3.8.0)
30
+
31
+ PLATFORMS
32
+ x64-mingw32
33
+
34
+ DEPENDENCIES
35
+ bt_jpegoptim!
36
+ bundler (~> 1.17)
37
+ rake (~> 10.0)
38
+ rspec (~> 3.0)
39
+
40
+ BUNDLED WITH
41
+ 1.17.2
data/LICENSE.MD ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2019 kirinnee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # Binary Transformer for JpegOptim
2
+
3
+ Binary Transformer plugin for jpeg optim.
4
+
5
+ Requires JpegOptim to be available via the PATH variable globally
6
+
7
+ To use it, please also install gem [Binary Transformer](https://gitlab.com/ruby-gem/binary-transformer), and
8
+ see [usage](#Usage).
9
+
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'bt_jpegoptim'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install bt_jpegoptim
26
+
27
+ ## Dependency
28
+ This depends on [JpegOptim](https://github.com/tjko/jpegoptim), so please ensure its available via
29
+ global PATH.
30
+
31
+ JpegOptim has to be at least version 1.4.4
32
+
33
+ To Check JpegOptim version:
34
+ ```bash
35
+ $ jpegoptim --help
36
+ ```
37
+
38
+ ## Getting Started
39
+ Install and require binary transform, and create a JpegOptim
40
+ instance. The constructor can take in the following fields
41
+
42
+ |Field|Description|
43
+ |---|---|
44
+ | strip_all: | Strip all metadata from the jpeg image. Default: true |
45
+ | progressive: | Make the jpeg progressive. Default: true |
46
+ | quality: | The maximum quality to keep. Default: 75|
47
+
48
+ ```ruby
49
+ require "binary_transformer"
50
+ require "bt_jpegoptim"
51
+
52
+ # Read image as binary
53
+ image = IO.binread "image.jpg"
54
+
55
+ # Use binary_transformer module to allow stream-like piping
56
+ image.extend StreamLike
57
+
58
+ # Create a pngquant instance with the follow settings. Settings not chosen will be set default
59
+ jpegoptim = BT::JpegOptim.new(quality: 50)
60
+
61
+ # Pipe it through the transformer instance
62
+ compressed = image > jpegoptim
63
+
64
+ # Write it out
65
+ IO.binwrite compressed, "small.jpg"
66
+ ```
67
+
68
+ ## Development
69
+
70
+ After checking out the repo, run `bin/setup` to install dependencies.
71
+
72
+ Then, run `rake unit` to run the unit tests.
73
+
74
+ To install this gem onto your local machine, run `rake install:local`.
75
+ at . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
76
+
77
+ ## Contributing
78
+ Please read [CONTRIBUTING.md](CONTRIBUTING.MD) for details on our code of conduct, and the process for submitting pull requests to us.
79
+
80
+ ## Versioning
81
+ We use [SemVer](https://semver.org/) for versioning. For the versions available, see the tags on this repository.
82
+
83
+ ## Authors
84
+ * [kirinnee](mailto:kirinnee@gmail.com)
85
+
86
+ ## License
87
+ This project is licensed under MIT - see the [LICENSE.md](LICENSE.MD) file for details
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task" #
3
+
4
+ RSpec::Core::RakeTask.new(:spec) #
5
+
6
+
7
+ task :unit => :rspec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "cyanfoldername"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,28 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "bt_jpegoptim/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bt_jpegoptim"
7
+ spec.version = BtJpegoptim::VERSION
8
+ spec.authors = ["kirinnee"]
9
+ spec.email = ["kirinnee@gmail.com"]
10
+
11
+ spec.summary = %q{Binary Transformer plugin for jpeg optim. Requires jpeg optim to be available via the PATH variable globally}
12
+ spec.homepage = "https://gitlab.com/ruby-gem/jpegoptim"
13
+ spec.license = "MIT"
14
+
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
18
+ `git ls-files -z`.split("\x0").reject {|f| f.match(%r{^(test|spec|features)/})}
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f)}
22
+ spec.require_paths = ["lib"]
23
+ spec.add_dependency "binary_transformer", "~> 0.1.0"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.17"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rspec", "~> 3.0"
28
+ end
data/expected.jpg ADDED
Binary file
@@ -0,0 +1,14 @@
1
+ require "open3"
2
+ module BT
3
+ refine String do
4
+ def <<(input_binary)
5
+ Open3.popen3(self) do |stdin, stdout|
6
+ stdin.binmode
7
+ stdin.write input_binary
8
+ stdin.close
9
+ stdout.binmode
10
+ stdout.read
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module BtJpegoptim
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,33 @@
1
+ require "bt_jpegoptim/version"
2
+ require "bt_jpegoptim/shell_helper"
3
+ require "binary_transformer"
4
+
5
+ using BT
6
+
7
+ module BT
8
+ class JpegOptim < BinaryTransformer::Transformer
9
+
10
+
11
+ def initialize(strip_all: true, progressive: true, quality: 75)
12
+ raise ArgumentError.new "Quality cannot be lower than 0%" if quality < 0
13
+ raise ArgumentError.new "Quality cannot exceed 100%" if quality > 100
14
+ @strip = strip_all ? "-s" : ""
15
+ @quality = "--max=#{quality}"
16
+ @progressive = progressive ? "--all-progressive" : "--all-normal"
17
+ end
18
+
19
+ def transform(bytes)
20
+ "jpegoptim #{arguments.join " " }" << bytes
21
+ end
22
+
23
+ def arguments
24
+ ["--stdin", "--stdout", @strip, @quality, @progressive]
25
+ .select {|x| !x.empty? && !x.nil?}
26
+ end
27
+
28
+ # @return [Array<String>]
29
+ def accepted_type
30
+ ["image/jpeg"]
31
+ end
32
+ end
33
+ end
data/target.jpg ADDED
Binary file
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bt_jpegoptim
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - kirinnee
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: binary_transformer
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.17'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.17'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description:
70
+ email:
71
+ - kirinnee@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".gitlab-ci.yml"
78
+ - ".idea/bt_jpeg_optim.iml"
79
+ - ".idea/encodings.xml"
80
+ - ".idea/misc.xml"
81
+ - ".idea/modules.xml"
82
+ - ".idea/runConfigurations/Local_Install.xml"
83
+ - ".idea/runConfigurations/Unit_Test.xml"
84
+ - ".rspec"
85
+ - CONTRIBUTING.MD
86
+ - Gemfile
87
+ - Gemfile.lock
88
+ - LICENSE.MD
89
+ - README.md
90
+ - Rakefile
91
+ - bin/console
92
+ - bin/setup
93
+ - bt_jpegoptim.gemspec
94
+ - expected.jpg
95
+ - lib/bt_jpegoptim.rb
96
+ - lib/bt_jpegoptim/shell_helper.rb
97
+ - lib/bt_jpegoptim/version.rb
98
+ - target.jpg
99
+ homepage: https://gitlab.com/ruby-gem/jpegoptim
100
+ licenses:
101
+ - MIT
102
+ metadata: {}
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubygems_version: 3.0.3
119
+ signing_key:
120
+ specification_version: 4
121
+ summary: Binary Transformer plugin for jpeg optim. Requires jpeg optim to be available
122
+ via the PATH variable globally
123
+ test_files: []