Skip to content

Commit

Permalink
Merge pull request #1 from floor114/boilerplate
Browse files Browse the repository at this point in the history
Add gem's initial codebase.
  • Loading branch information
floor114 authored May 22, 2023
2 parents f7035d3 + 191a63e commit 425a1f8
Show file tree
Hide file tree
Showing 16 changed files with 314 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on: pull_request

jobs:
lint:
runs-on: ubuntu-latest
name: Linter
steps:
- uses: actions/checkout@v3
- name: Set up Ruby and gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop

test:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- '3.0.0'
- '3.1.0'
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake test

test-results:
name: Check test results
needs: test
runs-on: ubuntu-latest
steps:
- name: Check test results
run: test "${{ needs.test.result }}" = "success"
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
13 changes: 13 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require:
- rubocop-minitest
- rubocop-rake

AllCops:
TargetRubyVersion: 3.0.0
NewCops: enable

Layout/LineLength:
Max: 120

Style/Documentation:
Enabled: false
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.0
5 changes: 5 additions & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--markup markdown
--markup-provider commonmarker
--no-private
-
*.md
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

No notable changes.
18 changes: 18 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

source 'https://rubygems.org'

gemspec

gem 'bundler'
gem 'commonmarker'
gem 'minitest'
gem 'minitest-reporters'
gem 'pry'
gem 'rake'
gem 'rubocop'
gem 'rubocop-minitest'
gem 'rubocop-rake'
gem 'timecop'
gem 'webrick'
gem 'yard'
92 changes: 92 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
PATH
remote: .
specs:
mysql2-aws_rds_iam (0.1.0)
aws-sdk-rds (~> 1)
mysql2
zeitwerk (~> 2)

GEM
remote: https://rubygems.org/
specs:
ansi (1.5.0)
ast (2.4.2)
aws-eventstream (1.2.0)
aws-partitions (1.767.0)
aws-sdk-core (3.173.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-rds (1.179.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.5.2)
aws-eventstream (~> 1, >= 1.0.2)
builder (3.2.4)
coderay (1.1.3)
commonmarker (0.23.9)
jmespath (1.6.2)
json (2.6.3)
method_source (1.0.0)
minitest (5.18.0)
minitest-reporters (1.6.0)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
mysql2 (0.5.5)
parallel (1.23.0)
parser (3.2.2.1)
ast (~> 2.4.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.8.0)
rexml (3.2.5)
rubocop (1.51.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.28.1)
parser (>= 3.2.1.0)
rubocop-minitest (0.31.0)
rubocop (>= 1.39, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.13.0)
timecop (0.9.6)
unicode-display_width (2.4.2)
webrick (1.8.1)
yard (0.9.34)
zeitwerk (2.6.8)

PLATFORMS
ruby
x86_64-darwin-22

DEPENDENCIES
bundler
commonmarker
minitest
minitest-reporters
mysql2-aws_rds_iam!
pry
rake
rubocop
rubocop-minitest
rubocop-rake
timecop
webrick
yard

BUNDLED WITH
2.4.13
20 changes: 20 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rubocop/rake_task'
require 'yard'

Rake::TestTask.new(:test) do |t|
t.description = 'Run tests'
t.libs << 'test'
t.test_files = FileList['test/**/test_*.rb']
end

desc 'Run linter'
RuboCop::RakeTask.new

desc 'Generate documentation'
YARD::Rake::YardocTask.new

task default: %i[test rubocop]
11 changes: 11 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require 'bundler/setup'
require 'mysql2/aws_rds_iam'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

require 'irb'
IRB.start(__FILE__)
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
12 changes: 12 additions & 0 deletions lib/mysql2/aws_rds_iam.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

require 'mysql2'
require 'zeitwerk'

loader = Zeitwerk::Loader.for_gem_extension(Mysql2)
loader.setup

module Mysql2
module AwsRdsIam
end
end
7 changes: 7 additions & 0 deletions lib/mysql2/aws_rds_iam/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

module Mysql2
module AwsRdsIam
VERSION = '0.1.0'
end
end
41 changes: 41 additions & 0 deletions mysql2-aws_rds_iam.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: true

require_relative 'lib/mysql2/aws_rds_iam/version'

Gem::Specification.new do |spec|
spec.name = 'mysql2-aws_rds_iam'
spec.version = Mysql2::AwsRdsIam::VERSION
spec.authors = ['Taras Shpachenko']
spec.email = ['[email protected]']

spec.summary = 'AWS RDS IAM authentication for MySQL'
spec.description = 'Mysql2::AwsRdsIam is an extension of mysql2 gem that adds support ' \
'of IAM authentication when connecting to MySQL in Amazon RDS.'
spec.homepage = 'https://github.com/floor114/mysql2-aws_rds_iam'
spec.license = 'MIT'

spec.required_ruby_version = '>= 3.0.0'

spec.metadata['rubygems_mfa_required'] = 'true'

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = spec.homepage
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
spec.metadata['documentation_uri'] = "https://rubydoc.info/gems/mysql2-aws_rds_iam/#{Mysql2::AwsRdsIam::VERSION}"

spec.files = Dir[
'lib/**/*.rb',
'.yardopts',
'CHANGELOG.md',
'LICENSE.txt',
'mysql2-aws_rds_iam.gemspec',
'README.md'
]
spec.require_paths = ['lib']

# Uncomment to register a new dependency of your gem
spec.add_dependency 'aws-sdk-rds', '~> 1'
spec.add_dependency 'mysql2'
spec.add_dependency 'zeitwerk', '~> 2'
end
15 changes: 15 additions & 0 deletions test/mysql2/test_aws_rds_iam.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

require 'test_helper'

module Mysql2
class TestAwsRdsIam < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::Mysql2::AwsRdsIam::VERSION
end

def test_it_does_something_useful
assert 'false' # rubocop:disable Minitest/UselessAssertion
end
end
end
12 changes: 12 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
require 'mysql2/aws_rds_iam'

require 'minitest/reporters'
Minitest::Reporters.use!(Minitest::Reporters::SpecReporter.new)

require 'timecop'
Timecop.safe_mode = true

require 'minitest/autorun'

0 comments on commit 425a1f8

Please sign in to comment.