Skip to content

Commit

Permalink
Modernize gemspec
Browse files Browse the repository at this point in the history
  • Loading branch information
delano authored and delano committed Jun 17, 2024
1 parent 89131aa commit c67a500
Show file tree
Hide file tree
Showing 17 changed files with 188 additions and 60 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Ruby

on:
push:
branches:
- master

pull_request:

jobs:
build:
runs-on: ubuntu-latest
name: Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby:
- '3.1.2'

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run the default task
run: bundle exec rake
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
.DS_Store
pkg
/.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 @@
AllCops:
TargetRubyVersion: 2.7.5

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
Enabled: true
EnforcedStyle: double_quotes

Layout/LineLength:
Max: 120
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
REDIS-DUMP, CHANGES

#### 1.0.0 (2023-01-17) ###############################

* ADDED: Timeout support for redis connections
* CHANGED: uri-redis dependency to 1.0.0


#### 0.4.0 (2017-11-23) ###############################

* ADDED: support for redis >= 4.0
Expand Down
10 changes: 10 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

source "https://rubygems.org"

# Specify your gem's dependencies in redis-dump.gemspec
gemspec

gem "rake", "~> 13.0"

gem "rubocop", "~> 1.21"
4 changes: 3 additions & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Copyright (c) 2010-2017 Solutious Inc, Delano Mandelbaum
The MIT License (MIT)

Copyright (c) 2023 delano

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Redis::Dump

TODO: Delete this and the text below, and describe your gem

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/redis/dump`. To experiment with that code, run `bin/console` for an interactive prompt.

## Installation

TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.

Install the gem and add to the application's Gemfile by executing:

$ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG

## Usage

TODO: Write usage instructions here

## Development

After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/redis-dump.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
61 changes: 5 additions & 56 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,59 +1,8 @@
require "rubygems"
require "rake"
require "rake/clean"
require "rdoc/task"
# frozen_string_literal: true

task :default => ["build"]
CLEAN.include [ 'pkg', 'rdoc' ]
name = "redis-dump"

$:.unshift File.join(File.dirname(__FILE__), 'lib')
require "redis/dump"
version = Redis::Dump::VERSION.to_s

begin
require "jeweler"
Jeweler::Tasks.new do |s|
s.version = version
s.name = name
s.summary = "Backup and restore your Redis data to and from JSON."
s.description = s.summary
s.email = "[email protected]"
s.homepage = "http://github.com/delano/redis-dump"
s.authors = ["Delano Mandelbaum"]

s.add_dependency("yajl-ruby", ">= 0.1")
s.add_dependency("redis", ">= 4.0")
s.add_dependency("uri-redis", ">= 0.4.0")
s.add_dependency("drydock", ">= 0.6.9")

s.license = "MIT"

s.signing_key = File.join('/mnt/gem/', 'gem-private_key.pem')
s.cert_chain = ['gem-public_cert.pem']
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
end

require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs = ["lib", "test"]
end

extra_files = %w[LICENSE.txt THANKS.txt CHANGES.txt ]
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = "rdoc"
rdoc.title = "#{name} #{version}"
rdoc.generator = 'hanna' # gem install hanna-nouveau
rdoc.main = 'README.rdoc'
rdoc.rdoc_files.include("README*")
rdoc.rdoc_files.include("bin/*.rb")
rdoc.rdoc_files.include("lib/**/*.rb")
extra_files.each { |file|
rdoc.rdoc_files.include(file) if File.exists?(file)
}
end
require "bundler/gem_tasks"
require "rubocop/rake_task"

RuboCop::RakeTask.new

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

require "bundler/setup"
require "redis/dump"

# 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.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

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
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 6 additions & 1 deletion lib/redis/dump.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# frozen_string_literal: true

unless defined?(RD_HOME)
RD_HOME = File.expand_path(File.join(File.dirname(__FILE__), '..', '..') )
end

require 'redis'
require 'uri/redis'
require 'yajl'
require 'base64'

require 'uri/redis'

require_relative "dump/version"

class Redis
class Dump
unless defined?(Redis::Dump::VALID_TYPES)
Expand Down
7 changes: 7 additions & 0 deletions lib/redis/dump/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

module Redis
class Dump
VERSION = "1.0.0"
end
end
39 changes: 39 additions & 0 deletions redis-dump.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

require_relative "lib/redis/dump/version"

Gem::Specification.new do |spec|
spec.name = "redis-dump"
spec.version = Redis::Dump::VERSION
spec.authors = ["delano"]
spec.email = "[email protected]"

spec.summary = "Backup and restore your Redis data to and from JSON."
spec.description = "Backup and restore your Redis data to and from JSON by database, key, or key pattern."
spec.homepage = "https://rubygems.org/gems/redis-dump"
spec.license = "MIT"
spec.required_ruby_version = ">= 2.7.5"

spec.metadata["allowed_push_host"] = "https://rubygems.org/"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/delano/redis-dump"
spec.metadata["changelog_uri"] = "https://github.com/delano/redis-dump/blob/main/CHANGES.txt"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(__dir__) do
`git ls-files -z`.split("\x0").reject do |f|
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
end
end
spec.bindir = "bin"
spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_dependency("yajl-ruby", ">= 0.1")
spec.add_dependency("oj", ">= 3.13.14")
spec.add_dependency("redis", ">= 4.0")
spec.add_dependency("uri-redis", ">= 1.0.0")
spec.add_dependency("drydock", ">= 0.6.9")
end
6 changes: 6 additions & 0 deletions sig/redis/dump.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Redis
module Dump
VERSION: String
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
end
end

0 comments on commit c67a500

Please sign in to comment.