adyen-skinbuilder 0.2.2 → 0.2.3
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.
- data/README.markdown +11 -1
- data/adyen/main_content.html +1 -1
- data/lib/adyen-skinbuilder/tasks/skin.rake +25 -9
- data/lib/adyen-skinbuilder/version.rb +1 -1
- metadata +4 -4
data/README.markdown
CHANGED
@@ -54,4 +54,14 @@ Also, providing environment variables will work:
|
|
54
54
|
|
55
55
|
rake adyen:skin:build SKIN=/path/to/skin/directory TARGET=/path/to/target
|
56
56
|
|
57
|
-
|
57
|
+
### More meaningful file naming
|
58
|
+
|
59
|
+
Adyen requires the name of root directory within the zip file to exactly match the skincode, e.g. `DV3tf95f`.
|
60
|
+
These skincodes are not very meaningful and hard to remember.
|
61
|
+
|
62
|
+
Therefore, the skin builder allows you to name the skin directories more meaningful by prepending the skin code, e.g. like this:
|
63
|
+
`BrandX-shop-DV3tf95f`, where the only thing that matters is that it ends with `-SKINCODE`.
|
64
|
+
The zip file will be named like the original folder name (with `.zip` appended), but the root directory within the zip has the skin code as its name.
|
65
|
+
So in this example, the zip file would be called `BrandX-shop-DV3tf95f.zip`, and the root directory whithin it `DV3tf95f`.
|
66
|
+
|
67
|
+
If the skin directory does not match this pattern, the zip and root directory within the zip will both be named after the original skin directory name.
|
data/adyen/main_content.html
CHANGED
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
<ul id="paymentMethods">
|
96
96
|
<li style="list-style-type: none;">
|
97
|
-
<
|
97
|
+
<input type="submit" name="brandName" value="VISA" class="imgB pmB pmBvisa" onclick="return show(collapsevisa, 'completeCard.shtml', 'card', 'visa');" />
|
98
98
|
<span id="pmmextracosts-visa" class="pmmextracosts"></span><span id="pmvisadescription" class="pmmdescription"></span>
|
99
99
|
<div id="pmmdetails-visa" class="pmmdetails">
|
100
100
|
<script type="text/javascript">
|
@@ -18,20 +18,37 @@ namespace :adyen do
|
|
18
18
|
task :build, :skin_directory, :target_directory do |t, args|
|
19
19
|
skin_directory = File.expand_path(args[:skin_directory] || ENV['SKIN'])
|
20
20
|
base_directory = File.expand_path(File.join(skin_directory, '..', 'base'))
|
21
|
+
# Allow the folder of a skin to have a meaningful name in this format:
|
22
|
+
# some-nice-name-SKINCODE (use a dash as last charachter before SKINCODE)
|
23
|
+
# Give the zip the full name, but give the top level directory in the zip
|
24
|
+
# archive only the SKINCODE, otherwise adyen will not accept it
|
21
25
|
skin_name = File.basename(skin_directory)
|
26
|
+
skin_code = skin_name[/(?<=\-)[a-zA-Z0-9]+$/] || skin_name
|
22
27
|
target_directory = File.expand_path((args[:target_directory] || ENV['TARGET']))
|
23
28
|
|
29
|
+
# Whether we do or do not have/use a base directory
|
30
|
+
use_base = File.directory?(base_directory)
|
31
|
+
puts use_base ? "Using base directory" : "Not using a base directory"
|
32
|
+
|
24
33
|
if File.directory?(skin_directory) and File.directory?(target_directory)
|
25
34
|
Zip::ZipOutputStream::open(File.join(target_directory, "#{skin_name}.zip")) do |io|
|
26
35
|
%w(css img inc js res).each do |d|
|
27
|
-
|
36
|
+
# First see what files the skin itself provides:
|
37
|
+
if File.directory?(File.join(skin_directory, d))
|
38
|
+
Dir.new(File.join(skin_directory, d)).each do |file|
|
39
|
+
if File.file?(File.join(skin_directory, d, file))
|
40
|
+
io.put_next_entry("#{skin_code}/#{d}/#{file}")
|
41
|
+
io.write File.read(File.join(skin_directory, d, file))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
# Then, let's see whether the base directory has more than what we got already:
|
46
|
+
if use_base && File.directory?(File.join(base_directory, d))
|
28
47
|
Dir.new(File.join(base_directory, d)).each do |file|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
if File.file?(File.join(
|
33
|
-
io.write File.read(File.join(skin_directory, d, file))
|
34
|
-
else
|
48
|
+
# Only use base file if skin does not provide it itself:
|
49
|
+
if !File.file?(File.join(skin_directory, d, file)) && File.file?(File.join(base_directory, d, file))
|
50
|
+
io.put_next_entry("#{skin_code}/#{d}/#{file}")
|
51
|
+
if File.file?(File.join(base_directory, d, file))
|
35
52
|
io.write File.read(File.join(base_directory, d, file))
|
36
53
|
end
|
37
54
|
end
|
@@ -39,10 +56,9 @@ namespace :adyen do
|
|
39
56
|
end
|
40
57
|
end
|
41
58
|
end
|
42
|
-
|
43
59
|
puts "Skin zip package was created to #{File.join(target_directory, "#{skin_name}.zip")}"
|
44
60
|
else
|
45
|
-
puts "Usage: rake adyen:buildskin[<skin_directory>,<target_directory>] or rake:adyen:buildskin
|
61
|
+
puts "Usage: rake adyen:buildskin[<skin_directory>,<target_directory>] or rake:adyen:buildskin SKIN=/from/dir TARGET=/to/dir"
|
46
62
|
end
|
47
63
|
end
|
48
64
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adyen-skinbuilder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Priit Haamer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-28 00:00:00 +03:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|