Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… made modifications to the file
  • Loading branch information
kojix2 committed Mar 29, 2024
0 parents commit a502d13
Show file tree
Hide file tree
Showing 18 changed files with 754 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release
on:
push:
tags:
- "*"
jobs:
github:
name: GitHub
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Extract release note
run: |
ruby \
-e 'print("## Red DataStock "); \
puts(ARGF.read.split(/^## /)[1]. \
gsub(/ {.+?}/, ""). \
gsub(/\[(.+?)\]\[.+?\]/) {$1})' \
doc/text/news.md > release-note.md
- name: Upload to release
run: |
title=$(head -n1 release-note.md | sed -e 's/^## //')
tail -n +2 release-note.md > release-note-without-version.md
gh release create ${GITHUB_REF_NAME} \
--discussion-category Announcements \
--notes-file release-note-without-version.md \
--title "${title}"
env:
GH_TOKEN: ${{ github.token }}

68 changes: 68 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Test

on:
push:
pull_request:
schedule:
- cron: |
0 0 * * 0
jobs:
test:
name: "Ruby ${{ matrix.ruby-version }}: ${{ matrix.runs-on }}"
strategy:
# To avoid high frequency datasets download in a short time.
max-parallel: 1
fail-fast: false
matrix:
ruby-version:
- "2.7"
- "3.0"
- "3.1"
- "3.2"
runs-on:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.runs-on }}
env:
# We can invalidate the current cache by updating this.
CACHE_VERSION: "2022-08-27"
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- uses: actions/cache@v4
if: |
runner.os == 'Linux'
with:
path: |
~/.cache/red-datasets
key: ${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('lib/**') }}
restore-keys: |
${{ env.CACHE_VERSION }}-${{ runner.os }}-
- uses: actions/cache@v4
if: |
runner.os == 'macOS'
with:
path: |
~/Library/Caches/red-datasets
key: ${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('lib/**') }}
restore-keys: |
${{ env.CACHE_VERSION }}-${{ runner.os }}-
- uses: actions/cache@v4
if: |
runner.os == 'Windows'
with:
path: |
~/AppData/Local/red-datasets
key: ${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('lib/**') }}
restore-keys: |
${{ env.CACHE_VERSION }}-${{ runner.os }}-
- name: Install dependencies
run: |
bundle install
- name: Test
run: |
bundle exec rake
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/Gemfile.lock
/_site/
/pkg/
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- ruby -*-

source "https://rubygems.org/"

gemspec
7 changes: 7 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2017 Kouhei Sutou <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Red Downloader

## Description

Red DataStock provides a library for downloading and caching data.

## Install

```
gem install red-datastock
```

## Usage

```ruby


## Development

Pull requests are welcome.

## License

The MIT license.
```
21 changes: 21 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- ruby -*-

require "rubygems"
require "bundler/gem_helper"

base_dir = File.join(File.dirname(__FILE__))

helper = Bundler::GemHelper.new(base_dir)
def helper.version_tag
version
end

helper.install
spec = helper.gemspec

task default: :test

desc "Run tests"
task :test do
ruby("test/run-test.rb")
end
28 changes: 28 additions & 0 deletions lib/datasets/cache-path.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module DataStock
class CachePath
def initialize(id)
@id = id
end

def base_dir
Pathname(system_cache_dir).expand_path + 'red-datastock' + @id
end

def remove
FileUtils.rmtree(base_dir.to_s, secure: true) if base_dir.exist?
end

private

def system_cache_dir
case RUBY_PLATFORM
when /mswin/, /mingw/
ENV['LOCALAPPDATA'] || '~/AppData/Local'
when /darwin/
'~/Library/Caches'
else
ENV['XDG_CACHE_HOME'] || '~/.cache'
end
end
end
end
Loading

0 comments on commit a502d13

Please sign in to comment.