-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3ae9981
Showing
18 changed files
with
955 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/.bundle/ | ||
/.yardoc | ||
/_yardoc/ | ||
/coverage/ | ||
/doc/ | ||
/pkg/ | ||
/spec/reports/ | ||
/tmp/ | ||
|
||
# rspec failure tracking | ||
.rspec_status | ||
|
||
|
||
#Added by cargo | ||
# | ||
#already existing elements are commented out | ||
|
||
/target | ||
**/*.rs.bk | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--format documentation | ||
--color | ||
--require spec_helper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
sudo: false | ||
language: ruby | ||
cache: bundler | ||
rvm: | ||
- 2.6.3 | ||
before_install: gem install bundler -v 2.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "rusty_lru" | ||
version = "0.1.0" | ||
authors = ["Alastair Pharo <me@asph.dev>"] | ||
edition = "2018" | ||
|
||
[dependencies] | ||
rutie = "0.6.1" | ||
lru = "0.1.17" | ||
lazy_static = "1.3.0" | ||
|
||
[lib] | ||
name = "rusty_lru" | ||
crate-type = ["dylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "https://rubygems.org" | ||
|
||
# Specify your gem's dependencies in rusty_lru.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
rusty_lru (0.1.0) | ||
rutie (~> 0.0.3) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
diff-lcs (1.3) | ||
irb (1.0.0) | ||
lru_redux (1.1.0) | ||
moneta (1.1.1) | ||
rake (10.5.0) | ||
rspec (3.8.0) | ||
rspec-core (~> 3.8.0) | ||
rspec-expectations (~> 3.8.0) | ||
rspec-mocks (~> 3.8.0) | ||
rspec-core (3.8.2) | ||
rspec-support (~> 3.8.0) | ||
rspec-expectations (3.8.4) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.8.0) | ||
rspec-mocks (3.8.1) | ||
diff-lcs (>= 1.2.0, < 2.0) | ||
rspec-support (~> 3.8.0) | ||
rspec-support (3.8.2) | ||
rutie (0.0.4) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
bundler (~> 2.0) | ||
irb (~> 1.0.0) | ||
lru_redux (~> 1.1) | ||
moneta (~> 1.1.0) | ||
rake (~> 10.0) | ||
rspec (~> 3.0) | ||
rusty_lru! | ||
|
||
BUNDLED WITH | ||
2.0.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# RustyLru | ||
|
||
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/rusty_lru`. To experiment with that code, run `bin/console` for an interactive prompt. | ||
|
||
TODO: Delete this and the text above, and describe your gem | ||
|
||
## Installation | ||
|
||
Add this line to your application's Gemfile: | ||
|
||
```ruby | ||
gem 'rusty_lru' | ||
``` | ||
|
||
And then execute: | ||
|
||
$ bundle | ||
|
||
Or install it yourself as: | ||
|
||
$ gem install rusty_lru | ||
|
||
## Usage | ||
|
||
TODO: Write usage instructions here | ||
|
||
## Development | ||
|
||
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. 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 tags, 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]/rusty_lru. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require "bundler/gem_tasks" | ||
require "rspec/core/rake_task" | ||
|
||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :default => :spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "bundler/setup" | ||
require "rusty_lru" | ||
|
||
# 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__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'rusty_lru/version' | ||
require 'rutie' | ||
|
||
# Top-level docs here | ||
module RustyLRU | ||
|
||
# Loads Rust code | ||
Rutie.new(:rusty_lru).init 'Init_rusty_lru', __dir__ | ||
|
||
# Now load the additional methods | ||
require_relative './rusty_lru/cache.rb' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
require 'forwardable' | ||
|
||
module RustyLRU | ||
# Top-level | ||
class Cache | ||
# This module is prepended to add support for returning an enumerator when | ||
# a block is not given for each of {#each_pair}, {#each_key} and | ||
# {#each_value}. | ||
# | ||
# @private | ||
module EnumHelpers | ||
def each_pair | ||
block_given? ? super : enum_for(:each_pair) { size } | ||
end | ||
|
||
def each_key | ||
block_given? ? super : enum_for(:each_key) { size } | ||
end | ||
|
||
def each_value | ||
block_given? ? super : enum_for(:each_value) { size } | ||
end | ||
end | ||
|
||
prepend EnumHelpers | ||
extend Forwardable | ||
include Enumerable | ||
|
||
def_delegator :each_key, :to_a, :keys | ||
def_delegator :each_value, :to_a, :values | ||
|
||
alias store []= | ||
alias key? has_key? | ||
alias member? has_key? | ||
alias size length | ||
alias each each_pair | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module RustyLRU | ||
VERSION = '0.1.0'.freeze | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
lib = File.expand_path('lib', __dir__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require 'rusty_lru/version' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = 'rusty_lru' | ||
spec.version = RustyLRU::VERSION | ||
spec.authors = ['Alastair Pharo'] | ||
spec.email = ['me@asph.dev'] | ||
|
||
spec.summary = 'blah' | ||
#spec.description = 'TODO: Write a longer description or delete this line.' | ||
spec.homepage = 'http://example.com/' | ||
|
||
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" | ||
|
||
spec.metadata['homepage_uri'] = spec.homepage | ||
spec.metadata['source_code_uri'] = 'http://example.com/' | ||
spec.metadata['changelog_uri'] = 'http://example.com/' | ||
|
||
# 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.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } | ||
spec.require_paths = ['lib'] | ||
|
||
spec.add_dependency 'rutie', '~> 0.0.3' | ||
|
||
spec.add_development_dependency 'bundler', '~> 2.0' | ||
spec.add_development_dependency 'irb', '~> 1.0.0' | ||
spec.add_development_dependency 'lru_redux', '~> 1.1' | ||
spec.add_development_dependency 'moneta', '~> 1.1.0' | ||
spec.add_development_dependency 'rake', '~> 10.0' | ||
spec.add_development_dependency 'rspec', '~> 3.0' | ||
end |
Oops, something went wrong.