esystem 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +37 -0
- data/doc/README.gen +35 -0
- data/esystem.gemspec +40 -0
- data/lib/esystem.rb +2 -0
- data/lib/esystem/autoinclude.rb +4 -0
- data/lib/esystem/esystem.rb +60 -0
- data/lib/esystem/method.rb +14 -0
- data/lib/esystem/version/version.rb +12 -0
- data/test/testing_esystem.rb +9 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0fc05799c4580872146cad98c89ef024da43000721d6f571f989e389145b99fa
|
4
|
+
data.tar.gz: a4be718992edd09c15b3dca21267aebe8e71837c05d0ac37a47c17a57b752ac9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1a5197d06eab193383a6ca5c0aa49db1c5e422f949694baee740dc0a9f79ae74e537e94defb58478a4bf1a1329bd0c107d562d72f491bfd14bc12cc73ef9f909
|
7
|
+
data.tar.gz: 60b5fa5a59f24725c94dbc1e860290aab4ce83bc3d03e8398cc37972762c13e01a822b46d0e142dc75d901c9ef8c3fc7ec3d5d17a7a744e85ec9f09a762d5258
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
|
2
|
+
[![forthebadge](http://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/esystem.svg)](https://badge.fury.io/rb/esystem)
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
This library normally just provides a single method
|
8
|
+
called esystem().
|
9
|
+
|
10
|
+
This will output given text, then run system().
|
11
|
+
It is supposed to work either with the Colours
|
12
|
+
module or by doing: alias e puts prior to use it.
|
13
|
+
|
14
|
+
## Using the library
|
15
|
+
|
16
|
+
There are several ways to use it. Example:
|
17
|
+
|
18
|
+
require 'esystem'
|
19
|
+
|
20
|
+
Esystem.esystem 'ls'
|
21
|
+
|
22
|
+
You can, as with all modules in ruby, include the main
|
23
|
+
namespace:
|
24
|
+
|
25
|
+
include Esystem
|
26
|
+
|
27
|
+
That way you can omit having to type the leading
|
28
|
+
**Esystem.** part.
|
29
|
+
|
30
|
+
## Contact information
|
31
|
+
|
32
|
+
If you have specific suggestions to make this gem more
|
33
|
+
useful for others, please drop me an email at:
|
34
|
+
|
35
|
+
shevegen@gmail.com
|
36
|
+
|
37
|
+
Thank you.
|
data/doc/README.gen
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
ADD_RUBY_HEADER
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
|
5
|
+
This library normally just provides a single method
|
6
|
+
called esystem().
|
7
|
+
|
8
|
+
This will output given text, then run system().
|
9
|
+
It is supposed to work either with the Colours
|
10
|
+
module or by doing: alias e puts prior to use it.
|
11
|
+
|
12
|
+
## Using the library
|
13
|
+
|
14
|
+
There are several ways to use it. Example:
|
15
|
+
|
16
|
+
require 'esystem'
|
17
|
+
|
18
|
+
Esystem.esystem 'ls'
|
19
|
+
|
20
|
+
You can, as with all modules in ruby, include the main
|
21
|
+
namespace:
|
22
|
+
|
23
|
+
include Esystem
|
24
|
+
|
25
|
+
That way you can omit having to type the leading
|
26
|
+
**Esystem.** part.
|
27
|
+
|
28
|
+
## Contact information
|
29
|
+
|
30
|
+
If you have specific suggestions to make this gem more
|
31
|
+
useful for others, please drop me an email at:
|
32
|
+
|
33
|
+
shevegen@gmail.com
|
34
|
+
|
35
|
+
Thank you.
|
data/esystem.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# =========================================================================== #
|
2
|
+
# Gemspec for Project Esystem.
|
3
|
+
# =========================================================================== #
|
4
|
+
require 'esystem/version/version.rb'
|
5
|
+
|
6
|
+
Gem::Specification.new { |s|
|
7
|
+
|
8
|
+
s.name = 'esystem'
|
9
|
+
s.version = Esystem::VERSION
|
10
|
+
s.date = Time.now.strftime('%Y-%m-%d')
|
11
|
+
|
12
|
+
DESCRIPTION = <<-EOF
|
13
|
+
|
14
|
+
This library normally just provides a single method
|
15
|
+
called esystem().
|
16
|
+
|
17
|
+
This will output given text, then run system().
|
18
|
+
It is supposed to work either with the Colours
|
19
|
+
module or by doing: alias e puts prior to use it.
|
20
|
+
Alternatively you could also use: Esystem.esystem('ls')
|
21
|
+
|
22
|
+
EOF
|
23
|
+
|
24
|
+
s.summary = DESCRIPTION
|
25
|
+
s.description = DESCRIPTION
|
26
|
+
|
27
|
+
s.extra_rdoc_files = %w()
|
28
|
+
|
29
|
+
s.authors = ['Robert A. Heiler']
|
30
|
+
s.email = 'shevegen@gmail.com'
|
31
|
+
s.files = Dir['**/*']
|
32
|
+
s.license = 'GPL-2.0'
|
33
|
+
|
34
|
+
s.required_ruby_version = '>= '+RUBY_VERSION
|
35
|
+
s.required_rubygems_version = '>= '+Gem::VERSION
|
36
|
+
s.rubygems_version = '>= '+Gem::VERSION
|
37
|
+
|
38
|
+
s.homepage = 'http://rubygems.org/gems/esystem'
|
39
|
+
|
40
|
+
}
|
data/lib/esystem.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
module Esystem # include Esystem
|
6
|
+
|
7
|
+
# ========================================================================= #
|
8
|
+
# === Esystem.esystem
|
9
|
+
#
|
10
|
+
# This method combines output via the e() method, and a system call
|
11
|
+
# through the inbuilt method system().
|
12
|
+
#
|
13
|
+
# If the optional colourize-argument is given, then we will invoke
|
14
|
+
# sfancy(), which will colourize the command that is to be run.
|
15
|
+
# ========================================================================= #
|
16
|
+
def self.esystem(
|
17
|
+
i,
|
18
|
+
optional_try_to_colourize_the_result = false
|
19
|
+
)
|
20
|
+
i = i.to_s # Seems more useful to have that in a String all the time.
|
21
|
+
if block_given?
|
22
|
+
yielded = yield
|
23
|
+
case yielded
|
24
|
+
# ===================================================================== #
|
25
|
+
# === :do_colourize_the_result
|
26
|
+
# ===================================================================== #
|
27
|
+
when :do_colourize_the_result
|
28
|
+
optional_try_to_colourize_the_result = true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
case optional_try_to_colourize_the_result
|
32
|
+
when :colourize_output, :use_colours, :do_colourize,
|
33
|
+
:do_colourize_the_result
|
34
|
+
optional_try_to_colourize_the_result = true
|
35
|
+
end
|
36
|
+
if Object.const_defined? :Colours # Use Colours if it is available.
|
37
|
+
_ = i # Work on a copy of the input here.
|
38
|
+
_ = sfancy(_) if optional_try_to_colourize_the_result
|
39
|
+
Colours.e(_)
|
40
|
+
else
|
41
|
+
puts i
|
42
|
+
end
|
43
|
+
begin
|
44
|
+
system i
|
45
|
+
rescue Errno::ENOENT => e
|
46
|
+
puts 'The base-directory seems to have been deleted.'
|
47
|
+
pp e
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# ========================================================================= #
|
52
|
+
# === esystem
|
53
|
+
#
|
54
|
+
# Simply delegate towards the above.
|
55
|
+
# ========================================================================= #
|
56
|
+
def esystem(i, optional_try_to_colourize_the_result = false)
|
57
|
+
Esystem.esystem(i, optional_try_to_colourize_the_result)
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
require 'esystem'
|
6
|
+
|
7
|
+
# =========================================================================== #
|
8
|
+
# === esystem
|
9
|
+
#
|
10
|
+
# This method combines output via e() with a system call through system().
|
11
|
+
# =========================================================================== #
|
12
|
+
def esystem(i, optional_try_to_colourize_the_result = false)
|
13
|
+
Esystem.esystem(i, optional_try_to_colourize_the_result)
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
# =========================================================================== #
|
5
|
+
module Esystem
|
6
|
+
|
7
|
+
# ========================================================================= #
|
8
|
+
# === VERSION
|
9
|
+
# ========================================================================= #
|
10
|
+
VERSION = '0.0.16'
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
# Encoding: UTF-8
|
3
|
+
# =========================================================================== #
|
4
|
+
require 'esystem/method'
|
5
|
+
require 'colours/autoinclude'
|
6
|
+
_ = 'ls' # Our test command.
|
7
|
+
esystem _
|
8
|
+
esystem _, :colourize_output
|
9
|
+
esystem _, :use_colours
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: esystem
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.16
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert A. Heiler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-05-01 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |2+
|
14
|
+
|
15
|
+
This library normally just provides a single method
|
16
|
+
called esystem().
|
17
|
+
|
18
|
+
This will output given text, then run system().
|
19
|
+
It is supposed to work either with the Colours
|
20
|
+
module or by doing: alias e puts prior to use it.
|
21
|
+
Alternatively you could also use: Esystem.esystem('ls')
|
22
|
+
|
23
|
+
email: shevegen@gmail.com
|
24
|
+
executables: []
|
25
|
+
extensions: []
|
26
|
+
extra_rdoc_files: []
|
27
|
+
files:
|
28
|
+
- README.md
|
29
|
+
- doc/README.gen
|
30
|
+
- esystem.gemspec
|
31
|
+
- lib/esystem.rb
|
32
|
+
- lib/esystem/autoinclude.rb
|
33
|
+
- lib/esystem/esystem.rb
|
34
|
+
- lib/esystem/method.rb
|
35
|
+
- lib/esystem/version/version.rb
|
36
|
+
- test/testing_esystem.rb
|
37
|
+
homepage: http://rubygems.org/gems/esystem
|
38
|
+
licenses:
|
39
|
+
- GPL-2.0
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 3.0.1
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.2.16
|
55
|
+
requirements: []
|
56
|
+
rubygems_version: 3.2.16
|
57
|
+
signing_key:
|
58
|
+
specification_version: 4
|
59
|
+
summary: 'This library normally just provides a single method called esystem(). This
|
60
|
+
will output given text, then run system(). It is supposed to work either with the
|
61
|
+
Colours module or by doing: alias e puts prior to use it. Alternatively you could
|
62
|
+
also use: Esystem.esystem(''ls'')'
|
63
|
+
test_files: []
|
64
|
+
...
|