bt_image_resizer 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ceb4ce1320a315268a0b97afa183be216949665a481abf4bf70f00b75076be3c
4
+ data.tar.gz: c5233093dd9a9476c67a125d26eb1a809ec55f43ffcfe81628919a49a2d8a08c
5
+ SHA512:
6
+ metadata.gz: c31543a55456cbe5be94fc7a7d05d9630dd09c634ce657e5a77be0cb07b269ce71f8bed7b8a8b43955b54ca0bca7542b8c4f095966b3cea84522be40d1f49e1c
7
+ data.tar.gz: d5fd53f902ca5f63bb51a240d9566efe64e7933c8ff7bb5b4bde424922c3bb910e666caf44cf6bccdf10cddebfc662cc95ef9af2261d1306b54c1dc3a09c37ab
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_image_resizer" />
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_image_resizer" />
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>
@@ -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_image_resizer.iml" filepath="$PROJECT_DIR$/.idea/bt_image_resizer.iml" />
6
+ <module fileurl="file://$PROJECT_DIR$/.idea/bt_image_resizer.iml" filepath="$PROJECT_DIR$/.idea/bt_image_resizer.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_image_resizer" />
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_image_resizer" />
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_image_resizer (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_image_resizer!
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,84 @@
1
+ # Binary Transformer Plugin: Image Resizer
2
+
3
+ A Binary Transformer Plugin to resize image
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
+ This depends on [GraphicsMagick](http://www.graphicsmagick.org/), so please ensure its available via
9
+ global PATH.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'bt_image_resizer'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install bt_image_resizer
26
+
27
+ ## Usage
28
+
29
+ This depends on [GraphicsMagick](http://www.graphicsmagick.org/), so please ensure its available via
30
+ global PATH.
31
+
32
+ To check whether `GraphicsMagick` is available, run the command
33
+ ```bash
34
+ $ gm version
35
+ ```
36
+
37
+ ---
38
+ This is a [Binary Transformer](https://gitlab.com/ruby-gem/binary-transformer) implementation. Please
39
+ ensure you installed the gem to use it.
40
+
41
+ Only works for `image/png` and `image/jpeg` signatures in byte.
42
+
43
+ ```ruby
44
+ require "bt_image_resizer"
45
+ require "binary_transformer"
46
+
47
+ # Create re-sizer that re-sizes the image to 20% width and 20% height
48
+ resize = BT::ResizeImage.new(20, 20)
49
+
50
+ # Read the binary of image
51
+ binary = IO.binread "image.png"
52
+
53
+ # Use binary_transformer module to allow stream-like piping
54
+ binary.extend StreamLike
55
+
56
+ # Resize the binary
57
+ small = binary > resize
58
+
59
+ # Write it back out
60
+ IO.binwrite "small.png", small
61
+ ```
62
+
63
+ This can be used in pipeline with other Binary Transformer plugins!
64
+
65
+ ## Development
66
+
67
+ After checking out the repo, run `bin/setup` to install dependencies.
68
+
69
+ Then, run `rake unit` to run the unit tests.
70
+
71
+ To install this gem onto your local machine, run `rake install:local`.
72
+ 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.
73
+
74
+ ## Contributing
75
+ Please read [CONTRIBUTING.md](CONTRIBUTING.MD) for details on our code of conduct, and the process for submitting pull requests to us.
76
+
77
+ ## Versioning
78
+ We use [SemVer](https://semver.org/) for versioning. For the versions available, see the tags on this repository.
79
+
80
+ ## Authors
81
+ * [kirinnee](mailto:kirinnee@gmail.com)
82
+
83
+ ## License
84
+ 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 => :spec
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_image_resizer/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bt_image_resizer"
7
+ spec.version = BtImageResizer::VERSION
8
+ spec.authors = ["kirinnee"]
9
+ spec.email = ["kirinnee@gmail.com"]
10
+
11
+ spec.summary = %q{A Binary Transformer Plugin to resize image}
12
+ spec.homepage = "https://gitlab.com/ruby-gem/image-resizer.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
@@ -0,0 +1,23 @@
1
+ require "bt_image_resizer"
2
+ require "binary_transformer"
3
+ require "bt_image_resizer/shell_helper"
4
+
5
+ using BT
6
+
7
+ module BT
8
+ class ResizeImage < BinaryTransformer::Transformer
9
+ def initialize(width, height)
10
+ @width = width
11
+ @height = height
12
+ end
13
+
14
+ def transform(bytes)
15
+ "gm convert -geometry #{@width}%x#{@height}% - -" << bytes
16
+ end
17
+
18
+ # @return [Array<String>]
19
+ def accepted_type
20
+ %w(image/jpeg image/png)
21
+ end
22
+ end
23
+ end
@@ -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 BtImageResizer
2
+ VERSION = "0.1.0"
3
+ end
data/r ADDED
@@ -0,0 +1,9 @@
1
+ require "bt_image_resizer"
2
+ require "binary_transformer"
3
+
4
+
5
+ resizer = BT::ResizeImage.new(20, 20)
6
+ sophie = IO.binread "./spec/sophie.png"
7
+ sophie.extend StreamLike
8
+ small = sophie > resizer
9
+ IO.binwrite "abc.png", small
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bt_image_resizer
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_image_resizer.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_image_resizer.gemspec
94
+ - lib/bt_image_resizer.rb
95
+ - lib/bt_image_resizer/shell_helper.rb
96
+ - lib/bt_image_resizer/version.rb
97
+ - r
98
+ homepage: https://gitlab.com/ruby-gem/image-resizer.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: A Binary Transformer Plugin to resize image
121
+ test_files: []