bt_pngquant 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.gitlab-ci.yml +35 -0
- data/.idea/bt_pngquant.iml +77 -0
- data/.idea/encodings.xml +4 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +9 -0
- data/.idea/runConfigurations/Local_Install.xml +29 -0
- data/.idea/runConfigurations/Unit_Test.xml +29 -0
- data/.rspec +3 -0
- data/CONTRIBUTING.MD +95 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +41 -0
- data/LICENSE.MD +21 -0
- data/README.md +88 -0
- data/Rakefile +7 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bt_pngquant.gemspec +28 -0
- data/lib/bt_pngquant.rb +34 -0
- data/lib/bt_pngquant/shell_helper.rb +14 -0
- data/lib/bt_pngquant/version.rb +3 -0
- data/sophie.png +0 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: def537ee4bee2a80600009b184a1932690a2f69bc809bc66919af530ec4bfaf4
|
4
|
+
data.tar.gz: c05f4de21f62b21f0c4b81a44165fe9ed1e9faf6ed5c834c1b7d2c69d3184f8f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4b3fe94ba5ef8029871eec030a3776bc4d04ec5f7beba20a4655c9ce52fa8674dabb1f0de2e82f85fefa9e913282f96246e6f08e8307e795841d7be2e87cfd4f
|
7
|
+
data.tar.gz: 8409fa55360c3ba29775dd39ae4217f8a0da65f4bafdf2f3782557b314af64cece6dbda38d7cf93a3c12085fc768e26147f2ef5c1586a00abe4678159b622442
|
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,77 @@
|
|
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_pngquant" />
|
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_pngquant" />
|
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="kirinnee_core (v0.2.1, ruby-2.6.0-p0) [gem]" level="application" />
|
69
|
+
<orderEntry type="library" scope="PROVIDED" name="mimemagic (v0.3.3, ruby-2.6.0-p0) [gem]" level="application" />
|
70
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.6.0-p0) [gem]" level="application" />
|
71
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
|
72
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
|
73
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.8.2, ruby-2.6.0-p0) [gem]" level="application" />
|
74
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
|
75
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.0, ruby-2.6.0-p0) [gem]" level="application" />
|
76
|
+
</component>
|
77
|
+
</module>
|
data/.idea/encodings.xml
ADDED
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_pngquant.iml" filepath="$PROJECT_DIR$/.idea/bt_pngquant.iml" />
|
6
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/bt_pngquant.iml" filepath="$PROJECT_DIR$/.idea/bt_pngquant.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_pngquant" />
|
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_pngquant" />
|
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
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
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
bt_pngquant (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_pngquant!
|
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,88 @@
|
|
1
|
+
# PngQuant Binary Transformer
|
2
|
+
|
3
|
+
A Binary Transformer Plugin to compress png images.
|
4
|
+
|
5
|
+
To use it, please also install gem [Binary Transformer](https://gitlab.com/ruby-gem/binary-transformer), and
|
6
|
+
see [usage](#Usage).
|
7
|
+
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'bt_pngquant'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install bt_pngquant
|
24
|
+
|
25
|
+
## Dependency
|
26
|
+
|
27
|
+
This depends on [PngQuant](https://pngquant.org/), so please ensure its available via
|
28
|
+
global PATH.
|
29
|
+
|
30
|
+
PngQuant has to be at least version 2.12.0
|
31
|
+
|
32
|
+
To Check PngQuant version:
|
33
|
+
```bash
|
34
|
+
$ pngquant --verbose
|
35
|
+
```
|
36
|
+
|
37
|
+
## Getting Started
|
38
|
+
Install and require binary transform, and create a PngQuant
|
39
|
+
instance. The constructor can take in the following fields
|
40
|
+
|
41
|
+
| Field | Description |
|
42
|
+
| --- | --- |
|
43
|
+
| min: | minimum quality. Default is 65 |
|
44
|
+
| max: | Maximum quality. Default is 80 |
|
45
|
+
| iebug: | Whether to fix ie bug, default is false |
|
46
|
+
| speed | The speed on pngquant. Between 1 and 11. default is 3 |
|
47
|
+
| bit | The png colorspace. Default is 256 |
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
require "binary_transformer"
|
51
|
+
require "bt_pngquant"
|
52
|
+
|
53
|
+
# Read image as binary
|
54
|
+
image = IO.binread "image.png"
|
55
|
+
# Use binary_transformer module to allow stream-like piping
|
56
|
+
image.extend StreamLike
|
57
|
+
# Create a pngquant instance with the follow settings. Settings not chosen will be set default
|
58
|
+
pngquant = BT::PngQuant.new(speed: 11)
|
59
|
+
|
60
|
+
# Pipe it through the transformer instance
|
61
|
+
compressed = image > pngquant
|
62
|
+
|
63
|
+
# Write it out
|
64
|
+
IO.binwrite compressed
|
65
|
+
```
|
66
|
+
|
67
|
+
This can be used in pipeline with other Binary Transformer plugins!
|
68
|
+
|
69
|
+
## Development
|
70
|
+
|
71
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
72
|
+
|
73
|
+
Then, run `rake unit` to run the unit tests.
|
74
|
+
|
75
|
+
To install this gem onto your local machine, run `rake install:local`.
|
76
|
+
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.
|
77
|
+
|
78
|
+
## Contributing
|
79
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.MD) for details on our code of conduct, and the process for submitting pull requests to us.
|
80
|
+
|
81
|
+
## Versioning
|
82
|
+
We use [SemVer](https://semver.org/) for versioning. For the versions available, see the tags on this repository.
|
83
|
+
|
84
|
+
## Authors
|
85
|
+
* [kirinnee](mailto:kirinnee@gmail.com)
|
86
|
+
|
87
|
+
## License
|
88
|
+
This project is licensed under MIT - see the [LICENSE.md](LICENSE.MD) file for details
|
data/Rakefile
ADDED
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
data/bt_pngquant.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "bt_pngquant/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "bt_pngquant"
|
7
|
+
spec.version = BtPngquant::VERSION
|
8
|
+
spec.authors = ["kirinnee"]
|
9
|
+
spec.email = ["kirinnee@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = %q{Binary Transformer plugin for PngQuant }
|
12
|
+
spec.homepage = "https://gitlab.com/ruby-gem/pngquant.git"
|
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/lib/bt_pngquant.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "bt_pngquant/version"
|
2
|
+
require "bt_pngquant/shell_helper"
|
3
|
+
require "binary_transformer"
|
4
|
+
|
5
|
+
using BT
|
6
|
+
|
7
|
+
module BT
|
8
|
+
class PngQuant < BinaryTransformer::Transformer
|
9
|
+
|
10
|
+
def initialize(bit: 256, min: 65, max: 80, speed: 3, iebug: false)
|
11
|
+
raise ArgumentError.new("Bit cannot be smaller than 8") if bit < 8
|
12
|
+
raise ArgumentError.new("at least 0% quality") if min < 0 or max < 0
|
13
|
+
raise ArgumentError.new("at most 100% quality") if max > 100 or min > 100
|
14
|
+
raise ArgumentError.new("max must be larger than min") if min > max
|
15
|
+
raise ArgumentError.new("Lowest speed is 1") if speed < 1
|
16
|
+
raise ArgumentError.new("Maximum speed is 11") if speed > 11
|
17
|
+
@min = min
|
18
|
+
@max = max
|
19
|
+
@speed = speed
|
20
|
+
@ie_bug = iebug ? "--iebug " : ""
|
21
|
+
@bit = bit
|
22
|
+
end
|
23
|
+
|
24
|
+
def transform(bytes)
|
25
|
+
ret = "pngquant #{@bit} --speed #{@speed} #{@ie_bug}--quality=#{@min}-#{@max}" << bytes
|
26
|
+
ret.length > bytes.length ? bytes : ret
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [Array<String>]
|
30
|
+
def accepted_type
|
31
|
+
["image/png"]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/sophie.png
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bt_pngquant
|
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_pngquant.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_pngquant.gemspec
|
94
|
+
- lib/bt_pngquant.rb
|
95
|
+
- lib/bt_pngquant/shell_helper.rb
|
96
|
+
- lib/bt_pngquant/version.rb
|
97
|
+
- sophie.png
|
98
|
+
homepage: https://gitlab.com/ruby-gem/pngquant.git
|
99
|
+
licenses:
|
100
|
+
- MIT
|
101
|
+
metadata: {}
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubygems_version: 3.0.3
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
120
|
+
summary: Binary Transformer plugin for PngQuant
|
121
|
+
test_files: []
|