esopo 1.1.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 +7 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +43 -0
- data/LICENSE +8 -0
- data/README.rdoc +67 -0
- data/Rakefile +23 -0
- data/bin/esopo +93 -0
- data/esopo.gemspec +24 -0
- data/esopo.rdoc +5 -0
- data/files/test.txt +15 -0
- data/lib/esopo/check.rb +23 -0
- data/lib/esopo/creator.rb +27 -0
- data/lib/esopo/deleter.rb +11 -0
- data/lib/esopo/footman.rb +11 -0
- data/lib/esopo/generator.rb +36 -0
- data/lib/esopo/output.rb +23 -0
- data/lib/esopo/version.rb +5 -0
- data/lib/esopo.rb +11 -0
- data/spec/lib/esopo/generator_spec.rb +36 -0
- data/spec/spec_helper.rb +100 -0
- metadata +140 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c6394889e2c62dfde62def3bb48c0f073882a25096219a2558b396c118dc1eb7
|
4
|
+
data.tar.gz: b686a22231e5fdf3312703ea6726bf738a98802e2c29c19e5f9246b3b706a98c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f217e4709a0e6e2b9a39b384a9ef296222a1bdad49dade3c9b4f9e68f5148e5a0daa1ce3b61d6cc339a49c8c2fbd57b9980405b9b7d489956926d4ffc5bc98bd
|
7
|
+
data.tar.gz: 172cfaf126ad5aa74b54252e3b8882512687d2cef03a75af84b6041d7cf9899053b560f613e1a9053e708d28ec648e3982c3b2d0fcd656f8209cf3f1b6e6cb8a
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
/.DS_Store
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
esopo (1.1.0)
|
5
|
+
gli (>= 1.21.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.5.0)
|
11
|
+
gli (2.21.0)
|
12
|
+
psych (5.1.0)
|
13
|
+
stringio
|
14
|
+
rake (13.0.6)
|
15
|
+
rdoc (6.5.0)
|
16
|
+
psych (>= 4.0.0)
|
17
|
+
rspec (3.12.0)
|
18
|
+
rspec-core (~> 3.12.0)
|
19
|
+
rspec-expectations (~> 3.12.0)
|
20
|
+
rspec-mocks (~> 3.12.0)
|
21
|
+
rspec-core (3.12.1)
|
22
|
+
rspec-support (~> 3.12.0)
|
23
|
+
rspec-expectations (3.12.2)
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
+
rspec-support (~> 3.12.0)
|
26
|
+
rspec-mocks (3.12.3)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.12.0)
|
29
|
+
rspec-support (3.12.0)
|
30
|
+
stringio (3.0.5)
|
31
|
+
|
32
|
+
PLATFORMS
|
33
|
+
arm64-darwin-21
|
34
|
+
arm64-darwin-22
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
esopo!
|
38
|
+
rake (>= 9.9.2)
|
39
|
+
rdoc (>= 4.3)
|
40
|
+
rspec (>= 3.10)
|
41
|
+
|
42
|
+
BUNDLED WITH
|
43
|
+
2.3.3
|
data/LICENSE
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
* ----------------------------------------------------------------------------
|
3
|
+
* "THE BEER-WARE LICENSE" (Revision 42):
|
4
|
+
* <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
|
5
|
+
* can do whatever you want with this stuff. If we meet some day, and you think
|
6
|
+
* this stuff is worth it, you can buy me a beer in return. Cherednichenko Danil
|
7
|
+
* ----------------------------------------------------------------------------
|
8
|
+
*/
|
data/README.rdoc
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
= esopo
|
2
|
+
|
3
|
+
== Title
|
4
|
+
This command line application is designed to store text data for the purpose of returns us an interpolated one-line text and further use in the terminal.
|
5
|
+
You can create/open/delete and run files.
|
6
|
+
The following commands are provided for interpolation:\n
|
7
|
+
%{get_uuid} - returns UUIDv4\n
|
8
|
+
%{get_phone} - returns the phone number (starts with +7)\n
|
9
|
+
%{get_number} - returns a random number with a length of 7 numbers\n
|
10
|
+
%{get_timestamp} - returns the current timestamp in iso8601 format\n
|
11
|
+
%{get_variable} - user variable required in case of dynamic variable. For example paste URL, list of commands.
|
12
|
+
|
13
|
+
==Example
|
14
|
+
|
15
|
+
I suggest creating a file, for this we will write a simple command.
|
16
|
+
|
17
|
+
esopo create example_command
|
18
|
+
|
19
|
+
A txt file is created inside the project and opened in your notepad in order to write data into it for further interpolation
|
20
|
+
let's insert the following data into our file. The data was taken from the site https://json-generator.com
|
21
|
+
|
22
|
+
'{
|
23
|
+
"guid": "%{get_uuid}",
|
24
|
+
"isActive": true,
|
25
|
+
"balance": "$2,748.23",
|
26
|
+
"age": "%{get_variable}",
|
27
|
+
"eyeColor": "green",
|
28
|
+
"name": "Sondra Chaney",
|
29
|
+
"gender": "female",
|
30
|
+
"company": "%{get_number}",
|
31
|
+
"email": "sondrachaney@zuvy.com",
|
32
|
+
"phone": "%{get_phone}",
|
33
|
+
"registered": "%{get_timestamp}",
|
34
|
+
"latitude": 23.141088,
|
35
|
+
"longitude": 6.578343
|
36
|
+
}'
|
37
|
+
|
38
|
+
I list the variables that we inserted for further interpolation
|
39
|
+
- %{get_uuid} — This command will return UUIDv4 format
|
40
|
+
- %{get_variable} — The user variable serves us to insert user data. By default, it is equal to nil, it will return only what the user specifies with the run command
|
41
|
+
- %{get_number} — This command will return us the generated number with a length of 7 characters
|
42
|
+
- %{get_phone} — This command will return us the generated phone number, the number will start with +7
|
43
|
+
- %{get_timestamp} — This command will return us the utc date and time in iso8601 format
|
44
|
+
|
45
|
+
Let's call the run command
|
46
|
+
|
47
|
+
esopo run my_age example_command
|
48
|
+
# esopo — our cli
|
49
|
+
# run — run
|
50
|
+
# command my_age — user data for the variable %{get_variable}
|
51
|
+
# example_file — our file that needs to be outputted
|
52
|
+
|
53
|
+
We get the next result
|
54
|
+
|
55
|
+
'{"guid":"491b63e5-9a84-4f72-75c7-38fd35bfa6bf","isActive":true,"balance":"$2,748.23","age":"my_age","eyeColor":"green","name":"Sondra Chaney","gender":"female","company":"ZUVY","email":"sondrachaney@zuvy.com","phone":"+72373248105","registered":"2023-02-18T18:50:29Z","latitude":23.141088,"longitude":6.578343}'
|
56
|
+
|
57
|
+
==Installation
|
58
|
+
To install, you need the following dependency versions
|
59
|
+
|
60
|
+
ruby 3.1.0
|
61
|
+
bundle 2.3.3
|
62
|
+
minitest (>= 4.14)
|
63
|
+
rake (>= 9.9.2)
|
64
|
+
rdoc (>= 4.3)
|
65
|
+
|
66
|
+
Clone this repository to the required folder.
|
67
|
+
To use it, you need to register the bundle exec bin/esopo command while inside the repository
|
data/Rakefile
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'rubygems/package_task'
|
6
|
+
require 'rdoc/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = 'README.rdoc'
|
9
|
+
rd.rdoc_files.include('README.rdoc', 'lib/**/*.rb', 'bin/**/*')
|
10
|
+
rd.title = 'Interpolation data and output into terminal'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('esopo.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
require 'rake/testtask'
|
18
|
+
Rake::TestTask.new do |t|
|
19
|
+
t.libs << 'rspec'
|
20
|
+
t.test_files = FileList['spec/*_spec.rb']
|
21
|
+
end
|
22
|
+
|
23
|
+
task default: :test
|
data/bin/esopo
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'gli'
|
5
|
+
require 'esopo'
|
6
|
+
|
7
|
+
class App
|
8
|
+
extend GLI::App
|
9
|
+
|
10
|
+
program_desc 'Interpolation data and output into terminal'
|
11
|
+
program_long_desc "This command line application is designed to store text data for the purpose of interpolation and further use in the terminal
|
12
|
+
You can create/open/delete and run files.
|
13
|
+
The following commands are provided for interpolation:\n
|
14
|
+
%{get_uuid} - returns UUIDv4\n
|
15
|
+
%{get_phone} - returns the phone number (starts with +7)\n
|
16
|
+
%{get_number} - returns a random number with a length of 7 numbers\n
|
17
|
+
%{get_timestamp} - returns the current timestamp in iso8601 format\n
|
18
|
+
%{get_variable} - user variable required in case of dynamic variable. For example paste URL, list of commands"
|
19
|
+
version Esopo::VERSION
|
20
|
+
|
21
|
+
subcommand_option_handling :normal
|
22
|
+
arguments :strict
|
23
|
+
|
24
|
+
# desc 'Describe some switch here'
|
25
|
+
# switch [:s,:switch]
|
26
|
+
|
27
|
+
# desc 'Flag inserts user variable'
|
28
|
+
# default_value 'null'
|
29
|
+
# arg_name 'user_variable'
|
30
|
+
# flag [:d, :dynamic_variable] do |c|
|
31
|
+
# arguments :loose
|
32
|
+
# c.action do |global, options, args|
|
33
|
+
# Esopo::Output.recorder(args.first.concat)
|
34
|
+
# end
|
35
|
+
# end
|
36
|
+
desc 'Command to create a text file'
|
37
|
+
long_desc 'This command creates a file in the txt format into which you later go to insert data and, if necessary, variables for interpolation,
|
38
|
+
only need to send the name, no file type'
|
39
|
+
command :create do |c|
|
40
|
+
c.default_desc 'Command to create a text file'
|
41
|
+
arguments :loose
|
42
|
+
c.action do |global, options, args|
|
43
|
+
Esopo::CreateFiles.create_doc(args.first.concat)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
desc 'Open file for edit arguments'
|
48
|
+
long_desc 'The command is intended for opening a text file in order to edit the file, insert variables, etc.'
|
49
|
+
command :open do |c|
|
50
|
+
arguments :loose
|
51
|
+
c.action do |global, options, args|
|
52
|
+
Esopo::CreateFiles.open_file(args.first.concat)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
desc 'Run result from data into terminal'
|
56
|
+
long_desc 'The main command is designed to display the interpolated result in the terminal.
|
57
|
+
If you need a dynamic result that depends on the input, then you must first enter the variable, and only then the file name'
|
58
|
+
command :run do |c|
|
59
|
+
arguments :norman
|
60
|
+
c.action do |global, options, args|
|
61
|
+
Esopo::Output.recorder(args.first.concat) if args.length > 1
|
62
|
+
Esopo::Output.run(args.last)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
desc 'The command is for deleting a file'
|
66
|
+
long_desc 'The command deletes a file, if you need to delete a file, then you need to write the file name, without the type of this file'
|
67
|
+
command :delete do |c|
|
68
|
+
arguments :loose
|
69
|
+
c.action do |global, options, args|
|
70
|
+
Esopo::DeleteFile.delete_file(args.first)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
# pre do |global,command,options,args|
|
74
|
+
# # Pre logic here
|
75
|
+
# # Return true to proceed; false to abort and not call the
|
76
|
+
# # chosen command
|
77
|
+
# # Use skips_pre before a command to skip this block
|
78
|
+
# # on that command only
|
79
|
+
# true
|
80
|
+
# end
|
81
|
+
# post do |global,command,options,args|
|
82
|
+
# # Post logic here
|
83
|
+
# # Use skips_post before a command to skip this
|
84
|
+
# # block on that command only
|
85
|
+
# end
|
86
|
+
# on_error do |exception|
|
87
|
+
# # Error logic here
|
88
|
+
# # return false to skip default error handling
|
89
|
+
# true
|
90
|
+
# end
|
91
|
+
end
|
92
|
+
|
93
|
+
exit App.run(ARGV)
|
data/esopo.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Ensure we require the local version and not one we might have installed already
|
4
|
+
require File.join([File.dirname(__FILE__), 'lib', 'esopo', 'version.rb'])
|
5
|
+
spec = Gem::Specification.new do |s|
|
6
|
+
s.name = 'esopo'
|
7
|
+
s.version = Esopo::VERSION
|
8
|
+
s.licenses = ['Beerware']
|
9
|
+
s.author = 'Danil Che'
|
10
|
+
s.email = 'denchiric@mail.ru'
|
11
|
+
s.homepage = 'https://github.com/kingjoy'
|
12
|
+
s.platform = Gem::Platform::RUBY
|
13
|
+
s.summary = 'Interpolation data and output into terminal'
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.require_paths << 'lib'
|
16
|
+
s.extra_rdoc_files = ['README.rdoc', 'esopo.rdoc']
|
17
|
+
s.rdoc_options << '--title' << 'esopo' << '--main' << 'README.rdoc' << '-ri'
|
18
|
+
s.bindir = 'bin'
|
19
|
+
s.executables << 'esopo'
|
20
|
+
s.add_development_dependency('rspec', '~> 3.10')
|
21
|
+
s.add_development_dependency('rake', '~> 9.9', '>= 9.9.2')
|
22
|
+
s.add_development_dependency('rdoc', '~> 4.3')
|
23
|
+
s.add_runtime_dependency('gli', '~> 1.21', '>= 1.21.0')
|
24
|
+
end
|
data/esopo.rdoc
ADDED
data/files/test.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
'{
|
2
|
+
"guid": "%{get_uuid}",
|
3
|
+
"isActive": true,
|
4
|
+
"balance": "$2,748.23",
|
5
|
+
"age": "%{get_variable}",
|
6
|
+
"eyeColor": "green",
|
7
|
+
"name": "Sondra Chaney",
|
8
|
+
"gender": "female",
|
9
|
+
"company": "ZUVY",
|
10
|
+
"email": "sondrachaney@zuvy.com",
|
11
|
+
"phone": "%{get_phone}",
|
12
|
+
"registered": "%{get_timestamp}",
|
13
|
+
"latitude": 23.141088,
|
14
|
+
"longitude": 6.578343
|
15
|
+
}'
|
data/lib/esopo/check.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Esopo
|
4
|
+
module CheckDecision
|
5
|
+
class << self
|
6
|
+
def user_decision(operation, user_arg)
|
7
|
+
p "file with name #{user_arg} #{operation == 'delete' ? 'does not' : false} exist in system"
|
8
|
+
p "#{operation} the file #{user_arg}? y/n?"
|
9
|
+
word = $stdin.gets.chomp
|
10
|
+
return if word == 'n'
|
11
|
+
|
12
|
+
if operation == 'owerwrite'
|
13
|
+
Esopo::DeleteFile.delete_file(user_arg)
|
14
|
+
sleep(0.2)
|
15
|
+
Esopo::CreateFiles.create_doc(user_arg)
|
16
|
+
else
|
17
|
+
word == 'delete'
|
18
|
+
Esopo::DeleteFile.delete_file(user_arg)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Esopo
|
4
|
+
module CreateFiles
|
5
|
+
class << self
|
6
|
+
# create doc wrom user input
|
7
|
+
def create_doc(user_arg)
|
8
|
+
# checker existing files in dir
|
9
|
+
if File.exist?("./files/#{user_arg}.txt")
|
10
|
+
Esopo::CheckDecision.user_decision('owerwrite', user_arg)
|
11
|
+
else
|
12
|
+
File.new("./files/#{user_arg}.txt", 'w+')
|
13
|
+
File.open("./files/#{user_arg}.txt", 'w+') do |f|
|
14
|
+
f.write("
|
15
|
+
# paste here you text and delete this comm
|
16
|
+
")
|
17
|
+
end
|
18
|
+
open_file(user_arg)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
# open files use term command
|
22
|
+
def open_file(user_arg)
|
23
|
+
exec("open ./files/#{user_arg}.txt")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
def gen_uuid(input_version)
|
4
|
+
Esopo::ValuesGenerator.rand_uuid(input_version)
|
5
|
+
end
|
6
|
+
|
7
|
+
def gen_phone(input_code)
|
8
|
+
Esopo::ValuesGenerator.rand_phone(input_code)
|
9
|
+
end
|
10
|
+
|
11
|
+
# the file is designed for convenient interpolation inside the document
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'securerandom'
|
4
|
+
module Esopo
|
5
|
+
module ValuesGenerator
|
6
|
+
class << self
|
7
|
+
def rand_uuid(version)
|
8
|
+
uuid_imprint = "xxxxxxxx-xxxx-#{version}xxx-xxxx-xxxxxxxxxxxx"
|
9
|
+
reducer(uuid_imprint, 16, 16)
|
10
|
+
end
|
11
|
+
|
12
|
+
def rand_phone(country_code)
|
13
|
+
phone_imprint = "+#{country_code}xxxxxxxxxx"
|
14
|
+
reducer(phone_imprint, 9, 10)
|
15
|
+
end
|
16
|
+
|
17
|
+
def rand_number
|
18
|
+
number_imprint = 'xxxxxxx'
|
19
|
+
reducer(number_imprint, 9, 10)
|
20
|
+
end
|
21
|
+
def current_timestamp
|
22
|
+
require 'time'
|
23
|
+
Time.now.utc.iso8601
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def reducer(input_imprint, input_range, converter)
|
29
|
+
init_value = Random.new
|
30
|
+
input_imprint.split('').map do |value|
|
31
|
+
value == 'x' ? value = init_value.rand(input_range).to_s(converter) : value
|
32
|
+
end.join('')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/esopo/output.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Esopo
|
4
|
+
module Output
|
5
|
+
class << self
|
6
|
+
def run(value_from_user)
|
7
|
+
sentence = format(IO.read("./files/#{value_from_user}.txt"),
|
8
|
+
get_uuid: Esopo::ValuesGenerator.rand_uuid(4).to_s,
|
9
|
+
get_phone: Esopo::ValuesGenerator.rand_phone(7).to_s,
|
10
|
+
get_number: Esopo::ValuesGenerator.rand_number.to_s,
|
11
|
+
get_timestamp: Esopo::ValuesGenerator.current_timestamp,
|
12
|
+
get_variable: $var).gsub(/^\s+|\s+$|\s^/,"").tr("\n", "").gsub(/:\s/, ':')
|
13
|
+
puts "Your result", "\u2193".encode('utf-8'), sentence
|
14
|
+
end
|
15
|
+
def recorder(var)
|
16
|
+
$var = var
|
17
|
+
end
|
18
|
+
def dynamic_var
|
19
|
+
return $var
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/esopo.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'esopo/version'
|
4
|
+
require 'esopo/generator'
|
5
|
+
require 'esopo/creator'
|
6
|
+
require 'esopo/output'
|
7
|
+
require 'esopo/footman'
|
8
|
+
require 'esopo/check'
|
9
|
+
require 'esopo/deleter'
|
10
|
+
# Add requires for other files you add to your project here, so
|
11
|
+
# you just need to require this one file in your bin file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
RSpec.describe Esopo::ValuesGenerator do
|
2
|
+
it "check uuid type string" do
|
3
|
+
stdin = Esopo::ValuesGenerator.rand_uuid(4)
|
4
|
+
expect(stdin).to be_a(String)
|
5
|
+
end
|
6
|
+
it "check input version" do
|
7
|
+
gen_version = Random.new
|
8
|
+
gen_version = gen_version.rand(9)
|
9
|
+
stdin = Esopo::ValuesGenerator.rand_uuid(gen_version)
|
10
|
+
expect(stdin[14]).to eq(gen_version.to_s)
|
11
|
+
end
|
12
|
+
it "check rand phone" do
|
13
|
+
gen_version = Random.new
|
14
|
+
gen_version = gen_version.rand(9)
|
15
|
+
stdin = Esopo::ValuesGenerator.rand_phone(gen_version)
|
16
|
+
expect(stdin[1]).to eq(gen_version.to_s)
|
17
|
+
end
|
18
|
+
it "check rand phone length" do
|
19
|
+
gen_version = Random.new
|
20
|
+
gen_version = gen_version.rand(9)
|
21
|
+
stdin = Esopo::ValuesGenerator.rand_phone(gen_version)
|
22
|
+
expect(stdin.length).to eq(12)
|
23
|
+
end
|
24
|
+
it "check rand number length" do
|
25
|
+
stdin = Esopo::ValuesGenerator.rand_number
|
26
|
+
expect(stdin.length).to eq(7)
|
27
|
+
end
|
28
|
+
it "check rand number type" do
|
29
|
+
stdin = Esopo::ValuesGenerator.rand_number
|
30
|
+
expect(stdin.to_i).to be_a(Numeric)
|
31
|
+
end
|
32
|
+
it "check timestamp" do
|
33
|
+
stdin = Esopo::ValuesGenerator.current_timestamp
|
34
|
+
expect(stdin).to eq(Time.now.utc.iso8601)
|
35
|
+
end
|
36
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
16
|
+
RSpec.configure do |config|
|
17
|
+
require_relative '../lib/esopo/generator.rb'
|
18
|
+
require_relative './lib/esopo/generator_spec.rb'
|
19
|
+
# rspec-expectations config goes here. You can use an alternate
|
20
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
21
|
+
# assertions if you prefer.
|
22
|
+
config.expect_with :rspec do |expectations|
|
23
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
24
|
+
# and `failure_message` of custom matchers include text for helper methods
|
25
|
+
# defined using `chain`, e.g.:
|
26
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
27
|
+
# # => "be bigger than 2 and smaller than 4"
|
28
|
+
# ...rather than:
|
29
|
+
# # => "be bigger than 2"
|
30
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
31
|
+
end
|
32
|
+
|
33
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
34
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
35
|
+
config.mock_with :rspec do |mocks|
|
36
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
37
|
+
# a real object. This is generally recommended, and will default to
|
38
|
+
# `true` in RSpec 4.
|
39
|
+
mocks.verify_partial_doubles = true
|
40
|
+
end
|
41
|
+
|
42
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
43
|
+
# have no way to turn it off -- the option exists only for backwards
|
44
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
45
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
46
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
47
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
48
|
+
|
49
|
+
# The settings below are suggested to provide a good initial experience
|
50
|
+
# with RSpec, but feel free to customize to your heart's content.
|
51
|
+
=begin
|
52
|
+
# This allows you to limit a spec run to individual examples or groups
|
53
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
54
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
55
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
56
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
57
|
+
config.filter_run_when_matching :focus
|
58
|
+
|
59
|
+
# Allows RSpec to persist some state between runs in order to support
|
60
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
61
|
+
# you configure your source control system to ignore this file.
|
62
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
63
|
+
|
64
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
65
|
+
# recommended. For more details, see:
|
66
|
+
# https://relishapp.com/rspec/rspec-core/docs/configuration/zero-monkey-patching-mode
|
67
|
+
config.disable_monkey_patching!
|
68
|
+
|
69
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
70
|
+
# be too noisy due to issues in dependencies.
|
71
|
+
config.warnings = true
|
72
|
+
|
73
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
74
|
+
# file, and it's useful to allow more verbose output when running an
|
75
|
+
# individual spec file.
|
76
|
+
if config.files_to_run.one?
|
77
|
+
# Use the documentation formatter for detailed output,
|
78
|
+
# unless a formatter has already been configured
|
79
|
+
# (e.g. via a command-line flag).
|
80
|
+
config.default_formatter = "doc"
|
81
|
+
end
|
82
|
+
|
83
|
+
# Print the 10 slowest examples and example groups at the
|
84
|
+
# end of the spec run, to help surface which specs are running
|
85
|
+
# particularly slow.
|
86
|
+
config.profile_examples = 10
|
87
|
+
|
88
|
+
# Run specs in random order to surface order dependencies. If you find an
|
89
|
+
# order dependency and want to debug it, you can fix the order by providing
|
90
|
+
# the seed, which is printed after each run.
|
91
|
+
# --seed 1234
|
92
|
+
config.order = :random
|
93
|
+
|
94
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
95
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
96
|
+
# test failures related to randomization by passing the same `--seed` value
|
97
|
+
# as the one that triggered the failure.
|
98
|
+
Kernel.srand config.seed
|
99
|
+
=end
|
100
|
+
end
|
metadata
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: esopo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Danil Che
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-02-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '9.9'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 9.9.2
|
37
|
+
type: :development
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '9.9'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 9.9.2
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rdoc
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '4.3'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '4.3'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: gli
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.21'
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.21.0
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1.21'
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.21.0
|
81
|
+
description:
|
82
|
+
email: denchiric@mail.ru
|
83
|
+
executables:
|
84
|
+
- esopo
|
85
|
+
extensions: []
|
86
|
+
extra_rdoc_files:
|
87
|
+
- README.rdoc
|
88
|
+
- esopo.rdoc
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
|
+
- Gemfile
|
93
|
+
- Gemfile.lock
|
94
|
+
- LICENSE
|
95
|
+
- README.rdoc
|
96
|
+
- Rakefile
|
97
|
+
- bin/esopo
|
98
|
+
- esopo.gemspec
|
99
|
+
- esopo.rdoc
|
100
|
+
- files/test.txt
|
101
|
+
- lib/esopo.rb
|
102
|
+
- lib/esopo/check.rb
|
103
|
+
- lib/esopo/creator.rb
|
104
|
+
- lib/esopo/deleter.rb
|
105
|
+
- lib/esopo/footman.rb
|
106
|
+
- lib/esopo/generator.rb
|
107
|
+
- lib/esopo/output.rb
|
108
|
+
- lib/esopo/version.rb
|
109
|
+
- spec/lib/esopo/generator_spec.rb
|
110
|
+
- spec/spec_helper.rb
|
111
|
+
homepage: https://github.com/kingjoy
|
112
|
+
licenses:
|
113
|
+
- Beerware
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options:
|
117
|
+
- "--title"
|
118
|
+
- esopo
|
119
|
+
- "--main"
|
120
|
+
- README.rdoc
|
121
|
+
- "-ri"
|
122
|
+
require_paths:
|
123
|
+
- lib
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubygems_version: 3.3.3
|
137
|
+
signing_key:
|
138
|
+
specification_version: 4
|
139
|
+
summary: Interpolation data and output into terminal
|
140
|
+
test_files: []
|