startor 0.6.2 → 0.6.3
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/bin/startor +4 -6
- data/lib/Array/all_but_last.rb +7 -24
- data/lib/Array/extract_optionsX.rb +3 -17
- data/lib/Array/lastX.rb +5 -8
- data/lib/Files.rb +32 -20
- data/lib/Module/alias_methods.rb +4 -13
- data/lib/Thoran/Array/AllButLast/all_but_last.rb +28 -0
- data/lib/Thoran/Array/ExtractOptionsX/extract_optionsX.rb +25 -0
- data/lib/Thoran/Array/LastX/lastX.rb +33 -0
- data/lib/Thoran/Module/AliasMethods/alias_methods.rb +23 -0
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc53f3a56d1a16ab625bc40c3ac78f227a70ae2e211ccff7e362d0c93b9e5184
|
4
|
+
data.tar.gz: b3e9b991bad3c524fa8ab4bdec2cf4669f4df0f5773a9253f9fc6e4c6c1f6faf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14ae6ecc7567c1c35f3f64c6eb1e02154d33d809ffe0bf7c9f093349f8beca6ba1c7b6f833585b4f05f9f65fb80ad81d3febc44ff2aecfb188eb42b937290ed1
|
7
|
+
data.tar.gz: d48241ae5e093866046f7319f0d161b96ada6a3e5bb82eedbbf62346a645bdfd77ac0322bca9172952fc061aac2a3f74dd9e0c81306faaac154f7cdfc8a83168
|
data/bin/startor
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# startor
|
3
3
|
|
4
|
-
#
|
5
|
-
# 0.6.
|
4
|
+
# 20190802
|
5
|
+
# 0.6.3
|
6
6
|
|
7
7
|
# History: Derived from https://kremalicious.com/simple-tor-setup-on-mac-os-x/...
|
8
8
|
|
9
|
-
#
|
10
|
-
# 1. tor binary is installed.
|
11
|
-
# 2. Ruby is installed, which it should be already!
|
9
|
+
# Prerequisite: Ruby is installed, which it should be already!
|
12
10
|
|
13
11
|
# Installation:
|
14
12
|
# 1. Press the <cmd> and <space> keys on the keyboard simultaneously.
|
@@ -21,7 +19,7 @@
|
|
21
19
|
# 3. Type: "startor setup" and press the <return> key.
|
22
20
|
# 4. Type: "startor" and press the <return> key.
|
23
21
|
# 5. If prompted, enter the password you use to login to your computer.
|
24
|
-
# 6. When wanting stop tor, go to the same window as the commands immediately above were entered and press the <ctrl> and <c> keys on the keyboard simultaneously.
|
22
|
+
# 6. When wanting to stop tor, go to the same window as the commands immediately above were entered and press the <ctrl> and <c> keys on the keyboard simultaneously.
|
25
23
|
# 7. If prompted, enter the password you use to login to your computer.
|
26
24
|
|
27
25
|
# Notes:
|
data/lib/Array/all_but_last.rb
CHANGED
@@ -1,24 +1,7 @@
|
|
1
|
-
# Array
|
2
|
-
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# Changes since 0.0:
|
9
|
-
# 1. I've added require 'Array/lastX', since I think it is reasonable that each file should load its own dependencies.
|
10
|
-
|
11
|
-
# Todo:
|
12
|
-
# 1. Conditionally do the require depending on whether the method already exists on Array and/or on whether rubylib has been defined elsewhere, since the require will fail in either case; and if rubylib is available, but this method isn't.
|
13
|
-
|
14
|
-
require 'Array/lastX'
|
15
|
-
|
16
|
-
class Array
|
17
|
-
|
18
|
-
def all_but_last
|
19
|
-
d = self.dup
|
20
|
-
d.last!
|
21
|
-
d
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
1
|
+
# Array/all_but_last.rb
|
2
|
+
# Array#all_but_last
|
3
|
+
|
4
|
+
# 20180804
|
5
|
+
# 0.1.0 (The same version number as the current version of Thoran/Array/AllButLast.)
|
6
|
+
|
7
|
+
require 'Thoran/Array/AllButLast/all_but_last'
|
@@ -1,21 +1,7 @@
|
|
1
1
|
# Array/extract_optionsX.rb
|
2
2
|
# Array#extract_options!
|
3
3
|
|
4
|
-
#
|
5
|
-
# 0.
|
4
|
+
# 20180804
|
5
|
+
# 0.2.0 (The same version number as the current version of Thoran/Array/ExtractOptions.)
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
# Changes:
|
10
|
-
# 1. + #extract_options (no exclamation). Whereas I had previously had #extract_options mean the same as what I now call #peek_options, I decided that Array has some precedents for method names which do not have a bang method, but which do modify the receiver in place; #shift, #unshift, #push, and #pop come to mind...
|
11
|
-
# 0/1
|
12
|
-
# 2. Some minor tidying.
|
13
|
-
|
14
|
-
class Array
|
15
|
-
|
16
|
-
def extract_options!
|
17
|
-
last.is_a?(::Hash) ? pop : {}
|
18
|
-
end
|
19
|
-
alias_method :extract_options, :extract_options!
|
20
|
-
|
21
|
-
end
|
7
|
+
require 'Thoran/Array/ExtractOptionsX/extract_optionsX'
|
data/lib/Array/lastX.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
+
# Array/lastX.rb
|
1
2
|
# Array#last!
|
2
|
-
# 20060630
|
3
|
-
#
|
4
|
-
# Description: Sometimes it makes more sense to treat arrays this way.
|
5
|
-
#
|
6
|
-
# Discussion: This and first! were taken from Skink2Quick from a few months ago.
|
7
3
|
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
# 20180804
|
5
|
+
# 0.2.3 (The same version number as the current version of Thoran/Array/LastX.)
|
6
|
+
|
7
|
+
require 'Thoran/Array/LastX/lastX'
|
data/lib/Files.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Files.rb
|
2
2
|
# Files
|
3
3
|
|
4
|
-
#
|
5
|
-
# 0.8.
|
4
|
+
# 20181112
|
5
|
+
# 0.8.7
|
6
6
|
|
7
7
|
# Changes since 0.7: (Switched from using Files to OpenStructs for @files instance variable because Ruby can't open more than some hundreds of files and nil was being returned after that limit had been reached.)
|
8
8
|
# 1. - Files.files_for().
|
@@ -36,15 +36,25 @@
|
|
36
36
|
# 26. ~ Files#sort_method_macro, #sorter_macro, and #reverse_sort_method_macro, so as to make use of instance_eval rather than eval.
|
37
37
|
# 27. Added Kernel/require_relative.rb back, since I should be able to run the specs with MacRuby as well.
|
38
38
|
# 28. Updated the gemspec with latest version number.
|
39
|
+
# 3/4
|
40
|
+
# 29. /return_ostruct_object/return_files_object/.
|
41
|
+
# 30. Updated the tests to pass again. Not sure what has caused the re-ordering. Has Ruby changed the way it handles files somehow? Would like to not have to sort the results prior to comparison and have it be exact at some point...
|
42
|
+
# 4/5
|
43
|
+
# 31. Switched from using the assertion style of testing to the spec style of testing, except for assert File.exist? and assert ... include_all_patterns?, because there is no satisfactory alternative (insofar as readability is concerned) in the spec world.
|
44
|
+
# 5/6
|
45
|
+
# 32. Using Thoran namespaced extensions to the standard library and updated those to the lastest versions.
|
46
|
+
# 6/7
|
47
|
+
# 33. Reintroduced a change made in the earlier version 0.8.4: "~ Files.gsub!, so as it calls the instance version for easier debugging."
|
39
48
|
|
40
49
|
# Todo:
|
41
50
|
# 1. Ensure that the interface is sufficiently usable that it will be reading for a 1.0 release after some more tinkering through the remainder of 0.8 and 0.9.
|
51
|
+
# 2. Remove the need for sorting in the tests, which is due to ordering differences which were introduced at some point.
|
42
52
|
|
43
53
|
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__))) unless
|
44
54
|
$LOAD_PATH.include?(File.dirname(__FILE__)) || $LOAD_PATH.include?(File.expand_path(File.dirname(__FILE__)))
|
45
55
|
|
46
56
|
require 'Array/extract_optionsX'
|
47
|
-
require 'File/
|
57
|
+
require 'File/gsubX'
|
48
58
|
require 'fileutils'
|
49
59
|
require 'Module/alias_methods'
|
50
60
|
require 'ostruct'
|
@@ -54,23 +64,23 @@ class Files
|
|
54
64
|
class << self
|
55
65
|
|
56
66
|
def find(options = {})
|
57
|
-
path, pattern,
|
67
|
+
path, pattern, return_files_object = options[:path], options[:pattern], options[:return_files_object]
|
58
68
|
case
|
59
69
|
when path && pattern
|
60
|
-
in_path___with_pattern___(path, pattern,
|
70
|
+
in_path___with_pattern___(path, pattern, return_files_object)
|
61
71
|
when path && !pattern
|
62
|
-
in_path___(path,
|
72
|
+
in_path___(path, return_files_object)
|
63
73
|
when !path && pattern
|
64
|
-
with_pattern___(pattern,
|
74
|
+
with_pattern___(pattern, return_files_object)
|
65
75
|
when !path && !pattern
|
66
|
-
here(
|
76
|
+
here(return_files_object)
|
67
77
|
end
|
68
78
|
end
|
69
79
|
alias_methods :all, :find
|
70
80
|
|
71
|
-
def in_path___with_pattern___(path, pattern,
|
81
|
+
def in_path___with_pattern___(path, pattern, return_files_object = true)
|
72
82
|
files = with_attributes(Dir["#{path}/#{pattern}"])
|
73
|
-
if
|
83
|
+
if return_files_object
|
74
84
|
files_object = Files.new
|
75
85
|
files_object.files = files
|
76
86
|
files_object
|
@@ -81,18 +91,18 @@ class Files
|
|
81
91
|
alias_methods :in_path_matching, :in_path___matching___,
|
82
92
|
:in_path_with_pattern, :in_path___with_pattern___
|
83
93
|
|
84
|
-
def in_path___(path,
|
85
|
-
in_path___matching___(path, '*',
|
94
|
+
def in_path___(path, return_files_object = true)
|
95
|
+
in_path___matching___(path, '*', return_files_object)
|
86
96
|
end
|
87
97
|
alias_methods :in, :in_path, :in_path___
|
88
98
|
|
89
|
-
def with_pattern___(pattern,
|
90
|
-
in_path___matching___('./', pattern,
|
99
|
+
def with_pattern___(pattern, return_files_object = true)
|
100
|
+
in_path___matching___('./', pattern, return_files_object)
|
91
101
|
end
|
92
102
|
alias_methods :with_pattern, :with_pattern___
|
93
103
|
|
94
|
-
def here(
|
95
|
-
in_path___matching___('./', '*',
|
104
|
+
def here(return_files_object = true)
|
105
|
+
in_path___matching___('./', '*', return_files_object)
|
96
106
|
end
|
97
107
|
|
98
108
|
def with_attributes(paths)
|
@@ -116,7 +126,9 @@ class Files
|
|
116
126
|
|
117
127
|
def gsub!(filenames, replacement_pattern, replacement_text, selection_pattern = nil)
|
118
128
|
filenames.each do |filename|
|
119
|
-
File.
|
129
|
+
File.open(filename, 'r+') do |f|
|
130
|
+
f.gsub!(replacement_pattern, replacement_text, selection_pattern)
|
131
|
+
end
|
120
132
|
end
|
121
133
|
end
|
122
134
|
|
@@ -147,11 +159,11 @@ class Files
|
|
147
159
|
if !@args.empty?
|
148
160
|
Files.with_attributes(@args.flatten)
|
149
161
|
elsif path && pattern
|
150
|
-
Files.find(path: path, pattern: pattern,
|
162
|
+
Files.find(path: path, pattern: pattern, return_files_object: false)
|
151
163
|
elsif path
|
152
|
-
Files.find(path: path,
|
164
|
+
Files.find(path: path, return_files_object: false)
|
153
165
|
elsif pattern
|
154
|
-
Files.find(pattern: pattern,
|
166
|
+
Files.find(pattern: pattern, return_files_object: false)
|
155
167
|
else
|
156
168
|
[]
|
157
169
|
end
|
data/lib/Module/alias_methods.rb
CHANGED
@@ -1,16 +1,7 @@
|
|
1
|
+
# Module/alias_methods.rb
|
1
2
|
# Module#alias_methods
|
2
3
|
|
3
|
-
#
|
4
|
-
# 0.0.
|
4
|
+
# 20190802
|
5
|
+
# 0.1.0 (The same version number as the current version of Thoran/Module/AliasMethods.)
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
require 'Array/all_but_last'
|
9
|
-
|
10
|
-
class Module
|
11
|
-
|
12
|
-
def alias_methods(*args)
|
13
|
-
args.all_but_last.each{|e| alias_method e.to_sym, args.last.to_sym}
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
7
|
+
require 'Thoran/Module/AliasMethods/alias_methods'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Thoran/Array/AllButLast/all_but_last.rb
|
2
|
+
# Thoran::Array::AllButLast#all_but_last
|
3
|
+
|
4
|
+
# 20180804
|
5
|
+
# 0.1.0
|
6
|
+
|
7
|
+
# Description: This returns a copy of the receiving array with the last element removed.
|
8
|
+
|
9
|
+
# Changes:
|
10
|
+
# 1. + Thoran namespace.
|
11
|
+
|
12
|
+
require 'Thoran/Array/LastX/lastX'
|
13
|
+
|
14
|
+
module Thoran
|
15
|
+
module Array
|
16
|
+
module AllButLast
|
17
|
+
|
18
|
+
def all_but_last
|
19
|
+
d = self.dup
|
20
|
+
d.last!
|
21
|
+
d
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Array.send(:include, Thoran::Array::AllButLast)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Thoran/Array/ExtractOptions/extract_optionsX.rb
|
2
|
+
# Thoran::Array::ExtractOptions#extract_options!
|
3
|
+
|
4
|
+
# 20180804
|
5
|
+
# 0.2.0
|
6
|
+
|
7
|
+
# History: Stolen wholesale from ActiveSupport.
|
8
|
+
|
9
|
+
# Changes:
|
10
|
+
# 1. + Thoran namespace.
|
11
|
+
|
12
|
+
module Thoran
|
13
|
+
module Array
|
14
|
+
module ExtractOptionsX
|
15
|
+
|
16
|
+
def extract_options!
|
17
|
+
last.is_a?(::Hash) ? pop : {}
|
18
|
+
end
|
19
|
+
alias_method :extract_options, :extract_options!
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
Array.send(:include, Thoran::Array::ExtractOptionsX)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Thoran/Array/LastX/lastX.rb
|
2
|
+
# Thoran::Array::LastX#last!
|
3
|
+
|
4
|
+
# 20180804
|
5
|
+
# 0.2.3
|
6
|
+
|
7
|
+
# Description: Sometimes it makes more sense to treat arrays this way.
|
8
|
+
|
9
|
+
# Changes since 0.1:
|
10
|
+
# 1. Added the complement of the extended version of Array#first!.
|
11
|
+
# 0/1
|
12
|
+
# 2. Switched the tests to spec-style.
|
13
|
+
# 1/2
|
14
|
+
# 3. Added a test for the state of the array afterward, since this is meant to be an in place change.
|
15
|
+
# 2/3
|
16
|
+
# 4. Added tests for the extended functionality introduced in the first version 0.1.0.
|
17
|
+
# 5. Fixed the implementation, so that the order is retained by unshifting the popped values rather than appending the shifted values as is the case with Array#first!.
|
18
|
+
|
19
|
+
module Thoran
|
20
|
+
module Array
|
21
|
+
module LastX
|
22
|
+
|
23
|
+
def last!(n = 1)
|
24
|
+
return_value = []
|
25
|
+
n.times{return_value.unshift(self.pop)}
|
26
|
+
return_value.size == 1 ? return_value[0] : return_value
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Array.send(:include, Thoran::Array::LastX)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Thoran/Module/AliasMethods/alias_methods.rb
|
2
|
+
# Thoran::Module::AliasMethods#alias_methods
|
3
|
+
|
4
|
+
# 20180806
|
5
|
+
# 0.1.0
|
6
|
+
|
7
|
+
# Description: I have a penchance for having multiple method names and having line after line of alias_method calls is kinda ugly.
|
8
|
+
|
9
|
+
require 'Array/all_but_last'
|
10
|
+
|
11
|
+
module Thoran
|
12
|
+
module Module
|
13
|
+
module AliasMethods
|
14
|
+
|
15
|
+
def alias_methods(*args)
|
16
|
+
args.all_but_last.each{|e| alias_method e.to_sym, args.last.to_sym}
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Module.send(:include, Thoran::Module::AliasMethods)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: startor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoran
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Easily install, start, and stop tor.
|
14
14
|
email: code@thoran.com
|
@@ -44,6 +44,10 @@ files:
|
|
44
44
|
- lib/String/each_char.rb
|
45
45
|
- lib/String/each_line.rb
|
46
46
|
- lib/String/grep.rb
|
47
|
+
- lib/Thoran/Array/AllButLast/all_but_last.rb
|
48
|
+
- lib/Thoran/Array/ExtractOptionsX/extract_optionsX.rb
|
49
|
+
- lib/Thoran/Array/LastX/lastX.rb
|
50
|
+
- lib/Thoran/Module/AliasMethods/alias_methods.rb
|
47
51
|
- lib/Thoran/String/Capture/capture.rb
|
48
52
|
- lib/Thoran/String/Captures/captures.rb
|
49
53
|
- lib/Version.rb
|
@@ -68,8 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
72
|
- !ruby/object:Gem::Version
|
69
73
|
version: '0'
|
70
74
|
requirements: []
|
71
|
-
|
72
|
-
rubygems_version: 2.7.6
|
75
|
+
rubygems_version: 3.0.3
|
73
76
|
signing_key:
|
74
77
|
specification_version: 4
|
75
78
|
summary: tor management made easy.
|