Skip to content

Commit a502d13

Browse files
committed
Forked RedDatasets https://github.com/red-data-tools/red-datasets and made modifications to the file
0 parents  commit a502d13

18 files changed

+754
-0
lines changed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/release.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
jobs:
7+
github:
8+
name: GitHub
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 10
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Extract release note
14+
run: |
15+
ruby \
16+
-e 'print("## Red DataStock "); \
17+
puts(ARGF.read.split(/^## /)[1]. \
18+
gsub(/ {.+?}/, ""). \
19+
gsub(/\[(.+?)\]\[.+?\]/) {$1})' \
20+
doc/text/news.md > release-note.md
21+
- name: Upload to release
22+
run: |
23+
title=$(head -n1 release-note.md | sed -e 's/^## //')
24+
tail -n +2 release-note.md > release-note-without-version.md
25+
gh release create ${GITHUB_REF_NAME} \
26+
--discussion-category Announcements \
27+
--notes-file release-note-without-version.md \
28+
--title "${title}"
29+
env:
30+
GH_TOKEN: ${{ github.token }}
31+

.github/workflows/test.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: |
8+
0 0 * * 0
9+
10+
jobs:
11+
test:
12+
name: "Ruby ${{ matrix.ruby-version }}: ${{ matrix.runs-on }}"
13+
strategy:
14+
# To avoid high frequency datasets download in a short time.
15+
max-parallel: 1
16+
fail-fast: false
17+
matrix:
18+
ruby-version:
19+
- "2.7"
20+
- "3.0"
21+
- "3.1"
22+
- "3.2"
23+
runs-on:
24+
- macos-latest
25+
- ubuntu-latest
26+
- windows-latest
27+
runs-on: ${{ matrix.runs-on }}
28+
env:
29+
# We can invalidate the current cache by updating this.
30+
CACHE_VERSION: "2022-08-27"
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: ruby/setup-ruby@v1
34+
with:
35+
ruby-version: ${{ matrix.ruby-version }}
36+
- uses: actions/cache@v4
37+
if: |
38+
runner.os == 'Linux'
39+
with:
40+
path: |
41+
~/.cache/red-datasets
42+
key: ${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('lib/**') }}
43+
restore-keys: |
44+
${{ env.CACHE_VERSION }}-${{ runner.os }}-
45+
- uses: actions/cache@v4
46+
if: |
47+
runner.os == 'macOS'
48+
with:
49+
path: |
50+
~/Library/Caches/red-datasets
51+
key: ${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('lib/**') }}
52+
restore-keys: |
53+
${{ env.CACHE_VERSION }}-${{ runner.os }}-
54+
- uses: actions/cache@v4
55+
if: |
56+
runner.os == 'Windows'
57+
with:
58+
path: |
59+
~/AppData/Local/red-datasets
60+
key: ${{ env.CACHE_VERSION }}-${{ runner.os }}-${{ hashFiles('lib/**') }}
61+
restore-keys: |
62+
${{ env.CACHE_VERSION }}-${{ runner.os }}-
63+
- name: Install dependencies
64+
run: |
65+
bundle install
66+
- name: Test
67+
run: |
68+
bundle exec rake

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/Gemfile.lock
2+
/_site/
3+
/pkg/

Gemfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- ruby -*-
2+
3+
source "https://rubygems.org/"
4+
5+
gemspec

LICENSE.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2017 Kouhei Sutou <[email protected]>
2+
3+
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:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
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.

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Red Downloader
2+
3+
## Description
4+
5+
Red DataStock provides a library for downloading and caching data.
6+
7+
## Install
8+
9+
```
10+
gem install red-datastock
11+
```
12+
13+
## Usage
14+
15+
```ruby
16+
17+
18+
## Development
19+
20+
Pull requests are welcome.
21+
22+
## License
23+
24+
The MIT license.
25+
```

Rakefile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# -*- ruby -*-
2+
3+
require "rubygems"
4+
require "bundler/gem_helper"
5+
6+
base_dir = File.join(File.dirname(__FILE__))
7+
8+
helper = Bundler::GemHelper.new(base_dir)
9+
def helper.version_tag
10+
version
11+
end
12+
13+
helper.install
14+
spec = helper.gemspec
15+
16+
task default: :test
17+
18+
desc "Run tests"
19+
task :test do
20+
ruby("test/run-test.rb")
21+
end

lib/datasets/cache-path.rb

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module DataStock
2+
class CachePath
3+
def initialize(id)
4+
@id = id
5+
end
6+
7+
def base_dir
8+
Pathname(system_cache_dir).expand_path + 'red-datastock' + @id
9+
end
10+
11+
def remove
12+
FileUtils.rmtree(base_dir.to_s, secure: true) if base_dir.exist?
13+
end
14+
15+
private
16+
17+
def system_cache_dir
18+
case RUBY_PLATFORM
19+
when /mswin/, /mingw/
20+
ENV['LOCALAPPDATA'] || '~/AppData/Local'
21+
when /darwin/
22+
'~/Library/Caches'
23+
else
24+
ENV['XDG_CACHE_HOME'] || '~/.cache'
25+
end
26+
end
27+
end
28+
end

0 commit comments

Comments
 (0)