SurfCustomCalabash 0.1.6 → 1.1.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.
Files changed (71) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +18 -0
  3. data/Gemfile +2 -1
  4. data/README.md +73 -4
  5. data/SurfCustomCalabash.gemspec +4 -4
  6. data/bin/SurfCustomCalabash +63 -0
  7. data/bin/files_for_update +7 -0
  8. data/bin/surf-calabash-console.rb +62 -0
  9. data/bin/surf-calabash-gen.rb +19 -0
  10. data/bin/surf-calabash-helpers.rb +36 -0
  11. data/bin/update_files.rb +202 -0
  12. data/lib/SurfCustomCalabash/CommonMethods.rb +316 -231
  13. data/lib/SurfCustomCalabash/DroidMethods.rb +104 -74
  14. data/lib/SurfCustomCalabash/IosMethods.rb +109 -73
  15. data/lib/SurfCustomCalabash/version.rb +1 -1
  16. data/sources/Backdoors list b/data/sources/Backdoors → list +0 -0
  17. data/sources/Gemfile +27 -0
  18. data/sources/Scripts/and.sh +5 -0
  19. data/sources/Scripts/ca.sh +5 -0
  20. data/sources/Scripts/ci.sh +5 -0
  21. data/sources/Scripts/data +7 -0
  22. data/sources/Scripts/fa.sh +6 -0
  23. data/sources/Scripts/fi.sh +5 -0
  24. data/sources/Scripts/get_apk.rb +68 -0
  25. data/sources/Scripts/get_scenarios.rb +193 -0
  26. data/sources/Scripts/import_scenarios.rb +172 -0
  27. data/sources/Scripts/ios.sh +5 -0
  28. data/sources/Scripts/parallel_android_smoke.sh +4 -0
  29. data/sources/Scripts/parallel_android_test.sh +4 -0
  30. data/sources/Scripts/ra.sh +12 -0
  31. data/sources/Scripts/ri.sh +9 -0
  32. data/sources/Scripts/smoke_and.sh +5 -0
  33. data/sources/Scripts/smoke_ios.sh +5 -0
  34. data/sources/Scripts/ta.sh +5 -0
  35. data/sources/Scripts/ti.sh +5 -0
  36. data/sources/Scripts/to_exec.sh +19 -0
  37. data/sources/Scripts/update.sh +24 -0
  38. data/sources/Scripts/update_exec.rb +96 -0
  39. data/sources/TestFolder/small.gif +0 -0
  40. data/sources/ci/JenkinsfileUiTestAndroid.groovy +22 -0
  41. data/sources/ci/JenkinsfileUiTestIos.groovy +23 -0
  42. data/sources/config/cucumber.yml +24 -0
  43. data/sources/features/android/pages/standard/DroidCommon.rb +33 -0
  44. data/sources/features/android/pages/standard/Init_android.rb +8 -0
  45. data/sources/features/android/pages/test.rb +43 -0
  46. data/sources/features/android/support/app_life_cycle_hooks.rb +147 -0
  47. data/sources/features/android/support/log_hooks_and.rb +40 -0
  48. data/sources/features/android/support/video_hooks_and.rb +110 -0
  49. data/sources/features/ios/pages/standard/Init_ios.rb +5 -0
  50. data/sources/features/ios/pages/standard/IosCommon.rb +30 -0
  51. data/sources/features/ios/pages/test.rb +37 -0
  52. data/sources/features/ios/support/01_launch.rb +194 -0
  53. data/sources/features/ios/support/log_hooks_ios.rb +40 -0
  54. data/sources/features/ios/support/video_hooks_ios.rb +58 -0
  55. data/sources/features/net/net.rb +28 -0
  56. data/sources/features/net/screentest_api.rb +186 -0
  57. data/sources/features/scenarios/eng.feature +8 -0
  58. data/sources/features/scenarios/rus.feature +8 -0
  59. data/sources/features/step_definitions/test.rb +43 -0
  60. data/sources/features/support/credentials.rb +11 -0
  61. data/sources/features/support/env.rb +8 -0
  62. data/sources/features/support/hooks.rb +21 -0
  63. data/sources/features/support/localization.rb +8 -0
  64. data/sources/find_id.rb +95 -0
  65. data/sources/group_steps.rb +39 -0
  66. data/sources/irbrcs/android/irbrc +105 -0
  67. data/sources/irbrcs/ios/irbrc +132 -0
  68. data/sources/start.sh +134 -0
  69. metadata +71 -11
  70. data/bin/console +0 -14
  71. data/bin/setup +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 719a47490b3ee7c43b29dfff52939628a76d8a3e
4
- data.tar.gz: 9f0a757d2fa132e512298c31fdd49ae5cba54257
2
+ SHA256:
3
+ metadata.gz: 642a2175dd5be63af09865c3e401256600b92e24e9d81b7acebb6a3431356c5f
4
+ data.tar.gz: cb0842d72f0a04b435f422b928869cbaa84aca0a14db4ea028e4c07d88b9bfb2
5
5
  SHA512:
6
- metadata.gz: d9093b915c8bf382758cf40fb47358ea73f910129ff397bd97337adb40365f4a8ceab6e018434c41d684a7edbfd5cb6e58bc7bcef8949520c920d70d0b9bb462
7
- data.tar.gz: 3a7d4fea4a6cd56da9e1e351df84dc52f23714a01a81e6cc0754ba8c61431e0499bbd916495e5fe39956fa632925d31667563a7d03bcb5e6e1ac5f381bf36a4f
6
+ metadata.gz: adfc4a77d09b27c5b2abd6094a49981763d9cd4dae2c033fd6602936d9ba3953e260424665511ed61b1b4dd152674c898ebea1bfb262ee45583797c39bfab31c
7
+ data.tar.gz: 35c47618c702ccc856c0bc5dcfe8e5a8ffaaf259609dd6e8ff758dde008f33a116814c91bab2ea2e6db8dc6fdd0bcf8018d0f5d34d111844f810e557e8e257d6
@@ -0,0 +1,18 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
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
+
11
+
12
+ ## v1.0.0 - 28.08.2020
13
+ ### Added
14
+ - Changelog.md
15
+ - Added template file for initializing a new autotest project (use **SurfCustomCalabash gen**)
16
+
17
+ ### Changed
18
+ - method close_keybord can now be called with optional parameters **x_start** and **y_start** (by default **x_start:** 100, **y_start:** 150)
data/Gemfile CHANGED
@@ -6,4 +6,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
6
6
  gemspec
7
7
 
8
8
  gem 'calabash-android'
9
- gem 'rspec/expectations'
9
+ gem 'rspec/expectations'
10
+ gem 'diffy'
data/README.md CHANGED
@@ -21,11 +21,80 @@ Or install it yourself as:
21
21
 
22
22
  This gem provides methods for easier use Calabash.
23
23
 
24
- Install gem in your project, add require 'SurfCustomCalabash/IosCommon' and 'SurfCustomCalabash/DroidCommon' in your ios or android ruby files.
24
+ Install gem in your exist project, add in your ios or android ruby files.
25
25
 
26
- IosCommon contains custom swipe methods for ios.
26
+ $require 'SurfCustomCalabash/IosCommon'
27
+
28
+ $require 'SurfCustomCalabash/DroidCommon'
29
+
30
+ **IosCommon** contains custom swipe methods for ios.
31
+
32
+ **DroidCommon** contains custom swipe methods for android.
33
+
34
+ **CommonMethods** contains different methods (taps, swipes, waits and other) for both platforms.
35
+
36
+ ### Create new project
37
+ You should move to the directory which would contains folder with your tests and execute command and then enter folder name
38
+
39
+ $ SurfCustomCalabash gen
40
+
41
+ After that you'll see many folders inside them. Each of them will be describe below.
42
+
43
+ #### ci
44
+
45
+ It is used for all scripts for continuous integration. In Surfstudio we have .groovy files for them.
27
46
 
28
- DroidCommon contains custom swipe methods for android.
47
+
48
+ #### config
49
+
50
+ Contains only cucumber.yml file. It named arguments are called profiles - e.g. iOS or Android for run.
51
+
52
+
53
+ #### features
54
+
55
+ Main folder of all project. Every feature, step definition, support files and page objects are here. You can read about it more in each file of this folder.
56
+
57
+
58
+ #### irbrcs
59
+
60
+ Our own shtick. We change calabash-android console and calabash-ios console a little, so you can write your own complex functions, which you'll implement in the step_definitions or in page objects. So for the correct work we had to change irbrc-files of gems too.
61
+
62
+ #### reports
63
+
64
+ Folder with screenshots of errors.
65
+
66
+
67
+ #### test_servers
68
+
69
+ Standard calabash-android folder with signed apk-files.
70
+
71
+ #### TestFolder
72
+
73
+ Contains some additional files, e.g. jpg-pictures or other data which can be used in tests.
74
+
75
+ #### Backdoors list
76
+
77
+ We use backdoors for our applications for get around the limit of nativity of calabash.
78
+
79
+ #### Gemfile
80
+
81
+ All required gems for surf-calabash. You should run installing all gems by bundle after initializing project when you rename **Change_it_to_your_own_project_name** to your own name.
82
+
83
+ $bundle install
84
+
85
+ #### Scripts
86
+
87
+ Some shell scripts which can help to start tests faster because of typing smaller count of symbols. :)
88
+ Also it shows some integration with Xray Jira plugin.
89
+
90
+ #### start.sh
91
+
92
+ Shell script for useful launch all helpful scripts of folder above.
93
+
94
+ ### Update infrastructure files
95
+
96
+ To check the relevance of the infrastructure files of your project with autotests, execute command:
29
97
 
30
- CommonMethods contains different methods (taps, swipes, waits and other) for both platforms.
98
+ $ SurfCustomCalabash update
31
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.
@@ -6,7 +6,7 @@ require "SurfCustomCalabash/version"
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "SurfCustomCalabash"
8
8
  spec.version = SurfCustomCalabash::VERSION
9
- spec.authors = ["Alexey Hripunov"]
9
+ spec.authors = ["Alexey Hripunov", "Igor Tolubaev"]
10
10
  spec.email = ["hripunov@surfstudio.ru"]
11
11
 
12
12
  spec.summary = "Custom methods for calabash ios and android"
@@ -32,9 +32,9 @@ Gem::Specification.new do |spec|
32
32
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
33
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
34
  end
35
- spec.bindir = "exe"
36
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
- spec.require_paths = ["lib"]
35
+ # spec.bindir = "exe"
36
+ spec.executables = ["SurfCustomCalabash"]
37
+ # spec.require_paths = ["lib"]
38
38
 
39
39
  spec.add_development_dependency "bundler", "~> 1.17"
40
40
  spec.add_development_dependency "rake", "~> 10.0"
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+ require 'rbconfig'
5
+
6
+ # for ruby 1.9.1 and earlier
7
+ unless defined? RbConfig.ruby
8
+ def RbConfig.ruby
9
+ File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["ruby_install_name"] + RbConfig::CONFIG["EXEEXT"])
10
+ end
11
+ end
12
+
13
+ require File.join(File.dirname(__FILE__), "surf-calabash-helpers")
14
+
15
+ @hierarchy = File.join(FileUtils.pwd, "features")
16
+ @source_dir = File.join(File.dirname(__FILE__), '..', 'sources')
17
+
18
+
19
+ if ARGV.length == 0
20
+ print_usage
21
+ else
22
+ cmd = ARGV.shift
23
+
24
+ case cmd
25
+ when 'help'
26
+ print_help
27
+ when 'gen'
28
+ gen = File.join(File.dirname(__FILE__), "surf-calabash-gen")
29
+ require gen
30
+ surf_gen
31
+ when 'android_console'
32
+ require 'calabash-android/helpers'
33
+ require 'calabash-android/utils'
34
+ require 'calabash-android/java_keystore'
35
+ require 'calabash-android/env'
36
+ require File.join(File.dirname(__FILE__), "surf-calabash-console")
37
+
38
+ if ARGV.empty? or not is_apk_file?(ARGV.first)
39
+ Kernel.puts "The first parameter must be the path to the apk file."
40
+ exit 1
41
+ else
42
+ android_console(relative_to_full_path(ARGV.shift))
43
+ end
44
+
45
+ when 'ios_console'
46
+ require File.join(File.dirname(__FILE__), "surf-calabash-console")
47
+ ios_console
48
+ when 'version'
49
+ require_relative '../lib/SurfCustomCalabash/version'
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
59
+ else
60
+ Kernel.puts "Invalid command '#{cmd}'"
61
+ print_usage
62
+ end
63
+ end
@@ -0,0 +1,7 @@
1
+ /sources/features/android/support
2
+ /sources/features/ios/support
3
+ /sources/features/net/screentest_api.rb
4
+ /sources/Scripts
5
+ /sources/find_id.rb
6
+ /sources/group_steps.rb
7
+ /sources/start.sh
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+ require 'rbconfig'
5
+
6
+ def android_console(app_path = nil)
7
+ test_server_path = test_server_path(app_path)
8
+
9
+ path = ENV['CALABASH_IRBRC']
10
+ Kernel.puts(path)
11
+
12
+ unless path
13
+ if File.exist?('irbrc')
14
+ path = File.expand_path('irbrc')
15
+ end
16
+ end
17
+
18
+ unless path
19
+ path = File.expand_path(File.join(File.dirname(__FILE__), '../sources/irbrcs/android', 'irbrc'))
20
+ end
21
+
22
+ ENV['IRBRC'] = path
23
+ Kernel.puts(path)
24
+
25
+ unless ENV['APP_PATH']
26
+ ENV['APP_PATH'] = app_path
27
+ end
28
+
29
+ unless ENV['TEST_APP_PATH']
30
+ ENV['TEST_APP_PATH'] = test_server_path
31
+ end
32
+
33
+ build_test_server_if_needed(app_path)
34
+
35
+ Kernel.puts 'Starting calabash-android console...'
36
+ Kernel.puts "Loading #{ENV['IRBRC']}"
37
+ Kernel.puts 'Running irb...'
38
+ exec('irb')
39
+ end
40
+
41
+ def is_apk_file?(file_path)
42
+ file_path.end_with? ".apk" and File.exist? file_path
43
+ end
44
+
45
+ def relative_to_full_path(file_path)
46
+ File.expand_path(file_path)
47
+ end
48
+
49
+ def ios_console
50
+ path = ENV['CALABASH_IRBRC']
51
+ unless path
52
+ if File.exist?('.irbrc')
53
+ path = File.expand_path('.irbrc')
54
+ end
55
+ end
56
+ unless path
57
+ path = File.expand_path(File.join(File.dirname(__FILE__), '../sources/irbrcs/ios', 'irbrc'))
58
+ end
59
+ ENV['IRBRC'] = path
60
+ puts "Running irb..."
61
+ exec("irb")
62
+ end
@@ -0,0 +1,19 @@
1
+ def surf_gen
2
+ if File.exists?(@hierarchy)
3
+ Kernel.puts "hierarchy is already created. Stopping..."
4
+ exit 1
5
+ end
6
+ msg("Question") do
7
+ Kernel.puts "I'm about to create a subdirectory called sources."
8
+ Kernel.puts "Please hit return to confirm that's what you want."
9
+ end
10
+ exit 2 unless STDIN.gets.chomp == ''
11
+
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))
16
+ msg("Info") do
17
+ Kernel.puts "hierarchy was created. \n"
18
+ end
19
+ end
@@ -0,0 +1,36 @@
1
+ require 'tempfile'
2
+ require 'json'
3
+ require "rubygems"
4
+
5
+ def msg(title, &block)
6
+ Kernel.puts "\n" + "-"*10 + title + "-"*10
7
+ block.call
8
+ Kernel.puts "-"*10 + "-------" + "-"*10 + "\n"
9
+ end
10
+
11
+ def print_usage
12
+ Kernel.puts <<EOF
13
+ Usage: SurfCustomCalabash <command-name> [parameters] [options]
14
+ <command-name> can be one of
15
+ help
16
+ prints more detailed help information.
17
+ gen
18
+ generate a features folder structure.
19
+ update
20
+ update infrastructure files in your project
21
+ version
22
+ prints the gem version
23
+
24
+ <options> can be
25
+ -v, --verbose
26
+ Turns on verbose logging
27
+ EOF
28
+ end
29
+
30
+ def print_help
31
+ print_usage
32
+ end
33
+
34
+ def is_json?(str)
35
+ str[0..0] == '{'
36
+ end
@@ -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