adyen-admin 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -5,9 +5,10 @@
5
5
  * add CLI binaries (to compile + upload) -> read from .adyenrc file
6
6
  * make compatible with Live system
7
7
 
8
- ## v0.0.14 - 19-06-2012
8
+ ## v0.0.16 - 19-06-2012
9
9
  * config parent_skin via skin file
10
10
  * throw exception when including subdirectory of subdirectories.
11
+ * added get_file to find files within skin, fall back to parent_skin
11
12
 
12
13
  ## v0.0.13 - 2-05-2012
13
14
  * fixed missing path when folder doesn't match `name-code` pattern
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.15
1
+ 0.0.16
@@ -32,8 +32,8 @@ module Adyen
32
32
  @default_path || "."
33
33
  end
34
34
 
35
- def self.default_path=(path)
36
- @default_path = path
35
+ def self.default_path=(default_path)
36
+ @default_path = default_path
37
37
  end
38
38
 
39
39
  # union remote and local skins. Local skins are frozen to
@@ -64,8 +64,8 @@ module Adyen
64
64
 
65
65
  # fetch all local skins
66
66
  def self.all_local
67
- Dir[File.join(default_path.to_s, "*")].map do |path|
68
- Skin.new(:path => path).freeze rescue nil
67
+ Dir[File.join(default_path.to_s, "*")].map do |skin_path|
68
+ Skin.new(:path => skin_path).freeze rescue nil
69
69
  end.compact
70
70
  end
71
71
 
@@ -97,6 +97,16 @@ module Adyen
97
97
  end
98
98
  end
99
99
 
100
+ def get_file(filename)
101
+ if self.path
102
+ File.join(self.path, filename).tap do |file|
103
+ if !File.exists?(file)
104
+ return File.join(File.dirname(self.path), parent_skin, filename)
105
+ end
106
+ end
107
+ end
108
+ end
109
+
100
110
  def skin_data(force_update = false)
101
111
  update if force_update
102
112
  @skin_data ||= YAML.load_file(skin_data_file) rescue {}
@@ -179,7 +189,7 @@ module Adyen
179
189
  end
180
190
 
181
191
  def compile(output, pattern = /<!-- ### inc\/([a-z]+) -->(.+?)<!-- ### -->/m)
182
- raise ArgumentError, "No Path given" unless path
192
+ raise ArgumentError, "No Path given" unless self.path
183
193
 
184
194
  output.scan(pattern) do |name, content|
185
195
  file = File.join(path, "inc/#{name}.txt")
@@ -206,7 +216,7 @@ module Adyen
206
216
  Dir["#{dir}/**/**"].each do |file|
207
217
  begin
208
218
  next if file =~ exclude
209
- raise if nested_subdirectory?(path, file)
219
+ raise if nested_subdirectory?(dir, file)
210
220
  zip_file.add(file.sub(dir, code), file)
211
221
  rescue Zip::ZipEntryExistsError
212
222
  # NOOP
@@ -269,15 +279,15 @@ module Adyen
269
279
  File.join(path, 'skin.yml')
270
280
  end
271
281
 
272
- def self.is_skin_path?(path)
282
+ def self.is_skin_path?(skin_path)
273
283
  %w(skin.html.erb skin.yml inc css js).each do |sub_path|
274
- return true if File.exists?(File.join(path.to_s, sub_path))
284
+ return true if File.exists?(File.join(skin_path.to_s, sub_path))
275
285
  end
276
286
  false
277
287
  end
278
288
 
279
- def nested_subdirectory?(path, file)
280
- (file.count("/") - path.count("/")) > 2
289
+ def nested_subdirectory?(skin_path, file)
290
+ (file.count("/") - skin_path.count("/")) > 2
281
291
  end
282
292
 
283
293
  ##################################
@@ -29,7 +29,7 @@ module Adyen::Admin
29
29
 
30
30
  describe ".all_remote" do
31
31
  it 'returns the skins' do
32
- Skin.all_remote.should == [
32
+ Skin.all_remote.should =~ [
33
33
  skin,
34
34
  Skin.new(:code => "Kx9axnRf", :name => "demo"),
35
35
  Skin.new(:code => "vQW0fEo8", :name => "test"),
@@ -44,10 +44,10 @@ module Adyen::Admin
44
44
 
45
45
  describe ".all_local" do
46
46
  it 'returns the skins' do
47
- Skin.all_local.should == [
47
+ Skin.all_local.should =~ [
48
48
  Skin.new(:code => "base"),
49
- Skin.new(:code => "DV3tf95f"),
50
49
  skin,
50
+ Skin.new(:code => "DV3tf95f"),
51
51
  Skin.new(:code => "JH0815"),
52
52
  ]
53
53
  end
@@ -55,7 +55,7 @@ module Adyen::Admin
55
55
 
56
56
  describe ".all" do
57
57
  it 'returns the skins' do
58
- Skin.all.should == [
58
+ Skin.all.should =~ [
59
59
  skin,
60
60
  Skin.new(:code => "Kx9axnRf", :name => "demo"),
61
61
  Skin.new(:code => "vQW0fEo8", :name => "test"),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adyen-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-19 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mechanize
16
- requirement: &70233332460240 !ruby/object:Gem::Requirement
16
+ requirement: &70340051676700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70233332460240
24
+ version_requirements: *70340051676700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rubyzip
27
- requirement: &70233332459760 !ruby/object:Gem::Requirement
27
+ requirement: &70340051676220 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70233332459760
35
+ version_requirements: *70340051676220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70233332459180 !ruby/object:Gem::Requirement
38
+ requirement: &70340051675640 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70233332459180
46
+ version_requirements: *70340051675640
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &70233332458720 !ruby/object:Gem::Requirement
49
+ requirement: &70340051675180 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70233332458720
57
+ version_requirements: *70340051675180
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: vcr
60
- requirement: &70233332477960 !ruby/object:Gem::Requirement
60
+ requirement: &70340051697240 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70233332477960
68
+ version_requirements: *70340051697240
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
- requirement: &70233332477500 !ruby/object:Gem::Requirement
71
+ requirement: &70340051696780 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70233332477500
79
+ version_requirements: *70340051696780
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: debugger
82
- requirement: &70233332477040 !ruby/object:Gem::Requirement
82
+ requirement: &70340051696320 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70233332477040
90
+ version_requirements: *70340051696320
91
91
  description: A little Gem to make your life easier when dealing with Adyen skins
92
92
  email:
93
93
  - tobi@soundcloud.com