yadecli 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.gitignore +13 -0
  4. data/.rspec +3 -0
  5. data/.travis.yml +7 -0
  6. data/CODE_OF_CONDUCT.md +74 -0
  7. data/Gemfile +6 -0
  8. data/Gemfile.lock +172 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +43 -0
  11. data/Rakefile +13 -0
  12. data/bin/yadecli +10 -0
  13. data/config-example.yml +14 -0
  14. data/lib/.DS_Store +0 -0
  15. data/lib/yadecli/.DS_Store +0 -0
  16. data/lib/yadecli/cli/application.rb +40 -0
  17. data/lib/yadecli/cli/composer.rb +68 -0
  18. data/lib/yadecli/cli/host.rb +28 -0
  19. data/lib/yadecli/cli/module.rb +24 -0
  20. data/lib/yadecli/cli/project.rb +42 -0
  21. data/lib/yadecli/cli/task.rb +21 -0
  22. data/lib/yadecli/client/authentication_client.rb +24 -0
  23. data/lib/yadecli/client/base_client.rb +78 -0
  24. data/lib/yadecli/client/composer_container_client.rb +27 -0
  25. data/lib/yadecli/client/composer_project_client.rb +27 -0
  26. data/lib/yadecli/client/composer_service_client.rb +27 -0
  27. data/lib/yadecli/client/domain_client.rb +23 -0
  28. data/lib/yadecli/client/host_client.rb +45 -0
  29. data/lib/yadecli/client/maven_build_step_client.rb +23 -0
  30. data/lib/yadecli/client/maven_build_task_client.rb +23 -0
  31. data/lib/yadecli/client/nvm_runtime_client.rb +23 -0
  32. data/lib/yadecli/client/project_client.rb +28 -0
  33. data/lib/yadecli/client/project_module_client.rb +35 -0
  34. data/lib/yadecli/client/pyenv_runtime_client.rb +23 -0
  35. data/lib/yadecli/client/role_client.rb +23 -0
  36. data/lib/yadecli/client/rvm_runtime_client.rb +23 -0
  37. data/lib/yadecli/client/sdk_package_client.rb +28 -0
  38. data/lib/yadecli/client/vcs_client.rb +23 -0
  39. data/lib/yadecli/config/app_config.rb +69 -0
  40. data/lib/yadecli/io/user_input.rb +21 -0
  41. data/lib/yadecli/model/composer_container.rb +19 -0
  42. data/lib/yadecli/model/composer_project.rb +30 -0
  43. data/lib/yadecli/model/composer_service.rb +19 -0
  44. data/lib/yadecli/model/domain.rb +24 -0
  45. data/lib/yadecli/model/git_status.rb +8 -0
  46. data/lib/yadecli/model/host.rb +24 -0
  47. data/lib/yadecli/model/ide_type.rb +7 -0
  48. data/lib/yadecli/model/installation_status.rb +7 -0
  49. data/lib/yadecli/model/maven_build_step.rb +19 -0
  50. data/lib/yadecli/model/maven_build_task.rb +19 -0
  51. data/lib/yadecli/model/nvm_runtime.rb +18 -0
  52. data/lib/yadecli/model/project.rb +26 -0
  53. data/lib/yadecli/model/project_module.rb +29 -0
  54. data/lib/yadecli/model/pyenv_runtime.rb +18 -0
  55. data/lib/yadecli/model/role.rb +24 -0
  56. data/lib/yadecli/model/rvm_runtime.rb +18 -0
  57. data/lib/yadecli/model/sdk_package.rb +18 -0
  58. data/lib/yadecli/model/vcs.rb +19 -0
  59. data/lib/yadecli/service/authentication_service.rb +31 -0
  60. data/lib/yadecli/service/build_step_service.rb +24 -0
  61. data/lib/yadecli/service/build_task_service.rb +70 -0
  62. data/lib/yadecli/service/composer_service.rb +395 -0
  63. data/lib/yadecli/service/connect_service.rb +19 -0
  64. data/lib/yadecli/service/host_service.rb +191 -0
  65. data/lib/yadecli/service/module_service.rb +78 -0
  66. data/lib/yadecli/service/project_service.rb +198 -0
  67. data/lib/yadecli/util/cli_util.rb +22 -0
  68. data/lib/yadecli/util/file_util.rb +46 -0
  69. data/lib/yadecli/util/nvm_util.rb +14 -0
  70. data/lib/yadecli/util/pyenv_util.rb +14 -0
  71. data/lib/yadecli/util/rvm_util.rb +38 -0
  72. data/lib/yadecli/util/sdk_util.rb +23 -0
  73. data/lib/yadecli/util/system_util.rb +22 -0
  74. data/lib/yadecli/version.rb +3 -0
  75. data/lib/yadecli.rb +69 -0
  76. data/scripts/nvm-install-node.sh +6 -0
  77. data/scripts/rvm-gemset-import.sh +8 -0
  78. data/scripts/rvm-install-ruby.sh +6 -0
  79. data/scripts/sdk-install-candidate.sh +6 -0
  80. data/scripts/setup-terminal.sh +3 -0
  81. data/scripts/start-ide.sh +3 -0
  82. data/yadecli.gemspec +55 -0
  83. metadata +379 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f44efa06d628222cc22d2209325595d1d989fd84d1cf4519606bf1f2a969835d
4
+ data.tar.gz: 57e0eb1a64a8c43d3968a9362b8dda2e01d0663a85621655a2d5b47beba0154a
5
+ SHA512:
6
+ metadata.gz: 4cc1a89229a77be4f5ce1dc9e04bc226a91f81f0863bbd6f43e2514f68626358aefcd5b0eff3b8778244210a5aa6283695820a4507545c63ee09644ddd09f234
7
+ data.tar.gz: 74202ff8a40779cd487ff6fe0d409dcc8eeb4d3c511ca6d5e4116620bb0c42a0624eb9f73c30c84ec59d11e05f770ec67992e841c925157b27b379a86e8705b9
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ *.log
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.4.4
7
+ before_install: gem install bundler -v 1.16.3
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at seba1403@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in yadecli.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,172 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ yadecli (0.1.1)
5
+ activemodel (~> 5.2)
6
+ artii (~> 2.1)
7
+ colorize (~> 0.8)
8
+ dotenv (~> 2.5)
9
+ httparty (~> 0.13)
10
+ net-ssh (~> 5.0)
11
+ rest-client (~> 2.0)
12
+ settingslogic (~> 2.0)
13
+ thor (~> 0.19)
14
+ tty-command (~> 0.8)
15
+ tty-prompt (~> 0.16)
16
+ tty-table (~> 0.10)
17
+
18
+ GEM
19
+ remote: https://rubygems.org/
20
+ specs:
21
+ activemodel (5.2.1)
22
+ activesupport (= 5.2.1)
23
+ activesupport (5.2.1)
24
+ concurrent-ruby (~> 1.0, >= 1.0.2)
25
+ i18n (>= 0.7, < 2)
26
+ minitest (~> 5.1)
27
+ tzinfo (~> 1.1)
28
+ artii (2.1.2)
29
+ aruba (0.14.6)
30
+ childprocess (>= 0.6.3, < 0.10.0)
31
+ contracts (~> 0.9)
32
+ cucumber (>= 1.3.19)
33
+ ffi (~> 1.9.10)
34
+ rspec-expectations (>= 2.99)
35
+ thor (~> 0.19)
36
+ ast (2.4.0)
37
+ backports (3.11.3)
38
+ builder (3.2.3)
39
+ childprocess (0.9.0)
40
+ ffi (~> 1.0, >= 1.0.11)
41
+ colorize (0.8.1)
42
+ concurrent-ruby (1.0.5)
43
+ contracts (0.16.0)
44
+ cucumber (3.1.2)
45
+ builder (>= 2.1.2)
46
+ cucumber-core (~> 3.2.0)
47
+ cucumber-expressions (~> 6.0.1)
48
+ cucumber-wire (~> 0.0.1)
49
+ diff-lcs (~> 1.3)
50
+ gherkin (~> 5.1.0)
51
+ multi_json (>= 1.7.5, < 2.0)
52
+ multi_test (>= 0.1.2)
53
+ cucumber-core (3.2.0)
54
+ backports (>= 3.8.0)
55
+ cucumber-tag_expressions (~> 1.1.0)
56
+ gherkin (>= 5.0.0)
57
+ cucumber-expressions (6.0.1)
58
+ cucumber-tag_expressions (1.1.1)
59
+ cucumber-wire (0.0.1)
60
+ diff-lcs (1.3)
61
+ domain_name (0.5.20180417)
62
+ unf (>= 0.0.5, < 1.0.0)
63
+ dotenv (2.5.0)
64
+ equatable (0.5.0)
65
+ ffi (1.9.25)
66
+ gherkin (5.1.0)
67
+ hitimes (1.3.0)
68
+ http-cookie (1.0.3)
69
+ domain_name (~> 0.5)
70
+ httparty (0.16.2)
71
+ multi_xml (>= 0.5.2)
72
+ i18n (1.1.0)
73
+ concurrent-ruby (~> 1.0)
74
+ jaro_winkler (1.5.1)
75
+ mime-types (3.2.2)
76
+ mime-types-data (~> 3.2015)
77
+ mime-types-data (3.2018.0812)
78
+ minitest (5.11.3)
79
+ multi_json (1.13.1)
80
+ multi_test (0.1.2)
81
+ multi_xml (0.6.0)
82
+ necromancer (0.4.0)
83
+ net-ssh (5.0.2)
84
+ netrc (0.11.0)
85
+ parallel (1.12.1)
86
+ parser (2.5.1.2)
87
+ ast (~> 2.4.0)
88
+ pastel (0.7.2)
89
+ equatable (~> 0.5.0)
90
+ tty-color (~> 0.4.0)
91
+ powerpack (0.1.2)
92
+ rainbow (3.0.0)
93
+ rake (10.5.0)
94
+ rest-client (2.0.2)
95
+ http-cookie (>= 1.0.2, < 2.0)
96
+ mime-types (>= 1.16, < 4.0)
97
+ netrc (~> 0.8)
98
+ rspec (3.8.0)
99
+ rspec-core (~> 3.8.0)
100
+ rspec-expectations (~> 3.8.0)
101
+ rspec-mocks (~> 3.8.0)
102
+ rspec-core (3.8.0)
103
+ rspec-support (~> 3.8.0)
104
+ rspec-expectations (3.8.1)
105
+ diff-lcs (>= 1.2.0, < 2.0)
106
+ rspec-support (~> 3.8.0)
107
+ rspec-json_expectations (2.1.0)
108
+ rspec-mocks (3.8.0)
109
+ diff-lcs (>= 1.2.0, < 2.0)
110
+ rspec-support (~> 3.8.0)
111
+ rspec-support (3.8.0)
112
+ rubocop (0.58.2)
113
+ jaro_winkler (~> 1.5.1)
114
+ parallel (~> 1.10)
115
+ parser (>= 2.5, != 2.5.1.1)
116
+ powerpack (~> 0.1)
117
+ rainbow (>= 2.2.2, < 4.0)
118
+ ruby-progressbar (~> 1.7)
119
+ unicode-display_width (~> 1.0, >= 1.0.1)
120
+ ruby-progressbar (1.10.0)
121
+ settingslogic (2.0.9)
122
+ strings (0.1.2)
123
+ unicode-display_width (~> 1.4.0)
124
+ unicode_utils (~> 1.4.0)
125
+ thor (0.20.0)
126
+ thread_safe (0.3.6)
127
+ timers (4.1.2)
128
+ hitimes
129
+ tty-color (0.4.3)
130
+ tty-command (0.8.2)
131
+ pastel (~> 0.7.0)
132
+ tty-cursor (0.6.0)
133
+ tty-prompt (0.17.0)
134
+ necromancer (~> 0.4.0)
135
+ pastel (~> 0.7.0)
136
+ timers (~> 4.0)
137
+ tty-cursor (~> 0.6.0)
138
+ tty-reader (~> 0.4.0)
139
+ tty-reader (0.4.0)
140
+ tty-cursor (~> 0.6.0)
141
+ tty-screen (~> 0.6.4)
142
+ wisper (~> 2.0.0)
143
+ tty-screen (0.6.5)
144
+ tty-table (0.10.0)
145
+ equatable (~> 0.5.0)
146
+ necromancer (~> 0.4.0)
147
+ pastel (~> 0.7.2)
148
+ strings (~> 0.1.0)
149
+ tty-screen (~> 0.6.4)
150
+ tzinfo (1.2.5)
151
+ thread_safe (~> 0.1)
152
+ unf (0.1.4)
153
+ unf_ext
154
+ unf_ext (0.0.7.5)
155
+ unicode-display_width (1.4.0)
156
+ unicode_utils (1.4.0)
157
+ wisper (2.0.0)
158
+
159
+ PLATFORMS
160
+ ruby
161
+
162
+ DEPENDENCIES
163
+ aruba (~> 0.14)
164
+ bundler (~> 1.16)
165
+ rake (~> 10.0)
166
+ rspec (~> 3.0)
167
+ rspec-json_expectations (~> 2.1)
168
+ rubocop (~> 0.58.0)
169
+ yadecli!
170
+
171
+ BUNDLED WITH
172
+ 1.16.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Sebastian Freund
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Yadecli
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/yadecli`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'yadecli'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install yadecli
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yadecli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Yadecli project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/yadecli/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'cucumber/rake/task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ Cucumber::Rake::Task.new(:feature) do |t|
10
+ t.cucumber_opts = %w{--format progress}
11
+ end
12
+
13
+ task :default => [:feature, :spec]
data/bin/yadecli ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require 'yadecli'
6
+
7
+ logfile_path = "#{Dir.pwd}/yadecli.log"
8
+ File.delete(logfile_path) if File.exist?(logfile_path)
9
+
10
+ Yadecli::Cli::Application.start(ARGV)
@@ -0,0 +1,14 @@
1
+ ---
2
+ url: http://<yade-gateway-host>:8080
3
+ auth_url: http://<yade-uaa-host>:9999
4
+ username: user
5
+ password: user
6
+ access_token: some_realy_long_access_token
7
+ refresh_token: some_realy_long_refresh_token
8
+ expiration_time: 2018-08-28 17:34:08.775486917 +02:00
9
+ git_username: your_git_username
10
+ git_password: your_git_password
11
+ git_token: your_git_token
12
+ docker_registry_url: registry.gitlab.example.com:5000
13
+ docker_registry_username: your_registry_username
14
+ docker_registry_password: your_registry_password
data/lib/.DS_Store ADDED
Binary file
Binary file
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+
5
+ # Yadecli Cli Application
6
+ module Yadecli
7
+ module Cli
8
+
9
+ # Application
10
+ class Application < Thor
11
+
12
+ class_option 'verbose', type: :boolean, default: false
13
+
14
+ desc 'connect NAME', 'Connect to a yade backend'
15
+ def connect(url)
16
+ Yadecli::Service::ConnectService.new.connect url
17
+ end
18
+
19
+ desc 'login AUTH_URL USERNAME PASSWORD', 'Login to a yade'
20
+ def login(auth_url, username, password)
21
+ Yadecli::Service::AuthenticationService.new.login auth_url, username, password
22
+ end
23
+
24
+ desc 'host TYPE', 'Manage hosts'
25
+ subcommand 'host', Yadecli::Cli::Host
26
+
27
+ desc 'project TYPE', 'Manage projects'
28
+ subcommand 'project', Yadecli::Cli::Project
29
+
30
+ desc 'module TYPE', 'Manage modules'
31
+ subcommand 'module', Yadecli::Cli::Module
32
+
33
+ desc 'task TYPE', 'Manage build tasks'
34
+ subcommand 'task', Yadecli::Cli::Task
35
+
36
+ desc 'composer TYPE', 'Manage composer projects'
37
+ subcommand 'composer', Yadecli::Cli::Composer
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+
5
+ module Yadecli
6
+ module Cli
7
+
8
+ # composer
9
+ class Composer < Thor
10
+
11
+ # setup command
12
+ desc 'setup', 'Setup yade composer on this host'
13
+ def setup
14
+ Yadecli::Service::ComposerService.new.setup
15
+ end
16
+
17
+ # list command
18
+ desc 'list', 'List the available Yade composer projects'
19
+ def list
20
+ Yadecli::Service::ComposerService.new.list
21
+ end
22
+
23
+ # install command
24
+ desc 'install', 'Install a Yade composer project'
25
+ method_option :clean, default: false, aliases: '-c', desc: 'Clean install, will delete a existing composer project'
26
+ method_option :yes, default: false, aliases: '-y', desc: 'Will answer yes to all questions, This will run a git pull on installed projects without asking'
27
+ method_option :pull, default: false, aliases: '-p', desc: 'Will run a git pull on a already installed project'
28
+ def install(name)
29
+ Yadecli::Service::ComposerService.new.install(name, options)
30
+ end
31
+
32
+ # switch branch command
33
+ desc 'switch', 'Switch the branch of a installed Composer project'
34
+ method_option :pull, default: false, aliases: '-p', desc: 'Will run a git pull after switching the branch'
35
+ def switch(project_name, target_branch)
36
+ Yadecli::Service::ComposerService.new.switch(project_name, target_branch, options)
37
+ end
38
+
39
+ # uninstall command
40
+ desc 'uninstall', 'Uninstall a Yade composer project'
41
+ method_option :yes, default: false, aliases: '-y', desc: 'Will answer yes to all questions, This will uninstall the project without asking'
42
+ def uninstall(name)
43
+ Yadecli::Service::ComposerService.new.uninstall(name, options)
44
+ end
45
+
46
+ # start command
47
+ desc 'start', 'Start a Yade Composer service'
48
+ def start(project_name = nil, service_name = nil)
49
+ Yadecli::Service::ComposerService.new.start_service(project_name, service_name)
50
+ end
51
+
52
+ # stop command
53
+ desc 'stop', 'Stop a Yade Composer service'
54
+ method_option :rm, default: false, aliases: '-r', desc: 'Remoce the docker container after stopping'
55
+ method_option :down, default: false, aliases: '-r', desc: 'Run docker-compose down -v'
56
+ def stop(project_name = nil, service_name = nil)
57
+ Yadecli::Service::ComposerService.new.stop_service(project_name, service_name, options)
58
+ end
59
+
60
+ # log container output of service
61
+ desc 'log', 'Stop a Yade Composer service'
62
+ method_option :follow, default: false, aliases: '-f', desc: 'Log the docker containers output of the service'
63
+ def log(project_name, service_name)
64
+ Yadecli::Service::ComposerService.new.log_service(project_name, service_name, options)
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+
5
+ module Yadecli
6
+ module Cli
7
+
8
+ # Build
9
+ class Host < Thor
10
+
11
+ desc 'list', 'List available Yade hosts'
12
+ def list
13
+ Yadecli::Service::HostService.new.list
14
+ end
15
+
16
+ desc 'bootstrap', 'Bootstrap a Yade host to prepare it for provisioning'
17
+ method_option :setup, default: true, aliases: '-s', desc: 'Setup Yade bootstrap repository on host and install plugins'
18
+ def bootstrap(host_fqdn)
19
+ Yadecli::Service::HostService.new.bootstrap(host_fqdn, options)
20
+ end
21
+
22
+ desc 'provision', 'Provision a Yade host'
23
+ def provision(host_fqdn)
24
+ Yadecli::Service::HostService.new.provision(host_fqdn, options)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+
5
+ module Yadecli
6
+ module Cli
7
+
8
+ # Build
9
+ class Module < Thor
10
+
11
+ desc 'list', 'List available modules'
12
+ def list(project_name)
13
+ Yadecli::Service::ModuleService.new.list(project_name)
14
+ end
15
+
16
+ desc 'install', 'Install a module for the project given by name'
17
+ method_option :yes, aliases: '-y', desc: 'Answering yes to all question, will do a update if module already installed'
18
+ def install(project_name, module_name)
19
+ Yadecli::Service::ModuleService.new.install(project_name, module_name, options)
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+
5
+ module Yadecli
6
+ module Cli
7
+
8
+ # Build
9
+ class Project < Thor
10
+
11
+ desc 'list', 'List available projects'
12
+ def list
13
+ Yadecli::Service::ProjectService.new.list
14
+ end
15
+
16
+ desc 'install', 'Install a project'
17
+ method_option :yes, aliases: '-y', desc: 'Answering yes to all question, will do a update if project already installed'
18
+ def install(project_name)
19
+ Yadecli::Service::ProjectService.new.install(project_name, options)
20
+ end
21
+
22
+ desc 'uninstall', 'Uninstall a project'
23
+ method_option :yes, aliases: '-y', desc: 'Answering yes to all question, will do a unattended uninstall'
24
+ def uninstall(project_name)
25
+ Yadecli::Service::ProjectService.new.uninstall(project_name, options)
26
+ end
27
+
28
+ desc 'setup', 'Setup a project'
29
+ #method_option :yes, aliases: '-y', desc: 'Answering yes to all question, will do a unattended uninstall'
30
+ def setup(project_name)
31
+ Yadecli::Service::ProjectService.new.setup(project_name, options)
32
+ end
33
+
34
+ desc 'start', 'Start a project'
35
+ #method_option :yes, aliases: '-y', desc: 'Answering yes to all question, will do a unattended uninstall'
36
+ def start(project_name)
37
+ Yadecli::Service::ProjectService.new.start(project_name, options)
38
+ end
39
+
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+
5
+ module Yadecli
6
+ module Cli
7
+ # Build
8
+ class Task < Thor
9
+
10
+ desc 'list', 'List the available tasks of a xxx'
11
+ def list(module_name = nil)
12
+ Yadecli::Service::BuildTaskService.new.list(module_name)
13
+ end
14
+
15
+ # desc 'pdf', 'Build html output'
16
+ # def pdf
17
+ # p 'Building pdf...'
18
+ # end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'httparty'
4
+
5
+ # yadecli cli
6
+ module Yadecli
7
+ module Client
8
+
9
+ # authentication client
10
+ class AuthenticationClient
11
+ include HTTParty
12
+
13
+ # request yade token
14
+ def request_token(auth_url, username, password)
15
+
16
+ options = { headers: { Accept: 'application/json', Authorization: 'Basic d2ViX2FwcDpjaGFuZ2VpdA==' } }
17
+
18
+ self.class.base_uri auth_url
19
+
20
+ self.class.post("/oauth/token?username=#{username}&password=#{password}&grant_type=password", options)
21
+ end
22
+ end
23
+ end
24
+ end