SurfCustomCalabash 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile +2 -1
- data/README.md +8 -3
- data/bin/SurfCustomCalabash +10 -1
- data/bin/files_for_update +7 -0
- data/bin/surf-calabash-gen.rb +4 -2
- data/bin/surf-calabash-helpers.rb +2 -0
- data/bin/update_files.rb +202 -0
- data/lib/SurfCustomCalabash/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 642a2175dd5be63af09865c3e401256600b92e24e9d81b7acebb6a3431356c5f
|
4
|
+
data.tar.gz: cb0842d72f0a04b435f422b928869cbaa84aca0a14db4ea028e4c07d88b9bfb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adfc4a77d09b27c5b2abd6094a49981763d9cd4dae2c033fd6602936d9ba3953e260424665511ed61b1b4dd152674c898ebea1bfb262ee45583797c39bfab31c
|
7
|
+
data.tar.gz: 35c47618c702ccc856c0bc5dcfe8e5a8ffaaf259609dd6e8ff758dde008f33a116814c91bab2ea2e6db8dc6fdd0bcf8018d0f5d34d111844f810e557e8e257d6
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## v1.1.0 - 08.10.2020
|
5
|
+
### Added
|
6
|
+
- File **files_for_update** with a list of files required for updating in your project with autotests. For update your project use **SurfCustomCalabash update**
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
- In command **SurfCustomCalabash gen** you can immediately enter the name of the folder with your tests
|
10
|
+
|
4
11
|
|
5
12
|
## v1.0.0 - 28.08.2020
|
6
13
|
### Added
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -34,8 +34,7 @@ Install gem in your exist project, add in your ios or android ruby files.
|
|
34
34
|
**CommonMethods** contains different methods (taps, swipes, waits and other) for both platforms.
|
35
35
|
|
36
36
|
### Create new project
|
37
|
-
You should move to the directory which would contains folder with your tests
|
38
|
-
surf-calabash will create it by itself with the name **Change_it_to_your_own_project_name**:
|
37
|
+
You should move to the directory which would contains folder with your tests and execute command and then enter folder name
|
39
38
|
|
40
39
|
$ SurfCustomCalabash gen
|
41
40
|
|
@@ -92,4 +91,10 @@ Also it shows some integration with Xray Jira plugin.
|
|
92
91
|
|
93
92
|
Shell script for useful launch all helpful scripts of folder above.
|
94
93
|
|
95
|
-
|
94
|
+
### Update infrastructure files
|
95
|
+
|
96
|
+
To check the relevance of the infrastructure files of your project with autotests, execute command:
|
97
|
+
|
98
|
+
$ SurfCustomCalabash update
|
99
|
+
|
100
|
+
If your project has files that are not up-to-date, you will be prompted to update them all or only those you need.
|
data/bin/SurfCustomCalabash
CHANGED
@@ -12,9 +12,10 @@ end
|
|
12
12
|
|
13
13
|
require File.join(File.dirname(__FILE__), "surf-calabash-helpers")
|
14
14
|
|
15
|
-
@hierarchy = File.join(FileUtils.pwd, "
|
15
|
+
@hierarchy = File.join(FileUtils.pwd, "features")
|
16
16
|
@source_dir = File.join(File.dirname(__FILE__), '..', 'sources')
|
17
17
|
|
18
|
+
|
18
19
|
if ARGV.length == 0
|
19
20
|
print_usage
|
20
21
|
else
|
@@ -47,6 +48,14 @@ else
|
|
47
48
|
when 'version'
|
48
49
|
require_relative '../lib/SurfCustomCalabash/version'
|
49
50
|
Kernel.puts SurfCustomCalabash::VERSION
|
51
|
+
when 'update'
|
52
|
+
require File.join(File.dirname(__FILE__), "update_files")
|
53
|
+
if File.exists?(@hierarchy)
|
54
|
+
show_files_for_update
|
55
|
+
else
|
56
|
+
Kernel.puts("В текущей папке нет файлов автотестов, перейдите в нужную папку или создайте новый проект используя команду:")
|
57
|
+
Kernel.puts("SurfCustomCalabash gen")
|
58
|
+
end
|
50
59
|
else
|
51
60
|
Kernel.puts "Invalid command '#{cmd}'"
|
52
61
|
print_usage
|
data/bin/surf-calabash-gen.rb
CHANGED
@@ -5,12 +5,14 @@ def surf_gen
|
|
5
5
|
end
|
6
6
|
msg("Question") do
|
7
7
|
Kernel.puts "I'm about to create a subdirectory called sources."
|
8
|
-
Kernel.puts "Please change name of it to name of your own project."
|
9
8
|
Kernel.puts "Please hit return to confirm that's what you want."
|
10
9
|
end
|
11
10
|
exit 2 unless STDIN.gets.chomp == ''
|
12
11
|
|
13
|
-
|
12
|
+
Kernel.puts("Please enter name autotest project:")
|
13
|
+
file_name = gets.chomp
|
14
|
+
file_name = "Change_it_to_your_own_project_name" if file_name == ""
|
15
|
+
FileUtils.cp_r(@source_dir, File.join(FileUtils.pwd, file_name))
|
14
16
|
msg("Info") do
|
15
17
|
Kernel.puts "hierarchy was created. \n"
|
16
18
|
end
|
data/bin/update_files.rb
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'diffy'
|
3
|
+
|
4
|
+
# for compare files use gem diffy https://github.com/samg/diffy
|
5
|
+
|
6
|
+
CUR_FOLDER = FileUtils.pwd
|
7
|
+
|
8
|
+
GEM_FOLDER = File.dirname(__FILE__)
|
9
|
+
|
10
|
+
# list files for update
|
11
|
+
FILES_FOR_UPDATE = File.join(GEM_FOLDER, 'files_for_update')
|
12
|
+
|
13
|
+
# path to data file
|
14
|
+
DATA_FILE = "/Scripts/data"
|
15
|
+
|
16
|
+
# read from file, files that need update
|
17
|
+
def read_file_to_arr(path_to_file)
|
18
|
+
arr_lines = Array.new
|
19
|
+
text = File.open(path_to_file).read
|
20
|
+
text.each_line do |line|
|
21
|
+
line.gsub!(/\n/, "")
|
22
|
+
arr_lines.push(line)
|
23
|
+
end
|
24
|
+
return arr_lines
|
25
|
+
end
|
26
|
+
|
27
|
+
# get list files from sourcec folder in gem
|
28
|
+
def get_list_files_for_update
|
29
|
+
list_files = read_file_to_arr(FILES_FOR_UPDATE)
|
30
|
+
all_files = Array.new
|
31
|
+
|
32
|
+
list_files.each do |name|
|
33
|
+
path = File.join(GEM_FOLDER, '..', name)
|
34
|
+
if File.file?(path)
|
35
|
+
all_files.push(path)
|
36
|
+
elsif File.directory?(path)
|
37
|
+
Dir["#{path}/*"].each {|pth| all_files.push(pth)}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
return all_files
|
42
|
+
end
|
43
|
+
|
44
|
+
# trim folder sources from path
|
45
|
+
def get_list_for_search
|
46
|
+
all_files = get_list_files_for_update
|
47
|
+
|
48
|
+
all_files.each do |name|
|
49
|
+
name.sub! /.*sources/, ''
|
50
|
+
end
|
51
|
+
|
52
|
+
return all_files
|
53
|
+
end
|
54
|
+
|
55
|
+
# search files, then not exist in autotest folder
|
56
|
+
def search_not_exists_files
|
57
|
+
not_exists_files = Array.new
|
58
|
+
get_list_for_search.each do |name|
|
59
|
+
not_exists_files.push(name) unless File.file?(CUR_FOLDER + name)
|
60
|
+
end
|
61
|
+
|
62
|
+
return not_exists_files
|
63
|
+
end
|
64
|
+
|
65
|
+
# search files, then exist in autotest folder
|
66
|
+
def search_exists_files
|
67
|
+
exists_files = Array.new
|
68
|
+
get_list_for_search.each do |name|
|
69
|
+
exists_files.push(name) if File.file?(CUR_FOLDER + name)
|
70
|
+
end
|
71
|
+
|
72
|
+
# exclude file data from list, then to don't erase user data
|
73
|
+
exclude_str_from_arr(exists_files, DATA_FILE)
|
74
|
+
return exists_files
|
75
|
+
end
|
76
|
+
|
77
|
+
# copy files from gem to autotest folder
|
78
|
+
def copy_files(list_for_copy)
|
79
|
+
list_for_copy.each do |name|
|
80
|
+
FileUtils.mkdir_p File.dirname(CUR_FOLDER + name)
|
81
|
+
FileUtils.cp(File.join(GEM_FOLDER, '../sources', name), File.dirname(CUR_FOLDER + name))
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
# add ccs style in html-report for readability
|
86
|
+
def add_css_style(file)
|
87
|
+
file.puts("<style>")
|
88
|
+
file.puts(Diffy::CSS)
|
89
|
+
file.puts("</style>")
|
90
|
+
end
|
91
|
+
|
92
|
+
# compare files from gem and autotest folder
|
93
|
+
# the result would be html file with differences in compare folder
|
94
|
+
def compare_files
|
95
|
+
need_copy = Array.new
|
96
|
+
FileUtils.rm_rf(Dir[File.join(CUR_FOLDER, '/compare/*')])
|
97
|
+
search_exists_files.each do |name|
|
98
|
+
compare_result = Diffy::Diff.new(File.dirname(CUR_FOLDER + name), File.join(GEM_FOLDER, '../sources', name), :source => 'files', :format => :html)
|
99
|
+
unless compare_result.to_s(:text).empty?
|
100
|
+
need_copy.push(name)
|
101
|
+
FileUtils.mkdir_p 'compare'
|
102
|
+
File.open(File.join(CUR_FOLDER, '/compare/', "#{File.basename(name, ".*")}.html"), "w:UTF-8") do |file|
|
103
|
+
add_css_style(file)
|
104
|
+
file.puts(compare_result.to_s(:html))
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
return need_copy
|
110
|
+
end
|
111
|
+
|
112
|
+
# delete from array element match str_name
|
113
|
+
def exclude_str_from_arr(input_arr, str_name)
|
114
|
+
result_arr = input_arr
|
115
|
+
need_del = result_arr.select { |el| el.include? str_name}
|
116
|
+
need_del.each do |value|
|
117
|
+
result_arr.delete(value)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
# show files, then don't exixst in autotest folder
|
122
|
+
def show_files_ready_for_copy
|
123
|
+
unless search_not_exists_files.empty?
|
124
|
+
Kernel.puts("Файлы которых нет в текущей папке с автотестами и они будут добавлены:")
|
125
|
+
Kernel.puts search_not_exists_files
|
126
|
+
Kernel.puts("\n")
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# exclude files from list, then don't need update
|
131
|
+
def excludes_files_for_update(input_arr, list_files)
|
132
|
+
all_files = list_files.split(/,\s*/)
|
133
|
+
list_files_for_update = input_arr
|
134
|
+
all_files.each do |name|
|
135
|
+
exclude_str_from_arr(list_files_for_update, name)
|
136
|
+
end
|
137
|
+
|
138
|
+
return list_files_for_update
|
139
|
+
end
|
140
|
+
|
141
|
+
# show files, then need update and update them
|
142
|
+
def show_files_for_update
|
143
|
+
Kernel.puts("\n")
|
144
|
+
|
145
|
+
new_files = search_not_exists_files
|
146
|
+
exist_files = compare_files
|
147
|
+
|
148
|
+
if !new_files.empty? && exist_files.empty?
|
149
|
+
show_files_ready_for_copy
|
150
|
+
Kernel.puts("Скопировать все файлы? (y/n)")
|
151
|
+
answer = gets
|
152
|
+
|
153
|
+
if answer == "y\n"|| answer == "\n"
|
154
|
+
copy_files(new_files)
|
155
|
+
Kernel.puts("Файлы успешно добавлены!")
|
156
|
+
end
|
157
|
+
elsif !exist_files.empty?
|
158
|
+
show_files_ready_for_copy
|
159
|
+
Kernel.puts("Файлы которые уже есть в текущей папки с автотестами, но требуют обновления:")
|
160
|
+
Kernel.puts exist_files
|
161
|
+
Kernel.puts("\n")
|
162
|
+
Kernel.puts("Все изменения в указанных файлах можно посмотреть в папке compare")
|
163
|
+
Kernel.puts("Для каждого файла создан html-отчет с отображением изменений")
|
164
|
+
Kernel.puts("\n")
|
165
|
+
Kernel.puts("Скопировать все файлы или исключить некоторые файлы из обновления?")
|
166
|
+
Kernel.puts("1 - Скопировать все файлы")
|
167
|
+
Kernel.puts("2 - Исключить файлы из обновления")
|
168
|
+
answer = gets.chomp
|
169
|
+
|
170
|
+
if answer == "1"
|
171
|
+
copy_files(new_files)
|
172
|
+
copy_files(exist_files)
|
173
|
+
Kernel.puts("Файлы успешно добавлены!")
|
174
|
+
elsif answer == "2"
|
175
|
+
Kernel.puts("Введите в одной строке через запятую имена файлов, которые надо исключить из обновления:")
|
176
|
+
file_names = gets.chomp
|
177
|
+
files_for_update = excludes_files_for_update(exist_files,file_names)
|
178
|
+
|
179
|
+
if !files_for_update.empty? || !new_files.empty?
|
180
|
+
Kernel.puts("Список файлов для обновления:")
|
181
|
+
Kernel.puts files_for_update
|
182
|
+
Kernel.puts new_files
|
183
|
+
Kernel.puts("Скопировать все файлы? (y/n)")
|
184
|
+
answer = gets
|
185
|
+
|
186
|
+
if answer == "y\n"|| answer == "\n"
|
187
|
+
copy_files(new_files)
|
188
|
+
copy_files(files_for_update)
|
189
|
+
Kernel.puts("Файлы успешно добавлены!")
|
190
|
+
end
|
191
|
+
else
|
192
|
+
Kernel.puts("Нет файлов для обновлений!")
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
if new_files.empty? && compare_files.empty?
|
198
|
+
Kernel.puts("В текущей папке все инфраструктурные файлы актуальны!")
|
199
|
+
end
|
200
|
+
|
201
|
+
Kernel.puts("\n")
|
202
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SurfCustomCalabash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Hripunov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -71,9 +71,11 @@ files:
|
|
71
71
|
- Rakefile
|
72
72
|
- SurfCustomCalabash.gemspec
|
73
73
|
- bin/SurfCustomCalabash
|
74
|
+
- bin/files_for_update
|
74
75
|
- bin/surf-calabash-console.rb
|
75
76
|
- bin/surf-calabash-gen.rb
|
76
77
|
- bin/surf-calabash-helpers.rb
|
78
|
+
- bin/update_files.rb
|
77
79
|
- lib/SurfCustomCalabash.rb
|
78
80
|
- lib/SurfCustomCalabash/CommonMethods.rb
|
79
81
|
- lib/SurfCustomCalabash/DroidMethods.rb
|