cloudflare_cli 0.0.3.pre.alpha.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 716949ad82365bdc2c64b15a22b317978d1209197014bf1568849d985fecb6bd
4
+ data.tar.gz: 3e8a2237719cb60a309c96a8cbc25ef8b5762ec397f92ff110bbb70abffbaf47
5
+ SHA512:
6
+ metadata.gz: 4e1efffaf8e347df516c9cbffad488ad62f0d953de8181d60d2102985c8e840206b1d326451f84d56915417f8220fcc015f9070db03a2650aeff2c34057e2397
7
+ data.tar.gz: 6f1246089a2740fca16752336ce94433ae9e3c03edb1996654a34a210a4baf451ddf10d5dff2d53a44514c27f635bb5d9e72036332c485fd7b8ce8e0fd13635f
@@ -0,0 +1,95 @@
1
+ 2018-11-28 Ken Spencer <me@iotaspencer.me>
2
+
3
+ * ChangeLog: upload ChangeLog
4
+
5
+ 2018-11-28 Ken Spencer <me@iotaspencer.me>
6
+
7
+ * lib/cloudflare_cli/version.rb: Bump cloudflare_cli to 0.0.2
8
+
9
+ 2018-11-28 Ken Spencer <me@iotaspencer.me>
10
+
11
+ * lib/cloudflare_cli/tree/zones.rb: implement /zones
12
+
13
+ 2018-11-28 Ken Spencer <me@iotaspencer.me>
14
+
15
+ * lib/cloudflare_cli/tree/ips.rb: implement /ips
16
+
17
+ 2018-11-28 Ken Spencer <me@iotaspencer.me>
18
+
19
+ * lib/cloudflare_cli/tree.rb: use tree as a middle module to
20
+ incorporate endpoints as we make them
21
+
22
+ 2018-11-28 Ken Spencer <me@iotaspencer.me>
23
+
24
+ * lib/cloudflare_cli/app.rb: change up app and add a long desc and
25
+ get couple of the commands working
26
+
27
+ 2018-11-28 Ken Spencer <me@iotaspencer.me>
28
+
29
+ * lib/cloudflare_cli.rb: allow state initialization without a class
30
+ having to be made and saved
31
+
32
+ 2018-11-28 Ken Spencer <me@iotaspencer.me>
33
+
34
+ * Gemfile: use rubyflare and use my cloned version
35
+
36
+ 2018-11-26 Ken Spencer <me@iotaspencer.me>
37
+
38
+ * lib/cloudflare_cli/tree/ips.rb: add rubyflare and remove httparty,
39
+ though we're going to bring it back
40
+
41
+ 2018-11-26 Ken Spencer <me@iotaspencer.me>
42
+
43
+ * lib/cloudflare_cli/app.rb: fix up the app file and put it in the
44
+ gem namespace
45
+
46
+ 2018-11-26 Ken Spencer <me@iotaspencer.me>
47
+
48
+ * lib/cloudflare_cli/api_tree.rb, lib/cloudflare_cli/tree.rb: rename
49
+ api_tree.rb -> tree.rb
50
+
51
+ 2018-11-26 Ken Spencer <me@iotaspencer.me>
52
+
53
+ * bin/cloudflare_cli: add the .run(ARGV) call back into the file
54
+
55
+ 2018-11-26 Ken Spencer <me@iotaspencer.me>
56
+
57
+ * README.rdoc: convert md to rdoc
58
+
59
+ 2018-11-26 Ken Spencer <me@iotaspencer.me>
60
+
61
+ * doc/App.html, doc/CloudflareCli.html,
62
+ doc/CloudflareCli/APITree.html, doc/CloudflareCli/APITree/IPs.html,
63
+ doc/_index.html, doc/class_list.html, doc/css/common.css,
64
+ doc/css/full_list.css, doc/css/style.css, doc/file.README.html,
65
+ doc/file_list.html, doc/frames.html, doc/index.html, doc/js/app.js,
66
+ doc/js/full_list.js, doc/js/jquery.js, doc/method_list.html,
67
+ doc/top-level-namespace.html: remove 'doc' folder in favor of 'docs'
68
+
69
+ 2018-11-26 Ken Spencer <me@iotaspencer.me>
70
+
71
+ * .yardopts, README.md => README.rdoc, cloudflare_cli.md =>
72
+ cloudflare_cli.rdoc, docs/App.html, docs/CloudflareCli.html,
73
+ docs/CloudflareCli/APITree.html,
74
+ docs/CloudflareCli/APITree/IPs.html, docs/_index.html,
75
+ docs/class_list.html, docs/css/common.css, docs/css/full_list.css,
76
+ docs/css/style.css, docs/file.README.html, docs/file_list.html,
77
+ docs/frames.html, docs/index.html, docs/js/app.js,
78
+ docs/js/full_list.js, docs/js/jquery.js, docs/method_list.html,
79
+ docs/top-level-namespace.html: upload docs
80
+
81
+ 2018-11-26 Ken Spencer <me@iotaspencer.me>
82
+
83
+ * .yardoc/checksums, .yardoc/complete, cloudflare_cli.gemspec,
84
+ doc/App.html, doc/CloudflareCli.html,
85
+ doc/CloudflareCli/APITree.html, doc/CloudflareCli/APITree/IPs.html,
86
+ doc/_index.html, doc/class_list.html, doc/css/common.css,
87
+ doc/css/full_list.css, doc/css/style.css, doc/file.README.html,
88
+ doc/file_list.html, doc/frames.html, doc/index.html, doc/js/app.js,
89
+ doc/js/full_list.js, doc/js/jquery.js, doc/method_list.html,
90
+ doc/top-level-namespace.html: more changes
91
+
92
+ 2018-11-26 Ken Spencer <me@iotaspencer.me>
93
+
94
+ * Initial Commit
95
+
@@ -0,0 +1,18 @@
1
+ = cloudflare_cli
2
+
3
+ A Command Line Interface for interacting with CloudFlare's API without having to
4
+ mess with scripting a script yourself.
5
+
6
+
7
+ == Installation
8
+
9
+ gem install cloudflare_cli
10
+
11
+ == About
12
+
13
+ This is not a library or require'able gem, this is an executable only.
14
+ If you wish to use CloudFlare's API in more advanced ways, then you would need
15
+ to install a gem that is requirable like [RubyFlare](https://github.com/trev/rubyflare)
16
+ which this gem uses behind the scenes.
17
+
18
+ gem install rubyflare
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'cloudflare_cli'
3
+
4
+ CloudflareCli::App.run(ARGV)
@@ -0,0 +1,20 @@
1
+ require "rubyflare"
2
+ # Add requires for other files you add to your project here, so
3
+ # you just need to require this one file in your bin file
4
+
5
+ module CloudflareCli
6
+ class State
7
+ # @param [Hash] options Hash of options to initiate the State
8
+ def self.initiate(options)
9
+ @@email = options[:email]
10
+ @@api_key = options["api-key"]
11
+ @@ctx = Rubyflare.connect_with(@@email, @@api_key)
12
+ end
13
+ def self.ctx
14
+ @@ctx
15
+ end
16
+ end
17
+ end
18
+
19
+ require "cloudflare_cli/version"
20
+ require "cloudflare_cli/app"
@@ -0,0 +1,56 @@
1
+ require "gli"
2
+ require "json"
3
+ require "cloudflare_cli/tree"
4
+
5
+ module CloudflareCli
6
+ class App
7
+ extend GLI::App
8
+ program_desc "Interface with the Cloudflare API!"
9
+
10
+ program_long_desc <<~HEREDOC
11
+
12
+ #{exe_name} is an interface into the Cloudflare API,
13
+ usage is rate-limited by Cloudflare itself, not the gem.
14
+
15
+ See https://api.cloudflare.com/#getting-started-requests for information
16
+ on the API and the linked anchor for rate-limiting specifically.
17
+ HEREDOC
18
+
19
+ version CloudflareCli::VERSION
20
+
21
+ config_file ".cfcli/config"
22
+ subcommand_option_handling :normal
23
+ arguments :strict
24
+ wrap_help_text :verbatim
25
+
26
+
27
+ commands_from 'cloudflare_cli/commands'
28
+ flag [:email], desc: "Cloudflare E-Mail", default_value: "", arg_name: "EMAIL", mask: true
29
+ flag ["api-key"], desc: "Cloudflare API Key", default_value: "", arg_name: "APIKEY", mask: true
30
+
31
+ around do |global_options, command, options, arguments, code|
32
+ CloudflareCli::State.initiate(global_options)
33
+ code.call
34
+ end
35
+ pre do |global, command, options, args|
36
+ # Pre logic here
37
+ # Return true to proceed; false to abort and not call the
38
+ # chosen command
39
+ # Use skips_pre before a command to skip this block
40
+ # on that command only
41
+ true
42
+ end
43
+ #
44
+ # post do |global,command,options,args|
45
+ # # Post logic here
46
+ # # Use skips_post before a command to skip this
47
+ # # block on that command only
48
+ # end
49
+ #
50
+ # on_error do |exception|
51
+ # # Error logic here
52
+ # # return false to skip default error handling
53
+ # true
54
+ # end
55
+ end
56
+ end
@@ -0,0 +1,42 @@
1
+ module CloudflareCli
2
+ class App
3
+ extend GLI::App
4
+
5
+ desc "DNS Record Management"
6
+ command "dns-record" do |c|
7
+ c.desc "add a record"
8
+ c.command :add do |dnsadd|
9
+ dnsadd.action do |global_options, options, args|
10
+
11
+ # Your command logic here
12
+
13
+ # If you have any errors, just raise them
14
+ # raise "that command made no sense"
15
+
16
+ puts "dns-record add command ran"
17
+ end
18
+ end
19
+
20
+ c.desc 'remove a record'
21
+ c.command [:rem, :del, :delete] do |dnsrem|
22
+ dnsrem.action do |global_options, options, args|
23
+ puts 'dns-record rem ran'
24
+ end
25
+ end
26
+
27
+ c.desc 'update a record'
28
+ c.command [:update, :modify] do |dnsmod|
29
+ dnsmod.action do |global_options, options, args|
30
+ puts 'dns-record update ran'
31
+ end
32
+ end
33
+
34
+ c.desc 'get a record'
35
+ c.command [:show] do |dnsshow|
36
+ dnsshow.action do |global_options, options, args|
37
+ puts 'dns-record show ran'
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,24 @@
1
+ require 'gli'
2
+ module CloudflareCli
3
+ class App
4
+ extend GLI::App
5
+
6
+ desc "Return Cloudflare IPs"
7
+ command :ips do |c|
8
+ c.desc "list out cloudflare's IPs"
9
+ c.command :list do |li|
10
+
11
+ li.switch [:pretty, :p], desc: "make the display of the ips pretty", negatable: false
12
+
13
+ li.action do |global_options, options, args|
14
+ if options[:pretty]
15
+ pp CloudflareCli::Endpoints::IPs.list.body
16
+ else
17
+ puts CloudflareCli::Endpoints::IPs.list.body
18
+ end
19
+ end
20
+ end
21
+ c.default_command :list
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,20 @@
1
+ module CloudflareCli
2
+ class App
3
+ extend GLI::App
4
+
5
+ desc "Use all the non-dns '/zones/*' endpoints"
6
+ command :zones do |c|
7
+ c.desc "list all zones or filter them"
8
+ c.command [:all, "list-zones"] do |lz|
9
+ lz.example "#{exe_name} zones [list-zones|all]", desc: "List all zones without filtering them"
10
+ lz.flag [:name], desc: "Zone name to search for"
11
+ lz.action do |global_options, options, args|
12
+ puts CloudflareCli::Endpoints::Zones.all(options)
13
+ end
14
+ end
15
+ c.action do |global_options, options, args|
16
+ end
17
+ c.default_command false
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,9 @@
1
+ require 'cloudflare_cli/tree/ips'
2
+ require 'cloudflare_cli/tree/zones'
3
+
4
+ module CloudflareCli
5
+ module Tree
6
+ #autoload :Zones, 'cloudflare_cli/tree/zones'
7
+
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ require "rubyflare"
2
+
3
+ module CloudflareCli
4
+ module Endpoints
5
+ class IPs
6
+ def self.list
7
+
8
+ ctx = CloudflareCli::State.ctx
9
+ ctx.get('ips')
10
+ rescue Rubyflare::ConnectionError => e
11
+ # puts e.response.body
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ require "rubyflare"
2
+
3
+ module CloudflareCli
4
+ module Endpoints
5
+ class Zones
6
+
7
+ # Return Cloudflare Account Zones
8
+ def self.all(options)
9
+ puts options
10
+ #begin
11
+ # ctx = CloudflareCli::State.ctx
12
+ # ctx.get('zones')
13
+ #rescue Rubyflare::ConnectionError => e
14
+ # puts e.response.body
15
+ #end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module CloudflareCli
2
+ VERSION = '0.0.3-alpha.2'
3
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cloudflare_cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3.pre.alpha.2
5
+ platform: ruby
6
+ authors:
7
+ - Ken Spencer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rdoc
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: aruba
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: gli
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 2.18.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 2.18.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: httparty
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.16.2
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.16.2
83
+ description:
84
+ email: me+cloudflare_cli@iotaspencer.me
85
+ executables:
86
+ - cloudflare_cli
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ChangeLog.md
91
+ - README.md
92
+ - bin/cloudflare_cli
93
+ - lib/cloudflare_cli.rb
94
+ - lib/cloudflare_cli/app.rb
95
+ - lib/cloudflare_cli/commands/001_dns_records.rb
96
+ - lib/cloudflare_cli/commands/002_cloudflare_ips.rb
97
+ - lib/cloudflare_cli/commands/003_zones.rb
98
+ - lib/cloudflare_cli/tree.rb
99
+ - lib/cloudflare_cli/tree/ips.rb
100
+ - lib/cloudflare_cli/tree/zones.rb
101
+ - lib/cloudflare_cli/version.rb
102
+ homepage: https://iotaspencer.me/projects/cloudflare_cli
103
+ licenses:
104
+ - MIT
105
+ metadata: {}
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">"
119
+ - !ruby/object:Gem::Version
120
+ version: 1.3.1
121
+ requirements: []
122
+ rubyforge_project:
123
+ rubygems_version: 2.7.6
124
+ signing_key:
125
+ specification_version: 4
126
+ summary: A CLI encapsulating /hopefully/ all of cloudflare's numerous endpoints (as
127
+ soon as its fully finished)
128
+ test_files: []