frameit 2.0.1 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d2a2a56cf47435c5ade1e1a23aa9be3d173a5d6
4
- data.tar.gz: 7cb3e2d31b45a5d536c8cad848c558bbef57d0b4
3
+ metadata.gz: a09eef67fb1b74cdf9233221b02a0bef2c90cdb7
4
+ data.tar.gz: 254360304c3cae8929e7a06c142223de91fb9008
5
5
  SHA512:
6
- metadata.gz: 05da10f3143b6f271f3b28328fc85875826f3f738f0ec90b9bcee82d4d8d0a62d57fde6e5731cc09c3b76fd7d6cbd06170bc5d404221950fcb4cbb24aace802b
7
- data.tar.gz: e0bf2d046840925a4ff16b91d0bf08807dc9a7e3d8fb20751ca584e2d78277eb04b9719d53785a7449cda7f24f188e37905d3d1c9be498114441763340ad86b4
6
+ metadata.gz: edf0fda390e74e7a6f2ebf31b4400e0ccd1c952b61bcc76968084dc9d4fa5d12cdcdb9f766e64595dfae804ba6799decd1af72cf5825a28f1492637a70be3b38
7
+ data.tar.gz: a9922bb2cb107ce9157b1d2be1bb7a95c5fa55205a91c5e768549382b86ee2f37accd817d74b82a978cf8f8b7cfeaacca791612e35b2f0429c14e2c378210985
data/README.md CHANGED
@@ -61,6 +61,20 @@ Here is a nice gif, that shows ```frameit``` in action:
61
61
 
62
62
  ![assets/FrameitGit.gif](assets/FrameitGit.gif?raw=1)
63
63
 
64
+ ### Results
65
+
66
+ ![assets/ScreenshotsBig.png](assets/ScreenshotsBig.png?raw=1)
67
+
68
+ -------
69
+
70
+ ![assets/ScreenshotsOverview.png](assets/ScreenshotsOverview.png?raw=1)
71
+
72
+ -------
73
+
74
+ ![assets/MacExample.png](assets/MacExample.png?raw=1)
75
+
76
+ <h5 align="center">The <code>frameit</code> 2.0 update was kindly sponsored by <a href="https://mindnode.com/">MindNode</a>, seen in the screenshots above.
77
+
64
78
  # Installation
65
79
 
66
80
  Make sure, you have the commandline tools installed
@@ -101,6 +115,107 @@ To run the setup process again to add new frames use:
101
115
 
102
116
  When using `frameit` without titles on top, the screenshots will have the full resolution, which means they can't be uploaded to the App Store directly. They are supposed to be used for websites, print media and emails. Check out the section below to use the screenshots for the App Store.
103
117
 
118
+ # Titles and Background (optional)
119
+
120
+ With `frameit` 2.0 you are now able to add a custom background, title and text colors to your screenshots.
121
+
122
+ A working example can be found in the [fastlane examples](https://github.com/fastlane/examples/tree/master/MindNode/screenshots) project.
123
+
124
+ #### `Framefile.json`
125
+
126
+ Use it to define the general information:
127
+
128
+ ```json
129
+ {
130
+ "default": {
131
+ "keyword": {
132
+ "font": "./fonts/MyFont-Rg.otf"
133
+ },
134
+ "title": {
135
+ "font": "./fonts/MyFont-Th.otf",
136
+ "color": "#545454"
137
+ },
138
+ "background": "./background.jpg",
139
+ "padding": 50
140
+ },
141
+
142
+ "data": [
143
+ {
144
+ "filter": "Brainstorming",
145
+ "keyword": {
146
+ "color": "#d21559"
147
+ }
148
+ },
149
+ {
150
+ "filter": "Organizing",
151
+ "keyword": {
152
+ "color": "#feb909"
153
+ }
154
+ },
155
+ {
156
+ "filter": "Sharing",
157
+ "keyword": {
158
+ "color": "#aa4dbc"
159
+ }
160
+ },
161
+ {
162
+ "filter": "Styling",
163
+ "keyword": {
164
+ "color": "#31bb48"
165
+ }
166
+ }
167
+ ]
168
+ }
169
+ ```
170
+
171
+ The `filter` value is a part of the screenshot named for which the given option should be used. If a screenshot is named `iPhone5_Brainstorming.png` the first entry in the `data` array will be used.
172
+
173
+ The `Framefile.json` should be in the `screenshots` folder, as seen in the [example](https://github.com/fastlane/examples/tree/master/MindNode/screenshots).
174
+
175
+ #### `.strings` files
176
+
177
+ To define the title and optionally the keyword, put two `.strings` files into the language folder (e.g. [en-US in the example project](https://github.com/fastlane/examples/tree/master/MindNode/screenshots/en-US))
178
+
179
+ 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.
180
+
181
+ #### Uploading screenshots to iTC
182
+
183
+ Use [deliver](https://github.com/KrauseFx/deliver) to upload all screenshots to iTunes Connect completely automatic :rocket:
184
+
185
+ ### Mac
186
+
187
+ With `frameit` 2.0 is possible to also frame Mac OS X Applications. You have to provide the following:
188
+
189
+ - The `offset` information so `frameit` knows where to put your screenshots
190
+ - A path to a `background`, which should contain both the background and the Mac
191
+ - `titleHeight`: The height in px that should be used for the title
192
+
193
+ ##### Example
194
+ ```json
195
+ {
196
+ "default": {
197
+ "title": {
198
+ "color": "#545454"
199
+ },
200
+ "background": "Mac.jpg",
201
+ "offset": {
202
+ "offset": "+676+479",
203
+ "titleHeight": 320
204
+ }
205
+ },
206
+ "data": [
207
+ {
208
+ "filter": "Brainstorming",
209
+ "keyword": {
210
+ "color": "#d21559"
211
+ }
212
+ }
213
+ ]
214
+ }
215
+ ```
216
+
217
+ Check out the [MindNode example project](https://github.com/fastlane/examples/tree/master/MindNode/screenshots)
218
+
104
219
  # Tips
105
220
 
106
221
  ## [`fastlane`](https://fastlane.tools) Toolchain
data/bin/frameit CHANGED
@@ -20,6 +20,7 @@ class FrameItApplication
20
20
 
21
21
  always_trace!
22
22
 
23
+ global_option('--verbose') { $verbose = true }
23
24
 
24
25
  default_command :black
25
26
 
@@ -41,11 +41,14 @@ module Frameit
41
41
  values.each do |key, value|
42
42
  if value.kind_of?Hash
43
43
  change_paths_to_absolutes!(value) # recursive call
44
+ elsif value.kind_of?Array
45
+ value.each do |current|
46
+ change_paths_to_absolutes!(current) if current.kind_of?Hash # recursive call
47
+ end
44
48
  else
45
49
  if ['font', 'background'].include?key
46
50
  # Change the paths to relative ones
47
51
  # `replace`: to change the content of the string, so it's actually stored
48
-
49
52
  if @path # where is the config file. We don't have a config file in tests
50
53
  containing_folder = File.expand_path('..', @path)
51
54
  value.replace File.join(containing_folder, value)
@@ -65,6 +68,16 @@ module Frameit
65
68
  raise "Could not find font at path '#{File.expand_path(value)}'" unless File.exists?value
66
69
  end
67
70
 
71
+ if key == 'fonts'
72
+ raise "`fonts` must be an array" unless value.kind_of?Array
73
+
74
+ value.each do |current|
75
+ raise "You must specify a font path" if current.fetch('font', '').length == 0
76
+ raise "Could not find font at path '#{File.expand_path(current.fetch('font'))}'" unless File.exists?current.fetch('font')
77
+ raise "`supported` must be an array" unless current.fetch('supported', []).kind_of?Array
78
+ end
79
+ end
80
+
68
81
  if key == 'background'
69
82
  raise "Could not find background image at path '#{File.expand_path(value)}'" unless File.exists?value
70
83
  end
@@ -92,7 +92,7 @@ module Frameit
92
92
  @image = put_into_frame
93
93
 
94
94
  # Decrease the size of the framed screenshot to fit into the defined padding + background
95
- frame_width = background.width - fetch_config['padding'] * 2
95
+ frame_width = background.width - frame_padding * 2
96
96
  image.resize "#{frame_width}x"
97
97
  end
98
98
 
@@ -105,6 +105,13 @@ module Frameit
105
105
  image
106
106
  end
107
107
 
108
+ # Padding around the frames
109
+ def frame_padding
110
+ multi = 1.0
111
+ multi = 1.7 if self.screenshot.is_triple_density?
112
+ return fetch_config['padding'] * multi
113
+ end
114
+
108
115
  # Returns a correctly sized background image
109
116
  def generate_background
110
117
  background = MiniMagick::Image.open(fetch_config['background'])
@@ -119,6 +126,7 @@ module Frameit
119
126
  left_space = (background.width / 2.0 - image.width / 2.0).round
120
127
  bottom_space = -(image.height / 10).round # to be just a bit below the image bottom
121
128
  bottom_space -= 40 if screenshot.is_portrait? # even more for portrait mode
129
+ bottom_space -= 50 if (screenshot.is_mini? and screenshot.is_portrait?) # super old devices
122
130
 
123
131
  self.top_space_above_device = background.height - image.height - bottom_space
124
132
 
@@ -184,10 +192,12 @@ module Frameit
184
192
  i.resize "#{max_width}x#{image_height}!" # `!` says it should ignore the ratio
185
193
  end
186
194
 
195
+ current_font = font(key)
196
+ Helper.log.debug "Using #{current_font} as font the #{key} of #{screenshot.path}" if $verbose and current_font
197
+
187
198
  # Add the actual title
188
- font = fetch_config[key.to_s]['font']
189
199
  title_image.combine_options do |i|
190
- i.font font if font
200
+ i.font current_font if current_font
191
201
  i.gravity "Center"
192
202
  i.pointsize actual_font_size
193
203
  i.draw "text 0,0 '#{fetch_text(key)}'"
@@ -226,6 +236,7 @@ module Frameit
226
236
 
227
237
  # No string files, fallback to Framefile config
228
238
  result = fetch_config[type.to_s]['text']
239
+ Helper.log.debug "Falling back to default text as there was nothing specified in the .strings file" if $verbose
229
240
 
230
241
  if !result and type == :title
231
242
  # title is mandatory
@@ -235,5 +246,30 @@ module Frameit
235
246
  return result
236
247
  end
237
248
 
249
+ # The font we want to use
250
+ def font(key)
251
+ single_font = fetch_config[key.to_s]['font']
252
+ return single_font if single_font
253
+
254
+ fonts = fetch_config[key.to_s]['fonts']
255
+ if fonts
256
+ fonts.each do |font|
257
+ if font['supported']
258
+ font['supported'].each do |language|
259
+ if screenshot.path.include?language
260
+ return font["font"]
261
+ end
262
+ end
263
+ else
264
+ # No `supported` array, this will always be true
265
+ Helper.log.debug "Found a font with no list of supported languages, using this now" if $verbose
266
+ return font["font"]
267
+ end
268
+ end
269
+ end
270
+
271
+ Helper.log.debug "No custom font specified, using the default one" if $verbose
272
+ return nil
273
+ end
238
274
  end
239
275
  end
@@ -20,7 +20,12 @@ module Frameit
20
20
  when size::IOS_40
21
21
  return {
22
22
  'offset' => "+54+197",
23
- 'width' => 543
23
+ 'width' => 544
24
+ }
25
+ when size::IOS_35
26
+ return {
27
+ 'offset' => "+59+260",
28
+ 'width' => 647
24
29
  }
25
30
  when size::IOS_IPAD
26
31
  return {
@@ -15,19 +15,21 @@ module Frameit
15
15
  end
16
16
 
17
17
  def run(path, color = Color::BLACK)
18
- screenshots = Dir.glob("#{path}/**/*.{png,PNG}")
18
+ screenshots = Dir.glob("#{path}/**/*.{png,PNG}").uniq # uniq because thanks to {png,PNG} there are duplicates
19
19
 
20
20
  if screenshots.count > 0
21
21
  screenshots.each do |full_path|
22
22
  next if full_path.include?"_framed.png"
23
23
  next if full_path.include?".itmsp/" # a package file, we don't want to modify that
24
24
  next if full_path.include?"device_frames/" # these are the device frames the user is using
25
+ next if full_path.downcase.include?"watch" # we don't care about watches right now
25
26
 
26
27
  begin
27
28
  screenshot = Screenshot.new(full_path, color)
28
29
  screenshot.frame!
29
30
  rescue => ex
30
31
  Helper.log.error ex
32
+ Helper.log.error "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
31
33
  end
32
34
  end
33
35
  else
@@ -36,6 +36,16 @@ module Frameit
36
36
  end
37
37
  end
38
38
 
39
+ # Is the device a 3x device? (e.g. 6 Plus)
40
+ def is_triple_density?
41
+ (screen_size == Deliver::AppScreenshot::ScreenSize::IOS_55)
42
+ end
43
+
44
+ # Super old devices
45
+ def is_mini?
46
+ (screen_size == Deliver::AppScreenshot::ScreenSize::IOS_35)
47
+ end
48
+
39
49
  def is_mac?
40
50
  return device_name == 'Mac'
41
51
  end
@@ -1,3 +1,3 @@
1
1
  module Frameit
2
- VERSION = "2.0.1"
2
+ VERSION = "2.1.0"
3
3
  end
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frameit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-17 00:00:00.000000000 Z
11
+ date: 2015-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.7.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.7.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fastimage
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.6.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.6.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mini_magick
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 4.0.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 4.0.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: deliver
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>'
59
+ - - ">"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.3'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>'
66
+ - - ">"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 3.1.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 3.1.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: yard
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.8.7.4
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.8.7.4
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: coveralls
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  description: Quickly put your screenshots into the right device frames
@@ -185,17 +185,17 @@ require_paths:
185
185
  - lib
186
186
  required_ruby_version: !ruby/object:Gem::Requirement
187
187
  requirements:
188
- - - '>='
188
+ - - ">="
189
189
  - !ruby/object:Gem::Version
190
190
  version: 2.0.0
191
191
  required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  requirements:
193
- - - '>='
193
+ - - ">="
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
196
  requirements: []
197
197
  rubyforge_project:
198
- rubygems_version: 2.2.2
198
+ rubygems_version: 2.4.6
199
199
  signing_key:
200
200
  specification_version: 4
201
201
  summary: Quickly put your screenshots into the right device frames