Skip to content

Commit 509e538

Browse files
committed
Modernize gem.
1 parent 491ee2f commit 509e538

File tree

10 files changed

+109
-114
lines changed

10 files changed

+109
-114
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
indent_size = 2

.github/workflows/development.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Development
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ${{matrix.os}}-latest
8+
continue-on-error: ${{matrix.experimental}}
9+
10+
strategy:
11+
matrix:
12+
os:
13+
- ubuntu
14+
- macos
15+
16+
ruby:
17+
- 2.5
18+
- 2.6
19+
- 2.7
20+
21+
experimental: [false]
22+
env: [""]
23+
24+
include:
25+
- os: ubuntu
26+
ruby: truffleruby
27+
experimental: true
28+
- os: ubuntu
29+
ruby: jruby
30+
experimental: true
31+
- os: ubuntu
32+
ruby: head
33+
experimental: true
34+
35+
steps:
36+
- uses: actions/checkout@v2
37+
- uses: ruby/setup-ruby@v1
38+
with:
39+
ruby-version: ${{matrix.ruby}}
40+
41+
- name: Install dependencies
42+
run: ${{matrix.env}} bundle install
43+
44+
- name: Run tests
45+
timeout-minutes: 5
46+
env:
47+
CLOUDFLARE_TEST_ZONE_MANAGEMENT: true
48+
CLOUDFLARE_EMAIL: ${{secrets.CLOUDFLARE_EMAIL}}
49+
CLOUDFLARE_KEY: ${{secrets.CLOUDFLARE_KEY}}
50+
run: ${{matrix.env}} bundle exec rspec

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/.bundle/
22
/.yardoc
3-
/Gemfile.lock
3+
/gems.locked
44
/_yardoc/
55
/coverage/
66
/doc/

.travis.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

README.md

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,29 @@
22

33
It is a Ruby wrapper for the Cloudflare V4 API. It provides a light weight wrapper using `RestClient::Resource`. The wrapper functionality is limited to zones and DNS records at this time, *PRs welcome*.
44

5-
[![Build Status](https://secure.travis-ci.org/socketry/cloudflare.svg)](http://travis-ci.org/socketry/cloudflare)
6-
[![Coverage Status](https://coveralls.io/repos/socketry/cloudflare/badge.svg)](https://coveralls.io/r/socketry/cloudflare)
5+
[![Development Status](https://github.com/socketry/cloudflare/workflows/Development/badge.svg)](https://github.com/socketry/cloudflare/actions?workflow=Development)
76

87
## Installation
98

109
Add this line to your application's Gemfile:
1110

12-
```ruby
11+
``` ruby
1312
gem 'cloudflare'
1413
```
1514

1615
And then execute:
1716

18-
```
19-
$ bundle
20-
```
17+
$ bundle
2118

2219
Or install it yourself as:
2320

24-
```
25-
$ gem install cloudflare
26-
```
21+
$ gem install cloudflare
2722

2823
## Usage
2924

3025
Here are some basic examples. For more details, refer to the code and specs.
3126

32-
```ruby
27+
``` ruby
3328
require 'cloudflare'
3429

3530
# Grab some details from somewhere:
@@ -67,7 +62,7 @@ end
6762

6863
You can read more about [bearer tokens here](https://blog.cloudflare.com/api-tokens-general-availability/). This allows you to limit priviledges.
6964

70-
```ruby
65+
``` ruby
7166
require 'cloudflare'
7267

7368
token = 'a_generated_api_token'
@@ -77,26 +72,38 @@ Cloudflare.connect(token: token) do |connection|
7772
end
7873
```
7974

75+
### Using with Async
76+
77+
``` ruby
78+
Async do
79+
connection = Cloudflare.connect(...)
80+
81+
# ... do something with connection ...
82+
ensure
83+
connection.close
84+
end
85+
```
86+
8087
## Contributing
8188

82-
1. Fork it
83-
2. Create your feature branch (`git checkout -b my-new-feature`)
84-
3. Commit your changes (`git commit -am 'Add some feature'`)
85-
4. Push to the branch (`git push origin my-new-feature`)
86-
5. Create new Pull Request
89+
1. Fork it
90+
2. Create your feature branch (`git checkout -b my-new-feature`)
91+
3. Commit your changes (`git commit -am 'Add some feature'`)
92+
4. Push to the branch (`git push origin my-new-feature`)
93+
5. Create new Pull Request
8794

8895
## See Also
8996

90-
- [Cloudflare::DNS::Update](https://github.com/ioquatix/cloudflare-dns-update) - A dynamic DNS updater based on this gem.
91-
- [Rubyflare](https://github.com/trev/rubyflare) - Another implementation.
97+
- [Cloudflare::DNS::Update](https://github.com/ioquatix/cloudflare-dns-update) - A dynamic DNS updater based on this gem.
98+
- [Rubyflare](https://github.com/trev/rubyflare) - Another implementation.
9299

93100
## License
94101

95102
Released under the MIT license.
96103

97104
Copyright, 2018, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
98105
Copyright, 2017, by [David Rosenbloom](http://artifactory.com).
99-
Copyright, 2012, 2014, by [Marcin Prokop](https://github.com/b4k3r).
106+
Copyright, 2012, 2014, by [Marcin Prokop](https://github.com/b4k3r).
100107

101108
Permission is hereby granted, free of charge, to any person obtaining a copy
102109
of this software and associated documentation files (the "Software"), to deal

Rakefile

Lines changed: 0 additions & 26 deletions
This file was deleted.

cloudflare.gemspec

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
1-
21
# frozen_string_literal: true
32

4-
require_relative 'lib/cloudflare/version'
3+
require_relative "lib/cloudflare/version"
54

65
Gem::Specification.new do |spec|
7-
spec.name = 'cloudflare'
8-
spec.version = Cloudflare::VERSION
9-
spec.platform = Gem::Platform::RUBY
10-
11-
spec.summary = 'A Ruby wrapper for the Cloudflare API.'
12-
spec.authors = ['Marcin Prokop', 'Samuel Williams']
13-
14-
spec.homepage = 'https://github.com/b4k3r/cloudflare'
15-
spec.licenses = ['MIT']
16-
17-
spec.files = `git ls-files`.split("\n")
18-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20-
spec.require_paths = ['lib']
21-
22-
spec.required_ruby_version = '>= 2.0.0'
23-
24-
spec.add_dependency 'async-rest', '~> 0.10.0'
25-
26-
spec.add_development_dependency 'async-rspec'
27-
28-
spec.add_development_dependency 'covered'
29-
spec.add_development_dependency 'bundler'
30-
spec.add_development_dependency 'rake'
31-
spec.add_development_dependency 'rspec', '~> 3.6'
6+
spec.name = "cloudflare"
7+
spec.version = Cloudflare::VERSION
8+
9+
spec.summary = "A Ruby wrapper for the Cloudflare API."
10+
spec.authors = ["Marcin Prokop", "Samuel Williams"]
11+
spec.license = "MIT"
12+
13+
spec.homepage = "https://github.com/socketry/cloudflare"
14+
15+
spec.files = Dir.glob('{lib}/**/*', File::FNM_DOTMATCH, base: __dir__)
16+
17+
spec.required_ruby_version = ">= 2.5"
18+
19+
spec.add_dependency "async-rest", "~> 0.10.0"
20+
21+
spec.add_development_dependency "async-rspec"
22+
spec.add_development_dependency "bundler"
23+
spec.add_development_dependency "covered"
24+
spec.add_development_dependency "rspec", "~> 3.6"
3225
end

Gemfile renamed to gems.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
gem 'async-http', '~> 0.48', '>= 0.48.2'
99

10-
group :development do
11-
gem 'pry'
12-
gem 'pry-coolline'
10+
group :maintenance, optional: true do
11+
gem "bake-bundler"
12+
gem "bake-modernize"
13+
14+
gem "utopia-project"
1315
end
1416

1517
group :test do

lib/cloudflare/rspec/connection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module Cloudflare
2929
module RSpec
3030
module Connection
3131
end
32-
32+
3333
RSpec.shared_context Connection do
3434
include_context Async::RSpec::Reactor
3535

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
ACCOUNT_ID = ENV['CLOUDFLARE_ACCOUNT_ID']
1414
NAMES = ['testing', 'horse', 'cat', 'dog', 'fish', 'dolphin', 'lion', 'tiger'].freeze
15-
JOB_ID = ENV.fetch('TRAVIS_JOB_ID', 0).to_i
15+
JOB_ID = ENV.fetch('GITHUB_RUN_ID', 0).to_i
1616
ZONE_NAME = ENV['CLOUDFLARE_ZONE_NAME'] || "#{NAMES[JOB_ID % NAMES.size]}.com"
1717

1818
require 'covered/rspec'

0 commit comments

Comments
 (0)