yadecli 0.1.3 → 0.1.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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.gitignore +2 -3
  4. data/Gemfile +5 -0
  5. data/Gemfile.lock +44 -2
  6. data/lib/yadecli/cli/application.rb +19 -4
  7. data/lib/yadecli/cli/composer.rb +70 -14
  8. data/lib/yadecli/cli/host.rb +19 -5
  9. data/lib/yadecli/cli/module.rb +14 -3
  10. data/lib/yadecli/cli/project.rb +30 -8
  11. data/lib/yadecli/cli/response/project_start_response.rb +21 -0
  12. data/lib/yadecli/cli/task.rb +9 -5
  13. data/lib/yadecli/client/gitlab_client.rb +4 -6
  14. data/lib/yadecli/command/composer/composer_install_command.rb +166 -0
  15. data/lib/yadecli/command/composer/composer_list_command.rb +63 -0
  16. data/lib/yadecli/command/composer/composer_log_command.rb +53 -0
  17. data/lib/yadecli/command/composer/composer_setup_command.rb +28 -0
  18. data/lib/yadecli/command/composer/composer_start_command.rb +70 -0
  19. data/lib/yadecli/command/composer/composer_stop_command.rb +60 -0
  20. data/lib/yadecli/command/composer/composer_switch_command.rb +51 -0
  21. data/lib/yadecli/command/composer/composer_uninstall_command.rb +44 -0
  22. data/lib/yadecli/command/connect_command.rb +29 -0
  23. data/lib/yadecli/command/host/host_bootstrap_command.rb +132 -0
  24. data/lib/yadecli/command/host/host_list_command.rb +36 -0
  25. data/lib/yadecli/command/host/host_provision_command.rb +59 -0
  26. data/lib/yadecli/command/login_command.rb +26 -0
  27. data/lib/yadecli/command/module/module_install_command.rb +79 -0
  28. data/lib/yadecli/command/module/module_list_command.rb +47 -0
  29. data/lib/yadecli/command/project/project_install_command.rb +58 -0
  30. data/lib/yadecli/command/project/project_list_command.rb +50 -0
  31. data/lib/yadecli/command/project/project_setup_command.rb +66 -0
  32. data/lib/yadecli/command/project/project_start_command.rb +110 -0
  33. data/lib/yadecli/command/project/project_uninstall_command.rb +44 -0
  34. data/lib/yadecli/command/task/task_list_command.rb +56 -0
  35. data/lib/yadecli/io/user_input.rb +1 -1
  36. data/lib/yadecli/util/cli_util.rb +11 -1
  37. data/lib/yadecli/util/maven_util.rb +35 -0
  38. data/lib/yadecli/version.rb +1 -1
  39. data/lib/yadecli.rb +38 -41
  40. data/scripts/setup-terminal.sh +1 -1
  41. data/yadecli.gemspec +6 -2
  42. metadata +81 -46
  43. data/lib/.DS_Store +0 -0
  44. data/lib/yadecli/.DS_Store +0 -0
  45. data/lib/yadecli/client/authentication_client.rb +0 -24
  46. data/lib/yadecli/client/base_client.rb +0 -78
  47. data/lib/yadecli/client/composer_container_client.rb +0 -27
  48. data/lib/yadecli/client/composer_project_client.rb +0 -27
  49. data/lib/yadecli/client/composer_service_client.rb +0 -27
  50. data/lib/yadecli/client/domain_client.rb +0 -23
  51. data/lib/yadecli/client/host_client.rb +0 -45
  52. data/lib/yadecli/client/maven_build_step_client.rb +0 -23
  53. data/lib/yadecli/client/maven_build_task_client.rb +0 -23
  54. data/lib/yadecli/client/nvm_runtime_client.rb +0 -23
  55. data/lib/yadecli/client/project_client.rb +0 -28
  56. data/lib/yadecli/client/project_module_client.rb +0 -35
  57. data/lib/yadecli/client/pyenv_runtime_client.rb +0 -23
  58. data/lib/yadecli/client/role_client.rb +0 -23
  59. data/lib/yadecli/client/rvm_runtime_client.rb +0 -23
  60. data/lib/yadecli/client/sdk_package_client.rb +0 -28
  61. data/lib/yadecli/client/vcs_client.rb +0 -23
  62. data/lib/yadecli/config/app_config.rb +0 -70
  63. data/lib/yadecli/model/composer_container.rb +0 -19
  64. data/lib/yadecli/model/composer_project.rb +0 -37
  65. data/lib/yadecli/model/composer_service.rb +0 -19
  66. data/lib/yadecli/model/domain.rb +0 -24
  67. data/lib/yadecli/model/host.rb +0 -24
  68. data/lib/yadecli/model/ide_type.rb +0 -7
  69. data/lib/yadecli/model/maven_build_step.rb +0 -19
  70. data/lib/yadecli/model/maven_build_task.rb +0 -19
  71. data/lib/yadecli/model/nvm_runtime.rb +0 -18
  72. data/lib/yadecli/model/project.rb +0 -26
  73. data/lib/yadecli/model/project_module.rb +0 -29
  74. data/lib/yadecli/model/pyenv_runtime.rb +0 -18
  75. data/lib/yadecli/model/role.rb +0 -24
  76. data/lib/yadecli/model/rvm_runtime.rb +0 -18
  77. data/lib/yadecli/model/sdk_package.rb +0 -18
  78. data/lib/yadecli/model/vcs.rb +0 -19
  79. data/lib/yadecli/service/authentication_service.rb +0 -31
  80. data/lib/yadecli/service/build_step_service.rb +0 -24
  81. data/lib/yadecli/service/build_task_service.rb +0 -70
  82. data/lib/yadecli/service/composer_service.rb +0 -416
  83. data/lib/yadecli/service/connect_service.rb +0 -19
  84. data/lib/yadecli/service/host_service.rb +0 -191
  85. data/lib/yadecli/service/module_service.rb +0 -78
  86. data/lib/yadecli/service/project_service.rb +0 -205
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mutations'
4
+ require 'uri'
5
+
6
+ module Yadecli
7
+ module Command
8
+ module Module
9
+ class ModuleInstallCommand < Mutations::Command
10
+
11
+ required do
12
+ string :project_name, empty: false
13
+ end
14
+
15
+ optional do
16
+ array :module_names, class: String
17
+ hash :options do
18
+ string :* # Allows any key to pass through. Useful for dynamic key / value objects
19
+ end
20
+ end
21
+
22
+ #
23
+ def execute
24
+ project_client = Yade::Project::Rest::Client::ProjectClient.new
25
+ project_module_client = Yade::Project::Rest::Client::ProjectModuleClient.new
26
+
27
+ project = project_client.project_by_name(project_name)
28
+
29
+ if options[:all]
30
+ project_modules = project_module_client.modules_for_project(project.id)
31
+
32
+ project_modules.each do |project_module|
33
+ install_module(project_module, options)
34
+ end
35
+ else
36
+ self.module_names.each do |module_name|
37
+ project_module = project_module_client.module_for_project(project.id, module_name)
38
+
39
+ install_module(project_module, options)
40
+ end
41
+ end
42
+ puts ''
43
+
44
+ "Module(s) installed successfully"
45
+ end
46
+
47
+ private
48
+
49
+ # install module
50
+ def install_module(project_module, options)
51
+ if project_module.installed?
52
+ puts ''
53
+ puts "The module with name #{project_module.name} is already installed"
54
+
55
+ if options[:yes]
56
+ do_update = true
57
+ else
58
+ prompt = TTY::Prompt.new
59
+ do_update = prompt.yes?('Do you want to pull the changes for the project? ')
60
+ end
61
+ end
62
+
63
+ cmd = TTY::Command.new(output: Yadecli.LOGGER)
64
+
65
+ if do_update
66
+ cmd_line = 'git pull'
67
+ cmd.run(cmd_line, chdir: project_module.home)
68
+ else
69
+ vcs_client = Yade::Project::Rest::Client::VcsClient.new
70
+
71
+ vcs = vcs_client.get(project_module.vcsId)
72
+ cmd_line = "git clone #{vcs.url} #{project_module.home}"
73
+ cmd.run(cmd_line)
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mutations'
4
+ require 'tty-table'
5
+
6
+ module Yadecli
7
+ module Command
8
+ module Module
9
+ class ModuleListCommand < Mutations::Command
10
+
11
+ required do
12
+ string :project_name, empty: false
13
+ end
14
+
15
+ optional do
16
+ hash :options do
17
+ string :* # Allows any key to pass through. Useful for dynamic key / value objects
18
+ end
19
+ end
20
+
21
+ #
22
+ def execute
23
+ project_client = Yade::Project::Rest::Client::ProjectClient.new
24
+ project_module_client = Yade::Project::Rest::Client::ProjectModuleClient.new
25
+
26
+ project = project_client.project_by_name(self.project_name)
27
+
28
+ puts "Project: #{project.name}".colorize(:mode => :bold)
29
+
30
+ project_modules = project_module_client.modules_for_project(project.id)
31
+
32
+ rows = []
33
+ project_modules.each do |m|
34
+ module_name = m.name
35
+ is_installed = m.installed?
36
+ git_status = '-'
37
+ git_status = FileUtil.git_status(m.home) if is_installed
38
+ rows << [module_name, is_installed, git_status]
39
+ end
40
+ table = TTY::Table.new header: ['Module name', 'Installed', 'Git Status'], rows: rows
41
+
42
+ table.render(:ascii, padding: [0, 1])
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,58 @@
1
+ require 'mutations'
2
+ require 'uri'
3
+
4
+ module Yadecli
5
+ module Command
6
+ module Project
7
+ class ProjectInstallCommand < Mutations::Command
8
+
9
+ required do
10
+ string :project_name, empty: false
11
+ end
12
+
13
+ optional do
14
+ hash :options do
15
+ string :* # Allows any key to pass through. Useful for dynamic key / value objects
16
+ end
17
+ end
18
+
19
+ #
20
+ def execute
21
+ project_client = Yade::Project::Rest::Client::ProjectClient.new
22
+ vcs_client = Yade::Project::Rest::Client::VcsClient.new
23
+
24
+ project = project_client.project_by_name(self.project_name)
25
+ vcs = vcs_client.get(project.vcsId)
26
+
27
+ if project.installed?
28
+ puts "The project with name #{project_name} is already installed"
29
+
30
+ if options[:yes]
31
+ do_update = true
32
+ else
33
+ puts ''
34
+ prompt = TTY::Prompt.new
35
+ do_update = prompt.yes?('Do you want to pull the changes for the project? ')
36
+ end
37
+ end
38
+
39
+ cmd = TTY::Command.new(output: Yadecli.LOGGER)
40
+
41
+ if do_update
42
+ cmd_line = 'git pull'
43
+
44
+ cmd.run(cmd_line, chdir: project.home)
45
+
46
+ "Yade project #{project.name} successfully pulled in #{project.home}"
47
+ else
48
+ cmd_line = "git clone #{vcs.url} #{project.home}"
49
+
50
+ cmd.run(cmd_line)
51
+
52
+ "Yade project #{project.name} successfully installed to #{project.home}"
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,50 @@
1
+ require 'mutations'
2
+ require 'uri'
3
+ require 'tty-table'
4
+
5
+ module Yadecli
6
+ module Command
7
+ module Project
8
+ class ProjectListCommand < Mutations::Command
9
+
10
+ #
11
+ def execute
12
+ project_client = Yade::Project::Rest::Client::ProjectClient.new
13
+ project_module_client = Yade::Project::Rest::Client::ProjectModuleClient.new
14
+
15
+ projects = project_client.list
16
+
17
+ projects.each do |p|
18
+ puts "Project: #{p.name}".colorize(mode: :bold)
19
+
20
+ project_modules = project_module_client.modules_for_project(p.id)
21
+
22
+ rows = []
23
+ project_modules.each do |m|
24
+ module_name = m.name
25
+ is_installed = m.installed?
26
+ git_status = '-'
27
+ git_status = FileUtil.git_status(m.home) if is_installed
28
+
29
+ if is_installed
30
+ current_branch = FileUtil.git_current_branch(p.home)
31
+ else
32
+ current_branch = '-'
33
+ end
34
+
35
+ rows << [module_name, is_installed, git_status, current_branch]
36
+ end
37
+ table = TTY::Table.new header: ['Module name', 'Installed', 'Git Status', 'Branch'], rows: rows
38
+ puts table.render(:ascii, padding: [0, 1])
39
+ end
40
+
41
+ """
42
+ You can run 'yadecli project install <project_name>' to install a project
43
+
44
+ You can run 'yadecli module install <project_name> <module_name>' to install a module to a project
45
+ """
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,66 @@
1
+ require 'mutations'
2
+ require 'uri'
3
+
4
+ module Yadecli
5
+ module Command
6
+ module Project
7
+ class ProjectSetupCommand < Mutations::Command
8
+
9
+ required do
10
+ string :project_name, empty: false
11
+ end
12
+
13
+ optional do
14
+ hash :options do
15
+ string :* # Allows any key to pass through. Useful for dynamic key / value objects
16
+ end
17
+ end
18
+
19
+ #
20
+ def execute
21
+ project_client = Yade::Project::Rest::Client::ProjectClient.new
22
+ sdk_package_client = Yade::Project::Rest::Client::SdkPackageClient.new
23
+ rvm_runtime_client = Yade::Project::Rest::Client::RvmRuntimeClient.new
24
+ nvm_runtime_client = Yade::Project::Rest::Client::NvmRuntimeClient.new
25
+ pyenv_runtime_client = Yade::Project::Rest::Client::PyenvRuntimeClient.new
26
+
27
+ project = project_client.project_by_name(self.project_name)
28
+
29
+ sdk_packages = sdk_package_client.sdk_packages_for_project(project.id)
30
+
31
+ # sdk
32
+ puts ''
33
+ puts 'Setup sdk packages:'.colorize(:mode => :bold)
34
+ sdk_packages.each do |sdkp|
35
+ SdkUtil.install_candidate(sdkp.name, sdkp.version)
36
+ end
37
+
38
+ # rvm
39
+ rvm_runtime = rvm_runtime_client.get(project.id)
40
+ RvmUtil.setup_rvm(project, rvm_runtime)
41
+
42
+ # nvm
43
+ nvm_runtime = nvm_runtime_client.get(project.id)
44
+ NvmUtil.setup_nvm(project, nvm_runtime)
45
+
46
+ # pyenv
47
+ pyenv_runtime = pyenv_runtime_client.get(project.id)
48
+ PyenvUtil.setup_pyenv(project, pyenv_runtime)
49
+
50
+ # direnv
51
+ puts ''
52
+ puts 'Setup direnv:'.colorize(mode: :bold)
53
+ puts ' ↳ Create .envrc'
54
+ File.open("#{project.home}/.envrc", 'w') do |f|
55
+ f.puts("export PROJECT_ID=#{project.name}")
56
+ f.puts("export PROJECT_HOME=#{project.home}")
57
+ f.puts("export PROJECT_SRC_HOME=#{project.home}/src")
58
+ end
59
+ puts ''
60
+
61
+ "Yade project #{project.name} successfully setup"
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,110 @@
1
+ require 'mutations'
2
+ require 'uri'
3
+
4
+ module Yadecli
5
+ module Command
6
+ module Project
7
+ class ProjectStartCommand < Mutations::Command
8
+
9
+ required do
10
+ string :project_name, empty: false
11
+ end
12
+
13
+ optional do
14
+ integer :selection, max: 5
15
+ hash :options do
16
+ string :* # Allows any key to pass through. Useful for dynamic key / value objects
17
+ end
18
+ end
19
+
20
+ #
21
+ def execute
22
+ project_client = Yade::Project::Rest::Client::ProjectClient.new
23
+
24
+ project = project_client.project_by_name(project_name)
25
+
26
+ puts " ↳ Name: #{project.name}"
27
+ puts " ↳ Home: #{project.home}"
28
+
29
+ prompt = TTY::Prompt.new
30
+
31
+ ide_name = if project.ideType == 'IDEA'
32
+ 'Intellij Idea'
33
+ elsif project.ideType == 'RUBYMINE'
34
+ 'Intellij Rubymine'
35
+ else
36
+ 'Unknown'
37
+ end
38
+
39
+ puts ''
40
+ if selection.nil?
41
+ answer = prompt.select('What do you want to do?'.colorize(mode: :bold)) do |menu|
42
+ menu.choice '1) Terminal setup', 1
43
+ menu.choice '2) Multiplexer Terminal setup', 2
44
+ if ide_name == 'Unknown'
45
+ menu.choice "3) Start IDE #{ide_name}", 3, disabled: '(n.a.)'
46
+ else
47
+ menu.choice "3) Start IDE #{ide_name}", 3
48
+ end
49
+ menu.choice '4) Start Editor', 4
50
+ menu.choice '5) Quit', 5
51
+ end
52
+ else
53
+ answer = Integer(selection)
54
+ end
55
+
56
+ result_json = "#{Yade::Common::Config::AppConfig[:yade_home]}/result.json"
57
+
58
+ case answer
59
+ when 1
60
+ # puts 'Setting up Terminal'
61
+ # puts ''
62
+
63
+ ProjectStartResponse.new(project: project, project_home: project.home, selection: answer)
64
+ .write(result_json)
65
+
66
+ "Yade project #{project.name} terminal setup successfully"
67
+ when 2
68
+ # puts 'Setting up Multiplexer Terminal'
69
+ # puts ''
70
+
71
+ tmux_config = prompt.select('Select the tmux profile?'.colorize(mode: :bold)) do |menu|
72
+ Dir.glob("#{project.home}/tmuxinator-*.yml").each do |tmux_config|
73
+ menu.choice File.basename(tmux_config, '.yml')[11..-1], tmux_config
74
+ end
75
+ end
76
+
77
+ dir = File.dirname(tmux_config)
78
+ FileUtils.ln tmux_config, "#{dir}/.tmuxinator.yml", force: true
79
+
80
+ ProjectStartResponse.new(project: project, project_home: project.home, selection: answer)
81
+ .write(result_json)
82
+
83
+ "Yade project #{project.name} multiplexer terminal setup successfully"
84
+ when 3
85
+ puts "Start IDE #{ide_name}"
86
+
87
+ ProjectStartResponse.new(project: project, project_home: project.home, selection: answer)
88
+ .write(result_json)
89
+
90
+ "Yade project #{project.name} ide started successfully"
91
+ when 4
92
+ puts 'Start Editor'
93
+
94
+ ProjectStartResponse.new(project: project, project_home: project.home, selection: answer)
95
+ .write(result_json)
96
+
97
+ "Yade project #{project.name} editor started successfully"
98
+ when 5
99
+ ProjectStartResponse.new(project: project, project_home: project.home, selection: answer)
100
+ .write(result_json)
101
+
102
+ 'Bye'
103
+ else
104
+ 'Unknown'
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,44 @@
1
+ require 'mutations'
2
+ require 'uri'
3
+
4
+ module Yadecli
5
+ module Command
6
+ module Project
7
+ class ProjectUninstallCommand < Mutations::Command
8
+
9
+ required do
10
+ string :project_name, empty: false
11
+ end
12
+
13
+ optional do
14
+ hash :options do
15
+ string :* # Allows any key to pass through. Useful for dynamic key / value objects
16
+ end
17
+ end
18
+
19
+ #
20
+ def execute
21
+ project_client = Yade::Project::Rest::Client::ProjectClient.new
22
+
23
+ project = project_client.project_by_name(self.project_name)
24
+
25
+ unless project.installed?
26
+ puts "The project with name #{self.project_name} is not installed"
27
+ exit 1
28
+ end
29
+
30
+ if options[:yes]
31
+ really_uninstall = true
32
+ else
33
+ prompt = TTY::Prompt.new
34
+ really_uninstall = prompt.yes?("Do you really want to uninstall the project #{project.name} and all it's modules? ")
35
+ end
36
+
37
+ FileUtils.rm_rf(project.home) if really_uninstall
38
+
39
+ "Yade project #{project.name} successfully uninstalled from #{project.home}"
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'mutations'
4
+ require 'tty-table'
5
+
6
+ module Yadecli
7
+ module Command
8
+ module Task
9
+ class TaskListCommand < Mutations::Command
10
+
11
+ required do
12
+ string :project_name, empty: false
13
+ end
14
+
15
+ optional do
16
+ string :module_name, empty: false
17
+ end
18
+
19
+ #
20
+ def execute
21
+ #puts "Task project_name: #{project_name} module_name: #{module_name}"
22
+
23
+ project_client = Yade::Project::Rest::Client::ProjectClient.new
24
+ project_task_client = Yade::Project::Rest::Client::ProjectTaskClient.new
25
+
26
+ project = project_client.project_by_name(project_name)
27
+
28
+ git_add_all_step = Yade::Project::Rest::Model::ProjectTaskStep.new({id: 1, name: 'git-add-all', command: 'git add .'})
29
+ git_commit_step = Yade::Project::Rest::Model::ProjectTaskStep.new({id: 2, name: 'git-commit', command: 'git commit -m "ncm"'})
30
+ git_push_step = Yade::Project::Rest::Model::ProjectTaskStep.new({id: 3, name: 'git-push', command: 'git push origin develop'})
31
+ git_pull_step = Yade::Project::Rest::Model::ProjectTaskStep.new({id: 4, name: 'git-pull', command: 'git pull origin develop'})
32
+
33
+ project_tasks = [
34
+ Yade::Project::Rest::Model::ProjectTask.new({id: 1,
35
+ name: 'commit-and-push',
36
+ desc: 'commit and push all changes for all project modules',
37
+ steps: [git_add_all_step, git_commit_step, git_push_step]}),
38
+ Yade::Project::Rest::Model::ProjectTask.new({id: 2,
39
+ name: 'pull',
40
+ desc: 'pull all changes for all project modules',
41
+ steps: [git_pull_step]})
42
+ ]
43
+
44
+ table = TTY::Table.new header: ['Name', 'Description', 'Steps']
45
+
46
+ project_tasks.each do |pt|
47
+ table << [pt.name, pt.desc, pt.steps.map { |s| s.name }.join(", ")]
48
+ end
49
+
50
+ puts "Project #{project.name}"
51
+ puts table.render(:ascii, width: 120, resize: true, padding: [0, 1])
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -8,7 +8,7 @@ class UserInput
8
8
  def self.ask(message, config_key)
9
9
  prompt = TTY::Prompt.new
10
10
 
11
- prompt.ask(message, default: AppConfig[config_key] ||= '')
11
+ prompt.ask(message, default: Yade::Common::Config::ComposerConfig[config_key] ||= '')
12
12
  end
13
13
 
14
14
  def self.select_branch(repo_name)
@@ -12,7 +12,17 @@ class CliUtil
12
12
  def print_header(title, subtitles)
13
13
  a = Artii::Base.new
14
14
  puts a.asciify(title).colorize(:color => :green, :mode => :bold)
15
- subtitles.each { |s| puts s.colorize(:green) } unless subtitles.nil? || subtitles.empty?
15
+ subtitles.each { |s| puts s.colorize(:cyan) } unless subtitles.nil? || subtitles.empty?
16
+ end
17
+
18
+ def print_command_outcome(outcome)
19
+ if outcome.success?
20
+ puts outcome.result.colorize(:color => :green, :mode => :bold)
21
+ else
22
+ outcome.errors.message_list.each do |message|
23
+ puts message.colorize(:color => :red, :mode => :bold)
24
+ end
25
+ end
16
26
  end
17
27
 
18
28
  def check_root
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Maven util
4
+ class MavenUtil
5
+
6
+ def self.create_mvn_commandline(project_module, maven_build_task, maven_build_step)
7
+ task_profiles = maven_build_task.profiles&.split(',')&.map { |item| item.strip }
8
+ step_profiles = maven_build_step.profiles&.split(',')&.map { |item| item.strip }
9
+ all_profiles = []
10
+ all_profiles << task_profiles unless task_profiles.nil?
11
+ all_profiles << step_profiles unless step_profiles.nil?
12
+
13
+ #puts "aaa #{all_profiles.flatten}"
14
+
15
+ task_params = maven_build_task.parameters&.split(',')&.map { |item| item.strip }
16
+ step_params = maven_build_step.parameters&.split(',')&.map { |item| item.strip }
17
+ all_params = []
18
+ all_params << task_params unless task_params.nil?
19
+ all_params << step_params unless step_params.nil?
20
+
21
+ #puts "bbb #{all_params.flatten}"
22
+
23
+ project = Yadecli::Client::ProjectClient.new.get(project_module.projectId)
24
+
25
+ cmd = "mvn -B -s #{project.home}/conf/settings.xml "
26
+ cmd += "-P#{all_profiles.flatten.join(',')}" if all_profiles.size.positive?
27
+
28
+ cmd += " #{maven_build_step.command} "
29
+
30
+ all_params.flatten.map { |p| cmd += " -D#{p}" } if all_params.size.positive?
31
+
32
+ cmd
33
+ end
34
+
35
+ end
@@ -1,3 +1,3 @@
1
1
  module Yadecli
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
data/lib/yadecli.rb CHANGED
@@ -1,23 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'yade/common/common'
4
+ require 'yade/domain/rest/client'
5
+ require 'yade/project/rest/client'
6
+ require 'yade/composer/rest/client'
7
+
3
8
  require 'yadecli/version'
4
- require 'yadecli/config/app_config'
5
- require 'yadecli/model/project'
6
- require 'yadecli/model/project_module'
7
- require 'yadecli/model/host'
8
- require 'yadecli/model/domain'
9
- require 'yadecli/model/role'
10
- require 'yadecli/model/vcs'
11
- require 'yadecli/model/composer_project'
12
- require 'yadecli/model/composer_service'
13
- require 'yadecli/model/composer_container'
14
- require 'yadecli/model/maven_build_task'
15
- require 'yadecli/model/maven_build_step'
16
- require 'yadecli/model/sdk_package'
17
- require 'yadecli/model/rvm_runtime'
18
- require 'yadecli/model/nvm_runtime'
19
- require 'yadecli/model/pyenv_runtime'
20
- require 'yadecli/model/ide_type'
21
9
  require 'yadecli/model/installation_status'
22
10
  require 'yadecli/model/git_status'
23
11
  require 'yadecli/util/cli_util'
@@ -27,37 +15,46 @@ require 'yadecli/util/sdk_util'
27
15
  require 'yadecli/util/rvm_util'
28
16
  require 'yadecli/util/nvm_util'
29
17
  require 'yadecli/util/pyenv_util'
18
+ require 'yadecli/util/maven_util'
30
19
  require 'yadecli/cli/host'
31
20
  require 'yadecli/cli/composer'
32
21
  require 'yadecli/cli/project'
33
22
  require 'yadecli/cli/module'
34
23
  require 'yadecli/cli/task'
35
24
  require 'yadecli/cli/application'
36
- require 'yadecli/client/authentication_client'
37
- require 'yadecli/client/project_client'
38
- require 'yadecli/client/project_module_client'
39
- require 'yadecli/client/host_client'
40
- require 'yadecli/client/domain_client'
41
- require 'yadecli/client/role_client'
42
- require 'yadecli/client/vcs_client'
43
- require 'yadecli/client/maven_build_task_client'
44
- require 'yadecli/client/maven_build_step_client'
45
- require 'yadecli/client/composer_project_client'
46
- require 'yadecli/client/composer_service_client'
47
- require 'yadecli/client/composer_container_client'
48
- require 'yadecli/client/sdk_package_client'
49
- require 'yadecli/client/rvm_runtime_client'
50
- require 'yadecli/client/nvm_runtime_client'
51
- require 'yadecli/client/pyenv_runtime_client'
25
+ require 'yadecli/cli/response/project_start_response'
52
26
  require 'yadecli/client/gitlab_client'
53
- require 'yadecli/service/connect_service'
54
- require 'yadecli/service/authentication_service'
55
- require 'yadecli/service/project_service'
56
- require 'yadecli/service/module_service'
57
- require 'yadecli/service/host_service'
58
- require 'yadecli/service/build_task_service'
59
- require 'yadecli/service/build_step_service'
60
- require 'yadecli/service/composer_service'
27
+
28
+ require 'yadecli/command/connect_command'
29
+ require 'yadecli/command/login_command'
30
+ require 'yadecli/command/host/host_list_command'
31
+ require 'yadecli/command/host/host_bootstrap_command'
32
+ require 'yadecli/command/host/host_provision_command'
33
+ require 'yadecli/command/project/project_list_command'
34
+ require 'yadecli/command/project/project_install_command'
35
+ require 'yadecli/command/project/project_uninstall_command'
36
+ require 'yadecli/command/project/project_setup_command'
37
+ require 'yadecli/command/project/project_start_command'
38
+ require 'yadecli/command/module/module_list_command'
39
+ require 'yadecli/command/module/module_install_command'
40
+ require 'yadecli/command/composer/composer_setup_command'
41
+ require 'yadecli/command/composer/composer_list_command'
42
+ require 'yadecli/command/composer/composer_install_command'
43
+ require 'yadecli/command/composer/composer_switch_command'
44
+ require 'yadecli/command/composer/composer_uninstall_command'
45
+ require 'yadecli/command/composer/composer_start_command'
46
+ require 'yadecli/command/composer/composer_stop_command'
47
+ require 'yadecli/command/composer/composer_log_command'
48
+ require 'yadecli/command/task/task_list_command'
49
+
50
+ #require 'yadecli/service/connect_service'
51
+ #require 'yadecli/service/authentication_service'
52
+ #require 'yadecli/service/project_service'
53
+ #require 'yadecli/service/module_service'
54
+ #require 'yadecli/service/host_service'
55
+ #require 'yadecli/service/build_task_service'
56
+ #require 'yadecli/service/build_step_service'
57
+ #require 'yadecli/service/composer_service'
61
58
  require 'yadecli/io/user_input'
62
59
 
63
60
  # yadecli