middleman-tiny_png 0.0.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 +7 -0
- data/.gitignore +5 -0
- data/Gemfile +18 -0
- data/Rakefile +14 -0
- data/features/support/env.rb +4 -0
- data/lib/middleman-tiny_png.rb +6 -0
- data/lib/middleman-tiny_png/extension.rb +36 -0
- data/middleman-tiny_png.gemspec +26 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57ff2fb34f09bc2df22610a6353a08a471f481ae
|
4
|
+
data.tar.gz: 22255b2d94246b537ff8c2caad8ebf735234c080
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3115ff8edebad7556f4feaa748a0c3854feed1b6d811da76db1ac6ffc299bfd99b8b5f6de3bb5544652d779b628525884f7fced3b69fd2b16b67b677fc094043
|
7
|
+
data.tar.gz: a47c8eb7d53766348db19521eec88fa4567031b2c3e60f475d1040bd4e7d89469cd8867050791394669f5304fb024bebd1b6e8ed1799fc9c436537c1ce9a7f21
|
data/.gitignore
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# If you do not have OpenSSL installed, update
|
2
|
+
# the following line to use "http://" instead
|
3
|
+
source 'https://rubygems.org'
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in middleman-tiny_png.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rdoc'
|
11
|
+
gem 'yard'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :test do
|
15
|
+
gem 'cucumber'
|
16
|
+
gem 'aruba'
|
17
|
+
gem 'rspec'
|
18
|
+
end
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'cucumber/rake/task'
|
5
|
+
|
6
|
+
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
|
7
|
+
t.cucumber_opts = '--color --tags ~@wip --strict'
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'rake/clean'
|
11
|
+
|
12
|
+
task test: ['cucumber']
|
13
|
+
|
14
|
+
task default: :test
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Require core library
|
2
|
+
require 'middleman-core'
|
3
|
+
require 'tinify'
|
4
|
+
require 'find'
|
5
|
+
|
6
|
+
# Extension namespace
|
7
|
+
module Middleman
|
8
|
+
module TinyPNG
|
9
|
+
class Extension < ::Middleman::Extension
|
10
|
+
option :api_key, "", 'API Key For TinyPNG'
|
11
|
+
|
12
|
+
|
13
|
+
def initialize(app, options_hash={}, &block)
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def after_build(builder)
|
18
|
+
Tinify.key = options.api_key
|
19
|
+
|
20
|
+
image_dir = File.join(app.config[:build_dir], app.config[:images_dir])
|
21
|
+
image_file_paths = []
|
22
|
+
|
23
|
+
Find.find(image_dir) do |path|
|
24
|
+
image_file_paths << path if (path =~ /.*\.png$/) || (path =~ /.*\.jpg$/)
|
25
|
+
end
|
26
|
+
|
27
|
+
image_file_paths.each do |file|
|
28
|
+
source = Tinify.from_file(file)
|
29
|
+
source.to_file(file)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "middleman-tiny_png"
|
6
|
+
s.version = "0.0.1"
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Paul Millar"]
|
9
|
+
s.email = ["paul@paulmilar.com"]
|
10
|
+
s.homepage = "http://paulmillar.com"
|
11
|
+
s.summary = %q{ TinyPNG middleman integration }
|
12
|
+
# s.description = %q{A longer description of your extension}
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# The version of middleman-core your extension depends on
|
22
|
+
s.add_runtime_dependency("middleman-core", "~> 4.2")
|
23
|
+
|
24
|
+
# Additional dependencies
|
25
|
+
s.add_runtime_dependency("tinify", "~> 1.5")
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: middleman-tiny_png
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paul Millar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: middleman-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tinify
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- paul@paulmilar.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- Rakefile
|
51
|
+
- features/support/env.rb
|
52
|
+
- lib/middleman-tiny_png.rb
|
53
|
+
- lib/middleman-tiny_png/extension.rb
|
54
|
+
- middleman-tiny_png.gemspec
|
55
|
+
homepage: http://paulmillar.com
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.6.11
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: TinyPNG middleman integration
|
79
|
+
test_files:
|
80
|
+
- features/support/env.rb
|