thefox-ext 1.3.0 → 1.6.3.pre.rc.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +15 -0
- data/.env.example +2 -0
- data/.github/workflows/ci.yml +43 -0
- data/.github/workflows/release.yml +38 -0
- data/.gitignore +3 -4
- data/CHANGELOG-v1.md +68 -0
- data/LICENSE +21 -0
- data/README.md +25 -14
- data/bin/.gitignore +1 -0
- data/bin/install.sh +51 -0
- data/bin/release.sh +37 -0
- data/bin/setup.sh +17 -0
- data/bin/test.sh +13 -0
- data/bin/uninstall.sh +24 -0
- data/lib/thefox-ext.rb +2 -0
- data/lib/thefox-ext/console.rb +47 -47
- data/lib/thefox-ext/ext/array.rb +38 -0
- data/lib/thefox-ext/ext/date.rb +42 -3
- data/lib/thefox-ext/ext/false.rb +6 -3
- data/lib/thefox-ext/ext/hash.rb +65 -0
- data/lib/thefox-ext/ext/integer.rb +3 -3
- data/lib/thefox-ext/ext/nil.rb +3 -3
- data/lib/thefox-ext/ext/string.rb +63 -57
- data/lib/thefox-ext/ext/true.rb +6 -3
- data/lib/thefox-ext/version.rb +5 -4
- data/thefox-ext.code-workspace +32 -0
- data/thefox-ext.gemspec +9 -7
- metadata +54 -20
- data/.travis.yml +0 -16
- data/Makefile +0 -8
- data/Makefile.common +0 -53
- data/tests/tc_date.rb +0 -19
- data/tests/tc_false.rb +0 -11
- data/tests/tc_integer.rb +0 -20
- data/tests/tc_nil.rb +0 -11
- data/tests/tc_string.rb +0 -87
- data/tests/tc_true.rb +0 -11
- data/tests/ts_all.rb +0 -8
- data/thefox-ext.sublime-project +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56f0aaf1d0a526b2e25839310cfad8eabbe388b6
|
4
|
+
data.tar.gz: d584f785472a160c9839dfd626e324b35797954a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9364e92312062f0eba009a5d4286edf90b7d21cd5e0bc42d4e1b910a6dd6e7beab9a77fc07ab37e755784a97b22fd9589d405b76c84300966d5055d8415f72c
|
7
|
+
data.tar.gz: 851d645cb01ddb424ff65a95239bb883752f58e7f8d2306f4b5739ede885a6b6edfcf0321f930ba643ceb2b4c69098b40cead2b33f1be996983212fc183163fa
|
data/.editorconfig
ADDED
data/.env.example
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
name: CI
|
3
|
+
|
4
|
+
env:
|
5
|
+
LANG: C.UTF-8
|
6
|
+
GEM_NAME: thefox-ext
|
7
|
+
GEMSPEC_FILE: thefox-ext.gemspec
|
8
|
+
|
9
|
+
on:
|
10
|
+
push:
|
11
|
+
branches:
|
12
|
+
- master
|
13
|
+
tags:
|
14
|
+
- v*
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
strategy:
|
20
|
+
matrix:
|
21
|
+
ruby-version:
|
22
|
+
- '2.3'
|
23
|
+
# - '2.4'
|
24
|
+
# - '2.5'
|
25
|
+
# - '2.6'
|
26
|
+
# - '2.7'
|
27
|
+
# - '3.0'
|
28
|
+
steps:
|
29
|
+
- uses: actions/checkout@v2
|
30
|
+
- name: Set up Ruby
|
31
|
+
uses: ruby/setup-ruby@v1
|
32
|
+
#uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
33
|
+
with:
|
34
|
+
ruby-version: ${{ matrix.ruby-version }}
|
35
|
+
bundler-cache: true
|
36
|
+
- name: Setup Rubygems
|
37
|
+
run: |
|
38
|
+
mkdir -p ~/.gem
|
39
|
+
printf "%s\n:rubygems_api_key: %s" "---" "${RUBYGEMSORG_API_KEY}" > ~/.gem/credentials; chmod 0600 ~/.gem/credentials
|
40
|
+
- name: Install
|
41
|
+
run: ./bin/install.sh
|
42
|
+
- name: Run tests
|
43
|
+
run: ./bin/test.sh
|
@@ -0,0 +1,38 @@
|
|
1
|
+
|
2
|
+
name: Release
|
3
|
+
|
4
|
+
env:
|
5
|
+
LANG: C.UTF-8
|
6
|
+
GEM_NAME: thefox-ext
|
7
|
+
GEMSPEC_FILE: thefox-ext.gemspec
|
8
|
+
|
9
|
+
on:
|
10
|
+
push:
|
11
|
+
tags:
|
12
|
+
- v*
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
test:
|
16
|
+
runs-on: ubuntu-latest
|
17
|
+
strategy:
|
18
|
+
matrix:
|
19
|
+
ruby-version:
|
20
|
+
- '2.3'
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v2
|
23
|
+
- name: Set up Ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
#uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
|
26
|
+
with:
|
27
|
+
ruby-version: ${{ matrix.ruby-version }}
|
28
|
+
bundler-cache: true
|
29
|
+
- name: Setup Rubygems
|
30
|
+
env:
|
31
|
+
RUBYGEMSORG_API_KEY: ${{ secrets.RUBYGEMSORG_API_KEY }}
|
32
|
+
run: |
|
33
|
+
mkdir -p ~/.gem
|
34
|
+
printf "%s\n:rubygems_api_key: %s" "---" "${RUBYGEMSORG_API_KEY}" > ~/.gem/credentials; chmod 0600 ~/.gem/credentials
|
35
|
+
- name: Install
|
36
|
+
run: ./bin/install.sh
|
37
|
+
- name: Release
|
38
|
+
run: ./bin/release.sh
|
data/.gitignore
CHANGED
data/CHANGELOG-v1.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Release Notes for Extended Ruby Classes v1.x
|
2
|
+
|
3
|
+
## v1.7.0 [unreleased]
|
4
|
+
|
5
|
+
## v1.6.0
|
6
|
+
|
7
|
+
- MIT License
|
8
|
+
- Remove Travis CI support.
|
9
|
+
- Range++
|
10
|
+
|
11
|
+
## v1.5.1
|
12
|
+
|
13
|
+
- Local variable shadowing fix.
|
14
|
+
|
15
|
+
## v1.5.0
|
16
|
+
|
17
|
+
- Array: Range String Resolver added.
|
18
|
+
- Test and release using Ruby 2.4.
|
19
|
+
|
20
|
+
## v1.4.2
|
21
|
+
|
22
|
+
- Hash, merge_recursive() - check h2 class.
|
23
|
+
|
24
|
+
## v1.4.1
|
25
|
+
|
26
|
+
- Hash Bugfix: do nothing when the key of Hash 2 doesn't exist.
|
27
|
+
|
28
|
+
## v1.4.0
|
29
|
+
|
30
|
+
- Hash extension added.
|
31
|
+
- Date: get week array for a specific date.
|
32
|
+
- Hash: don't make a clone; modify the source hash.
|
33
|
+
|
34
|
+
## v1.3.0
|
35
|
+
|
36
|
+
- `Date.today?` function added.
|
37
|
+
|
38
|
+
## v1.2.1
|
39
|
+
|
40
|
+
- Dependency fixes.
|
41
|
+
|
42
|
+
## v1.2.0
|
43
|
+
|
44
|
+
- String: to_hex function added.
|
45
|
+
- Console support class added.
|
46
|
+
- NilClass fix.
|
47
|
+
- Tests added.
|
48
|
+
|
49
|
+
## v1.1.1
|
50
|
+
|
51
|
+
- Version date fix.
|
52
|
+
|
53
|
+
## v1.1.0
|
54
|
+
|
55
|
+
- 'install' target added.
|
56
|
+
- Nil extension added.
|
57
|
+
- Common Makefile added.
|
58
|
+
- True extension added.
|
59
|
+
- False extension added.
|
60
|
+
- Integer extension added.
|
61
|
+
- String: to_i32a function added.
|
62
|
+
- String: is_digit, is_lower and is_upper function added.
|
63
|
+
|
64
|
+
## v1.0.0
|
65
|
+
|
66
|
+
- String Manipulation
|
67
|
+
- Title Case
|
68
|
+
- UTF-8 Encoding
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2015 Christian Mayer
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,21 +1,34 @@
|
|
1
1
|
# Extended Ruby Classes
|
2
2
|
|
3
|
-
|
3
|
+
This gem extents some of the basic Ruby classes by missing functionalities.
|
4
|
+
|
5
|
+
## Project Outlines
|
6
|
+
|
7
|
+
The project outlines as described in my blog post about [Open Source Software Collaboration](https://blog.fox21.at/2019/02/21/open-source-software-collaboration.html).
|
8
|
+
|
9
|
+
- The main purpose of this collection is to provide common single functions or classes, which are too small for a separate project.
|
10
|
+
- This list is open. Feel free to request features.
|
4
11
|
|
5
12
|
## Install
|
6
13
|
|
7
|
-
The preferred method of installation is via RubyGems.org:
|
14
|
+
The preferred method of installation is via RubyGems.org:
|
8
15
|
<https://rubygems.org/gems/thefox-ext>
|
9
16
|
|
10
|
-
|
17
|
+
```bash
|
18
|
+
gem install thefox-ext
|
19
|
+
```
|
11
20
|
|
12
21
|
or via `Gemfile`:
|
13
22
|
|
14
|
-
|
23
|
+
```ruby
|
24
|
+
gem 'thefox-ext', '~>1.5'
|
25
|
+
```
|
15
26
|
|
16
27
|
Use it in your sources:
|
17
28
|
|
18
|
-
|
29
|
+
```ruby
|
30
|
+
require 'thefox-ext'
|
31
|
+
```
|
19
32
|
|
20
33
|
## Features
|
21
34
|
|
@@ -24,16 +37,14 @@ Use it in your sources:
|
|
24
37
|
- UTF-8 Encoding
|
25
38
|
- Intenger 32-bit Array
|
26
39
|
- Console Support
|
27
|
-
- Date
|
40
|
+
- Date
|
41
|
+
- `today?`
|
42
|
+
- Get week array for a specific date.
|
43
|
+
- Array
|
44
|
+
- Range String Resolver
|
45
|
+
- Hash
|
46
|
+
- Recursive Merge
|
28
47
|
|
29
48
|
## Project Links
|
30
49
|
|
31
50
|
- [Gem](https://rubygems.org/gems/thefox-ext)
|
32
|
-
- [Travis CI Repository](https://travis-ci.org/TheFox/ext.rb)
|
33
|
-
|
34
|
-
## License
|
35
|
-
Copyright (C) 2015 Christian Mayer <http://fox21.at>
|
36
|
-
|
37
|
-
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
38
|
-
|
39
|
-
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
data/bin/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
dev
|
data/bin/install.sh
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Install Gem local.
|
4
|
+
|
5
|
+
SCRIPT_BASEDIR=$(dirname "$0")
|
6
|
+
|
7
|
+
|
8
|
+
option=$1
|
9
|
+
set -e
|
10
|
+
which mkdir &> /dev/null || { echo 'ERROR: mkdir not found in PATH'; exit 1; }
|
11
|
+
which mv &> /dev/null || { echo 'ERROR: mv not found in PATH'; exit 1; }
|
12
|
+
which chmod &> /dev/null || { echo 'ERROR: chmod not found in PATH'; exit 1; }
|
13
|
+
which gem &> /dev/null || { echo 'ERROR: gem not found in PATH'; exit 1; }
|
14
|
+
which bundler &> /dev/null || { echo 'ERROR: bundler not found in PATH'; exit 1; }
|
15
|
+
|
16
|
+
cd "${SCRIPT_BASEDIR}/.."
|
17
|
+
|
18
|
+
# Load Environment Variables
|
19
|
+
[[ -f .env ]] && source .env
|
20
|
+
|
21
|
+
if [[ -z "${GEMSPEC_FILE}" ]] ; then
|
22
|
+
echo 'ERROR: one of the environment variables is missing'
|
23
|
+
|
24
|
+
echo "GEMSPEC_FILE: '${GEMSPEC_FILE}'"
|
25
|
+
|
26
|
+
exit 1
|
27
|
+
fi
|
28
|
+
|
29
|
+
gem_file=$(gem build "${GEMSPEC_FILE}" 2> /dev/null | grep 'File:' | tail -1 | awk '{ print $2 }')
|
30
|
+
|
31
|
+
if [[ -z "$gem_file" ]] ; then
|
32
|
+
echo 'ERROR: gem_file variable not set'
|
33
|
+
exit 1
|
34
|
+
fi
|
35
|
+
|
36
|
+
echo "install gem file '$gem_file'"
|
37
|
+
gem install "$gem_file"
|
38
|
+
|
39
|
+
# Create tmp directory.
|
40
|
+
if [[ ! -d tmp/releases ]]; then
|
41
|
+
mkdir -p tmp/releases
|
42
|
+
|
43
|
+
chmod u=rwx,go-rwx tmp
|
44
|
+
chmod u=rwx,go-rwx tmp/releases
|
45
|
+
fi
|
46
|
+
|
47
|
+
if [[ "$option" = "-f" ]]; then
|
48
|
+
mv -v "$gem_file" tmp/releases
|
49
|
+
else
|
50
|
+
mv -v -i "$gem_file" tmp/releases
|
51
|
+
fi
|
data/bin/release.sh
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Release gem to https://rubygems.org.
|
4
|
+
|
5
|
+
SCRIPT_BASEDIR=$(dirname "$0")
|
6
|
+
|
7
|
+
which mv &> /dev/null || { echo 'ERROR: mv not found in PATH'; exit 1; }
|
8
|
+
which gem &> /dev/null || { echo 'ERROR: gem not found in PATH'; exit 1; }
|
9
|
+
|
10
|
+
cd "${SCRIPT_BASEDIR}/.."
|
11
|
+
|
12
|
+
# Load Environment Variables
|
13
|
+
if [[ -f .env ]] ; then
|
14
|
+
source .env
|
15
|
+
fi
|
16
|
+
|
17
|
+
if [[ -z "${GEMSPEC_FILE}" ]] ; then
|
18
|
+
echo 'ERROR: one of the environment variables is missing'
|
19
|
+
|
20
|
+
echo "GEMSPEC_FILE: '${GEMSPEC_FILE}'"
|
21
|
+
|
22
|
+
exit 1
|
23
|
+
fi
|
24
|
+
|
25
|
+
gem_file=$(gem build "${GEMSPEC_FILE}" 2> /dev/null | grep 'File:' | tail -1 | awk '{ print $2 }')
|
26
|
+
|
27
|
+
echo "push gem file '$gem_file'"
|
28
|
+
gem push "$gem_file"
|
29
|
+
|
30
|
+
# Create tmp directory.
|
31
|
+
if [[ ! -d tmp/releases ]]; then
|
32
|
+
mkdir -p tmp/releases
|
33
|
+
|
34
|
+
chmod u=rwx,go-rwx tmp
|
35
|
+
chmod u=rwx,go-rwx tmp/releases
|
36
|
+
fi
|
37
|
+
mv -v -i "$gem_file" tmp/releases
|
data/bin/setup.sh
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Development setup.
|
4
|
+
|
5
|
+
SCRIPT_BASEDIR=$(dirname "$0")
|
6
|
+
|
7
|
+
which cp &> /dev/null || { echo 'ERROR: cp not found in PATH'; exit 1; }
|
8
|
+
which bundler &> /dev/null || { echo 'ERROR: bundler not found in PATH'; exit 1; }
|
9
|
+
|
10
|
+
cd "${SCRIPT_BASEDIR}/.."
|
11
|
+
|
12
|
+
# Create .env file.
|
13
|
+
if [[ ! -f .env ]]; then
|
14
|
+
cp .env.example .env
|
15
|
+
fi
|
16
|
+
|
17
|
+
bundler install
|
data/bin/test.sh
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Run Tests.
|
4
|
+
|
5
|
+
SCRIPT_BASEDIR=$(dirname "$0")
|
6
|
+
RUBYOPT=-w
|
7
|
+
TZ=Europe/Vienna
|
8
|
+
|
9
|
+
which bundler &> /dev/null || { echo 'ERROR: bundler not found in PATH'; exit 1; }
|
10
|
+
|
11
|
+
cd "${SCRIPT_BASEDIR}/.."
|
12
|
+
|
13
|
+
bundler exec ./test/suite_all.rb $*
|
data/bin/uninstall.sh
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
# Uninstall gem.
|
4
|
+
|
5
|
+
SCRIPT_BASEDIR=$(dirname "$0")
|
6
|
+
|
7
|
+
|
8
|
+
set -e
|
9
|
+
which gem &> /dev/null || { echo 'ERROR: gem not found in PATH'; exit 1; }
|
10
|
+
|
11
|
+
cd "${SCRIPT_BASEDIR}/.."
|
12
|
+
|
13
|
+
# Load Environment Variables
|
14
|
+
[[ -f .env ]] && source .env
|
15
|
+
|
16
|
+
if [[ -z "${GEM_NAME}" ]] ; then
|
17
|
+
echo 'ERROR: one of the environment variables is missing'
|
18
|
+
|
19
|
+
echo "GEM_NAME: '${GEM_NAME}'"
|
20
|
+
|
21
|
+
exit 1
|
22
|
+
fi
|
23
|
+
|
24
|
+
gem uninstall "${GEM_NAME}" --all --executables
|
data/lib/thefox-ext.rb
CHANGED
@@ -3,9 +3,11 @@ require 'thefox-ext/version'
|
|
3
3
|
|
4
4
|
require 'thefox-ext/ext/date'
|
5
5
|
require 'thefox-ext/ext/false'
|
6
|
+
require 'thefox-ext/ext/hash'
|
6
7
|
require 'thefox-ext/ext/integer'
|
7
8
|
require 'thefox-ext/ext/nil'
|
8
9
|
require 'thefox-ext/ext/string'
|
9
10
|
require 'thefox-ext/ext/true'
|
11
|
+
require 'thefox-ext/ext/array'
|
10
12
|
|
11
13
|
require 'thefox-ext/console'
|