thefox-ext 1.5.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d14897095dc26bac336578c091c1e94313834eb3
4
- data.tar.gz: 05c2a4e3466b3f7455a2c6767bb18f9c7e0bcab6
3
+ metadata.gz: 56f0aaf1d0a526b2e25839310cfad8eabbe388b6
4
+ data.tar.gz: d584f785472a160c9839dfd626e324b35797954a
5
5
  SHA512:
6
- metadata.gz: b6b408162e7a6518a02c562823960806cc21421b67bfd8c20f601d9377dfaa054013b34d1d6121a5c37035c6389655e1f39d92313d1c37a85c6f327c4ff346d8
7
- data.tar.gz: 1629885191db6325a9061919584c2927c50cc1ac8715c3a91a890dacd5c686715baea51fe3aaaca4bc3de671a38737201643bb05ee428f6ab3d31acd5c856d98
6
+ metadata.gz: f9364e92312062f0eba009a5d4286edf90b7d21cd5e0bc42d4e1b910a6dd6e7beab9a77fc07ab37e755784a97b22fd9589d405b76c84300966d5055d8415f72c
7
+ data.tar.gz: 851d645cb01ddb424ff65a95239bb883752f58e7f8d2306f4b5739ede885a6b6edfcf0321f930ba643ceb2b4c69098b40cead2b33f1be996983212fc183163fa
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,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
@@ -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,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
@@ -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