appium_thor 0.0.4
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/.gitignore +37 -0
- data/Gemfile +2 -0
- data/LICENSE +201 -0
- data/README.md +33 -0
- data/Thorfile +7 -0
- data/appium_thor.gemspec +22 -0
- data/lib/appium_thor/commands/commands.rb +70 -0
- data/lib/appium_thor/commands/init.rb +17 -0
- data/lib/appium_thor/config.rb +60 -0
- data/lib/appium_thor/docs.rb +90 -0
- data/lib/appium_thor/helpers.rb +179 -0
- data/lib/appium_thor/version.rb +6 -0
- data/lib/appium_thor.rb +17 -0
- data/release_notes.md +10 -0
- metadata +113 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: d682101a6cfd4a4967443f57f1cfb94928cbeb22
|
|
4
|
+
data.tar.gz: 4788966e9edd1c2dc21e60358bb0354a49baf07e
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 54f4ccf0888fb75511c6d2d4f39983643b54932d82f24eb227af3a15dbdba990687fab879b6ac553ecf2f7d2a6a5bda018881468490cc31b80640e5923896472
|
|
7
|
+
data.tar.gz: d8c804a24737dd3200aa8ffa8676b4b1bbcf30c657374c13f2ce0bdc95e0001f18d0ab5b94a521eb04a80d76bffbd9f232f7801e9e9cc1b8d10bcc90ca062f51
|
data/.gitignore
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
*.lock
|
|
3
|
+
.id*
|
|
4
|
+
*.gem
|
|
5
|
+
*.rbc
|
|
6
|
+
/.config
|
|
7
|
+
/coverage/
|
|
8
|
+
/InstalledFiles
|
|
9
|
+
/pkg/
|
|
10
|
+
/spec/reports/
|
|
11
|
+
/test/tmp/
|
|
12
|
+
/test/version_tmp/
|
|
13
|
+
/tmp/
|
|
14
|
+
|
|
15
|
+
## Specific to RubyMotion:
|
|
16
|
+
.dat*
|
|
17
|
+
.repl_history
|
|
18
|
+
build/
|
|
19
|
+
|
|
20
|
+
## Documentation cache and generated files:
|
|
21
|
+
/.yardoc/
|
|
22
|
+
/_yardoc/
|
|
23
|
+
/doc/
|
|
24
|
+
/rdoc/
|
|
25
|
+
|
|
26
|
+
## Environment normalisation:
|
|
27
|
+
/.bundle/
|
|
28
|
+
/lib/bundler/man/
|
|
29
|
+
|
|
30
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
31
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
32
|
+
# Gemfile.lock
|
|
33
|
+
# .ruby-version
|
|
34
|
+
# .ruby-gemset
|
|
35
|
+
|
|
36
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
37
|
+
.rvmrc
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# appium_thor
|
|
2
|
+
|
|
3
|
+
Appium Thor helpers for appium's gems (appium_lib, appium_capybara)
|
|
4
|
+
|
|
5
|
+
--
|
|
6
|
+
|
|
7
|
+
Example configuration
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
Appium::Thor::Config.set do
|
|
11
|
+
gem_name 'appium_lib'
|
|
12
|
+
github_name 'ruby_lib'
|
|
13
|
+
version_file 'path/to/version.rb'
|
|
14
|
+
end
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Available tasks
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
thor build # Build a new gem (same as gem task)
|
|
21
|
+
thor bump # Bump the z version number and update the date
|
|
22
|
+
thor bumpx # Bump the x version number, set y & z to zero, update the ...
|
|
23
|
+
thor bumpy # Bump the y version number, set z to zero, update the date
|
|
24
|
+
thor byte # Remove non-ascii bytes
|
|
25
|
+
thor dev # Install gems required for release task
|
|
26
|
+
thor docs # Update android and iOS docs
|
|
27
|
+
thor gem # Build a new gem
|
|
28
|
+
thor install # Install gem
|
|
29
|
+
thor notes # Update release notes
|
|
30
|
+
thor publish # Build and release a new gem to rubygems.org (same as rele...
|
|
31
|
+
thor release # Build and release a new gem to rubygems.org
|
|
32
|
+
thor uninstall # Uninstall gem
|
|
33
|
+
```
|
data/Thorfile
ADDED
data/appium_thor.gemspec
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require_relative 'lib/appium_thor/version'
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |s|
|
|
4
|
+
# 1.8.x is not supported
|
|
5
|
+
s.required_ruby_version = '>= 1.9.3'
|
|
6
|
+
|
|
7
|
+
s.name = 'appium_thor'
|
|
8
|
+
s.version = Appium::Thor::VERSION
|
|
9
|
+
s.date = Appium::Thor::DATE
|
|
10
|
+
s.license = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
11
|
+
s.description = s.summary = 'Thor tasks for Appium gems'
|
|
12
|
+
s.description += '.' # avoid identical warning
|
|
13
|
+
s.authors = s.email = ['code@bootstraponline.com']
|
|
14
|
+
s.homepage = 'https://github.com/appium/appium_thor'
|
|
15
|
+
s.require_paths = ['lib']
|
|
16
|
+
|
|
17
|
+
s.add_runtime_dependency 'redcarpet', '~> 3.1.2'
|
|
18
|
+
s.add_runtime_dependency 'posix-spawn', '~> 0.3', '>= 0.3.8'
|
|
19
|
+
s.add_runtime_dependency 'yard', '~> 0.8', '>= 0.8.7.4'
|
|
20
|
+
|
|
21
|
+
s.files = `git ls-files`.split "\n"
|
|
22
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require_relative 'init'
|
|
2
|
+
|
|
3
|
+
# Define Thor tasks in the top level Default namespace.
|
|
4
|
+
class Default < Thor
|
|
5
|
+
desc 'info', 'prints config info for this gem'
|
|
6
|
+
def info
|
|
7
|
+
puts " gem_name: #{gem_name}\n" +
|
|
8
|
+
" github_name: #{github_name}\n" +
|
|
9
|
+
"version_file: #{version_file}"
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
desc 'bumpx', 'Bump the x version number, set y & z to zero, update the date.'
|
|
13
|
+
def bumpx
|
|
14
|
+
_bump :x
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
desc 'bumpy', 'Bump the y version number, set z to zero, update the date.'
|
|
18
|
+
def bumpy
|
|
19
|
+
_bump :y
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
desc 'bump', 'Bump the z version number and update the date.'
|
|
23
|
+
def bump
|
|
24
|
+
_bump :z
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
desc 'publish', 'Build and release a new gem to rubygems.org'
|
|
28
|
+
def publish
|
|
29
|
+
_publish
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
desc 'release', 'Build and release a new gem to rubygems.org (same as publish)'
|
|
33
|
+
def release
|
|
34
|
+
_publish
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
desc 'build', 'Build a new gem'
|
|
38
|
+
def build
|
|
39
|
+
_build_gem
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# uninstall is a reserved task name
|
|
43
|
+
# https://github.com/erikhuda/thor/issues/428
|
|
44
|
+
desc 'gem_uninstall', 'Uninstall gem'
|
|
45
|
+
def gem_uninstall
|
|
46
|
+
_uninstall
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# install is a reserved task name
|
|
50
|
+
# https://github.com/erikhuda/thor/issues/428
|
|
51
|
+
desc 'gem_install', 'Install gem'
|
|
52
|
+
def gem_install
|
|
53
|
+
_install
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
desc 'docs', 'Update android and iOS docs'
|
|
57
|
+
def docs
|
|
58
|
+
docks_block.call if docs_block
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
desc 'notes', 'Update release notes'
|
|
62
|
+
def notes
|
|
63
|
+
update_release_notes
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
desc 'byte', 'Remove non-ascii bytes'
|
|
67
|
+
def byte
|
|
68
|
+
remove_non_ascii_from_cwd
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Define Thor tasks in the top level Default namespace.
|
|
2
|
+
class Default < Thor
|
|
3
|
+
extend Forwardable
|
|
4
|
+
include Appium::Thor::Helpers
|
|
5
|
+
include Appium::Thor::Docs
|
|
6
|
+
|
|
7
|
+
# For each possible option method, delegate calls to the config instance
|
|
8
|
+
no_commands do
|
|
9
|
+
def_delegators(:@cfg, *Appium::Thor::Config.options)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def initialize(args = [], options = {}, config = {})
|
|
13
|
+
super
|
|
14
|
+
# Aquire reference to the config defined in the Thorfile
|
|
15
|
+
@cfg = Appium::Thor::Config.instance
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module Appium
|
|
2
|
+
module Thor
|
|
3
|
+
class Config
|
|
4
|
+
include Singleton
|
|
5
|
+
|
|
6
|
+
# Returns true if all options are truthy
|
|
7
|
+
def validate
|
|
8
|
+
raise 'Must set gem_name, github_name, version_file' unless @gem_name && @github_name && @version_file
|
|
9
|
+
raise "version file doesn't exist #{@version_file}" unless File.exist?(@version_file)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Returns option value if it's set otherwise
|
|
13
|
+
# sets the option value to string
|
|
14
|
+
def gem_name string=nil
|
|
15
|
+
return @gem_name if @gem_name
|
|
16
|
+
@gem_name = string
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns option value if it's set otherwise
|
|
20
|
+
# sets the option value to string
|
|
21
|
+
def github_name string=nil
|
|
22
|
+
return @github_name if @github_name
|
|
23
|
+
@github_name = string
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Returns option value if it's set otherwise
|
|
27
|
+
# sets the option value to string
|
|
28
|
+
def version_file string=nil
|
|
29
|
+
return @version_file if @version_file
|
|
30
|
+
@version_file = string
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# block of code to execute that contains documentation
|
|
34
|
+
# generation logic
|
|
35
|
+
def docs_block &block
|
|
36
|
+
return @docs_block if @docs_block
|
|
37
|
+
@docs_block = block
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# all config.rb options as a symbol array
|
|
41
|
+
def self.options
|
|
42
|
+
%w[gem_name github_name version_file docs_block].map(&:to_sym)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Enables setting config in the Thorfile
|
|
46
|
+
#
|
|
47
|
+
# Appium::Thor::Config.set do
|
|
48
|
+
# gem_name 'appium_thor'
|
|
49
|
+
# github_name 'appium_thor'
|
|
50
|
+
# version_file 'path/to/version.rb'
|
|
51
|
+
# end
|
|
52
|
+
def self.set &block
|
|
53
|
+
config = self.instance
|
|
54
|
+
config.instance_eval &block
|
|
55
|
+
config.validate
|
|
56
|
+
config
|
|
57
|
+
end
|
|
58
|
+
end # module Config
|
|
59
|
+
end # module Thor
|
|
60
|
+
end # module Appium
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
module Appium
|
|
2
|
+
module Thor
|
|
3
|
+
module Docs
|
|
4
|
+
def space amount
|
|
5
|
+
' ' * amount
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def last_sha
|
|
9
|
+
`git rev-parse --verify HEAD`.strip
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def mobj_to_md obj
|
|
13
|
+
out = ''
|
|
14
|
+
# skip objects without method signatures
|
|
15
|
+
sig = obj.signature
|
|
16
|
+
return out unless sig
|
|
17
|
+
|
|
18
|
+
# skip class vars
|
|
19
|
+
if sig.start_with?('@@') ||
|
|
20
|
+
# skip methods marked private
|
|
21
|
+
obj.tag('private') ||
|
|
22
|
+
# skip date and version from version.rb
|
|
23
|
+
obj.name.match(/DATE|VERSION/)
|
|
24
|
+
return out
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
method_path = obj.file.split('/lib/').last
|
|
28
|
+
os = method_path.downcase.match /ios|android/
|
|
29
|
+
out += "##### [#{obj.name.to_s}](https://github.com/appium/ruby_lib/blob/#{last_sha}/lib/#{method_path}#L#{obj.line}) #{os}\n\n"
|
|
30
|
+
out += "> #{obj.signature}\n\n"
|
|
31
|
+
out += "#{obj.docstring}\n\n"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
indent = space 5
|
|
35
|
+
params = obj.tags.select { |tag| tag.tag_name == 'param' }
|
|
36
|
+
if !params.empty?
|
|
37
|
+
out += "__Parameters:__\n\n"
|
|
38
|
+
params.each do |param|
|
|
39
|
+
out += indent + "[#{param.types.join ', '}] "
|
|
40
|
+
out += "#{param.name} - #{param.text}\n\n"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
ret = obj.tag 'return'
|
|
45
|
+
if ret
|
|
46
|
+
out += "__Returns:__\n\n"
|
|
47
|
+
out += indent + "[#{ret.types.join ', '}] #{ret.text}\n\n"
|
|
48
|
+
end
|
|
49
|
+
out += "--\n\n"
|
|
50
|
+
|
|
51
|
+
out
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def run out_file, globs
|
|
55
|
+
YARD::Registry.clear
|
|
56
|
+
puts "Globbing: #{globs}"
|
|
57
|
+
puts "Writing: #{out_file}"
|
|
58
|
+
YARD::Parser::SourceParser.parse globs
|
|
59
|
+
File.open(out_file, 'w') do |file|
|
|
60
|
+
entries = YARD::Registry.entries
|
|
61
|
+
entries_length = entries.length
|
|
62
|
+
puts "Processing: #{entries_length} entries"
|
|
63
|
+
raise 'No entries to process' if entries_length <= 0
|
|
64
|
+
YARD::Registry.entries.each do |entry|
|
|
65
|
+
file.write mobj_to_md entry
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
raise 'Empty file generated' if File.size(out_file) <= 0
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def globs paths
|
|
73
|
+
# Convert single string to array for map
|
|
74
|
+
paths = [paths] unless paths.kind_of? Array
|
|
75
|
+
# Adjust path based on system
|
|
76
|
+
paths.map! { |path| "#{Dir.pwd}#{path}" }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
=begin
|
|
80
|
+
common_globs = '/lib/appium_lib/*.rb', '/lib/appium_lib/device/*.rb', '/lib/appium_lib/common/**/*.rb'
|
|
81
|
+
android_globs = common_globs + ['/lib/appium_lib/android/**/*.rb']
|
|
82
|
+
ios_globs = common_globs + ['/lib/appium_lib/ios/**/*.rb']
|
|
83
|
+
|
|
84
|
+
run 'docs/android_docs.md', globs(android_globs)
|
|
85
|
+
|
|
86
|
+
run 'docs/ios_docs.md', globs(ios_globs)
|
|
87
|
+
=end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
module Appium
|
|
2
|
+
module Thor
|
|
3
|
+
module Helpers
|
|
4
|
+
def _build_gem
|
|
5
|
+
`chmod 0600 ~/.gem/credentials`
|
|
6
|
+
sh "gem build #{gem_name}.gemspec"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def tag_exists tag_name
|
|
10
|
+
cmd = %Q(git branch -a --contains "#{tag_name}")
|
|
11
|
+
POSIX::Spawn::Child.new(cmd).out.include? '* master'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def sh command
|
|
15
|
+
process = POSIX::Spawn::Child.new command
|
|
16
|
+
|
|
17
|
+
unless process.success?
|
|
18
|
+
raise "Command #{command} failed. out: #{process.out}\nerr: #{process.err}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
out = process.out
|
|
22
|
+
out ? out.strip : out
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def version_rgx
|
|
26
|
+
/\s*VERSION\s*=\s*'([^']+)'/m
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def version
|
|
30
|
+
@version ||= File.read(version_file).match(version_rgx)[1]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def _bump value
|
|
34
|
+
data = File.read version_file
|
|
35
|
+
|
|
36
|
+
v_line = data.match version_rgx
|
|
37
|
+
d_line = data.match /\s*DATE\s*=\s*'([^']+)'/m
|
|
38
|
+
|
|
39
|
+
old_v = v_line[0]
|
|
40
|
+
old_d = d_line[0]
|
|
41
|
+
|
|
42
|
+
old_num = v_line[1]
|
|
43
|
+
new_num = old_num.split('.')
|
|
44
|
+
new_num[-1] = new_num[-1].to_i + 1
|
|
45
|
+
|
|
46
|
+
if value == :y
|
|
47
|
+
new_num[-1] = 0 # x.y.Z -> x.y.0
|
|
48
|
+
new_num[-2] = new_num[-2].to_i + 1 # x.Y -> x.Y+1
|
|
49
|
+
elsif value == :x
|
|
50
|
+
new_num[-1] = 0 # x.y.Z -> x.y.0
|
|
51
|
+
new_num[-2] = 0 # x.Y.z -> x.0.z
|
|
52
|
+
new_num[-3] = new_num[-3].to_i + 1
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
new_num = new_num.join '.'
|
|
56
|
+
|
|
57
|
+
new_v = old_v.sub old_num, new_num
|
|
58
|
+
puts "#{old_num} -> #{new_num}"
|
|
59
|
+
|
|
60
|
+
old_date = d_line[1]
|
|
61
|
+
new_date = Date.today.to_s
|
|
62
|
+
new_d = old_d.sub old_date, new_date
|
|
63
|
+
puts "#{old_date} -> #{new_date}" unless old_date == new_date
|
|
64
|
+
|
|
65
|
+
data.sub! old_v, new_v
|
|
66
|
+
data.sub! old_d, new_d
|
|
67
|
+
|
|
68
|
+
File.write version_file, data
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def update_release_notes
|
|
72
|
+
tag_sort = ->(tag1, tag2) do
|
|
73
|
+
tag1_numbers = tag1.match(/\.?v(\d+\.\d+\.\d+)$/)[1].split('.').map! { |n| n.to_i }
|
|
74
|
+
tag2_numbers = tag2.match(/\.?v(\d+\.\d+\.\d+)$/)[1].split('.').map! { |n| n.to_i }
|
|
75
|
+
tag1_numbers <=> tag2_numbers
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
tags = `git tag`.split "\n"
|
|
79
|
+
tags.sort! &tag_sort
|
|
80
|
+
pairs = []
|
|
81
|
+
tags.each_index { |a| pairs.push tags[a] + '...' + tags[a+1] unless tags[a+1].nil? }
|
|
82
|
+
|
|
83
|
+
notes = ''
|
|
84
|
+
|
|
85
|
+
dates = `git log --tags --simplify-by-decoration --pretty="format:%d %ad" --date=short`.split "\n"
|
|
86
|
+
|
|
87
|
+
pairs.sort! &tag_sort
|
|
88
|
+
pairs.reverse! # pairs are in reverse order.
|
|
89
|
+
|
|
90
|
+
tag_date = []
|
|
91
|
+
pairs.each do |pair|
|
|
92
|
+
tag = pair.split('...').last
|
|
93
|
+
dates.each do |line|
|
|
94
|
+
# regular tag, or tag on master.
|
|
95
|
+
if line.include?(tag + ')') || line.include?(tag + ',')
|
|
96
|
+
tag_date.push tag + ' ' + line.match(/\d{4}-\d{2}-\d{2}/)[0]
|
|
97
|
+
break
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
pairs.each_index do |a|
|
|
103
|
+
data =`git log --pretty=oneline #{pairs[a]}`
|
|
104
|
+
new_data = ''
|
|
105
|
+
data.split("\n").each do |line|
|
|
106
|
+
hex = line.match(/[a-zA-Z0-9]+/)[0]
|
|
107
|
+
# use first 7 chars to match GitHub
|
|
108
|
+
comment = line.gsub(hex, '').strip
|
|
109
|
+
next if comment == 'Update release notes'
|
|
110
|
+
new_data += "- [#{hex[0...7]}](https://github.com/appium/#{github_name}/commit/#{hex}) #{comment}\n"
|
|
111
|
+
end
|
|
112
|
+
data = new_data + "\n"
|
|
113
|
+
|
|
114
|
+
# last pair is the released version.
|
|
115
|
+
notes += "#### #{tag_date[a]}\n\n" + data + "\n"
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
File.open('release_notes.md', 'w') { |f| f.write notes.to_s.strip }
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
def _install
|
|
122
|
+
_build_gem
|
|
123
|
+
_uninstall
|
|
124
|
+
sh "gem install --no-rdoc --no-ri --local #{gem_name}-#{version}.gem"
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def _uninstall
|
|
128
|
+
cmd = "gem uninstall -aIx #{gem_name}"
|
|
129
|
+
# rescue on gem not installed error.
|
|
130
|
+
begin
|
|
131
|
+
sh "#{cmd}"
|
|
132
|
+
rescue
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def _publish
|
|
137
|
+
unless `git branch`.include? '* master'
|
|
138
|
+
puts 'Master branch required to release.'
|
|
139
|
+
exit!
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# ensure gems are installed
|
|
143
|
+
`bundle update`
|
|
144
|
+
|
|
145
|
+
# Commit then pull before pushing.
|
|
146
|
+
tag_name = "v#{version}"
|
|
147
|
+
raise 'Tag already exists!' if tag_exists tag_name
|
|
148
|
+
|
|
149
|
+
# Commit then pull before pushing.
|
|
150
|
+
sh "git commit --allow-empty -am 'Release #{version}'"
|
|
151
|
+
sh 'git pull'
|
|
152
|
+
sh "git tag #{tag_name}"
|
|
153
|
+
# update notes now that there's a new tag
|
|
154
|
+
notes
|
|
155
|
+
docs
|
|
156
|
+
sh "git commit --allow-empty -am 'Update release notes'"
|
|
157
|
+
sh 'git push origin master'
|
|
158
|
+
sh "git push origin #{tag_name}"
|
|
159
|
+
_build_gem
|
|
160
|
+
sh "gem push #{gem_name}-#{version}.gem"
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Remove non-ascii bytes from all rb files in the current working directory.
|
|
164
|
+
# Used to purge byte order marks that mess up YARD
|
|
165
|
+
def remove_non_ascii_from_cwd
|
|
166
|
+
glob = File.expand_path File.join(Dir.pwd, '**', '*.rb')
|
|
167
|
+
Dir.glob(glob) do |path|
|
|
168
|
+
path = File.expand_path path
|
|
169
|
+
next if File.directory? path
|
|
170
|
+
|
|
171
|
+
data = File.read path
|
|
172
|
+
data = data.encode('US-ASCII', invalid: :replace, undef: :replace, replace: '')
|
|
173
|
+
data = data.encode('UTF-8')
|
|
174
|
+
File.open(path, 'w') { |f| f.write data }
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end # module Helpers
|
|
178
|
+
end # module Thor
|
|
179
|
+
end # module Appium
|
data/lib/appium_thor.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# stdlib
|
|
2
|
+
|
|
3
|
+
require 'forwardable' # commands.rb
|
|
4
|
+
require 'singleton' # config.rb
|
|
5
|
+
|
|
6
|
+
# gems
|
|
7
|
+
require 'rubygems'
|
|
8
|
+
require 'yard'
|
|
9
|
+
require 'posix-spawn'
|
|
10
|
+
require 'date'
|
|
11
|
+
|
|
12
|
+
require_relative 'appium_thor/docs'
|
|
13
|
+
require_relative 'appium_thor/helpers'
|
|
14
|
+
require_relative 'appium_thor/version'
|
|
15
|
+
|
|
16
|
+
require_relative 'appium_thor/config'
|
|
17
|
+
require_relative 'appium_thor/commands/commands'
|
data/release_notes.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#### v0.0.4 2014-07-31
|
|
2
|
+
|
|
3
|
+
- [b0f4217](https://github.com/appium/appium_thor/commit/b0f42170c7b7df3befa9651647ea8c65ecd86710) Release 0.0.4
|
|
4
|
+
- [68f6e7b](https://github.com/appium/appium_thor/commit/68f6e7b4d641017eee1123fbcc9872940adf37b8) Fix update_release_notes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
#### v0.0.3 2014-07-31
|
|
8
|
+
|
|
9
|
+
- [71b4199](https://github.com/appium/appium_thor/commit/71b419998ce835cf1e722563cd9ba99d89da6fb0) Release 0.0.3
|
|
10
|
+
- [9904612](https://github.com/appium/appium_thor/commit/99046121f53f42bebb0cea4971f89b91c358da22) Testing release notes
|
metadata
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: appium_thor
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.4
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- code@bootstraponline.com
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-07-31 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: redcarpet
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 3.1.2
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 3.1.2
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: posix-spawn
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0.3'
|
|
34
|
+
- - ">="
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: 0.3.8
|
|
37
|
+
type: :runtime
|
|
38
|
+
prerelease: false
|
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
40
|
+
requirements:
|
|
41
|
+
- - "~>"
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '0.3'
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 0.3.8
|
|
47
|
+
- !ruby/object:Gem::Dependency
|
|
48
|
+
name: yard
|
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0.8'
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: 0.8.7.4
|
|
57
|
+
type: :runtime
|
|
58
|
+
prerelease: false
|
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
60
|
+
requirements:
|
|
61
|
+
- - "~>"
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: '0.8'
|
|
64
|
+
- - ">="
|
|
65
|
+
- !ruby/object:Gem::Version
|
|
66
|
+
version: 0.8.7.4
|
|
67
|
+
description: Thor tasks for Appium gems.
|
|
68
|
+
email:
|
|
69
|
+
- code@bootstraponline.com
|
|
70
|
+
executables: []
|
|
71
|
+
extensions: []
|
|
72
|
+
extra_rdoc_files: []
|
|
73
|
+
files:
|
|
74
|
+
- ".gitignore"
|
|
75
|
+
- Gemfile
|
|
76
|
+
- LICENSE
|
|
77
|
+
- README.md
|
|
78
|
+
- Thorfile
|
|
79
|
+
- appium_thor.gemspec
|
|
80
|
+
- lib/appium_thor.rb
|
|
81
|
+
- lib/appium_thor/commands/commands.rb
|
|
82
|
+
- lib/appium_thor/commands/init.rb
|
|
83
|
+
- lib/appium_thor/config.rb
|
|
84
|
+
- lib/appium_thor/docs.rb
|
|
85
|
+
- lib/appium_thor/helpers.rb
|
|
86
|
+
- lib/appium_thor/version.rb
|
|
87
|
+
- release_notes.md
|
|
88
|
+
homepage: https://github.com/appium/appium_thor
|
|
89
|
+
licenses:
|
|
90
|
+
- http://www.apache.org/licenses/LICENSE-2.0.txt
|
|
91
|
+
metadata: {}
|
|
92
|
+
post_install_message:
|
|
93
|
+
rdoc_options: []
|
|
94
|
+
require_paths:
|
|
95
|
+
- lib
|
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
|
+
requirements:
|
|
98
|
+
- - ">="
|
|
99
|
+
- !ruby/object:Gem::Version
|
|
100
|
+
version: 1.9.3
|
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
|
+
requirements:
|
|
103
|
+
- - ">="
|
|
104
|
+
- !ruby/object:Gem::Version
|
|
105
|
+
version: '0'
|
|
106
|
+
requirements: []
|
|
107
|
+
rubyforge_project:
|
|
108
|
+
rubygems_version: 2.2.2
|
|
109
|
+
signing_key:
|
|
110
|
+
specification_version: 4
|
|
111
|
+
summary: Thor tasks for Appium gems
|
|
112
|
+
test_files: []
|
|
113
|
+
has_rdoc:
|