thefox-ext 1.5.1 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d14897095dc26bac336578c091c1e94313834eb3
4
- data.tar.gz: 05c2a4e3466b3f7455a2c6767bb18f9c7e0bcab6
2
+ SHA256:
3
+ metadata.gz: bcefb673b1bb706645dc891ce843d7e63e6910796baa4ac07e18f320a17eaa12
4
+ data.tar.gz: ed00a2d80532d7066b8f1cd8391d6ced0d4731949ad471482a28259754326f3e
5
5
  SHA512:
6
- metadata.gz: b6b408162e7a6518a02c562823960806cc21421b67bfd8c20f601d9377dfaa054013b34d1d6121a5c37035c6389655e1f39d92313d1c37a85c6f327c4ff346d8
7
- data.tar.gz: 1629885191db6325a9061919584c2927c50cc1ac8715c3a91a890dacd5c686715baea51fe3aaaca4bc3de671a38737201643bb05ee428f6ab3d31acd5c856d98
6
+ metadata.gz: 3abf71b5c666eb4ecaeb351d56d5b25c9baa3d81d517bc2a299ea279712f71007bbce299cbd6a5467da3092414129f5a1198b16902d3d7ae6dc04c3a198a61a0
7
+ data.tar.gz: 686db7d5104d99a72df0bb244f510e1366c67a98bbf8c60cf233c025ead1e6475c090f1f727dc86c5766bc64b44ee524151a89ee63796da9df628bcb96b7aed7
data/.editorconfig CHANGED
@@ -3,12 +3,13 @@
3
3
  root = true
4
4
 
5
5
  [*]
6
- indent_style = tab
7
- indent_size = 4
6
+ indent_style = space
7
+ indent_size = 2
8
8
  end_of_line = lf
9
9
  charset = utf-8
10
- trim_trailing_whitespace = false
10
+ trim_trailing_whitespace = true
11
11
  insert_final_newline = true
12
12
 
13
- [*.yml]
14
- indent_style = space
13
+ [*.sh]
14
+ indent_style = tab
15
+ indent_size = 4
data/.env.example ADDED
@@ -0,0 +1,2 @@
1
+ GEM_NAME=thefox-ext
2
+ GEMSPEC_FILE=thefox-ext.gemspec
@@ -0,0 +1,42 @@
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
+ steps:
28
+ - uses: actions/checkout@v2
29
+ - name: Set up Ruby
30
+ uses: ruby/setup-ruby@v1
31
+ #uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
32
+ with:
33
+ ruby-version: ${{ matrix.ruby-version }}
34
+ bundler-cache: true
35
+ - name: Setup Rubygems
36
+ run: |
37
+ mkdir -p ~/.gem
38
+ printf "%s\n:rubygems_api_key: %s" "---" "${RUBYGEMSORG_API_KEY}" > ~/.gem/credentials; chmod 0600 ~/.gem/credentials
39
+ - name: Install
40
+ run: ./bin/install.sh
41
+ - name: Run tests
42
+ run: ./bin/test.sh
@@ -0,0 +1,36 @@
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
+ release:
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ matrix:
19
+ ruby-version:
20
+ - '2.6'
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: Release
36
+ run: ./bin/release.sh
data/.gitignore CHANGED
@@ -1,7 +1,4 @@
1
- /.bundle/
2
- .setup
3
- CHANGELOG-*.txt
4
1
  /coverage/
5
- dev
6
2
  Gemfile.lock
7
- /releases/
3
+ /tmp/
4
+ .env
data/CHANGELOG-v1.md ADDED
@@ -0,0 +1,83 @@
1
+ # Release Notes for Extended Ruby Classes v1.x
2
+
3
+ ## v1.8.0 [unreleased]
4
+
5
+ - Ruby v3 Support
6
+
7
+ ## v1.7.0
8
+
9
+ - GitHub Actions
10
+ - Ruby Support: 2.4, 2.5, 2.6, 2.7
11
+
12
+ ## v1.6.3 [unreleased]
13
+
14
+ Only RCs.
15
+
16
+ ## v1.6.1
17
+
18
+ - Deployment
19
+
20
+ ## v1.6.0
21
+
22
+ - MIT License
23
+ - Remove Travis CI support.
24
+ - Range++
25
+
26
+ ## v1.5.1
27
+
28
+ - Local variable shadowing fix.
29
+
30
+ ## v1.5.0
31
+
32
+ - Array: Range String Resolver added.
33
+ - Test and release using Ruby 2.4.
34
+
35
+ ## v1.4.2
36
+
37
+ - Hash, merge_recursive() - check h2 class.
38
+
39
+ ## v1.4.1
40
+
41
+ - Hash Bugfix: do nothing when the key of Hash 2 doesn't exist.
42
+
43
+ ## v1.4.0
44
+
45
+ - Hash extension added.
46
+ - Date: get week array for a specific date.
47
+ - Hash: don't make a clone; modify the source hash.
48
+
49
+ ## v1.3.0
50
+
51
+ - `Date.today?` function added.
52
+
53
+ ## v1.2.1
54
+
55
+ - Dependency fixes.
56
+
57
+ ## v1.2.0
58
+
59
+ - String: to_hex function added.
60
+ - Console support class added.
61
+ - NilClass fix.
62
+ - Tests added.
63
+
64
+ ## v1.1.1
65
+
66
+ - Version date fix.
67
+
68
+ ## v1.1.0
69
+
70
+ - 'install' target added.
71
+ - Nil extension added.
72
+ - Common Makefile added.
73
+ - True extension added.
74
+ - False extension added.
75
+ - Integer extension added.
76
+ - String: to_i32a function added.
77
+ - String: is_digit, is_lower and is_upper function added.
78
+
79
+ ## v1.0.0
80
+
81
+ - String Manipulation
82
+ - Title Case
83
+ - 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
@@ -2,20 +2,33 @@
2
2
 
3
3
  This gem extents some of the basic Ruby classes by missing functionalities.
4
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.
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
- gem install thefox-ext
17
+ ```bash
18
+ gem install thefox-ext
19
+ ```
11
20
 
12
21
  or via `Gemfile`:
13
22
 
14
- gem 'thefox-ext', '~>1.5'
23
+ ```ruby
24
+ gem 'thefox-ext', '~>1.5'
25
+ ```
15
26
 
16
27
  Use it in your sources:
17
28
 
18
- require 'thefox-ext'
29
+ ```ruby
30
+ require 'thefox-ext'
31
+ ```
19
32
 
20
33
  ## Features
21
34
 
@@ -35,12 +48,3 @@ Use it in your sources:
35
48
  ## Project Links
36
49
 
37
50
  - [Gem](https://rubygems.org/gems/thefox-ext)
38
- - [Travis CI Repository](https://travis-ci.org/TheFox/ext.rb)
39
-
40
- ## License
41
-
42
- Copyright (C) 2015 Christian Mayer <https://fox21.at>
43
-
44
- 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.
45
-
46
- 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
@@ -1,50 +1,50 @@
1
1
 
2
2
  class Console
3
-
4
- CHAR_ESCAPE = "\x1b"
5
-
6
- def self.cursor_up(rows = 1)
7
- print "#{CHAR_ESCAPE}[#{rows}A"
8
- end
9
-
10
- def self.cursor_down(rows = 1)
11
- print "#{CHAR_ESCAPE}[#{rows}B"
12
- end
13
-
14
- def self.cursor_jump_to_top
15
- print "#{CHAR_ESCAPE}[1;1f"
16
- end
17
-
18
- def self.cursor_jump_to_column(col = 1)
19
- print "#{CHAR_ESCAPE}[#{col}G"
20
- end
21
-
22
- def self.cursor_right(offset = 1)
23
- print "#{CHAR_ESCAPE}[#{offset}C"
24
- end
25
-
26
- def self.cursor_left(offset = 1)
27
- print "#{CHAR_ESCAPE}[#{offset}D"
28
- end
29
-
30
- def self.line_clear
31
- print "\r#{CHAR_ESCAPE}[K"
32
- end
33
-
34
- def self.line_clear_right
35
- print "#{CHAR_ESCAPE}[0K"
36
- end
37
-
38
- def self.screen_clear_to_bottom
39
- print "#{CHAR_ESCAPE}[J"
40
- end
41
-
42
- def self.scroll_up
43
- print "#{CHAR_ESCAPE}[S"
44
- end
45
-
46
- def self.scroll_down
47
- print "#{CHAR_ESCAPE}[T"
48
- end
49
-
3
+
4
+ CHAR_ESCAPE = "\x1b"
5
+
6
+ def self.cursor_up(rows = 1)
7
+ print "#{CHAR_ESCAPE}[#{rows}A"
8
+ end
9
+
10
+ def self.cursor_down(rows = 1)
11
+ print "#{CHAR_ESCAPE}[#{rows}B"
12
+ end
13
+
14
+ def self.cursor_jump_to_top
15
+ print "#{CHAR_ESCAPE}[1;1f"
16
+ end
17
+
18
+ def self.cursor_jump_to_column(col = 1)
19
+ print "#{CHAR_ESCAPE}[#{col}G"
20
+ end
21
+
22
+ def self.cursor_right(offset = 1)
23
+ print "#{CHAR_ESCAPE}[#{offset}C"
24
+ end
25
+
26
+ def self.cursor_left(offset = 1)
27
+ print "#{CHAR_ESCAPE}[#{offset}D"
28
+ end
29
+
30
+ def self.line_clear
31
+ print "\r#{CHAR_ESCAPE}[K"
32
+ end
33
+
34
+ def self.line_clear_right
35
+ print "#{CHAR_ESCAPE}[0K"
36
+ end
37
+
38
+ def self.screen_clear_to_bottom
39
+ print "#{CHAR_ESCAPE}[J"
40
+ end
41
+
42
+ def self.scroll_up
43
+ print "#{CHAR_ESCAPE}[S"
44
+ end
45
+
46
+ def self.scroll_down
47
+ print "#{CHAR_ESCAPE}[T"
48
+ end
49
+
50
50
  end