vips-process 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/vips-process/version.rb +1 -1
- data/lib/vips-process.rb +7 -5
- data/test/vips-process-test.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59a91f48061d5e4937600eb21932952df50fd2db
|
4
|
+
data.tar.gz: 0f837c37c6fb38e2b59e6c6276694d3a620df659
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb19b085512ee9ce0ed901310ca6a23951de9d355266d49e94e1f88d935ab558665e3038f7c02c2df3a37b1a1fea85069fb276839eff4b6af4b02ed797b93d26
|
7
|
+
data.tar.gz: 4a9eae05b824e972aba6cd61dc76965e33684400aee8f4da2e85021ca5f6fe96870082853d6320052aee7a27b80bc8fe90e288efcb3b24709c4043373711fbed
|
data/Gemfile.lock
CHANGED
data/lib/vips-process/version.rb
CHANGED
data/lib/vips-process.rb
CHANGED
@@ -105,8 +105,9 @@ module Vips
|
|
105
105
|
def version(name, deps = [], &block)
|
106
106
|
throw :need_block_or_deps unless block_given? || !deps.empty?
|
107
107
|
|
108
|
-
|
109
|
-
|
108
|
+
versions = begin class_variable_get(:@@_versions) rescue {} end
|
109
|
+
versions[name] = {deps: deps, block: block}
|
110
|
+
class_variable_set :@@_versions, versions
|
110
111
|
|
111
112
|
define_method "#{name}_version" do |new_dst=nil, should_process=true|
|
112
113
|
# Make sure we have a reference to the old version if it's being changed
|
@@ -114,12 +115,13 @@ module Vips
|
|
114
115
|
old_dst = @dst
|
115
116
|
@dst = new_dst
|
116
117
|
end
|
118
|
+
_versions = class_variable_get :@@_versions
|
117
119
|
|
118
120
|
# Recursively call dependencies but don't process them yet
|
119
|
-
|
121
|
+
_versions[name][:deps].each { |dep| send "#{dep}_version", new_dst, false }
|
120
122
|
|
121
123
|
# Run the version's block
|
122
|
-
instance_eval
|
124
|
+
instance_eval _versions[name][:block]
|
123
125
|
|
124
126
|
# Process if we were explicitly told to do so
|
125
127
|
version_dst = process! if should_process
|
@@ -132,7 +134,7 @@ module Vips
|
|
132
134
|
end
|
133
135
|
|
134
136
|
# Get all the version keys
|
135
|
-
def versions;
|
137
|
+
def versions; class_variable_get(:@@_versions).keys; end
|
136
138
|
end
|
137
139
|
end
|
138
140
|
end
|
data/test/vips-process-test.rb
CHANGED
@@ -31,6 +31,19 @@ test "it should define a version" do
|
|
31
31
|
assert image.respond_to?(:blurred_version)
|
32
32
|
end
|
33
33
|
|
34
|
+
test "it should keep the versions within the class they were defined" do
|
35
|
+
class Image1 < Vips::Process::Base
|
36
|
+
version(:v1) { 'v1' }
|
37
|
+
end
|
38
|
+
|
39
|
+
class Image2 < Vips::Process::Base
|
40
|
+
version(:v2) { 'v2' }
|
41
|
+
end
|
42
|
+
|
43
|
+
assert_equal Image1.versions, [:v1]
|
44
|
+
assert_equal Image2.versions, [:v2]
|
45
|
+
end
|
46
|
+
|
34
47
|
test "it should allow a version to be composed out of other versions" do print 'S' end
|
35
48
|
test "it should allow a version to be composed out of other versions and have a block" do print 'S' end
|
36
49
|
test "it should reset the settings after process! runs" do print 'S' end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vips-process
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darío Javier Cravero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-vips
|