Skip to content

Commit

Permalink
Add CircleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
MaicolBen committed Nov 19, 2019
1 parent d35c219 commit 6516853
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 53 deletions.
48 changes: 48 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/ruby:2.4.1-node-browsers

working_directory: ~/repo

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "Gemfile.lock" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run:
name: install dependencies
command: |
bundle install --jobs=4 --retry=3 --path vendor/bundle
- save_cache:
paths:
- ./vendor/bundle
key: v1-dependencies-{{ checksum "Gemfile.lock" }}

# run tests!
- run:
name: run tests
command: |
mkdir /tmp/test-results
TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
bundle exec rspec --format progress \
--out /tmp/test-results/rspec.xml \
--format progress \
$TEST_FILES
# collect reports
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: /tmp/test-results
destination: test-results
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

35 changes: 35 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
PATH
remote: .
specs:
simple-redis-lock (0.1.0)

GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.3)
rake (10.5.0)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.0)
rspec-support (~> 3.9.0)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.0)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 2.0)
rake (~> 10.0)
rspec (~> 3.0)
simple-redis-lock!

BUNDLED WITH
2.0.1
2 changes: 1 addition & 1 deletion lib/simple_redis_lock/redis_lock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module SimpleRedisLock
class RedisLock
DEFAULT_RETRY_COUNT = 25
DEFAULT_TTL = 5.seconds
# DEFAULT_TTL = 5.seconds # TODO: add active support?
UNLOCK_SCRIPT = <<~LUA
if redis.call("get",KEYS[1]) == ARGV[1] then
return redis.call("del",KEYS[1])
Expand Down
3 changes: 3 additions & 0 deletions lib/simple_redis_lock/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module SimpleRedisLock
VERSION = '0.1.0'.freeze
end
47 changes: 14 additions & 33 deletions simple-redis-lock.gemspec
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@

lib = File.expand_path("../lib", __FILE__)
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "simple/redis/lock/version"
require 'simple_redis_lock/version'

Gem::Specification.new do |spec|
spec.name = "simple-redis-lock"
spec.version = Simple::Redis::Lock::VERSION
spec.authors = ["MaicolBen"]
spec.email = ["[email protected]"]
spec.name = 'simple-redis-lock'
spec.version = SimpleRedisLock::VERSION
spec.authors = ['Hint']
spec.email = ['[email protected]']

spec.summary = %q{TODO: Write a short summary, because RubyGems requires one.}
spec.description = %q{TODO: Write a longer description or delete this line.}
spec.homepage = "TODO: Put your gem's website or public repo URL here."
spec.license = "MIT"
spec.summary = 'Simple redis lock'
spec.license = 'MIT'

# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if spec.respond_to?(:metadata)
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
else
raise "RubyGems 2.0 or newer is required to protect against " \
"public gem pushes."
end

# 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(File.expand_path('..', __FILE__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.bindir = "exe"
spec.files = Dir['lib/**/*.rb']
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.require_paths = ['lib']

spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency 'bundler', '~> 2.0'
spec.add_development_dependency 'rake', '~> 10.0'
spec.add_development_dependency 'rspec', '~> 3.0'
end
9 changes: 0 additions & 9 deletions spec/simple/redis/lock_spec.rb

This file was deleted.

6 changes: 3 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require "bundler/setup"
require "simple/redis/lock"
require 'bundler/setup'
require 'simple_redis_lock/redis_lock'

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
config.example_status_persistence_file_path = '.rspec_status'

# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!
Expand Down

0 comments on commit 6516853

Please sign in to comment.