fastlane-plugin-vitrine 1.0.0
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +92 -0
- data/lib/fastlane/plugin/vitrine/actions/vitrine_export_action.rb +122 -0
- data/lib/fastlane/plugin/vitrine/actions/vitrine_import_action.rb +153 -0
- data/lib/fastlane/plugin/vitrine/actions/vitrine_validate_action.rb +76 -0
- data/lib/fastlane/plugin/vitrine/helper/vitrine_helper.rb +50 -0
- data/lib/fastlane/plugin/vitrine/version.rb +7 -0
- data/lib/fastlane/plugin/vitrine.rb +14 -0
- metadata +50 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5455ef683cd36355979634f3b3420c16160f81f1f3d1bf1eb35dd8481d169378
|
|
4
|
+
data.tar.gz: 0b42a2741b6a3a9f7fadd62093f68934b2b5768cbe242374c3ff614ce48515ad
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 681c0cef62db0772561a7be5abfdb3e86b0e4b2b6bfbe49c95fa409a158ba5a309baff21a655364601fb1db5667e55132dc4bbecaac6f6dcdd40aaeab4b71c14
|
|
7
|
+
data.tar.gz: 818351c576f1af4ff51a4be59281e3e88bed3703c1042f7a1b9fdafb1563fd5c583b7d9ed9273371eed6fcabfb47683a076056aa1de950ee1864434963de3e9d
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Looking4Cache UG (haftungsbeschränkt)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# fastlane-plugin-vitrine
|
|
2
|
+
|
|
3
|
+
[fastlane](https://fastlane.tools) plugin for
|
|
4
|
+
[Vitrine Studio](https://vitrinestudio.app): import snapshot/screengrab
|
|
5
|
+
captures into a Vitrine Studio project, validate it and export the framed,
|
|
6
|
+
localized App Store / Play Store screenshots straight into deliver's and
|
|
7
|
+
supply's folders – a replacement for `frameit`.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
fastlane add_plugin vitrine
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Needs the `vitrine` command line tool (Vitrine Studio 1.0.0 or later), see
|
|
14
|
+
below. The source is maintained in
|
|
15
|
+
[`integrations/fastlane-plugin/`](https://github.com/vitrinestudio-app/vitrine/tree/main/integrations/fastlane-plugin)
|
|
16
|
+
of the main repository and copied to
|
|
17
|
+
[`vitrinestudio-app/fastlane-plugin-vitrine`](https://github.com/vitrinestudio-app/fastlane-plugin-vitrine).
|
|
18
|
+
|
|
19
|
+
Three actions that call the `vitrine` CLI – fastlane runs on every CI system
|
|
20
|
+
mobile teams use (GitHub Actions, Bitrise, Codemagic, CircleCI, Jenkins, and
|
|
21
|
+
locally), so this one plugin covers all of them:
|
|
22
|
+
|
|
23
|
+
| action | does |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `vitrine_import` | `vitrine import screenshots`; copies snapshot/screengrab captures (default `./fastlane/captures`, else `./fastlane`; or any folder via `source`) into the project; Vitrine Studio's own exports are skipped; `lang_map`/`device_map`/`key_map` as hashes, `save_mapping`, `dry_run`; fails the lane when files cannot be mapped |
|
|
26
|
+
| `vitrine_validate` | `vitrine validate`; fails the lane on errors (warnings with `strict: true`) |
|
|
27
|
+
| `vitrine_export` | `vitrine export --layout fastlane --out ./fastlane`; sets `DELIVER_SCREENSHOTS_PATH` / `SUPPLY_METADATA_PATH` (unless already set) and the lane context `VITRINE_SCREENSHOTS_PATH`, `VITRINE_METADATA_PATH`; `foreign_images: "fail"` (default) / `"warn"` / `"remove"` for images in the upload folders that Vitrine Studio did not export |
|
|
28
|
+
|
|
29
|
+
The CLI is found via the `binary` option, `$VITRINE_CLI`, or `vitrine` on
|
|
30
|
+
`PATH` (Vitrine Studio app → *Install command line tool*, or the CLI
|
|
31
|
+
archive of a GitHub release).
|
|
32
|
+
|
|
33
|
+
Raw captures and finished images live in separate folders: snapshot and
|
|
34
|
+
screengrab write below `fastlane/captures/` (their usual structure), Vitrine
|
|
35
|
+
Studio exports into deliver's `fastlane/screenshots/` and supply's
|
|
36
|
+
`fastlane/metadata/android/`. deliver and supply upload every image in those
|
|
37
|
+
folders, so only Vitrine Studio's images should be there (decision 0032 in the
|
|
38
|
+
Vitrine Studio repository, `ARCHITECTURE.md` §9).
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
# fastlane/Snapfile
|
|
42
|
+
output_directory("./fastlane/captures/screenshots")
|
|
43
|
+
|
|
44
|
+
# fastlane/Screengrabfile
|
|
45
|
+
output_directory("fastlane/captures/metadata/android")
|
|
46
|
+
|
|
47
|
+
# fastlane/Pluginfile
|
|
48
|
+
gem "fastlane-plugin-vitrine"
|
|
49
|
+
|
|
50
|
+
# fastlane/Fastfile
|
|
51
|
+
lane :screenshots do
|
|
52
|
+
capture_screenshots # snapshot → fastlane/captures/screenshots
|
|
53
|
+
capture_android_screenshots # screengrab → fastlane/captures/metadata/android
|
|
54
|
+
vitrine_import(project: "store-screens") # reads fastlane/captures
|
|
55
|
+
vitrine_validate(project: "store-screens", strict: true)
|
|
56
|
+
vitrine_export(project: "store-screens") # replaces frameit
|
|
57
|
+
upload_to_app_store(skip_binary_upload: true, skip_metadata: true, overwrite_screenshots: true)
|
|
58
|
+
upload_to_play_store(skip_upload_apk: true, skip_upload_aab: true, skip_upload_metadata: true,
|
|
59
|
+
skip_upload_changelogs: true, skip_upload_images: false, skip_upload_screenshots: false)
|
|
60
|
+
end
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Keeping the captures in `fastlane/screenshots` and `fastlane/metadata/android`
|
|
64
|
+
(the snapshot/screengrab defaults) still imports correctly – the import
|
|
65
|
+
skips the files Vitrine Studio exported (listed in `fastlane/.vitrine-export.json`,
|
|
66
|
+
or named `01_<target>.png` / `01_<locale>.png`) – but then the captures sit
|
|
67
|
+
in the upload folders: `vitrine_export` stops the lane and lists them.
|
|
68
|
+
`foreign_images: "remove"` deletes them after each export instead (they are
|
|
69
|
+
captured again on the next run); `"warn"` only prints them.
|
|
70
|
+
|
|
71
|
+
Paths in the actions are relative to the folder fastlane runs actions in
|
|
72
|
+
(the project root, one level above `fastlane/`).
|
|
73
|
+
|
|
74
|
+
Why not also wrap `vitrine upload`? deliver/supply already upload in a
|
|
75
|
+
fastlane setup, and Vitrine Studio's own upload has a plan → confirm
|
|
76
|
+
token → execute flow that a single action would hide. A later
|
|
77
|
+
`vitrine_upload` action could run `upload plan` and `upload execute
|
|
78
|
+
--confirm <token> --yes` with the credentials mapped from fastlane's
|
|
79
|
+
`app_store_connect_api_key` (owner decision).
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
bundle install
|
|
85
|
+
bundle exec rake # rspec (with a fake `vitrine` binary) + rubocop
|
|
86
|
+
vitrine new demo && bundle exec fastlane test project:demo # against the real CLI
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Licence
|
|
90
|
+
|
|
91
|
+
MIT (see `LICENSE`). The plugin only runs the `vitrine` program; Vitrine
|
|
92
|
+
Studio itself is licensed under the GNU GPL v3 or later.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
require "fastlane/action"
|
|
2
|
+
require "fastlane/boolean"
|
|
3
|
+
require "fastlane_core/configuration/config_item"
|
|
4
|
+
require_relative "../helper/vitrine_helper"
|
|
5
|
+
|
|
6
|
+
module Fastlane
|
|
7
|
+
module Actions
|
|
8
|
+
module SharedValues
|
|
9
|
+
VITRINE_EXPORT_DIR = :VITRINE_EXPORT_DIR
|
|
10
|
+
VITRINE_SCREENSHOTS_PATH = :VITRINE_SCREENSHOTS_PATH
|
|
11
|
+
VITRINE_METADATA_PATH = :VITRINE_METADATA_PATH
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# `vitrine export --layout fastlane`: writes deliver's
|
|
15
|
+
# `screenshots/<locale>/` and supply's `metadata/android/<locale>/images/`
|
|
16
|
+
# folders, so `upload_to_app_store` / `upload_to_play_store` upload them
|
|
17
|
+
# unchanged. Replaces `frameit`.
|
|
18
|
+
class VitrineExportAction < Action
|
|
19
|
+
def self.run(params)
|
|
20
|
+
binary = Helper::VitrineHelper.binary(params[:binary])
|
|
21
|
+
out = File.expand_path(params[:output_directory])
|
|
22
|
+
report, code = Helper::VitrineHelper.run_json(binary: binary, project: params[:project], args: cli_args(params, out), what: "export")
|
|
23
|
+
Array(report["notes"]).each { |n| UI.important("#{[n['target'], n['lang']].compact.join(' ')}: #{n['message']}") }
|
|
24
|
+
Array(report["errors"]).each { |e| UI.error(e.to_s) }
|
|
25
|
+
UI.user_error!("Vitrine Studio export failed") if code == 1
|
|
26
|
+
|
|
27
|
+
Array(report["removed_foreign"]).each { |f| UI.message("Removed (not from Vitrine Studio): #{f}") }
|
|
28
|
+
check_foreign(Array(report["foreign"]), out) if params[:foreign_images] == "fail"
|
|
29
|
+
|
|
30
|
+
files = Array(report["files"])
|
|
31
|
+
written = files.count { |f| !f["skipped"] }
|
|
32
|
+
UI.success("Vitrine Studio: #{written} file(s) written, #{files.length - written} unchanged → #{out}")
|
|
33
|
+
Actions.lane_context[SharedValues::VITRINE_EXPORT_DIR] = out
|
|
34
|
+
publish_fastlane_paths(out) if params[:layout] == "fastlane"
|
|
35
|
+
report
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.cli_args(params, out)
|
|
39
|
+
args = ["export", "--layout", params[:layout], "--out", out, "--format", "json", "--no-html"]
|
|
40
|
+
args << "--force" if params[:force]
|
|
41
|
+
args << "--remove-foreign" if params[:layout] == "fastlane" && params[:foreign_images] == "remove"
|
|
42
|
+
Array(params[:targets]).each { |t| args.push("--target", t) }
|
|
43
|
+
Array(params[:languages]).each { |l| args.push("--lang", l) }
|
|
44
|
+
args
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Images deliver/supply would upload together with Vitrine Studio's:
|
|
48
|
+
# raw snapshot/screengrab captures, frameit output.
|
|
49
|
+
def self.check_foreign(foreign, out)
|
|
50
|
+
return if foreign.empty?
|
|
51
|
+
|
|
52
|
+
foreign.first(10).each { |f| UI.error("not from Vitrine Studio: #{File.join(out, f)}") }
|
|
53
|
+
UI.user_error!("#{foreign.length} image(s) in the upload folders were not exported by Vitrine Studio; " \
|
|
54
|
+
"deliver/supply would upload them too. Let snapshot/screengrab write to fastlane/captures " \
|
|
55
|
+
"(output_directory) and import from there, or use foreign_images: \"remove\".")
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self.publish_fastlane_paths(out)
|
|
59
|
+
screenshots = File.join(out, "screenshots")
|
|
60
|
+
metadata = File.join(out, "metadata", "android")
|
|
61
|
+
Actions.lane_context[SharedValues::VITRINE_SCREENSHOTS_PATH] = screenshots
|
|
62
|
+
Actions.lane_context[SharedValues::VITRINE_METADATA_PATH] = metadata
|
|
63
|
+
# deliver / supply read these when no explicit path is given.
|
|
64
|
+
ENV["DELIVER_SCREENSHOTS_PATH"] ||= screenshots if File.directory?(screenshots)
|
|
65
|
+
ENV["SUPPLY_METADATA_PATH"] ||= metadata if File.directory?(metadata)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def self.description
|
|
69
|
+
"Export App Store / Play Store screenshots with Vitrine Studio (fastlane folder layout by default)"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def self.authors
|
|
73
|
+
["Vitrine Studio"]
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def self.output
|
|
77
|
+
[
|
|
78
|
+
["VITRINE_EXPORT_DIR", "The export folder"],
|
|
79
|
+
["VITRINE_SCREENSHOTS_PATH", "deliver's screenshots folder (layout fastlane)"],
|
|
80
|
+
["VITRINE_METADATA_PATH", "supply's metadata folder (layout fastlane)"]
|
|
81
|
+
]
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def self.return_value
|
|
85
|
+
"The export report (Hash: out_dir, files, issues, notes, errors)"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def self.available_options
|
|
89
|
+
[
|
|
90
|
+
FastlaneCore::ConfigItem.new(key: :project, env_name: "VITRINE_PROJECT", description: "Project folder (with project.yaml)", default_value: "."),
|
|
91
|
+
FastlaneCore::ConfigItem.new(key: :output_directory, env_name: "VITRINE_EXPORT_DIR", description: "Export folder (fastlane layout: the folder that gets screenshots/ and metadata/android/)", default_value: "./fastlane"),
|
|
92
|
+
FastlaneCore::ConfigItem.new(key: :layout, description: "fastlane or standard", default_value: "fastlane",
|
|
93
|
+
verify_block: proc { |v| UI.user_error!("layout must be fastlane or standard") unless %w[fastlane standard].include?(v) }),
|
|
94
|
+
FastlaneCore::ConfigItem.new(key: :targets, description: "Only these targets", type: Array, optional: true),
|
|
95
|
+
FastlaneCore::ConfigItem.new(key: :languages, description: "Only these languages", type: Array, optional: true),
|
|
96
|
+
FastlaneCore::ConfigItem.new(key: :foreign_images,
|
|
97
|
+
description: "Images in the deliver/supply folders that Vitrine Studio did not export (raw captures, frameit output): " \
|
|
98
|
+
"fail (default: stop the lane), warn, or remove (delete them after the export)",
|
|
99
|
+
default_value: "fail",
|
|
100
|
+
verify_block: proc { |v| UI.user_error!("foreign_images must be fail, warn or remove") unless %w[fail warn remove].include?(v) }),
|
|
101
|
+
FastlaneCore::ConfigItem.new(key: :force, description: "Render everything (ignore the export cache)", type: Boolean, default_value: false),
|
|
102
|
+
FastlaneCore::ConfigItem.new(key: :binary, env_name: "VITRINE_CLI", description: "Path of the vitrine binary", optional: true)
|
|
103
|
+
]
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def self.is_supported?(platform)
|
|
107
|
+
%i[ios mac android].include?(platform)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def self.example_code
|
|
111
|
+
[
|
|
112
|
+
'vitrine_export(project: "store-screens")
|
|
113
|
+
upload_to_app_store(skip_binary_upload: true, skip_metadata: true, overwrite_screenshots: true)'
|
|
114
|
+
]
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def self.category
|
|
118
|
+
:screenshots
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
require "fastlane/action"
|
|
2
|
+
require "fastlane/boolean"
|
|
3
|
+
require "fastlane_core/configuration/config_item"
|
|
4
|
+
require_relative "../helper/vitrine_helper"
|
|
5
|
+
|
|
6
|
+
module Fastlane
|
|
7
|
+
module Actions
|
|
8
|
+
module SharedValues
|
|
9
|
+
VITRINE_IMPORTED_COUNT = :VITRINE_IMPORTED_COUNT
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# `vitrine import screenshots`: copies the raw screenshots from
|
|
13
|
+
# snapshot / screengrab (or any folder) into the Vitrine Studio project
|
|
14
|
+
# (`screenshots/<lang>/<variant>/<key>.png`). Run it after
|
|
15
|
+
# `capture_screenshots` / `capture_android_screenshots` and before
|
|
16
|
+
# `vitrine_export`.
|
|
17
|
+
class VitrineImportAction < Action
|
|
18
|
+
UNMAPPED = %w[unresolved duplicate].freeze
|
|
19
|
+
COPIES = %w[new overwrite].freeze
|
|
20
|
+
|
|
21
|
+
def self.run(params)
|
|
22
|
+
binary = Helper::VitrineHelper.binary(params[:binary])
|
|
23
|
+
source = File.expand_path(params[:source] || default_source)
|
|
24
|
+
UI.user_error!("Screenshot folder not found: #{source}") unless File.directory?(source)
|
|
25
|
+
|
|
26
|
+
report, code = Helper::VitrineHelper.run_json(binary: binary, project: params[:project], args: cli_args(params, source), what: "import")
|
|
27
|
+
print_plan(report)
|
|
28
|
+
if code == 1
|
|
29
|
+
UI.user_error!("Vitrine Studio import: some screenshots could not be mapped. Add lang_map / device_map / key_map " \
|
|
30
|
+
"(or run with dry_run: true to see the plan).")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Actions.lane_context[SharedValues::VITRINE_IMPORTED_COUNT] = params[:dry_run] ? summarize_dry_run(report) : summarize(report)
|
|
34
|
+
report
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.cli_args(params, source)
|
|
38
|
+
args = ["import", "screenshots", source, "--format", params[:format], "--format-output", "json"]
|
|
39
|
+
{ lang_map: "--lang-map", device_map: "--device-map", key_map: "--key-map" }.each do |key, flag|
|
|
40
|
+
(params[key] || {}).each { |k, v| args.push(flag, "#{k}=#{v}") }
|
|
41
|
+
end
|
|
42
|
+
args << "--include-framed" if params[:include_framed]
|
|
43
|
+
args << "--save-mapping" if params[:save_mapping]
|
|
44
|
+
args << "--dry-run" if params[:dry_run]
|
|
45
|
+
args
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.print_plan(report)
|
|
49
|
+
plan = report["plan"] || {}
|
|
50
|
+
print_unmapped(Array(plan["items"]))
|
|
51
|
+
own = Array(plan["skipped"]).count { |s| s["reason"].to_s.include?("Vitrine Studio") }
|
|
52
|
+
UI.message("Skipped #{own} image(s) exported by Vitrine Studio (not captures)") if own.positive?
|
|
53
|
+
Array(report.dig("applied", "failed")).each { |src, err| UI.error("#{src}: #{err}") }
|
|
54
|
+
Array(plan["missing"]).each do |m|
|
|
55
|
+
UI.important("missing screenshot #{m['lang']}/#{m['variant']}/#{m['key']} (#{m['status']})")
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Files that could not be mapped (unknown device/locale/screen) or
|
|
60
|
+
# that map to the same destination twice.
|
|
61
|
+
def self.print_unmapped(items)
|
|
62
|
+
items.select { |i| UNMAPPED.include?(i["action"]) }.each do |item|
|
|
63
|
+
hint = Array(item["notes"]).join("; ")
|
|
64
|
+
UI.error("#{item['source']}: #{item['action']}#{hint.empty? ? '' : " – #{hint}"}")
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def self.summarize_dry_run(report)
|
|
69
|
+
copies = Array(report.dig("plan", "items")).count { |i| COPIES.include?(i["action"]) }
|
|
70
|
+
UI.success("Vitrine Studio import (dry run): #{copies} file(s) would be copied")
|
|
71
|
+
0
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.summarize(report)
|
|
75
|
+
applied = report["applied"] || {}
|
|
76
|
+
copied = Array(applied["copied"]).length
|
|
77
|
+
UI.success("Vitrine Studio: #{copied} screenshot(s) imported, #{Array(applied['unchanged']).length} unchanged")
|
|
78
|
+
UI.message("Mapping stored in project.yaml") if report["mapping_saved"]
|
|
79
|
+
copied
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Raw captures belong in their own folder (`fastlane/captures`,
|
|
83
|
+
# see the Snapfile / Screengrabfile snippets in the README), so
|
|
84
|
+
# deliver/supply upload only Vitrine Studio's images. Falls back to
|
|
85
|
+
# `./fastlane`; the import then skips Vitrine Studio's own exports.
|
|
86
|
+
CAPTURES = "./fastlane/captures"
|
|
87
|
+
|
|
88
|
+
def self.default_source
|
|
89
|
+
return CAPTURES if File.directory?(CAPTURES)
|
|
90
|
+
|
|
91
|
+
UI.important("No #{CAPTURES} folder: importing from ./fastlane. Point snapshot/screengrab's output_directory " \
|
|
92
|
+
"to fastlane/captures so the raw captures are not uploaded next to Vitrine Studio's images.")
|
|
93
|
+
"./fastlane"
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def self.description
|
|
97
|
+
"Import raw screenshots (snapshot, screengrab or a folder) into a Vitrine Studio project"
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def self.authors
|
|
101
|
+
["Vitrine Studio"]
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def self.output
|
|
105
|
+
[
|
|
106
|
+
["VITRINE_IMPORTED_COUNT", "Number of screenshots copied into the project (0 for a dry run)"]
|
|
107
|
+
]
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def self.return_value
|
|
111
|
+
"The import report (Hash: ok, dry_run, plan, applied, mapping_saved)"
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def self.available_options
|
|
115
|
+
[
|
|
116
|
+
FastlaneCore::ConfigItem.new(key: :project, env_name: "VITRINE_PROJECT", description: "Project folder (with project.yaml)", default_value: "."),
|
|
117
|
+
FastlaneCore::ConfigItem.new(key: :source, env_name: "VITRINE_IMPORT_SOURCE",
|
|
118
|
+
description: "Folder with the raw screenshots (snapshot's screenshots/ + screengrab's metadata/android/ below it, or any folder). " \
|
|
119
|
+
"Default: ./fastlane/captures, else ./fastlane",
|
|
120
|
+
optional: true),
|
|
121
|
+
FastlaneCore::ConfigItem.new(key: :format, description: "Source layout: auto, fastlane, vitrine or flat", default_value: "auto",
|
|
122
|
+
verify_block: proc { |v| UI.user_error!("format must be auto, fastlane, vitrine or flat") unless %w[auto fastlane vitrine flat].include?(v) }),
|
|
123
|
+
FastlaneCore::ConfigItem.new(key: :lang_map, description: "Locale → language, e.g. { \"de-DE\" => \"de\" }", type: Hash, optional: true),
|
|
124
|
+
FastlaneCore::ConfigItem.new(key: :device_map, description: "Device name → screenshot variant, e.g. { \"iPhone 17 Pro Max\" => \"ios-phone\" }", type: Hash, optional: true),
|
|
125
|
+
FastlaneCore::ConfigItem.new(key: :key_map, description: "Screen name → screenshot key, e.g. { \"01Home\" => \"home\" }", type: Hash, optional: true),
|
|
126
|
+
FastlaneCore::ConfigItem.new(key: :include_framed, description: "Also import frameit's *_framed.png files (skipped by default)", type: Boolean, default_value: false),
|
|
127
|
+
FastlaneCore::ConfigItem.new(key: :save_mapping, description: "Store the effective mapping in project.yaml so later imports map the same way", type: Boolean, default_value: false),
|
|
128
|
+
FastlaneCore::ConfigItem.new(key: :dry_run, description: "Only show the plan; copy nothing", type: Boolean, default_value: false),
|
|
129
|
+
FastlaneCore::ConfigItem.new(key: :binary, env_name: "VITRINE_CLI", description: "Path of the vitrine binary", optional: true)
|
|
130
|
+
]
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def self.is_supported?(platform)
|
|
134
|
+
%i[ios mac android].include?(platform)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def self.example_code
|
|
138
|
+
[
|
|
139
|
+
'# Snapfile: output_directory("./fastlane/captures/screenshots")
|
|
140
|
+
capture_screenshots
|
|
141
|
+
vitrine_import(project: "store-screens") # reads ./fastlane/captures
|
|
142
|
+
vitrine_export(project: "store-screens")',
|
|
143
|
+
'vitrine_import(project: "store-screens",
|
|
144
|
+
device_map: { "iPhone 17 Pro Max" => "ios-phone" }, save_mapping: true)'
|
|
145
|
+
]
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def self.category
|
|
149
|
+
:screenshots
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require "fastlane/action"
|
|
2
|
+
require "fastlane/boolean"
|
|
3
|
+
require "fastlane_core/configuration/config_item"
|
|
4
|
+
require_relative "../helper/vitrine_helper"
|
|
5
|
+
|
|
6
|
+
module Fastlane
|
|
7
|
+
module Actions
|
|
8
|
+
# `vitrine validate`: fails the lane on errors (and on warnings with
|
|
9
|
+
# `strict`). Returns the report hash (ok, errors, warnings, findings).
|
|
10
|
+
class VitrineValidateAction < Action
|
|
11
|
+
def self.run(params)
|
|
12
|
+
binary = Helper::VitrineHelper.binary(params[:binary])
|
|
13
|
+
report, code = Helper::VitrineHelper.run_json(binary: binary, project: params[:project], args: cli_args(params), what: "validate")
|
|
14
|
+
Array(report["findings"]).each { |f| print_finding(f) }
|
|
15
|
+
summary = "#{report['errors']} error(s), #{report['warnings']} warning(s)"
|
|
16
|
+
UI.user_error!("Vitrine Studio validation failed: #{summary}") if code == 1
|
|
17
|
+
UI.success("Vitrine Studio validation: #{summary}")
|
|
18
|
+
report
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.cli_args(params)
|
|
22
|
+
args = %w[validate --format json]
|
|
23
|
+
args << "--strict" if params[:strict]
|
|
24
|
+
args << "--preview" if params[:preview]
|
|
25
|
+
Array(params[:targets]).each { |t| args.push("--target", t) }
|
|
26
|
+
Array(params[:languages]).each { |l| args.push("--lang", l) }
|
|
27
|
+
args
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.print_finding(finding)
|
|
31
|
+
scope = [finding["target"], finding["lang"] && "(#{finding['lang']})"].compact.join(" ")
|
|
32
|
+
line = "#{finding['code']} #{scope}: #{finding['message']}"
|
|
33
|
+
case finding["level"]
|
|
34
|
+
when "error" then UI.error(line)
|
|
35
|
+
when "warn" then UI.important(line)
|
|
36
|
+
else UI.verbose(line)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.description
|
|
41
|
+
"Validate a Vitrine Studio project (texts, screenshots, store rules)"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.authors
|
|
45
|
+
["Vitrine Studio"]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.return_value
|
|
49
|
+
"The validation report (Hash: ok, errors, warnings, infos, findings)"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.available_options
|
|
53
|
+
[
|
|
54
|
+
FastlaneCore::ConfigItem.new(key: :project, env_name: "VITRINE_PROJECT", description: "Project folder (with project.yaml)", default_value: "."),
|
|
55
|
+
FastlaneCore::ConfigItem.new(key: :strict, description: "Fail on warnings too", type: Boolean, default_value: false),
|
|
56
|
+
FastlaneCore::ConfigItem.new(key: :preview, description: "Missing screenshots are warnings", type: Boolean, default_value: false),
|
|
57
|
+
FastlaneCore::ConfigItem.new(key: :targets, description: "Only these targets", type: Array, optional: true),
|
|
58
|
+
FastlaneCore::ConfigItem.new(key: :languages, description: "Only these languages", type: Array, optional: true),
|
|
59
|
+
FastlaneCore::ConfigItem.new(key: :binary, env_name: "VITRINE_CLI", description: "Path of the vitrine binary", optional: true)
|
|
60
|
+
]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def self.is_supported?(platform)
|
|
64
|
+
%i[ios mac android].include?(platform)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def self.example_code
|
|
68
|
+
['vitrine_validate(project: "store-screens", strict: true)']
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def self.category
|
|
72
|
+
:screenshots
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
require "open3"
|
|
3
|
+
require "fastlane_core/ui/ui"
|
|
4
|
+
|
|
5
|
+
module Fastlane
|
|
6
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
|
|
7
|
+
|
|
8
|
+
module Helper
|
|
9
|
+
# Finds and runs the `vitrine` CLI. Everything the plugin does goes
|
|
10
|
+
# through the CLI; the plugin never reads or writes project files.
|
|
11
|
+
class VitrineHelper
|
|
12
|
+
# `binary` option → $VITRINE_CLI → `vitrine` on PATH.
|
|
13
|
+
def self.binary(explicit = nil)
|
|
14
|
+
candidate = explicit || ENV.fetch("VITRINE_CLI", nil)
|
|
15
|
+
return candidate if candidate && !candidate.empty?
|
|
16
|
+
|
|
17
|
+
exe = Gem.win_platform? ? "vitrine.exe" : "vitrine"
|
|
18
|
+
found = ENV.fetch("PATH", "").split(File::PATH_SEPARATOR).map { |d| File.join(d, exe) }.find { |p| File.executable?(p) }
|
|
19
|
+
return found if found
|
|
20
|
+
|
|
21
|
+
UI.user_error!("The `vitrine` command was not found. Install Vitrine Studio (app settings → Install command line tool), " \
|
|
22
|
+
"download the CLI archive from the GitHub release, or set the `binary` option / VITRINE_CLI.")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Runs `vitrine --project <project> <args…>`; returns [stdout, exit code].
|
|
26
|
+
# Exit codes: 0 ok, 1 project problems, 2 could not run.
|
|
27
|
+
def self.run(binary:, project:, args:, print_command: true)
|
|
28
|
+
cmd = [binary, "--project", project] + args
|
|
29
|
+
UI.command(cmd.join(" ")) if print_command
|
|
30
|
+
stdout, stderr, status = Open3.capture3(*cmd)
|
|
31
|
+
stderr.each_line { |l| UI.message(l.chomp) } unless stderr.empty?
|
|
32
|
+
[stdout, status.exitstatus]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Runs the CLI and parses its JSON report; exit code 2 (could not
|
|
36
|
+
# run) fails the lane. Returns [report, exit code].
|
|
37
|
+
def self.run_json(binary:, project:, args:, what:)
|
|
38
|
+
stdout, code = run(binary: binary, project: project, args: args)
|
|
39
|
+
UI.user_error!("vitrine #{what} could not run (exit #{code})") if code == 2
|
|
40
|
+
[parse_json(stdout, what), code]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.parse_json(text, what)
|
|
44
|
+
JSON.parse(text)
|
|
45
|
+
rescue JSON::ParserError
|
|
46
|
+
UI.user_error!("vitrine #{what} did not return JSON")
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require "fastlane/plugin/vitrine/version"
|
|
2
|
+
|
|
3
|
+
module Fastlane
|
|
4
|
+
module Vitrine
|
|
5
|
+
# Loads the actions and helpers (fastlane's plugin convention).
|
|
6
|
+
def self.all_classes
|
|
7
|
+
Dir[File.expand_path("**/{actions,helper}/*.rb", File.dirname(__FILE__))]
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Fastlane::Vitrine.all_classes.each do |current|
|
|
13
|
+
require current
|
|
14
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fastlane-plugin-vitrine
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Vitrine Studio
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
executables: []
|
|
13
|
+
extensions: []
|
|
14
|
+
extra_rdoc_files: []
|
|
15
|
+
files:
|
|
16
|
+
- LICENSE
|
|
17
|
+
- README.md
|
|
18
|
+
- lib/fastlane/plugin/vitrine.rb
|
|
19
|
+
- lib/fastlane/plugin/vitrine/actions/vitrine_export_action.rb
|
|
20
|
+
- lib/fastlane/plugin/vitrine/actions/vitrine_import_action.rb
|
|
21
|
+
- lib/fastlane/plugin/vitrine/actions/vitrine_validate_action.rb
|
|
22
|
+
- lib/fastlane/plugin/vitrine/helper/vitrine_helper.rb
|
|
23
|
+
- lib/fastlane/plugin/vitrine/version.rb
|
|
24
|
+
homepage: https://github.com/vitrinestudio-app/fastlane-plugin-vitrine
|
|
25
|
+
licenses:
|
|
26
|
+
- MIT
|
|
27
|
+
metadata:
|
|
28
|
+
homepage_uri: https://vitrinestudio.app
|
|
29
|
+
source_code_uri: https://github.com/vitrinestudio-app/fastlane-plugin-vitrine
|
|
30
|
+
documentation_uri: https://vitrinestudio.app/docs/
|
|
31
|
+
rubygems_mfa_required: 'true'
|
|
32
|
+
rdoc_options: []
|
|
33
|
+
require_paths:
|
|
34
|
+
- lib
|
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '3.1'
|
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
|
+
requirements:
|
|
42
|
+
- - ">="
|
|
43
|
+
- !ruby/object:Gem::Version
|
|
44
|
+
version: '0'
|
|
45
|
+
requirements: []
|
|
46
|
+
rubygems_version: 4.0.4
|
|
47
|
+
specification_version: 4
|
|
48
|
+
summary: Import, validate and export App Store / Play Store screenshots with Vitrine
|
|
49
|
+
Studio (replaces frameit)
|
|
50
|
+
test_files: []
|