nx-watermark 0.1.0 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f982cb579297b4f63b99f7b1d440c565a5f62433d986d6c7b50aa30fe6ac63c6
4
- data.tar.gz: 44c351fa7064262e40867759021654821657a3ce43b9cc9b18a24cc74760e926
3
+ metadata.gz: fd27f96a7df4f4caafa41bb5a8d18be7499d4e5c320bdfe8648ab20ec0bc7ff7
4
+ data.tar.gz: 0aa08bb4661ef1dd44fcf976a231cd25ac704872f5a172de59244067500bded2
5
5
  SHA512:
6
- metadata.gz: 6e0a790d9a62eb31a250fcf9dc4fb0e9fe9cb29ac0e6828f19c89e0ce4adef0cbb831ee4fde4a5becb32bf4e05b42b97139bf901692568477d9e91eeac373dc0
7
- data.tar.gz: c1ae522b6663a75e848a725b8c4787b44b9254afb91c6a9a91a88be147e88f6aa9e137f585a663ff60e3ca6610c611eaf60c124a67092da7e2185f86b3453e8a
6
+ metadata.gz: d655c40cc21b964f2d9aa19ea94d68df064497324d86ac30438c33eec60254c79fa9f6c51ec4c1a6e2bd911a973165a01cbf37d8c9be4405b2f5bc65d7b0525f
7
+ data.tar.gz: 583a71c72d453e96ca2e3d0a615f9119e3c2122d548987066704448fe73739d014cb7e5829d5196c02daea879839cd290f7b591f4a4a06202e639d43e397413a
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in templates.gemspec
4
+ gemspec
@@ -0,0 +1,28 @@
1
+ # nx-watermark
2
+ > Watermark use mini_magick.
3
+
4
+ ## installation
5
+ ```rb
6
+ # from gem
7
+ gem 'nx-watermark'
8
+ # from git
9
+ gem 'nx-watermark', git: 'git@github.com:afeiship/nx-watermark.git'
10
+ ```
11
+
12
+ ## usage
13
+ ```rb
14
+ Nx::Watermark.patch(
15
+ source: "https://img9.doubanio.com/view/ark_article_cover/retina/public/12051836.jpg?v=0",
16
+ watermark: "__tests__/watermark_20.png",
17
+ dest: "__tests__/dist.png",
18
+ )
19
+ ```
20
+
21
+ ## build/publish
22
+ ```shell
23
+ # build
24
+ gem build nx-watermark.gemspec
25
+
26
+ # publish
27
+ gem push nx-watermark-0.1.0.gem
28
+ ```
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,7 @@
1
+ require_relative "../lib/nx-watermark"
2
+
3
+ Nx::Watermark.patch(
4
+ source: "https://img9.doubanio.com/view/ark_article_cover/retina/public/12051836.jpg?v=0",
5
+ watermark: "__tests__/watermark_20.png",
6
+ dest: "__tests__/dist.png",
7
+ )
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nx-watermark"
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__)
@@ -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,5 @@
1
+ module Nx
2
+ class Watermark
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
@@ -0,0 +1,17 @@
1
+ module Nx
2
+ class Watermark
3
+ def self.patch(in_options)
4
+ source_image = MiniMagick::Image.open(in_options[:source])
5
+ water_image = MiniMagick::Image.new(in_options[:watermark])
6
+ result = source_image.composite(water_image) do |config|
7
+ config.gravity "center"
8
+ config.compose "Over"
9
+ if block_given?
10
+ yield config
11
+ end
12
+ end
13
+
14
+ result.write in_options[:dest]
15
+ end
16
+ end
17
+ end
Binary file
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "nx/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nx-watermark"
8
+ spec.version = Nx::Watermark::VERSION
9
+ spec.licenses = ["MIT"]
10
+ spec.authors = ["afeiship"]
11
+ spec.email = ["1290657123@qq.com"]
12
+
13
+ spec.summary = %q{Watermark for ruby.}
14
+ spec.description = %q{Watermark use mini_magick.}
15
+ spec.homepage = "https://github.com/afeiship/nx-watermark"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.14"
34
+ spec.add_development_dependency "rake", "~> 12.3", ">= 12.3.3"
35
+ spec.add_dependency "mini_magick", "~> 4.10", ">= 4.10.1"
36
+ end
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "nx-watermark",
3
+ "version": "1.0.0",
4
+ "description": "Watermark use mini_magick.",
5
+ "directories": {
6
+ "lib": "lib"
7
+ },
8
+ "scripts": {
9
+ "clean": "rm -rf *.gem",
10
+ "build": "gem build *.gemspec",
11
+ "pubpush": "gem push *.gem"
12
+ },
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/afeiship/nx-watermark.git"
16
+ },
17
+ "author": "afei",
18
+ "license": "MIT",
19
+ "bugs": {
20
+ "url": "https://github.com/afeiship/nx-watermark/issues"
21
+ },
22
+ "homepage": "https://github.com/afeiship/nx-watermark#readme"
23
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nx-watermark
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
  - afeiship
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-06 00:00:00.000000000 Z
11
+ date: 2020-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -71,7 +71,19 @@ executables: []
71
71
  extensions: []
72
72
  extra_rdoc_files: []
73
73
  files:
74
+ - ".gitignore"
75
+ - Gemfile
76
+ - README.md
77
+ - Rakefile
78
+ - __tests__/app.rb
79
+ - bin/console
80
+ - bin/setup
74
81
  - lib/nx-watermark.rb
82
+ - lib/nx/version.rb
83
+ - lib/nx/watermark.rb
84
+ - nx-watermark-0.1.0.gem
85
+ - nx-watermark.gemspec
86
+ - package.json
75
87
  homepage: https://github.com/afeiship/nx-watermark
76
88
  licenses:
77
89
  - MIT