frameit 2.4.1 → 2.4.2
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 +4 -4
- data/README.md +11 -5
- data/bin/frameit +1 -1
- data/lib/frameit.rb +1 -0
- data/lib/frameit/config_parser.rb +11 -11
- data/lib/frameit/dependency_checker.rb +6 -6
- data/lib/frameit/editor.rb +10 -10
- data/lib/frameit/frame_converter.rb +20 -20
- data/lib/frameit/runner.rb +3 -3
- data/lib/frameit/screenshot.rb +2 -2
- data/lib/frameit/strings_parser.rb +5 -5
- data/lib/frameit/template_finder.rb +6 -6
- data/lib/frameit/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51f6e23e8a0eda4b74b3c2088da03c61ef8e98e5
|
4
|
+
data.tar.gz: 424487c213ded6efd87fb8e3f6dedfe6c090e063
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a4b71cff4333d074dfa1577fae67ca6675b55022e50048222017694856fa3e6af54921d7f210245673e393d77a7d01ba4e6f801dc598ba651aedf4b97cfd1d6
|
7
|
+
data.tar.gz: 33c0fe594cb17ebf08aa5a2a207eda07f53204fe03181f3b6450869b0958a29a9dfb7ed754984bbc466f5ec2c83f9fde4b6f696eadb328ab774bea4530220c33
|
data/README.md
CHANGED
@@ -29,14 +29,14 @@
|
|
29
29
|
frameit
|
30
30
|
============
|
31
31
|
|
32
|
-
[](https://github.com/
|
32
|
+
[](https://twitter.com/FastlaneTools)
|
33
|
+
[](https://github.com/fastlane/frameit/blob/master/LICENSE)
|
34
34
|
[](http://rubygems.org/gems/frameit)
|
35
35
|
[](https://travis-ci.org/fastlane/frameit)
|
36
36
|
|
37
37
|
###### Quickly put your screenshots into the right device frames
|
38
38
|
|
39
|
-
Get in contact with the developer on Twitter: [@
|
39
|
+
Get in contact with the developer on Twitter: [@FastlaneTools](https://twitter.com/FastlaneTools)
|
40
40
|
|
41
41
|
|
42
42
|
-------
|
@@ -99,7 +99,7 @@ You only have to do this once per computer.
|
|
99
99
|
- Press ```Enter```. The [Apple page](https://developer.apple.com/app-store/marketing/guidelines/#images) to download the images should open in your browser.
|
100
100
|
- Download the devices you want to use
|
101
101
|
- Press ```Enter```
|
102
|
-
- Unzip and move the content of the zip files to ```~/.frameit/
|
102
|
+
- Unzip and move the content of the zip files to ```~/.frameit/devices_frames```
|
103
103
|
- Press ```Enter```
|
104
104
|
|
105
105
|
# Usage
|
@@ -185,6 +185,9 @@ To define the title and optionally the keyword, put two `.strings` files into th
|
|
185
185
|
|
186
186
|
The `keyword.strings` and `title.strings` are standard `.strings` file you already use for your iOS apps, making it easy to use your existing translation service to get localized titles.
|
187
187
|
|
188
|
+
**Note:** These `.strings` files **MUST** be utf-16 encoded. If you are having trouble see [issue #49](https://github.com/fastlane/frameit/issues/49)
|
189
|
+
|
190
|
+
|
188
191
|
#### Uploading screenshots to iTC
|
189
192
|
|
190
193
|
Use [deliver](https://github.com/fastlane/deliver) to upload all screenshots to iTunes Connect completely automatically :rocket:
|
@@ -248,7 +251,7 @@ Check out [`snapshot`](https://github.com/fastlane/snapshot) to automatically ge
|
|
248
251
|
|
249
252
|
## Alternative location to store device_frames
|
250
253
|
|
251
|
-
Device frames can also be stored in a ```./fastlane/screenshots/
|
254
|
+
Device frames can also be stored in a ```./fastlane/screenshots/devices_frames``` directory if you prefer rather than in the ```~/.frameit/device_frames``` directory. If doing so please be aware that Apple's images are copyrighted and should not be redistributed as part of a repository so you may want to include them in your .gitignore file.
|
252
255
|
|
253
256
|
## White background of frames
|
254
257
|
|
@@ -273,6 +276,9 @@ brew install imagemagick
|
|
273
276
|
# Need help?
|
274
277
|
Please submit an issue on GitHub and provide information about your setup
|
275
278
|
|
279
|
+
# Code of Conduct
|
280
|
+
Help us keep `frameit` open and inclusive. Please read and follow our [Code of Conduct](https://github.com/fastlane/code-of-conduct).
|
281
|
+
|
276
282
|
# License
|
277
283
|
This project is licensed under the terms of the MIT license. See the LICENSE file.
|
278
284
|
|
data/bin/frameit
CHANGED
@@ -15,7 +15,7 @@ class FrameItApplication
|
|
15
15
|
program :description, 'Quickly put your screenshots into the right device frames'
|
16
16
|
program :help, 'Author', 'Felix Krause <frameit@krausefx.com>'
|
17
17
|
program :help, 'Website', 'https://fastlane.tools'
|
18
|
-
program :help, 'GitHub', 'https://github.com/
|
18
|
+
program :help, 'GitHub', 'https://github.com/fastlane/frameit'
|
19
19
|
program :help_formatter, :compact
|
20
20
|
|
21
21
|
global_option('--verbose') { $verbose = true }
|
data/lib/frameit.rb
CHANGED
@@ -2,7 +2,7 @@ module Frameit
|
|
2
2
|
class ConfigParser
|
3
3
|
def load(path)
|
4
4
|
return nil unless File.exist?(path) # we are okay with no config at all
|
5
|
-
|
5
|
+
UI.message "Parsing config file '#{path}'" if $verbose
|
6
6
|
@path = path
|
7
7
|
self.parse(File.read(path))
|
8
8
|
end
|
@@ -12,8 +12,8 @@ module Frameit
|
|
12
12
|
begin
|
13
13
|
@data = JSON.parse(data)
|
14
14
|
rescue => ex
|
15
|
-
|
16
|
-
|
15
|
+
UI.error ex.message
|
16
|
+
UI.user_error! "Invalid JSON file at path '#{@path}'. Make sure it's a valid JSON file"
|
17
17
|
end
|
18
18
|
|
19
19
|
self
|
@@ -63,29 +63,29 @@ module Frameit
|
|
63
63
|
validate_values(value) # recursive call
|
64
64
|
else
|
65
65
|
if key == 'font'
|
66
|
-
|
66
|
+
UI.user_error! "Could not find font at path '#{File.expand_path(value)}'" unless File.exist? value
|
67
67
|
end
|
68
68
|
|
69
69
|
if key == 'fonts'
|
70
|
-
|
70
|
+
UI.user_error! "`fonts` must be an array" unless value.kind_of? Array
|
71
71
|
|
72
72
|
value.each do |current|
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
UI.user_error! "You must specify a font path" if current.fetch('font', '').length == 0
|
74
|
+
UI.user_error! "Could not find font at path '#{File.expand_path(current.fetch('font'))}'" unless File.exist? current.fetch('font')
|
75
|
+
UI.user_error! "`supported` must be an array" unless current.fetch('supported', []).kind_of? Array
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
if key == 'background'
|
80
|
-
|
80
|
+
UI.user_error! "Could not find background image at path '#{File.expand_path(value)}'" unless File.exist? value
|
81
81
|
end
|
82
82
|
|
83
83
|
if key == 'color'
|
84
|
-
|
84
|
+
UI.user_error! "Invalid color '#{value}'. Must be valid Hex #123123" unless value.include? "#"
|
85
85
|
end
|
86
86
|
|
87
87
|
if key == 'padding'
|
88
|
-
|
88
|
+
UI.user_error! "padding must be type integer or pair of integers of format 'AxB'" unless value.kind_of?(Integer) || value.split('x').length == 2
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -8,12 +8,12 @@ module Frameit
|
|
8
8
|
|
9
9
|
def self.check_image_magick
|
10
10
|
unless `which convert`.include? "convert"
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
UI.error '#############################################################'
|
12
|
+
UI.error "# You have to install the ImageMagick to use FrameIt"
|
13
|
+
UI.error "# Install it using 'brew update && brew install imagemagick'"
|
14
|
+
UI.error "# If you don't have homebrew: http://brew.sh"
|
15
|
+
UI.error '#############################################################'
|
16
|
+
UI.user_error! "Install ImageMagick and start frameit again!"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/frameit/editor.rb
CHANGED
@@ -39,7 +39,7 @@ module Frameit
|
|
39
39
|
output_path = screenshot.path.gsub('.png', '_framed.png').gsub('.PNG', '_framed.png')
|
40
40
|
image.format "png"
|
41
41
|
image.write output_path
|
42
|
-
|
42
|
+
UI.success "Added frame: '#{File.expand_path(output_path)}'"
|
43
43
|
end
|
44
44
|
|
45
45
|
# puts the screenshot into the frame
|
@@ -58,7 +58,7 @@ module Frameit
|
|
58
58
|
if @offset_information and (@offset_information['offset'] or @offset_information['offset'])
|
59
59
|
return @offset_information
|
60
60
|
end
|
61
|
-
|
61
|
+
UI.user_error! "Could not find offset_information for '#{screenshot}'"
|
62
62
|
end
|
63
63
|
|
64
64
|
#########################################################################################
|
@@ -179,7 +179,7 @@ module Frameit
|
|
179
179
|
# too large - resizing now
|
180
180
|
smaller = (1.0 / ratio)
|
181
181
|
|
182
|
-
|
182
|
+
UI.message "Text for image #{self.screenshot.path} is quite long, reducing font size by #{(ratio - 1.0).round(2)}" if $verbose
|
183
183
|
|
184
184
|
title.resize "#{(smaller * title.width).round}x"
|
185
185
|
keyword.resize "#{(smaller * keyword.width).round}x" if keyword
|
@@ -235,8 +235,8 @@ module Frameit
|
|
235
235
|
|
236
236
|
current_font = font(key)
|
237
237
|
text = fetch_text(key)
|
238
|
-
|
239
|
-
|
238
|
+
UI.message "Using #{current_font} as font the #{key} of #{screenshot.path}" if $verbose and current_font
|
239
|
+
UI.message "Adding text '#{text}'" if $verbose
|
240
240
|
|
241
241
|
text.gsub! '\n', "\n"
|
242
242
|
|
@@ -269,7 +269,7 @@ module Frameit
|
|
269
269
|
|
270
270
|
# Fetches the title + keyword for this particular screenshot
|
271
271
|
def fetch_text(type)
|
272
|
-
|
272
|
+
UI.user_error! "Valid parameters :keyword, :title" unless [:keyword, :title].include? type
|
273
273
|
|
274
274
|
# Try to get it from a keyword.strings or title.strings file
|
275
275
|
strings_path = File.join(File.expand_path("..", screenshot.path), "#{type}.strings")
|
@@ -281,11 +281,11 @@ module Frameit
|
|
281
281
|
|
282
282
|
# No string files, fallback to Framefile config
|
283
283
|
result = fetch_config[type.to_s]['text'] if fetch_config[type.to_s]
|
284
|
-
|
284
|
+
UI.message "Falling back to default text as there was nothing specified in the .strings file" if $verbose
|
285
285
|
|
286
286
|
if type == :title and !result
|
287
287
|
# title is mandatory
|
288
|
-
|
288
|
+
UI.user_error! "Could not get title for screenshot #{screenshot.path}. Please provide one in your Framefile.json"
|
289
289
|
end
|
290
290
|
|
291
291
|
return result
|
@@ -307,13 +307,13 @@ module Frameit
|
|
307
307
|
end
|
308
308
|
else
|
309
309
|
# No `supported` array, this will always be true
|
310
|
-
|
310
|
+
UI.message "Found a font with no list of supported languages, using this now" if $verbose
|
311
311
|
return font["font"]
|
312
312
|
end
|
313
313
|
end
|
314
314
|
end
|
315
315
|
|
316
|
-
|
316
|
+
UI.message "No custom font specified for #{screenshot}, using the default one" if $verbose
|
317
317
|
return nil
|
318
318
|
end
|
319
319
|
end
|
@@ -8,34 +8,34 @@ module Frameit
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def setup_frames
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
UI.success "----------------------------------------------------"
|
12
|
+
UI.success "Looks like you have no device templates installed"
|
13
|
+
UI.success "The images can not be pre-installed due to licensing"
|
14
|
+
UI.success "Press Enter to get started"
|
15
|
+
UI.success "----------------------------------------------------"
|
16
16
|
STDIN.gets
|
17
17
|
|
18
18
|
system("open '#{DOWNLOAD_URL}'")
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
UI.success "----------------------------------------------------"
|
20
|
+
UI.success "Download the zip files for the following devices"
|
21
|
+
UI.success "iPhone 6s, iPhone 6s Plus, iPhone 5s, iPad mini 4 and iPad Pro"
|
22
|
+
UI.success "You only need to download the devices you want to use"
|
23
|
+
UI.success "Press Enter when you downloaded the zip files"
|
24
|
+
UI.success "----------------------------------------------------"
|
25
25
|
STDIN.gets
|
26
26
|
|
27
27
|
loop do
|
28
28
|
system("mkdir -p '#{templates_path}' && open '#{templates_path}'")
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
UI.success "----------------------------------------------------"
|
30
|
+
UI.success "Extract the downloaded files into the folder"
|
31
|
+
UI.success "'#{templates_path}', which should be open in your Finder"
|
32
|
+
UI.success "You can just copy the whole content into it."
|
33
|
+
UI.success "Press Enter when you extracted the files into the given folder"
|
34
|
+
UI.success "----------------------------------------------------"
|
35
35
|
STDIN.gets
|
36
36
|
|
37
37
|
if !frames_exist?
|
38
|
-
|
38
|
+
UI.error "Sorry, I can't find the PSD files. Make sure you unzipped them into '#{templates_path}'"
|
39
39
|
else
|
40
40
|
break # everything is finished
|
41
41
|
end
|
@@ -62,7 +62,7 @@ module Frameit
|
|
62
62
|
resulting_path = psd.gsub('.psd', '.png')
|
63
63
|
next if File.exist?(resulting_path)
|
64
64
|
|
65
|
-
|
65
|
+
UI.important "Converting PSD file '#{psd}'"
|
66
66
|
image = MiniMagick::Image.open(psd)
|
67
67
|
if image
|
68
68
|
image.format 'png'
|
@@ -70,7 +70,7 @@ module Frameit
|
|
70
70
|
|
71
71
|
image.write(resulting_path)
|
72
72
|
else
|
73
|
-
|
73
|
+
UI.error "Could not parse PSD file at path '#{psd}'"
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
data/lib/frameit/runner.rb
CHANGED
@@ -28,12 +28,12 @@ module Frameit
|
|
28
28
|
screenshot = Screenshot.new(full_path, color)
|
29
29
|
screenshot.frame!
|
30
30
|
rescue => ex
|
31
|
-
|
32
|
-
|
31
|
+
UI.error ex.to_s
|
32
|
+
UI.error "Backtrace:\n\t#{ex.backtrace.join("\n\t")}" if $verbose
|
33
33
|
end
|
34
34
|
end
|
35
35
|
else
|
36
|
-
|
36
|
+
UI.error "Could not find screenshots"
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
data/lib/frameit/screenshot.rb
CHANGED
@@ -9,7 +9,7 @@ module Frameit
|
|
9
9
|
# path: Path to screenshot
|
10
10
|
# color: Color to use for the frame
|
11
11
|
def initialize(path, color)
|
12
|
-
|
12
|
+
UI.user_error "Couldn't find file at path '#{path}'" unless File.exist? path
|
13
13
|
@color = color
|
14
14
|
@path = path
|
15
15
|
@size = FastImage.size(path)
|
@@ -36,7 +36,7 @@ module Frameit
|
|
36
36
|
when sizes::MAC
|
37
37
|
return 'Mac'
|
38
38
|
else
|
39
|
-
|
39
|
+
UI.error "Unknown device type for size #{@screen_size} for path '#{path}'"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -2,15 +2,15 @@ module Frameit
|
|
2
2
|
# This class will parse the .string files
|
3
3
|
class StringsParser
|
4
4
|
def self.parse(path)
|
5
|
-
|
6
|
-
|
5
|
+
UI.user_error! "Couldn't find strings file at path '#{path}'" unless File.exist? path
|
6
|
+
UI.user_error! "Must be .strings file, only got '#{path}'" unless path.end_with? ".strings"
|
7
7
|
|
8
8
|
result = {}
|
9
9
|
|
10
10
|
# A .strings file is UTF-16 encoded. We only want to deal with UTF-8
|
11
11
|
content = `iconv -f UTF-16 -t UTF-8 '#{path}'`
|
12
12
|
|
13
|
-
content.split("\n").
|
13
|
+
content.split("\n").each_with_index do |line, index|
|
14
14
|
begin
|
15
15
|
# We don't care about comments and empty lines
|
16
16
|
if line.start_with? '"'
|
@@ -20,8 +20,8 @@ module Frameit
|
|
20
20
|
result[key] = value
|
21
21
|
end
|
22
22
|
rescue => ex
|
23
|
-
|
24
|
-
|
23
|
+
UI.error "Error parsing #{path} line #{index + 1}: '#{line}'"
|
24
|
+
UI.verbose "#{ex.message}\n#{ex.backtrace.join('\n')}"
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -26,13 +26,13 @@ module Frameit
|
|
26
26
|
|
27
27
|
if templates.count == 0
|
28
28
|
if screenshot.screen_size == Deliver::AppScreenshot::ScreenSize::IOS_35
|
29
|
-
|
30
|
-
|
29
|
+
UI.important "Unfortunately 3.5\" device frames were discontinued. Skipping screen '#{screenshot.path}'"
|
30
|
+
UI.error "Looked for: '#{parts.join(joiner)}.png'"
|
31
31
|
else
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
UI.error "Could not find a valid template for screenshot '#{screenshot.path}'"
|
33
|
+
UI.error "You can download new templates from '#{FrameConverter::DOWNLOAD_URL}'"
|
34
|
+
UI.error "and store them in '#{templates_path}'"
|
35
|
+
UI.error "Missing file: '#{parts.join(joiner)}.png'"
|
36
36
|
end
|
37
37
|
return nil
|
38
38
|
else
|
data/lib/frameit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frameit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastlane_core
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.36.1
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 1.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.36.1
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.0.0
|
@@ -190,14 +190,14 @@ dependencies:
|
|
190
190
|
requirements:
|
191
191
|
- - "~>"
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version:
|
193
|
+
version: 0.35.1
|
194
194
|
type: :development
|
195
195
|
prerelease: false
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
198
|
- - "~>"
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version:
|
200
|
+
version: 0.35.1
|
201
201
|
description: Quickly put your screenshots into the right device frames
|
202
202
|
email:
|
203
203
|
- frameit@krausefx.com
|
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
243
243
|
version: '0'
|
244
244
|
requirements: []
|
245
245
|
rubyforge_project:
|
246
|
-
rubygems_version: 2.4.
|
246
|
+
rubygems_version: 2.4.6
|
247
247
|
signing_key:
|
248
248
|
specification_version: 4
|
249
249
|
summary: Quickly put your screenshots into the right device frames
|