fastlane-plugin-demo_mode 0.1.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: 3e57d9c8b39789345771eed0f7545fa5931f00de
4
+ data.tar.gz: 84a718d2e1206b9e866d2d24b6bef3ac24b07871
5
+ SHA512:
6
+ metadata.gz: fc998792dcda6a652ec62a25efb37559ab0709c381b80f93d27614e71d55f8a1bed2f071c3677a5e539d1393b4c206bf5dd56ed18ec90c4089ebcd0b9934b9dd
7
+ data.tar.gz: 0b78ffba98bcc9f6bc16bdd243b161ebd9314b32cc1ab7e108ebfa2067cc1ee9e78391beadc086c6fd49f2f25c23ac03e2ea75ae8e45ab81c21a4a4803eae43e
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Florian Rauscha <florian.rauscha@gmail.com>
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,72 @@
1
+ # Fastlane Plugin: demo_mode
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-demo_mode)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-demo_mode`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin demo_mode
11
+ ```
12
+
13
+ ## About demo_mode
14
+
15
+ This fastlane plugin sets your connected android devices to demo mode.
16
+
17
+ ![Comparison](img/comparison.png)
18
+
19
+ ## Example
20
+
21
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
+
23
+ You could run `demo_mode` before `screengrab` and deactivate it after `screengrab` has finished.
24
+
25
+ ```
26
+ lane :test do
27
+
28
+ demo_mode(
29
+ clock: "0800",
30
+ wifi: true,
31
+ wifi_level: 4,
32
+ mobile: true,
33
+ mobile_level: 4,
34
+ plugged: false,
35
+ battery: 100,
36
+ notifications: false)
37
+
38
+ screengrab
39
+
40
+ demo_mode(deactivate: true)
41
+
42
+ end
43
+ ```
44
+
45
+ ## Run tests for this plugin
46
+
47
+ To run both the tests, and code style validation, run
48
+
49
+ ```
50
+ rake
51
+ ```
52
+
53
+ To automatically fix many of the styling issues, use
54
+ ```
55
+ rubocop -a
56
+ ```
57
+
58
+ ## Issues and Feedback
59
+
60
+ For any other issues and feedback about this plugin, please submit it to this repository.
61
+
62
+ ## Troubleshooting
63
+
64
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
65
+
66
+ ## Using `fastlane` Plugins
67
+
68
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
69
+
70
+ ## About `fastlane`
71
+
72
+ `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,113 @@
1
+
2
+ module Fastlane
3
+ module Actions
4
+ class DemoModeAction < Action
5
+ def self.run(config)
6
+
7
+ command = "adb shell am broadcast -a com.android.systemui.demo -e command "
8
+ showWifi = config[:wifi] ? "show" : "hide"
9
+ showMobile = config[:mobile] ? "show" : "hide"
10
+
11
+ Actions.sh("adb shell settings put global sysui_demo_allowed 1")
12
+
13
+ if config[:deactivate]
14
+ Actions.sh(command + "exit")
15
+ else
16
+ Actions.sh(command + "enter")
17
+ Actions.sh(command + "clock -e hhmm #{config[:clock]}")
18
+ Actions.sh(command + "battery -e level #{config[:battery]}")
19
+ Actions.sh(command + "battery -e plugged #{config[:plugged]}")
20
+ Actions.sh(command + "network -e wifi #{showWifi} -e level #{config[:wifi_level]}")
21
+ Actions.sh(command + "network -e mobile #{showMobile} -e datatype none -e level #{config[:mobile_level]}")
22
+ Actions.sh(command + "notifications -e visible #{config[:notifications]}")
23
+ end
24
+
25
+ end
26
+
27
+ def self.description
28
+ "Sets your device to demo mode"
29
+ end
30
+
31
+ def self.authors
32
+ ["Florian Rauscha"]
33
+ end
34
+
35
+ def self.details
36
+ # Optional:
37
+ "Set your devices to demo mode before creating screenshots"
38
+ end
39
+
40
+ def self.available_options
41
+ [
42
+ FastlaneCore::ConfigItem.new(
43
+ key: :deactivate,
44
+ description: "Deactivate demo mode (default: false)",
45
+ optional: true,
46
+ is_string: false,
47
+ default_value: false
48
+ ),
49
+ FastlaneCore::ConfigItem.new(
50
+ key: :clock,
51
+ description: "Set clock (default: 0700)",
52
+ optional: true,
53
+ default_value: "0700",
54
+ type: String
55
+ ),
56
+ FastlaneCore::ConfigItem.new(
57
+ key: :wifi,
58
+ description: "Show wifi (default: true)",
59
+ optional: true,
60
+ is_string: false,
61
+ default_value: false
62
+ ),
63
+ FastlaneCore::ConfigItem.new(
64
+ key: :wifi_level,
65
+ description: "Set wifi level (default: 4)",
66
+ optional: true,
67
+ default_value: 4,
68
+ type: Integer
69
+ ),
70
+ FastlaneCore::ConfigItem.new(
71
+ key: :mobile,
72
+ description: "Show mobile (default: true)",
73
+ optional: true,
74
+ is_string: false,
75
+ default_value: false
76
+ ),
77
+ FastlaneCore::ConfigItem.new(
78
+ key: :mobile_level,
79
+ description: "Set mobile level (default: 4)",
80
+ optional: true,
81
+ default_value: 4,
82
+ type: Integer
83
+ ),
84
+ FastlaneCore::ConfigItem.new(
85
+ key: :battery,
86
+ description: "Set battery status (default: 100)",
87
+ optional: true,
88
+ default_value: 100,
89
+ type: Integer
90
+ ),
91
+ FastlaneCore::ConfigItem.new(
92
+ key: :plugged,
93
+ description: "Is the battery plugged (default: false)",
94
+ optional: true,
95
+ is_string: false,
96
+ default_value: false
97
+ ),
98
+ FastlaneCore::ConfigItem.new(
99
+ key: :notifications,
100
+ description: "Show notifications (default: false)",
101
+ optional: true,
102
+ is_string: false,
103
+ default_value: false
104
+ )
105
+ ]
106
+ end
107
+
108
+ def self.is_supported?(platform)
109
+ [:android].include?(platform)
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,12 @@
1
+ module Fastlane
2
+ module Helper
3
+ class DemoModeHelper
4
+ # class methods that you define here become available in your action
5
+ # as `Helper::DemoModeHelper.your_method`
6
+ #
7
+ def self.show_message
8
+ UI.message("Hello from the demo_mode plugin helper!")
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module DemoMode
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/demo_mode/version'
2
+
3
+ module Fastlane
4
+ module DemoMode
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::DemoMode.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-demo_mode
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Florian Rauscha
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-04-11 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: rake
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: rubocop
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: fastlane
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: 2.3.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: 2.3.0
97
+ description:
98
+ email:
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - LICENSE
104
+ - README.md
105
+ - lib/fastlane/plugin/demo_mode.rb
106
+ - lib/fastlane/plugin/demo_mode/actions/demo_mode_action.rb
107
+ - lib/fastlane/plugin/demo_mode/helper/demo_mode_helper.rb
108
+ - lib/fastlane/plugin/demo_mode/version.rb
109
+ homepage:
110
+ licenses:
111
+ - MIT
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - '>='
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.6.10
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: sets your connected android devices to demo mode
133
+ test_files: []