fastlane-plugin-device_image_selector 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 53cf59eb78d2cd990b0080bde16e8a707a2e3e2b
4
+ data.tar.gz: c006bc660ba58116b3869647d2609d4ceda1898f
5
+ SHA512:
6
+ metadata.gz: d22f2d39eeaf4f1ff47c42fed1a5a9ea5a34a6a72ba159664017b77ea1cf2e3881cf301382e363f1158dc7fc80521d25f5bbb9314dfc6253d4908e1c16db0029
7
+ data.tar.gz: a9f377739228277b7e6674de81bcec1e0334a538d38aec04b7f37470399dd4dd736bab669bfe0569b961217818d840f96bef4ce57b6be689d95f1988957468c9
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Mario Zimmermann <mail@zisoft.de>
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,64 @@
1
+ # device_image_selector plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-device_image_selector)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-device_image_selector`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin device_image_selector
11
+ ```
12
+
13
+ ## About device_image_selector
14
+
15
+ After creating hundrets of screenshots for the AppStore you probably want to use only a few of them with device frames, i.e. to put them on your website. Instead of running 'frameit' on the whole screenshots directory this plugin selects only the screenshots you want to use and puts them into the output directory. Running 'frameit' on this directory produces the device images. After that, the screenshot files can automatically be deleted by running the cleanup action. So the Fastfile may look like this:
16
+
17
+
18
+ desc "Generate device images"
19
+ lane :device_images do
20
+ device_image_selector(name_prefixes: ["iPhone X","iPad Pro (12.9-inch)"])
21
+ frame_screenshots(path: "fastlane/screenshots/device_images")
22
+ device_image_selector_cleanup
23
+ end
24
+
25
+ ## Actions
26
+ ### device_image_selector
27
+ Selects only the screenshot files which matches the specified name prefixes and copys them into the output directory.
28
+
29
+ # iPhone X screenshots only
30
+ device_image_selector(name_prefixes: "iPhone X")
31
+
32
+ # iPhone 8 Plus and iPad Pro (9.7-inch) screenshots
33
+ device_image_selector(name_prefixes: ["iPhone 8 Plus","iPad Pro (9.7-inch)"])
34
+
35
+ # specify the screenshots directory (default: ./fastlane/screenshots)
36
+ device_image_selector(screenshot_directory: "path/to/screenshots", name_prefixes: "iPhone X")
37
+
38
+ # specify the output directory (default: ./fastlane/screenshots/device_images)
39
+ device_image_selector(output_directory: "~/device_images", name_prefixes: "iPhone X")
40
+
41
+
42
+
43
+ ### device_image_selector_cleanup
44
+ Cleans up the output directory by deleting the previously selected screenshot files. This leaves only the generated device images in the output directory.
45
+
46
+ # cleanup after the device images are created
47
+ device_image_selector_cleanup
48
+
49
+
50
+ ## Issues and Feedback
51
+
52
+ For any other issues and feedback about this plugin, please submit it to this repository.
53
+
54
+ ## Troubleshooting
55
+
56
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
57
+
58
+ ## Using _fastlane_ Plugins
59
+
60
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
61
+
62
+ ## About _fastlane_
63
+
64
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/device_image_selector/version'
2
+
3
+ module Fastlane
4
+ module DeviceImageSelector
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::DeviceImageSelector.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,44 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/device_image_selector_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class DeviceImageSelectorCleanupAction < Action
7
+ def self.run(params)
8
+ UI.message("Cleaning up device images...")
9
+
10
+ Actions.lane_context[SharedValues::DEVICE_IMAGE_SELECTOR_FILES].split(",").each do |file|
11
+ File.delete(file)
12
+ end
13
+ end
14
+
15
+ def self.description
16
+ "Cleanup screenshot files after frameit"
17
+ end
18
+
19
+ def self.authors
20
+ ["Mario Zimmermann"]
21
+ end
22
+
23
+ def self.return_value
24
+ # If your method provides a return value, you can describe here what it does
25
+ end
26
+
27
+ def self.details
28
+ # Optional:
29
+ "Deletes the screenshot files in the output directory which were previously selected and processed by frameit"
30
+ end
31
+
32
+ def self.available_options
33
+ end
34
+
35
+ def self.is_supported?(platform)
36
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
37
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
38
+ #
39
+ # [:ios, :mac, :android].include?(platform)
40
+ true
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,102 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/device_image_selector_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ module SharedValues
7
+ DEVICE_IMAGE_SELECTOR_FILES = :DEVICE_IMAGE_SELECTOR_FILES
8
+ end
9
+
10
+ class DeviceImageSelectorAction < Action
11
+ def self.run(params)
12
+ Dir.mkdir(params[:output_directory]) unless Dir.exists?(params[:output_directory])
13
+
14
+ files = []
15
+
16
+ Dir.entries(params[:screenshot_directory]).each do |entry|
17
+ next if entry == "." || entry == ".."
18
+ input_dir = params[:screenshot_directory] + "/#{entry}"
19
+ next unless File.directory?(input_dir)
20
+ next if input_dir == params[:output_directory]
21
+
22
+ output_dir = "#{params[:output_directory]}/#{entry}"
23
+ Dir.mkdir(output_dir) unless Dir.exists?(output_dir)
24
+
25
+ Dir.entries(input_dir).each do |filename|
26
+ next if filename == "." || filename == ".."
27
+
28
+ use_this = false
29
+ params[:name_prefixes].each do |name_prefix|
30
+ if filename.start_with?(name_prefix)
31
+ use_this = true
32
+ break
33
+ end
34
+ end
35
+ next unless use_this
36
+
37
+ FileUtils.copy("#{input_dir}/#{filename}","#{output_dir}/#{filename}")
38
+
39
+ files << "#{output_dir}/#{filename}"
40
+ end
41
+ end
42
+
43
+ Actions.lane_context[SharedValues::DEVICE_IMAGE_SELECTOR_FILES] = files.join(",")
44
+ end
45
+
46
+ def self.description
47
+ "Selects screenshots with specified names for processing with frameit"
48
+ end
49
+
50
+ def self.authors
51
+ ["Mario Zimmermann"]
52
+ end
53
+
54
+ def self.return_value
55
+ # If your method provides a return value, you can describe here what it does
56
+ end
57
+
58
+ def self.output
59
+ [
60
+ ["DEVICE_IMAGE_SELECTOR_FILES", "Comma separated list of selected screenshot files"]
61
+ ]
62
+ end
63
+
64
+ def self.details
65
+ # Optional:
66
+ "Takes the device screenshots which matches the specified names and puts them in the output directory for frameit to process. The screenshot files can then be cleaned up after the device images are created."
67
+ end
68
+
69
+ def self.available_options
70
+ [
71
+ FastlaneCore::ConfigItem.new(key: :screenshot_directory,
72
+ env_name: "DEVICE_IMAGE_SELECTOR_SCREENSHOT_DIRECTORY",
73
+ description: "Directory where the screenshots are located",
74
+ optional: false,
75
+ default_value: "./fastlane/screenshots",
76
+ type: String),
77
+
78
+ FastlaneCore::ConfigItem.new(key: :output_directory,
79
+ env_name: "DEVICE_IMAGE_SELECTOR_OUTPUT_DIRECTORY",
80
+ description: "Directory where to put the selected screenshots",
81
+ optional: false,
82
+ default_value: "./fastlane/screenshots/device_images",
83
+ type: String),
84
+
85
+ FastlaneCore::ConfigItem.new(key: :name_prefixes,
86
+ env_name: "DEVICE_IMAGE_SELECTOR_NAME_PREFIXES",
87
+ description: "Array of filename prefixes to select",
88
+ optional: true,
89
+ type: Array)
90
+ ]
91
+ end
92
+
93
+ def self.is_supported?(platform)
94
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
95
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
96
+ #
97
+ # [:ios, :mac, :android].include?(platform)
98
+ true
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane_core/ui/ui'
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+
6
+ module Helper
7
+ class DeviceImageSelectorHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::DeviceImageSelectorHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the device_image_selector plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module DeviceImageSelector
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-device_image_selector
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Mario Zimmermann
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-02-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec_junit_formatter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.49.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.49.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-require_tools
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: fastlane
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 2.81.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.81.0
139
+ description:
140
+ email: mail@zisoft.de
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - LICENSE
146
+ - README.md
147
+ - lib/fastlane/plugin/device_image_selector.rb
148
+ - lib/fastlane/plugin/device_image_selector/actions/cleanup.rb
149
+ - lib/fastlane/plugin/device_image_selector/actions/select.rb
150
+ - lib/fastlane/plugin/device_image_selector/helper/device_image_selector_helper.rb
151
+ - lib/fastlane/plugin/device_image_selector/version.rb
152
+ homepage: https://github.com/zisoft/fastlane-plugin-device_image_selector
153
+ licenses:
154
+ - MIT
155
+ metadata: {}
156
+ post_install_message:
157
+ rdoc_options: []
158
+ require_paths:
159
+ - lib
160
+ required_ruby_version: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: '0'
165
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ requirements: []
171
+ rubyforge_project:
172
+ rubygems_version: 2.5.2
173
+ signing_key:
174
+ specification_version: 4
175
+ summary: Takes the screenshots from devices which matches the specified names and
176
+ puts them in a new directory for frameit to process. The screenshot files can then
177
+ be cleaned up after the device images are created.
178
+ test_files: []