icon-banner 0.2.0 → 0.2.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
  SHA1:
3
- metadata.gz: 1b283b9c99b5cb468b6896e612534c0558f0ff9a
4
- data.tar.gz: 630b469925fa01b7dd4bffd14e459681fe5a5209
3
+ metadata.gz: ed3a2c8b2bc9d5c45b65dacb6b3056f4c64833a1
4
+ data.tar.gz: 39e6f79af8d63bb8eaa29378aabdb05d7735e76f
5
5
  SHA512:
6
- metadata.gz: da778a5e555e0f6bbcb2eb2730ba50a6a46496165485e3647676d00e7b0ee5db7e4ba523d1a52149895841a7ff2a86781c2c460e774cf6996f4156c09eda1abb
7
- data.tar.gz: 256e2e38d73b7a32fe6ab4a48e5138a91cc778f7130a44b5a8705d1aa5b02a128b934158affa545bc045636178359c206dbe36ebe4caff36bda2ffa270fad608
6
+ metadata.gz: 016d9230c576877baecab16ba3b29cd2fccd2198e25729ccfd5e51cdc04c700062e09a1018078745cef072ce4fb38219c0cb5802d35651a21d5918ab13bd1cc2
7
+ data.tar.gz: 66ceab0eb31ddd7ad600fa7340fe619664d9ce069094122ad752fa276f1864c2771b0030b7d86d06dc6ffe28d67c9254f939e51cf9a0c09680074bb0b4781dbc
@@ -3,7 +3,7 @@ require 'icon_banner/ic_launcher'
3
3
  require 'commander'
4
4
 
5
5
  module IconBanner
6
- VERSION = '0.2.0'
6
+ VERSION = '0.2.1'
7
7
  DESCRIPTION = 'IconBanner adds custom nice-looking banners over your mobile app icons'
8
8
 
9
9
  UI = FastlaneCore::UI
@@ -75,7 +75,23 @@ module IconBanner
75
75
  end
76
76
 
77
77
  def backup_path(path)
78
- path.gsub('/src/', "/src#{BACKUP_EXTENSION}/")
78
+ ext = File.extname path
79
+ backup_path = path
80
+ backup_path = append_parent_dirname(path, 'res', BACKUP_EXTENSION) if path.include?('/res/')
81
+ backup_path = path.gsub('/src/', "/src#{BACKUP_EXTENSION}/") if path == backup_path
82
+ backup_path = path.gsub('/app/', "/src#{BACKUP_EXTENSION}/") if path == backup_path
83
+ backup_path = path.gsub('/android/', "/src#{BACKUP_EXTENSION}/") if path == backup_path
84
+ backup_path = path.gsub(ext, BACKUP_EXTENSION + ext) if path == backup_path
85
+ backup_path
86
+ end
87
+
88
+ def append_parent_dirname(path, dir, suffix)
89
+ segments = path.split(File::SEPARATOR)
90
+ dir_index = segments.index(dir)
91
+ return path unless dir_index && dir_index - 1 >= 0
92
+
93
+ parent_segment = segments[dir_index-1]
94
+ path.gsub("/#{parent_segment}/","/#{parent_segment}#{suffix}/")
79
95
  end
80
96
 
81
97
  def should_ignore_icon(icon)
@@ -34,8 +34,8 @@ module IconBanner
34
34
  end unless color
35
35
 
36
36
  banner_file = Tempfile.new %w[banner .png]
37
- generate_banner banner_file.path, label, color, font
38
- process_icon icon_path, banner_file.path
37
+ # generate_banner banner_file.path, label, color, font
38
+ # process_icon icon_path, banner_file.path
39
39
  banner_file.close
40
40
 
41
41
  UI.verbose "Completed processing #{File.basename icon_path}"
@@ -65,6 +65,8 @@ module IconBanner
65
65
  UI.message "Completed #{self.class::PLATFORM} restore."
66
66
  end
67
67
 
68
+ private
69
+
68
70
  def get_app_icons(path)
69
71
  app_icons = Dir.glob("#{path}#{self.class::BASE_ICON_PATH}")
70
72
  app_icons.reject { |icon| should_ignore_icon(icon) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icon-banner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Émile Bélair