docli 0.0.2.pre.alpha.pre.15 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,72 @@
1
+ # Controller for droplets:
2
+ # action: list, create ...
3
+
4
+ module DoCli
5
+ class Parser
6
+ require 'yaml'
7
+ def self.droplets_parse argv
8
+ opt_parser = OptionParser.new do |opt|
9
+ opt.banner = "Usage: docli droplets [COMMAND]"
10
+ opt.separator ""
11
+ opt.separator "Commands"
12
+ opt.separator " create: create new droplets on DigitalOcean"
13
+ opt.separator " list: list all droplets on DigitalOcean"
14
+ opt.separator ""
15
+ opt.separator "Options"
16
+ opt.on("-h","--help","show help message")
17
+ opt.separator ""
18
+ opt.separator "Show help command:"
19
+ opt.separator "docli droplets [COMMAND] --help"
20
+ end
21
+
22
+ case ARGV[1]
23
+ when "create"
24
+ Docli::Droplets.create_new_droplets argv
25
+ when "list"
26
+ DoCli::Droplets.list_all_droplets
27
+ else
28
+ puts opt_parser
29
+ end
30
+ end
31
+
32
+ def self.file_parse argv
33
+ options = {}
34
+ opt_parser = OptionParser.new do |opt|
35
+ opt.banner = "Usage: docli create -f [FILE]"
36
+ opt.banner = " docli apply --file [FILE]"
37
+ opt.separator ""
38
+ opt.separator "Commands"
39
+ opt.separator " create: create new droplets on DigitalOcean"
40
+ opt.separator " list: list all droplets on DigitalOcean"
41
+ opt.separator ""
42
+ opt.separator "Options"
43
+ opt.on("-f ","--file ","File contain the resources define") do |file|
44
+ options[:file_config] = file
45
+ end
46
+ opt.on("-h","--help","show help message")
47
+ opt.separator ""
48
+ opt.separator "Show help command:"
49
+ opt.separator "docli droplets [COMMAND] --help"
50
+ end
51
+
52
+ opt_parser.parse!
53
+ if options[:file_config].nil?
54
+ puts "Please specify your config file".red
55
+ puts opt_parser
56
+ exit
57
+ end
58
+ context = YAML.load(File.open(options[:file_config]))
59
+
60
+ context.each do |key, value|
61
+ case value["resource_type"]
62
+ when "droplets"
63
+ Cmd::NewDroplets.create_new_droplets_from_file value
64
+ else
65
+ puts "Cannot get resource_type" + value['resource_type']
66
+ puts opt_parser
67
+ exit
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -1,3 +1,9 @@
1
- module Docli
2
- VERSION = '0.0.2'
1
+ DOCLI_VERSION = "0.0.1"
2
+
3
+ module DoCli
4
+ class Version
5
+ def self.show_version
6
+ puts "You are using DOCLI with version: " + DOCLI_VERSION.red
7
+ end
8
+ end
3
9
  end
metadata CHANGED
@@ -1,85 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.pre.alpha.pre.15
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wayarmy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-07 00:00:00.000000000 Z
11
+ date: 2017-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.14'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.14'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.0'
55
- - !ruby/object:Gem::Dependency
56
- name: byebug
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 9.0.6
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 9.0.6
69
- - !ruby/object:Gem::Dependency
70
- name: thor
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 0.19.4
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 0.19.4
83
13
  - !ruby/object:Gem::Dependency
84
14
  name: colorize
85
15
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +58,14 @@ dependencies:
128
58
  requirements:
129
59
  - - '='
130
60
  - !ruby/object:Gem::Version
131
- version: 2.1.0
61
+ version: 1.4.3
132
62
  type: :runtime
133
63
  prerelease: false
134
64
  version_requirements: !ruby/object:Gem::Requirement
135
65
  requirements:
136
66
  - - '='
137
67
  - !ruby/object:Gem::Version
138
- version: 2.1.0
68
+ version: 1.4.3
139
69
  - !ruby/object:Gem::Dependency
140
70
  name: thread_safe
141
71
  requirement: !ruby/object:Gem::Requirement
@@ -310,14 +240,14 @@ dependencies:
310
240
  requirements:
311
241
  - - '='
312
242
  - !ruby/object:Gem::Version
313
- version: 0.1.6
243
+ version: 0.1.5
314
244
  type: :runtime
315
245
  prerelease: false
316
246
  version_requirements: !ruby/object:Gem::Requirement
317
247
  requirements:
318
248
  - - '='
319
249
  - !ruby/object:Gem::Version
320
- version: 0.1.6
250
+ version: 0.1.5
321
251
  - !ruby/object:Gem::Dependency
322
252
  name: faraday
323
253
  requirement: !ruby/object:Gem::Requirement
@@ -374,53 +304,19 @@ dependencies:
374
304
  - - '='
375
305
  - !ruby/object:Gem::Version
376
306
  version: 1.0.5
377
- description: CommandLine Interface for DigitalOcean
378
- email:
379
- - quanpc294@gmail.com
307
+ description: Commandline interface for DigitalOcean
308
+ email: quanpc@topica.edu.vn
380
309
  executables:
381
310
  - docli
382
311
  extensions: []
383
312
  extra_rdoc_files: []
384
313
  files:
385
- - ".byebug_history"
386
- - ".gitignore"
387
- - ".rspec"
388
- - ".travis.yml"
389
- - CODE_OF_CONDUCT.md
390
- - Gemfile
391
- - LICENSE.txt
392
- - README.md
393
- - Rakefile
394
- - bin/console
395
- - bin/setup
396
- - dev-build.sh
397
- - docli.gemspec
398
- - example/new-droplets.yaml
399
- - example/resources.template
400
314
  - exe/docli
401
- - lib/cmd/account.rb
402
- - lib/cmd/actions.rb
403
- - lib/cmd/certificates.rb
404
- - lib/cmd/domain_records.rb
405
- - lib/cmd/domains.rb
406
- - lib/cmd/droplets.rb
407
- - lib/cmd/floating_ips.rb
408
- - lib/cmd/images.rb
409
- - lib/cmd/loadbalancers.rb
410
- - lib/cmd/regions.rb
411
- - lib/cmd/sizes.rb
412
- - lib/cmd/snapshots.rb
413
- - lib/cmd/sshkeys.rb
414
- - lib/cmd/tags.rb
415
- - lib/cmd/volume.rb
315
+ - lib/cmd/authen.rb
316
+ - lib/cmd/create_new_droplets.rb
416
317
  - lib/docli.rb
417
- - lib/docli/create.rb
418
- - lib/docli/delete.rb
419
- - lib/docli/get.rb
420
- - lib/docli/get_user_information.rb
421
- - lib/docli/list_all_domains.rb
422
- - lib/docli/subcommand_base.rb
423
- - lib/docli/utils.rb
318
+ - lib/docli/create_new_droplets.rb
319
+ - lib/docli/options_parse.rb
424
320
  - lib/docli/version.rb
425
321
  homepage: https://github.com/wayarmy/docli
426
322
  licenses:
@@ -437,13 +333,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
437
333
  version: '0'
438
334
  required_rubygems_version: !ruby/object:Gem::Requirement
439
335
  requirements:
440
- - - ">"
336
+ - - ">="
441
337
  - !ruby/object:Gem::Version
442
- version: 1.3.1
338
+ version: '0'
443
339
  requirements: []
444
340
  rubyforge_project:
445
- rubygems_version: 2.4.8
341
+ rubygems_version: 2.5.1
446
342
  signing_key:
447
343
  specification_version: 4
448
- summary: CommandLine Interface for DigitalOcean
344
+ summary: docli
449
345
  test_files: []
@@ -1,9 +0,0 @@
1
- exit
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
13
- *.gem
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
@@ -1,18 +0,0 @@
1
- sudo: false
2
- dist: trusty
3
- language: ruby
4
- rvm:
5
- - 2.3.0
6
- gemfile:
7
- - Gemfile
8
- before_install:
9
- - gem install bundler -v 1.14.6
10
- before_script:
11
- - bundle install
12
- script:
13
- - rake
14
- deploy:
15
- provider: rubygems
16
- api_key: "23273da484b0a88a720e4216103b67e9"
17
- on:
18
- branch: master
@@ -1,74 +0,0 @@
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 phamminhthanh69@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 DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2017 Wayarmy
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 DELETED
@@ -1,47 +0,0 @@
1
- # DOCLI
2
-
3
- ![Linux Build Status](https://img.shields.io/travis/wayarmy/docli/master.svg?label=Linux%20build)
4
-
5
- a commandline tool for DigitalOcean
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'docli'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install docli
22
-
23
- ## Usage
24
-
25
- ```
26
- $ docli
27
- Commands:
28
- docli config # Init or update config
29
- docli create # Create a resource by filename or stdin
30
- docli delete # Delete resources by filenames, stdin, resources and names, or by resources and label selector
31
- docli get # Display one or many resource
32
- docli help [COMMAND] # Describe available commands or one specific command
33
- docli version # Show version information
34
- ```
35
-
36
- ## Contributing
37
-
38
- Bug reports and pull requests are welcome on GitHub at https://github.com/wayarmy/docli. 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.
39
-
40
- ## Roadmap
41
-
42
- * May 2017: Able to create/show droplets from YAML config file
43
- > Vision: DigitalOcean infrastructure as code
44
-
45
- ## License
46
-
47
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).