random-words 1.0.15 → 1.0.16
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile +4 -3
- data/Rakefile +96 -0
- data/docker/Dockerfile +12 -0
- data/docker/Dockerfile-2.6 +13 -0
- data/docker/Dockerfile-2.7 +13 -0
- data/docker/Dockerfile-3.0 +13 -0
- data/docker/Dockerfile-3.3 +13 -0
- data/docker/Dockerfile-3.4 +13 -0
- data/docker/bash_profile +17 -0
- data/docker/inputrc +57 -0
- data/docker/sources.list +11 -0
- data/lib/random-words/source.rb +1 -1
- data/lib/random-words/string.rb +18 -0
- data/lib/random-words/version.rb +1 -1
- data/random-words.gemspec +2 -1
- data/scripts/runtests.sh +5 -0
- metadata +31 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b39309d58668b2ae045ea68974a6281e6256f65a3810cddb75a808d6484a372
|
4
|
+
data.tar.gz: 67954ff10b5a2dd032bcbd1776444998c69eb5fb4e85bfb890477e9731ca67ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c507cbb755b641f23b2249e4e989ee11fb65bcc61d628e453bdf6d7fd03f0859f064efe00c38ea848e42674b61b5c2264b51eb0b53e9875d746ec5f7bb8e37dc
|
7
|
+
data.tar.gz: bf006d722b68479d26fc7be323beb6c5cfd9548c4c71a3c63a2c462968df46f2971268ba4cd5c3292f3ed20cbb461c44f99123aed21b487bc1a2c1020f4392b0
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -16,6 +16,7 @@ gem "simplecov", "~> 0.21"
|
|
16
16
|
gem "simplecov-console", "~> 0.9"
|
17
17
|
gem "standard", "~> 1.3"
|
18
18
|
gem "yard", "~> 0.9", ">= 0.9.36"
|
19
|
-
gem "rubocop", "~> 1.75.2"
|
20
|
-
gem "rubocop-performance", "~> 1.25.0"
|
21
|
-
gem "rubocop-rspec", "~> 2.0"
|
19
|
+
# gem "rubocop", "~> 1.75.2"
|
20
|
+
# gem "rubocop-performance", "~> 1.25.0"
|
21
|
+
# gem "rubocop-rspec", "~> 2.0"
|
22
|
+
gem "tty-spinner", "~> 0.9", ">= 0.9.0"
|
data/Rakefile
CHANGED
@@ -3,6 +3,18 @@ require 'rspec/core/rake_task'
|
|
3
3
|
require 'rdoc/task'
|
4
4
|
require 'standard/rake'
|
5
5
|
require 'yard'
|
6
|
+
require 'tty-spinner'
|
7
|
+
require 'English'
|
8
|
+
|
9
|
+
## Docker error class
|
10
|
+
class DockerError < StandardError
|
11
|
+
def initialize(msg = nil)
|
12
|
+
msg = msg ? "Docker error: #{msg}" : 'Docker error'
|
13
|
+
super
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# task :doc, [*Rake.application[:yard].arg_names] => [:yard]
|
6
18
|
|
7
19
|
Rake::RDocTask.new do |rd|
|
8
20
|
rd.main = 'README.rdoc'
|
@@ -83,3 +95,87 @@ task :bump, :type do |_, args|
|
|
83
95
|
end
|
84
96
|
File.open(version_file, 'w+') { |f| f.puts content }
|
85
97
|
end
|
98
|
+
|
99
|
+
desc 'Run tests in Docker'
|
100
|
+
task :dockertest, :version, :login, :attempt do |_, args|
|
101
|
+
args.with_defaults(version: 'all', login: false, attempt: 1)
|
102
|
+
`open -a Docker`
|
103
|
+
|
104
|
+
Rake::Task['clobber'].reenable
|
105
|
+
Rake::Task['clobber'].invoke
|
106
|
+
Rake::Task['build'].reenable
|
107
|
+
Rake::Task['build'].invoke
|
108
|
+
|
109
|
+
case args[:version]
|
110
|
+
when /^a/
|
111
|
+
%w[26 27 30 33 34].each do |v|
|
112
|
+
Rake::Task['dockertest'].reenable
|
113
|
+
Rake::Task['dockertest'].invoke(v, false)
|
114
|
+
end
|
115
|
+
Process.exit 0
|
116
|
+
when /^3\.?4/
|
117
|
+
version = '3.4'
|
118
|
+
img = 'randwtest34'
|
119
|
+
file = 'docker/Dockerfile-3.4'
|
120
|
+
when /^3\.?3/
|
121
|
+
version = '3.3'
|
122
|
+
img = 'randwtest33'
|
123
|
+
file = 'docker/Dockerfile-3.3'
|
124
|
+
when /^2\.?6/
|
125
|
+
version = '2.6'
|
126
|
+
img = 'randwtest26'
|
127
|
+
file = 'docker/Dockerfile-2.6'
|
128
|
+
when /^2/
|
129
|
+
version = '2.7'
|
130
|
+
img = 'randwtest27'
|
131
|
+
file = 'docker/Dockerfile-2.7'
|
132
|
+
else
|
133
|
+
version = '3.0'
|
134
|
+
img = 'randwtest30'
|
135
|
+
file = 'docker/Dockerfile-3.0'
|
136
|
+
end
|
137
|
+
|
138
|
+
spinner = TTY::Spinner.new("[:spinner] Updating Docker image (#{version})...", hide_cursor: true)
|
139
|
+
`docker build . --file #{file} -t #{img} &> /dev/null`
|
140
|
+
|
141
|
+
unless $CHILD_STATUS.success?
|
142
|
+
spinner.error
|
143
|
+
spinner.stop
|
144
|
+
raise DockerError, 'Error building docker image'
|
145
|
+
end
|
146
|
+
|
147
|
+
spinner.success
|
148
|
+
spinner.stop
|
149
|
+
|
150
|
+
dirs = {
|
151
|
+
File.dirname(__FILE__) => '/randw',
|
152
|
+
File.expand_path('~/.config') => '/root/.config'
|
153
|
+
}
|
154
|
+
dir_args = dirs.map { |s, d| " -v '#{s}:#{d}'" }.join(' ')
|
155
|
+
exec "docker run #{dir_args} --name #{img} -it #{img} /bin/bash -l" if args[:login]
|
156
|
+
|
157
|
+
spinner = TTY::Spinner.new("[:spinner] Running tests (#{version})...", hide_cursor: true)
|
158
|
+
|
159
|
+
spinner.auto_spin
|
160
|
+
output = `docker run --name #{img} --rm #{dir_args} -it #{img} 2>&1`
|
161
|
+
if $CHILD_STATUS.success?
|
162
|
+
spinner.success
|
163
|
+
spinner.stop
|
164
|
+
else
|
165
|
+
spinner.error
|
166
|
+
spinner.stop
|
167
|
+
raise DockerError, 'Error running docker image'
|
168
|
+
puts output
|
169
|
+
end
|
170
|
+
|
171
|
+
# commit = puts `bash -c "docker commit $(docker ps -a|grep #{img}|awk '{print $1}'|head -n 1) #{img}"`.strip
|
172
|
+
|
173
|
+
# puts commit&.empty? ? "Error commiting Docker tag #{img}" : "Committed Docker tag #{img}"
|
174
|
+
rescue DockerError
|
175
|
+
raise StandardError.new('Docker not responding') if args[:attempt] > 3
|
176
|
+
|
177
|
+
`open -a Docker`
|
178
|
+
sleep 3
|
179
|
+
Rake::Task['dockertest'].reenable
|
180
|
+
Rake::Task['dockertest'].invoke(args[:version], args[:login], args[:attempt] + 1)
|
181
|
+
end
|
data/docker/Dockerfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
FROM ruby:3.0.1
|
2
|
+
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
3
|
+
RUN mkdir /randw
|
4
|
+
WORKDIR /randw
|
5
|
+
RUN gem install bundler:2.2
|
6
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
7
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
8
|
+
RUN apt-get install -y sudo || true
|
9
|
+
RUN sudo apt-get install -y less vim || true
|
10
|
+
COPY ./docker/inputrc /root/.inputrc
|
11
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
12
|
+
CMD ["/randw/scripts/runtests.sh"]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FROM ruby:2.6
|
2
|
+
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
3
|
+
RUN mkdir /randw
|
4
|
+
WORKDIR /randw
|
5
|
+
RUN gem install bundler:2.2
|
6
|
+
RUN bundle config set force_ruby_platform true
|
7
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
8
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
9
|
+
RUN apt-get install -y sudo || true
|
10
|
+
RUN sudo apt-get install -y less vim || true
|
11
|
+
COPY ./docker/inputrc /root/.inputrc
|
12
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
13
|
+
CMD ["/randw/scripts/runtests.sh"]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FROM ruby:2.7
|
2
|
+
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
3
|
+
RUN mkdir /randw
|
4
|
+
WORKDIR /randw
|
5
|
+
RUN gem install bundler:2.2
|
6
|
+
RUN bundle config set force_ruby_platform true
|
7
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
8
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
9
|
+
RUN apt-get install -y sudo || true
|
10
|
+
RUN sudo apt-get install -y less vim || true
|
11
|
+
COPY ./docker/inputrc /root/.inputrc
|
12
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
13
|
+
CMD ["/randw/scripts/runtests.sh"]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FROM ruby:3.0.1
|
2
|
+
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
3
|
+
RUN mkdir /randw
|
4
|
+
WORKDIR /randw
|
5
|
+
RUN gem install bundler:2.2
|
6
|
+
RUN bundle config set force_ruby_platform true
|
7
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
8
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
9
|
+
RUN apt-get install -y sudo || true
|
10
|
+
RUN sudo apt-get install -y less vim || true
|
11
|
+
COPY ./docker/inputrc /root/.inputrc
|
12
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
13
|
+
CMD ["/randw/scripts/runtests.sh"]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FROM ruby:3.3.0
|
2
|
+
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
3
|
+
RUN mkdir /randw
|
4
|
+
WORKDIR /randw
|
5
|
+
RUN gem install bundler:2.6.8
|
6
|
+
RUN bundle config set force_ruby_platform true
|
7
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
8
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
9
|
+
RUN apt-get install -y sudo || true
|
10
|
+
RUN sudo apt-get install -y less vim || true
|
11
|
+
COPY ./docker/inputrc /root/.inputrc
|
12
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
13
|
+
CMD ["/randw/scripts/runtests.sh"]
|
@@ -0,0 +1,13 @@
|
|
1
|
+
FROM ruby:3.4.4
|
2
|
+
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
3
|
+
RUN mkdir /randw
|
4
|
+
WORKDIR /randw
|
5
|
+
RUN gem install bundler:2.6.8
|
6
|
+
RUN bundle config set force_ruby_platform true
|
7
|
+
COPY ./docker/sources.list /etc/apt/sources.list
|
8
|
+
RUN apt-get update -y --allow-insecure-repositories || true
|
9
|
+
RUN apt-get install -y sudo || true
|
10
|
+
RUN sudo apt-get install -y less vim || true
|
11
|
+
COPY ./docker/inputrc /root/.inputrc
|
12
|
+
COPY ./docker/bash_profile /root/.bash_profile
|
13
|
+
CMD ["/randw/scripts/runtests.sh"]
|
data/docker/bash_profile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
export GLI_DEBUG=true
|
3
|
+
export EDITOR="/usr/bin/vim"
|
4
|
+
alias b="bundle exec bin/randw"
|
5
|
+
alias be="bundle exec"
|
6
|
+
alias quit="exit"
|
7
|
+
|
8
|
+
shopt -s nocaseglob
|
9
|
+
shopt -s histappend
|
10
|
+
shopt -s histreedit
|
11
|
+
shopt -s histverify
|
12
|
+
shopt -s cmdhist
|
13
|
+
|
14
|
+
cd /randw
|
15
|
+
bundle update
|
16
|
+
gem update --system
|
17
|
+
gem install pkg/*.gem
|
data/docker/inputrc
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
"\e[3~": delete-char
|
2
|
+
"\ex": 'cd !$ \015ls\015'
|
3
|
+
"\ez": 'cd -\015'
|
4
|
+
"\e\C-m": '\C-a "$(\C-e|fzf)"\C-a'
|
5
|
+
"\e/": '"$(!!|fzf)"\C-a \C-m\C-m'
|
6
|
+
# these allow you to use alt+left/right arrow keys
|
7
|
+
# to jump the cursor over words
|
8
|
+
"\e[1;5C": forward-word
|
9
|
+
"\e[1;5D": backward-word
|
10
|
+
# "\e[D": backward-word
|
11
|
+
# "\e[C": forward-word
|
12
|
+
"\ea": menu-complete
|
13
|
+
# TAB: menu-complete
|
14
|
+
# "\e[Z": "\e-1\C-i"
|
15
|
+
|
16
|
+
"\e\C-l": history-and-alias-expand-line
|
17
|
+
|
18
|
+
# these allow you to start typing a command and
|
19
|
+
# use the up/down arrow to auto complete from
|
20
|
+
# commands in your history
|
21
|
+
"\e[B": history-search-forward
|
22
|
+
"\e[A": history-search-backward
|
23
|
+
"\ew": history-search-backward
|
24
|
+
"\es": history-search-forward
|
25
|
+
# this lets you hit tab to auto-complete a file or
|
26
|
+
# directory name ignoring case
|
27
|
+
set completion-ignore-case On
|
28
|
+
set mark-symlinked-directories On
|
29
|
+
set completion-prefix-display-length 2
|
30
|
+
set bell-style none
|
31
|
+
# set bell-style visible
|
32
|
+
set meta-flag on
|
33
|
+
set convert-meta off
|
34
|
+
set input-meta on
|
35
|
+
set output-meta on
|
36
|
+
set show-all-if-ambiguous on
|
37
|
+
set show-all-if-unmodified on
|
38
|
+
set completion-map-case on
|
39
|
+
set visible-stats on
|
40
|
+
|
41
|
+
# Do history expansion when space entered?
|
42
|
+
$if bash
|
43
|
+
Space: magic-space
|
44
|
+
$endif
|
45
|
+
|
46
|
+
# Show extra file information when completing, like `ls -F` does
|
47
|
+
set visible-stats on
|
48
|
+
|
49
|
+
# Be more intelligent when autocompleting by also looking at the text after
|
50
|
+
# the cursor. For example, when the current line is "cd ~/src/mozil", and
|
51
|
+
# the cursor is on the "z", pressing Tab will not autocomplete it to "cd
|
52
|
+
# ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the
|
53
|
+
# Readline used by Bash 4.)
|
54
|
+
set skip-completed-text on
|
55
|
+
|
56
|
+
# Use Alt/Meta + Delete to delete the preceding word
|
57
|
+
"\e[3;3~": kill-word
|
data/docker/sources.list
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
deb http://archive.ubuntu.com/ubuntu/ focal main restricted
|
2
|
+
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
|
3
|
+
deb http://archive.ubuntu.com/ubuntu/ focal universe
|
4
|
+
deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
|
5
|
+
deb http://archive.ubuntu.com/ubuntu/ focal multiverse
|
6
|
+
deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
|
7
|
+
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
|
8
|
+
|
9
|
+
deb http://security.ubuntu.com/ubuntu focal-security main restricted
|
10
|
+
deb http://security.ubuntu.com/ubuntu focal-security universe
|
11
|
+
deb http://security.ubuntu.com/ubuntu focal-security multiversesudo apt update
|
data/lib/random-words/source.rb
CHANGED
@@ -78,7 +78,7 @@ module RandomWords
|
|
78
78
|
filename = "#{filename.sub(/\.txt$/, '')}.txt"
|
79
79
|
path = File.join(@path, filename)
|
80
80
|
|
81
|
-
File.read(path).strip.split("\n").map(&:strip) # Changed from split_lines to split("\n")
|
81
|
+
File.read(path).clean_encode.strip.split("\n").map(&:strip) # Changed from split_lines to split("\n")
|
82
82
|
rescue Errno::ENOENT
|
83
83
|
warn "File not found: #{path}"
|
84
84
|
[]
|
data/lib/random-words/string.rb
CHANGED
@@ -13,6 +13,24 @@ module RandomWords
|
|
13
13
|
# str.terminate(["", "."]) # => "Hello World."
|
14
14
|
#
|
15
15
|
class ::String
|
16
|
+
##
|
17
|
+
## Get a clean UTF-8 string by forcing an ISO encoding and then re-encoding
|
18
|
+
##
|
19
|
+
## @return [String] UTF-8 string
|
20
|
+
##
|
21
|
+
def clean_encode
|
22
|
+
force_encoding('ISO-8859-1').encode('utf-8', replace: nil)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
## Destructive version of #clean_encode
|
27
|
+
##
|
28
|
+
## @return [String] UTF-8 string, in place
|
29
|
+
##
|
30
|
+
def clean_encode!
|
31
|
+
replace clean_encode
|
32
|
+
end
|
33
|
+
|
16
34
|
# Remove unwanted characters and whitespace from a string.
|
17
35
|
# @return [String] The string with unwanted characters removed.
|
18
36
|
# @example
|
data/lib/random-words/version.rb
CHANGED
data/random-words.gemspec
CHANGED
data/scripts/runtests.sh
ADDED
metadata
CHANGED
@@ -1,28 +1,42 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: random-words
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: json
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - '='
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: 2.7.6
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - '='
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 2.7.6
|
12
26
|
- !ruby/object:Gem::Dependency
|
13
27
|
name: nokogiri
|
14
28
|
requirement: !ruby/object:Gem::Requirement
|
15
29
|
requirements:
|
16
|
-
- -
|
30
|
+
- - '='
|
17
31
|
- !ruby/object:Gem::Version
|
18
|
-
version:
|
32
|
+
version: 1.13.2
|
19
33
|
type: :runtime
|
20
34
|
prerelease: false
|
21
35
|
version_requirements: !ruby/object:Gem::Requirement
|
22
36
|
requirements:
|
23
|
-
- -
|
37
|
+
- - '='
|
24
38
|
- !ruby/object:Gem::Version
|
25
|
-
version:
|
39
|
+
version: 1.13.2
|
26
40
|
description: Generate random text (lorem ipsum) from a variety of sources.
|
27
41
|
email: me@brettterpstra.com
|
28
42
|
executables:
|
@@ -42,6 +56,15 @@ files:
|
|
42
56
|
- README.md
|
43
57
|
- Rakefile
|
44
58
|
- bin/randw
|
59
|
+
- docker/Dockerfile
|
60
|
+
- docker/Dockerfile-2.6
|
61
|
+
- docker/Dockerfile-2.7
|
62
|
+
- docker/Dockerfile-3.0
|
63
|
+
- docker/Dockerfile-3.3
|
64
|
+
- docker/Dockerfile-3.4
|
65
|
+
- docker/bash_profile
|
66
|
+
- docker/inputrc
|
67
|
+
- docker/sources.list
|
45
68
|
- generator.cgi
|
46
69
|
- lib/random-words.rb
|
47
70
|
- lib/random-words/array.rb
|
@@ -275,6 +298,7 @@ files:
|
|
275
298
|
- lib/random-words/words/walken/verbs-plural.txt
|
276
299
|
- lib/random-words/words/walken/verbs-singular.txt
|
277
300
|
- random-words.gemspec
|
301
|
+
- scripts/runtests.sh
|
278
302
|
- src/_README.md
|
279
303
|
homepage: https://github.com/ttscoff/random-words
|
280
304
|
licenses:
|
@@ -307,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
307
331
|
- !ruby/object:Gem::Version
|
308
332
|
version: '0'
|
309
333
|
requirements: []
|
310
|
-
rubygems_version: 3.6.
|
334
|
+
rubygems_version: 3.6.7
|
311
335
|
specification_version: 4
|
312
336
|
summary: Random words generator
|
313
337
|
test_files: []
|