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
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'httparty'
4
- require 'logger'
5
- require 'yadecli/client/base_client'
6
-
7
- # yadecli cli
8
- module Yadecli
9
- module Client
10
-
11
- # domain client
12
- class SdkPackageClient < BaseClient
13
- include HTTParty
14
- #logger ::Logger.new(STDOUT), :debug
15
-
16
- base_uri AppConfig[:url]
17
-
18
- def initialize
19
- super('yadeproject', 'sdk-package')
20
- end
21
-
22
- # get sdk packages for project with id
23
- def sdk_packages_for_project(project_id)
24
- list.select { |sdk_package| sdk_package.projectId == project_id }
25
- end
26
- end
27
- end
28
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'httparty'
4
- require 'logger'
5
- require 'yadecli/client/base_client'
6
-
7
- # yadecli cli
8
- module Yadecli
9
- module Client
10
-
11
- # vcs client
12
- class VcsClient < BaseClient
13
- include HTTParty
14
- #logger ::Logger.new(STDOUT), :debug
15
-
16
- base_uri AppConfig[:url]
17
-
18
- def initialize
19
- super('yadeproject', 'vcs')
20
- end
21
- end
22
- end
23
- end
@@ -1,70 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'settingslogic'
4
-
5
- class AppConfig < Settingslogic
6
-
7
- @@yade_home = File.join(File.expand_path('~'), '.yade')
8
- @@config_path = File.join(@@yade_home, 'config.yml')
9
-
10
- @@composer_home = File.join(File.expand_path('~'), 'yade', 'composer')
11
-
12
- source File.join(@@config_path)
13
-
14
- class << self
15
- attr_accessor :yade_home, :config_path, :composer_home
16
- end
17
-
18
- def self.load!
19
- if no_config_file?
20
- $stderr.puts <<-HELP
21
- ******** You haven't set up your Yade settings file. **********
22
- Please do the following:
23
- 1. Create the yade base directory and download the application.yml example:
24
- mkdir -p ~/.yade
25
- cd ~/.yade
26
- curl --header 'PRIVATE-TOKEN: <your token>' \
27
- 'http://gitlab.dzbw.de/client/v4/projects/366/repository/files/application%2Eyml%2Eexample/raw?ref=master' \
28
- -o config.yml
29
- 2. Have a look at the settings in that file and change it according to your needs.
30
- HELP
31
- Process.exit(1)
32
- end
33
-
34
- super
35
-
36
- end
37
-
38
- # no config
39
- def self.no_config_file?
40
- !File.exists?(@source)
41
- end
42
-
43
- load!
44
-
45
- def self.[](key)
46
- return @@yade_home if key == :yade_home
47
- return @@config_path if key == :config_path
48
- return @@composer_home if key == :composer_home
49
- super
50
- end
51
-
52
- def self.write!
53
- d = YAML.load_file(@@config_path)
54
-
55
- d['url'] = self.url
56
- d['auth_url'] = self.auth_url
57
- d['username'] = self.username
58
- d['password'] = self.password
59
- d['access_token'] = self.access_token
60
- d['refresh_token'] = self.refresh_token
61
- d['expiration_time'] = self.expiration_time
62
- d['git_api_url'] = self.git_api_url
63
- d['git_username'] = self.git_username
64
- d['git_password'] = self.git_password
65
- d['git_token'] = self.git_token
66
-
67
- File.open(@@config_path, 'w') { |f| f.write d.to_yaml }
68
- end
69
-
70
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # Project
6
- class ComposerContainer
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :name, :composerServiceId
12
-
13
- validates_presence_of 'id', 'name', 'composerServiceId'
14
-
15
- def attributes
16
- instance_values
17
- end
18
-
19
- end
@@ -1,37 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
- require 'uri'
5
-
6
- # Project
7
- class ComposerProject
8
- include ActiveModel::Model
9
- include ActiveModel::Validations
10
- include ActiveModel::Serializers::JSON
11
-
12
- attr_accessor :id, :name, :gitUrl
13
-
14
- validates_presence_of 'id', 'name', 'gitUrl'
15
-
16
- def attributes
17
- instance_values
18
- end
19
-
20
- def install_dir
21
- "#{AppConfig[:composer_home]}/#{name}"
22
- end
23
-
24
- def installed?
25
- File.directory?("#{AppConfig[:composer_home]}/#{name}")
26
- end
27
-
28
- def uninstall
29
- FileUtils.rm_rf("#{AppConfig[:composer_home]}/#{name}")
30
- end
31
-
32
- def git_repo_name
33
- uri = URI(gitUrl)
34
-
35
- uri.path.split('/').last.split('.').first
36
- end
37
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # Project
6
- class ComposerService
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :name, :title, :enabled, :requiredEnvs, :composerProjectId
12
-
13
- validates_presence_of 'id', 'name', 'title', 'composerProjectId'
14
-
15
- def attributes
16
- instance_values
17
- end
18
-
19
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # Domain
6
- class Domain
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :name
12
-
13
- validates_presence_of 'id', 'name'
14
-
15
- def attributes=(hash)
16
- hash.each do |key, value|
17
- send("#{key}=", value)
18
- end
19
- end
20
-
21
- def attributes
22
- instance_values
23
- end
24
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # Host
6
- class Host
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :name, :hostName, :ip, :datacenter, :zone, :environmentType, :osType, :isMaster, :domainId, :roleId
12
-
13
- validates_presence_of 'id', 'name', 'hostName', 'ip', 'datacenter', 'zone', 'environmentType', 'osType', 'domainId', 'roleId'
14
-
15
- def attributes=(hash)
16
- hash.each do |key, value|
17
- send("#{key}=", value)
18
- end
19
- end
20
-
21
- def attributes
22
- instance_values
23
- end
24
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # installation status
4
- class IdeType
5
- RUBYMINE = 'mine'
6
- IDEA = 'idea'
7
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # MavenBuildStep
6
- class MavenBuildStep
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :command, :profiles, :parameters, :mavenBuildTaskId
12
-
13
- validates_presence_of 'id', 'command', 'mavenBuildTaskId'
14
-
15
- def attributes
16
- instance_values
17
- end
18
-
19
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # MavenBuildTask
6
- class MavenBuildTask
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :name, :desc, :profiles, :parameters, :projectModuleId
12
-
13
- validates_presence_of 'id', 'name', 'projectModuleId'
14
-
15
- def attributes
16
- instance_values
17
- end
18
-
19
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # NvmRuntime
6
- class NvmRuntime
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :version, :packages
12
-
13
- validates_presence_of 'id', 'version',
14
-
15
- def attributes
16
- instance_values
17
- end
18
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # Project
6
- class Project
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :name, :ideType, :vcsId, :nvmRuntimeId, :rvmRuntimeId, :pyenvRuntimeId
12
-
13
- validates_presence_of 'id', 'name', 'ideType', 'vcsId'
14
-
15
- def attributes
16
- instance_values
17
- end
18
-
19
- def home
20
- "#{File.expand_path('~')}/yade/projects/#{name}"
21
- end
22
-
23
- def installed?
24
- File.directory?(home)
25
- end
26
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # Module
6
- class ProjectModule
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :name, :enabled, :languageType, :buildToolType, :vcsId, :projectId
12
-
13
- validates_presence_of 'id', 'name', 'languageType', 'buildToolType', 'vcsId', 'projectId'
14
-
15
- def attributes
16
- instance_values
17
- end
18
-
19
- def home
20
- project_client = Yadecli::Client::ProjectClient.new
21
- project = project_client.get(projectId)
22
-
23
- "#{project.home}/src/#{name}"
24
- end
25
-
26
- def installed?
27
- File.directory?(home)
28
- end
29
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # PyenvRuntime
6
- class PyenvRuntime
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :version, :packages
12
-
13
- validates_presence_of 'id', 'version',
14
-
15
- def attributes
16
- instance_values
17
- end
18
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # Role
6
- class Role
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :name
12
-
13
- validates_presence_of 'id', 'name'
14
-
15
- def attributes=(hash)
16
- hash.each do |key, value|
17
- send("#{key}=", value)
18
- end
19
- end
20
-
21
- def attributes
22
- instance_values
23
- end
24
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # RvmRuntime
6
- class RvmRuntime
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :version, :packages
12
-
13
- validates_presence_of 'id', 'version',
14
-
15
- def attributes
16
- instance_values
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # SdkPackage
6
- class SdkPackage
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :name, :projectId, :version
12
-
13
- validates_presence_of 'id', 'name', 'projectId', 'version'
14
-
15
- def attributes
16
- instance_values
17
- end
18
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_model'
4
-
5
- # Vcs
6
- class Vcs
7
- include ActiveModel::Model
8
- include ActiveModel::Validations
9
- include ActiveModel::Serializers::JSON
10
-
11
- attr_accessor :id, :vcsType, :url
12
-
13
- validates_presence_of 'id', 'vcsType', 'url'
14
-
15
- def attributes
16
- instance_values
17
- end
18
-
19
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # yadecli cli
4
- module Yadecli
5
- module Service
6
-
7
- # connect
8
- class AuthenticationService
9
-
10
- def initialize
11
- @authentication_client = Yadecli::Client::AuthenticationClient.new
12
- end
13
-
14
- def login(auth_url, username, password)
15
- CliUtil.print_header('Yade Login',
16
- ["Going to log in user #{username}, password: *** against uaa at #{auth_url}", ''])
17
-
18
- response = @authentication_client.request_token(auth_url, username, password)
19
-
20
- AppConfig[:auth_url] = auth_url
21
- AppConfig[:username] = username
22
- AppConfig[:password] = password
23
- AppConfig[:access_token] = response['access_token']
24
- AppConfig[:refresh_token] = response['refresh_token']
25
- AppConfig[:expiration_time] = Time.now + response['expires_in']
26
-
27
- AppConfig.write!
28
- end
29
- end
30
- end
31
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # yadecli cli
4
- module Yadecli
5
- module Service
6
-
7
- # list
8
- class BuildStepService
9
-
10
- def initialize
11
- @maven_build_step_client = Yadecli::Client::MavenBuildStepClient.new
12
- end
13
-
14
- # build
15
- def maven_build_steps
16
- @maven_build_step_client.list
17
- end
18
-
19
- def maven_build_steps_for_task(maven_build_task_id)
20
- maven_build_steps.select {|mbs| mbs.mavenBuildTaskId == maven_build_task_id}
21
- end
22
- end
23
- end
24
- end
@@ -1,70 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # yadecli cli
4
- module Yadecli
5
- module Service
6
-
7
- # list
8
- class BuildTaskService
9
-
10
- def initialize
11
- @module_client = Yadecli::Client::ProjectModuleClient.new
12
- @maven_build_task_client = Yadecli::Client::MavenBuildTaskClient.new
13
- @maven_build_step_service = Yadecli::Service::BuildStepService.new
14
- end
15
-
16
- # build
17
- def maven_build_tasks
18
- @maven_build_task_client.list
19
- end
20
-
21
- def list(module_name = nil)
22
- CliUtil.print_header'YadeCli Tasks List',
23
- ['Going to list Yade tasks', '']
24
-
25
- puts 'You can run any of these tasks with `yade task run <name>`'
26
- puts ''
27
-
28
- if module_name
29
- tasks_to_list = maven_build_tasks.select do |mbt|
30
- tmodule = @module_client.get(mbt.moduleId)
31
- tmodule.name == module_name
32
- end
33
- else
34
- tasks_to_list = maven_build_tasks
35
- end
36
-
37
- tasks_to_list.each do |maven_build_task|
38
-
39
- tmodule = @module_client.get(maven_build_task.moduleId)
40
-
41
- print "Task: #{maven_build_task.name}".colorize(:mode => :bold)
42
- puts " - #{maven_build_task.desc}"
43
- puts " ▶ Module : #{tmodule.name}"
44
- puts " ▶ Profiles : #{maven_build_task.profiles}"
45
- puts " ▶ Parameters: #{maven_build_task.parameters}"
46
-
47
- puts ''
48
- puts 'Build Steps:'
49
-
50
- maven_build_steps = @maven_build_step_service.maven_build_steps_for_task(maven_build_task.id)
51
-
52
- rows = []
53
- maven_build_steps.each do |mbs|
54
- profiles = mbs.profiles || '-'
55
- command = mbs.command
56
- parameters = mbs.parameters || '-'
57
-
58
- rows << [profiles, command, parameters]
59
- end
60
-
61
- table = TTY::Table.new header: ['Profiles', 'Command', 'Parameters'], rows: rows
62
-
63
- puts table.render(:ascii, width: 80, resize: true, padding: [0, 1])
64
- puts ''
65
- end
66
- end
67
-
68
- end
69
- end
70
- end