fastlane-plugin-framer 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +82 -3
- data/lib/fastlane/plugin/framer/actions/framer_action.rb +20 -4
- data/lib/fastlane/plugin/framer/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead286739a4dc5358d1ce3b78445e2be9d1b998b
|
4
|
+
data.tar.gz: 52b60581ce5c3dda8011a98b38e52aaa36395558
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f04aabf6c588370a376dc7b9feb44cc8fb5d6209a63025a0958d5095893abb3b0146ed386c7c588ad6c03f6c889869287cc8eaa401192b957256226d443c8d0
|
7
|
+
data.tar.gz: 163a4fe66cd172c1b9d75b71789565eb952dbe943cb657c35ac5bec196f4935283c9abf77f891fd579b18c19611718410044c5b231777e3c348db63fba0ed70f
|
data/README.md
CHANGED
@@ -12,18 +12,97 @@ fastlane add_plugin framer
|
|
12
12
|
|
13
13
|
## About framer
|
14
14
|
|
15
|
-
Create images combining app screenshots to templates to make nice pictures to upload in App Store.
|
15
|
+
Create images combining app screenshots to templates to make nice pictures to upload in App Store or Google Play.
|
16
|
+
|
17
|
+
![Flow](assets/example-flow.png)
|
16
18
|
|
17
19
|
It gives you the freedom to customize the looks of each image (your designers will love that!) while keep their generation fully automated.
|
18
20
|
|
21
|
+
Template images can be anything. The only important thing is that it needs to be the same size as the screenshot it will contains.
|
22
|
+
|
23
|
+
You can specify the position and the size of the screen in the template and (optionally) the position and size of the text.
|
24
|
+
|
19
25
|
## Example
|
20
26
|
|
21
|
-
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin.
|
27
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin.
|
28
|
+
|
29
|
+
There are 2 lanes, one for a simple flow (`demo-1`) and another with more languages and screens (`demo-2`).
|
30
|
+
|
31
|
+
Try them by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane demo_1` or `bundle exec fastlane demo_2`.
|
32
|
+
|
33
|
+
## Configuration
|
34
|
+
|
35
|
+
> From great customizations come great configurations [files]
|
36
|
+
|
37
|
+
In order to work, you need to configure each template and the text to draw in the final images.
|
38
|
+
|
39
|
+
### Running parameters
|
40
|
+
|
41
|
+
The **framer** action support 4 optional parameters (default values are used).
|
42
|
+
|
43
|
+
| Option | Description | Default |
|
44
|
+
| ----------------- | -------- | ------------ |
|
45
|
+
| `source_folder` | path to the folder that contains raw screenshots and `text.json` file | `./fastlane/framer/screens` |
|
46
|
+
| `template_folder` | path to the folder that contains the templates images and configuration | `./fastlane/framer/templates` |
|
47
|
+
| `output_folder` | path to the folder that will contains the final images, framed. Used then by `deliver` | `./fastlane/screenshots` (default one for `deliver`) |
|
48
|
+
| `output_suffix` | filenam suffix for the framed images | `-framed` |
|
49
|
+
|
50
|
+
### Template Configuration
|
51
|
+
|
52
|
+
In the template folder you choose, there must be a `Config.json` file (see [example](fastlane/demo-1/templates/Config.json)). In there you will found
|
53
|
+
|
54
|
+
- a default configuration for all templates
|
55
|
+
- a custom configuration for each template (if needed).
|
56
|
+
|
57
|
+
**default** is, as you guess, the default configuration for all templates (a fallback configuration, if you will).
|
58
|
+
|
59
|
+
After that, for each template image you have, you have to put a new map with the same filename as your template image.
|
60
|
+
|
61
|
+
There are keys for configuring screeshot and for the text.
|
62
|
+
|
63
|
+
```
|
64
|
+
"iPhone6s": {
|
65
|
+
"image": {
|
66
|
+
"offset": "+148+172",
|
67
|
+
"width": 457
|
68
|
+
},
|
69
|
+
"text": {
|
70
|
+
"offset_y": 1123,
|
71
|
+
"height": 210,
|
72
|
+
"size": 48
|
73
|
+
}
|
74
|
+
}
|
75
|
+
```
|
76
|
+
|
77
|
+
#### Image
|
78
|
+
|
79
|
+
| Key | Type | Description |
|
80
|
+
| -------------- | --------:| ------------:|
|
81
|
+
| `offset` | String | Pixel position in the format `+[X value]+[Y value]` |
|
82
|
+
| `width` | Number | space available, in pixel, for the screen |
|
83
|
+
|
84
|
+
#### Text
|
85
|
+
|
86
|
+
| Key | Type | Description |
|
87
|
+
| -------------- | --------:| ------------:|
|
88
|
+
| `offset_x` | Number | X position of the text block |
|
89
|
+
| `offset_y` | Number | Y position of the text block|
|
90
|
+
| `height` | Number | height of the text block |
|
91
|
+
| `size` | Number | font size |
|
92
|
+
| `font` | String | path of custom font file to use |
|
93
|
+
| `color` | String | color for the text in hex format (ex. `#545454`) |
|
94
|
+
| `padding` | Number | horizontal internal padding of the text block |
|
95
|
+
|
96
|
+
### Screenshots Text
|
97
|
+
|
98
|
+
If you want some text in the final framed images, you need to create a `text.json` file and put it with the raw device screenshots. It makes sense to commit this file in your repository.
|
99
|
+
|
100
|
+
`text.json` is a simple map where *key* is the part of the screenshot filename (I suggest the same string you use with the `snapshot()` command on your UI tests.
|
101
|
+
The *value* can be any strings.
|
22
102
|
|
23
103
|
## Run tests for this plugin
|
24
104
|
|
25
105
|
To run both the tests, and code style validation, run
|
26
|
-
|
27
106
|
```
|
28
107
|
rake
|
29
108
|
```
|
@@ -29,7 +29,7 @@ module Fastlane
|
|
29
29
|
UI.message "Processing #{file}"
|
30
30
|
|
31
31
|
template = self.find_template(templates, file)
|
32
|
-
text = self.find_text(file)
|
32
|
+
text = self.find_text(source_folder, file)
|
33
33
|
output = self.find_output(source_folder, file, output_folder, params[:output_suffix])
|
34
34
|
|
35
35
|
if template.nil?
|
@@ -65,7 +65,7 @@ module Fastlane
|
|
65
65
|
# Detect available templates
|
66
66
|
templates = []
|
67
67
|
|
68
|
-
Dir.glob("#{template_folder}
|
68
|
+
Dir.glob("#{template_folder}/**/*.png") do |file|
|
69
69
|
|
70
70
|
name = File.basename(file, ".png")
|
71
71
|
UI.message "Loading template #{name}"
|
@@ -116,9 +116,16 @@ module Fastlane
|
|
116
116
|
return templates.find { |template| template.size == size }
|
117
117
|
end
|
118
118
|
|
119
|
-
def self.find_text(screenshot_file)
|
119
|
+
def self.find_text(source_dir, screenshot_file)
|
120
120
|
directory = File.dirname(screenshot_file)
|
121
121
|
strings_path = File.join(directory, "text.json")
|
122
|
+
|
123
|
+
while !File.exist?(strings_path) do
|
124
|
+
directory = File.dirname(directory)
|
125
|
+
break if directory == source_dir
|
126
|
+
strings_path = File.join(directory, "text.json")
|
127
|
+
end
|
128
|
+
|
122
129
|
return nil unless File.exist?(strings_path)
|
123
130
|
|
124
131
|
text = JSON.parse(File.read(strings_path))
|
@@ -145,7 +152,7 @@ module Fastlane
|
|
145
152
|
|
146
153
|
# Ensure output dir exist
|
147
154
|
folder = File.dirname(file_path)
|
148
|
-
|
155
|
+
self.create_dir_if_not_exists(folder)
|
149
156
|
|
150
157
|
return file_path
|
151
158
|
end
|
@@ -222,6 +229,15 @@ module Fastlane
|
|
222
229
|
template_img.destroy!
|
223
230
|
end
|
224
231
|
|
232
|
+
def self.create_dir_if_not_exists(path)
|
233
|
+
recursive = path.split('/')
|
234
|
+
directory = ''
|
235
|
+
recursive.each do |sub_directory|
|
236
|
+
directory += sub_directory + '/'
|
237
|
+
Dir.mkdir(directory) unless (File.directory? directory)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
225
241
|
#####################################################
|
226
242
|
# @!group Documentation
|
227
243
|
#####################################################
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-framer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DrAL3X
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_magick
|
@@ -155,10 +155,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
157
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.6.
|
158
|
+
rubygems_version: 2.6.8
|
159
159
|
signing_key:
|
160
160
|
specification_version: 4
|
161
161
|
summary: Create images combining app screenshots with templates to make nice pictures
|
162
162
|
for the App Store
|
163
163
|
test_files: []
|
164
|
-
has_rdoc:
|