spiced_rumby 0.6.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/.codeclimate.yml +50 -0
- data/.gitignore +47 -0
- data/.rspec +1 -0
- data/.rubocop.yml +61 -0
- data/.travis.yml +20 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +125 -0
- data/LICENSE +22 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/lib/spiced_rumby/cli_input.rb +20 -0
- data/lib/spiced_rumby/cli_output.rb +56 -0
- data/lib/spiced_rumby/version.rb +3 -0
- data/lib/spiced_rumby.rb +23 -0
- data/run +12 -0
- data/spec/spec_helper.rb +41 -0
- data/spec/support/display/null/ui.rb +19 -0
- data/spec/support/utils.rb +70 -0
- data/spiced_rumby.gemspec +32 -0
- metadata +136 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 7500edb751d872e8801cc00025799598251a8855
|
|
4
|
+
data.tar.gz: 896ed518924d16828d61ebf7363d3bff74b39cb4
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: eb44d32b62d0723a4f0b075d4aaebdb5898d46a3db28b9c704bda9c80fdc816175500b2f6c8a2982d6f1ef7435be0a202de9a93091fe99bb742cbb7eb7966437
|
|
7
|
+
data.tar.gz: 2b438ddbfb30509a4172a47cb3011ddc28aa2b830858013b85e08c07ef894afed6fa3cebad2f64649cde391cb599c7220383f2d76d13ea79f9dcb0a8a699b85a
|
data/.codeclimate.yml
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# This is a sample .codeclimate.yml configured for Engine analysis on Code
|
|
2
|
+
# Climate Platform. For an overview of the Code Climate Platform, see here:
|
|
3
|
+
# http://docs.codeclimate.com/article/300-the-codeclimate-platform
|
|
4
|
+
|
|
5
|
+
# Under the engines key, you can configure which engines will analyze your repo.
|
|
6
|
+
# Each key is an engine name. For each value, you need to specify enabled: true
|
|
7
|
+
# to enable the engine as well as any other engines-specific configuration.
|
|
8
|
+
|
|
9
|
+
# For more details, see here:
|
|
10
|
+
# http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
|
|
11
|
+
|
|
12
|
+
# For a list of all available engines, see here:
|
|
13
|
+
# http://docs.codeclimate.com/article/296-engines-available-engines
|
|
14
|
+
|
|
15
|
+
engines:
|
|
16
|
+
# to turn on an engine, add it here and set enabled to `true`
|
|
17
|
+
# to turn off an engine, set enabled to `false` or remove it
|
|
18
|
+
rubocop:
|
|
19
|
+
enabled: true
|
|
20
|
+
# golint:
|
|
21
|
+
# enabled: true
|
|
22
|
+
# gofmt:
|
|
23
|
+
# enabled: true
|
|
24
|
+
# eslint:
|
|
25
|
+
# enabled: true
|
|
26
|
+
# csslint:
|
|
27
|
+
# enabled: true
|
|
28
|
+
|
|
29
|
+
# Engines can analyze files and report issues on them, but you can separately
|
|
30
|
+
# decide which files will receive ratings based on those issues. This is
|
|
31
|
+
# specified by path patterns under the ratings key.
|
|
32
|
+
|
|
33
|
+
# For more details see here:
|
|
34
|
+
# http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
|
|
35
|
+
|
|
36
|
+
# Note: If the ratings key is not specified, this will result in a 0.0 GPA on your dashboard.
|
|
37
|
+
|
|
38
|
+
ratings:
|
|
39
|
+
paths:
|
|
40
|
+
- lib/**
|
|
41
|
+
# - app/**
|
|
42
|
+
# - "**.rb"
|
|
43
|
+
# - "**.go"
|
|
44
|
+
|
|
45
|
+
# You can globally exclude files from being analyzed by any engine using the
|
|
46
|
+
# exclude_paths key.
|
|
47
|
+
|
|
48
|
+
exclude_paths:
|
|
49
|
+
- spec/**/*
|
|
50
|
+
- vendor/**/*
|
data/.gitignore
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
## Spiced Rumby Specific
|
|
2
|
+
settings.json
|
|
3
|
+
serverlist.json
|
|
4
|
+
test-settings
|
|
5
|
+
test-activeserverlist
|
|
6
|
+
test-serverlist
|
|
7
|
+
test-hashfile
|
|
8
|
+
debug.log
|
|
9
|
+
*.sqlite3
|
|
10
|
+
*.json
|
|
11
|
+
|
|
12
|
+
## default ruby git ignore
|
|
13
|
+
*.gem
|
|
14
|
+
*.rbc
|
|
15
|
+
/.config
|
|
16
|
+
/coverage/
|
|
17
|
+
/InstalledFiles
|
|
18
|
+
/pkg/
|
|
19
|
+
/spec/reports/
|
|
20
|
+
/test/tmp/
|
|
21
|
+
/test/version_tmp/
|
|
22
|
+
/tmp/
|
|
23
|
+
|
|
24
|
+
## Specific to RubyMotion:
|
|
25
|
+
.dat*
|
|
26
|
+
.repl_history
|
|
27
|
+
build/
|
|
28
|
+
|
|
29
|
+
## Documentation cache and generated files:
|
|
30
|
+
/.yardoc/
|
|
31
|
+
/_yardoc/
|
|
32
|
+
/doc/
|
|
33
|
+
/rdoc/
|
|
34
|
+
|
|
35
|
+
## Environment normalisation:
|
|
36
|
+
/.bundle/
|
|
37
|
+
/vendor/bundle
|
|
38
|
+
/lib/bundler/man/
|
|
39
|
+
|
|
40
|
+
# for a library or gem, you might want to ignore these files since the code is
|
|
41
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
42
|
+
# Gemfile.lock
|
|
43
|
+
# .ruby-version
|
|
44
|
+
# .ruby-gemset
|
|
45
|
+
|
|
46
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
47
|
+
.rvmrc
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--color --format doc --fail-fast
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
AllCops:
|
|
2
|
+
Exclude:
|
|
3
|
+
- config/initializers/forbidden_yaml.rb
|
|
4
|
+
- !ruby/regexp /(vendor|bundle|bin|db|tmp)\/.*/
|
|
5
|
+
DisplayCopNames: true
|
|
6
|
+
DisplayStyleGuide: true
|
|
7
|
+
|
|
8
|
+
Lint/NestedMethodDefinition:
|
|
9
|
+
Enabled: false
|
|
10
|
+
|
|
11
|
+
Style/StringLiterals:
|
|
12
|
+
EnforcedStyle: single_quotes
|
|
13
|
+
|
|
14
|
+
Metrics/AbcSize:
|
|
15
|
+
Max: 35 # TODO: Lower to 15
|
|
16
|
+
|
|
17
|
+
Metrics/ClassLength:
|
|
18
|
+
Max: 261 # TODO: Lower to 100
|
|
19
|
+
Exclude:
|
|
20
|
+
- test/**/*.rb
|
|
21
|
+
|
|
22
|
+
Metrics/CyclomaticComplexity:
|
|
23
|
+
Max: 7 # TODO: Lower to 6
|
|
24
|
+
|
|
25
|
+
Metrics/LineLength:
|
|
26
|
+
Max: 110 # TODO: Lower to 80
|
|
27
|
+
|
|
28
|
+
Metrics/MethodLength:
|
|
29
|
+
Max: 25
|
|
30
|
+
|
|
31
|
+
Metrics/PerceivedComplexity:
|
|
32
|
+
Max: 9 # TODO: Lower to 7
|
|
33
|
+
|
|
34
|
+
Style/AlignParameters:
|
|
35
|
+
EnforcedStyle: with_fixed_indentation
|
|
36
|
+
|
|
37
|
+
Style/ClassAndModuleChildren:
|
|
38
|
+
EnforcedStyle: nested
|
|
39
|
+
|
|
40
|
+
Style/Documentation:
|
|
41
|
+
Enabled: false
|
|
42
|
+
|
|
43
|
+
Style/MissingElse:
|
|
44
|
+
Enabled: false # TODO: maybe enable this?
|
|
45
|
+
EnforcedStyle: case
|
|
46
|
+
|
|
47
|
+
Style/EmptyElse:
|
|
48
|
+
EnforcedStyle: empty
|
|
49
|
+
|
|
50
|
+
Style/MultilineOperationIndentation:
|
|
51
|
+
EnforcedStyle: indented
|
|
52
|
+
|
|
53
|
+
Style/BlockDelimiters:
|
|
54
|
+
Enabled: true
|
|
55
|
+
EnforcedStyle: line_count_based
|
|
56
|
+
|
|
57
|
+
Style/PredicateName:
|
|
58
|
+
Enabled: false # TODO: enable with correct prefixes
|
|
59
|
+
|
|
60
|
+
Style/ClassVars:
|
|
61
|
+
Enabled: false
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
language: ruby
|
|
2
|
+
bundler_args: --without guard
|
|
3
|
+
rvm:
|
|
4
|
+
- "2.0"
|
|
5
|
+
- "2.1"
|
|
6
|
+
- "2.2"
|
|
7
|
+
- ruby-head
|
|
8
|
+
script: "bundle exec rspec"
|
|
9
|
+
addons:
|
|
10
|
+
code_climate:
|
|
11
|
+
repo_token: 18ddab0ec2f7be2430569f2ffc7dee169da139b792172d3992a6aacba1f50877
|
|
12
|
+
branches:
|
|
13
|
+
only: master
|
|
14
|
+
notifications:
|
|
15
|
+
email: false
|
|
16
|
+
|
|
17
|
+
matrix:
|
|
18
|
+
fast_finish: true
|
|
19
|
+
allow_failures:
|
|
20
|
+
- rvm: ruby-head
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
spiced_rumby (0.5.1)
|
|
5
|
+
meshchat
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
activemodel (4.2.4)
|
|
11
|
+
activesupport (= 4.2.4)
|
|
12
|
+
builder (~> 3.1)
|
|
13
|
+
activerecord (4.2.4)
|
|
14
|
+
activemodel (= 4.2.4)
|
|
15
|
+
activesupport (= 4.2.4)
|
|
16
|
+
arel (~> 6.0)
|
|
17
|
+
activesupport (4.2.4)
|
|
18
|
+
i18n (~> 0.7)
|
|
19
|
+
json (~> 1.7, >= 1.7.7)
|
|
20
|
+
minitest (~> 5.1)
|
|
21
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
|
22
|
+
tzinfo (~> 1.1)
|
|
23
|
+
arel (6.0.3)
|
|
24
|
+
ast (2.1.0)
|
|
25
|
+
astrolabe (1.3.1)
|
|
26
|
+
parser (~> 2.2)
|
|
27
|
+
awesome_print (1.6.1)
|
|
28
|
+
builder (3.2.2)
|
|
29
|
+
byebug (5.0.0)
|
|
30
|
+
columnize (= 0.9.0)
|
|
31
|
+
codeclimate-test-reporter (0.4.8)
|
|
32
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
|
33
|
+
coderay (1.1.0)
|
|
34
|
+
colorize (0.7.7)
|
|
35
|
+
columnize (0.9.0)
|
|
36
|
+
curb (0.8.8)
|
|
37
|
+
curses (1.0.1)
|
|
38
|
+
daemons (1.2.3)
|
|
39
|
+
diff-lcs (1.2.5)
|
|
40
|
+
docile (1.1.5)
|
|
41
|
+
eventmachine (1.0.8)
|
|
42
|
+
ffi (1.9.10)
|
|
43
|
+
i18n (0.7.0)
|
|
44
|
+
json (1.8.3)
|
|
45
|
+
libnotify (0.9.1)
|
|
46
|
+
ffi (>= 1.0.11)
|
|
47
|
+
meshchat (0.5.0)
|
|
48
|
+
activerecord
|
|
49
|
+
activesupport
|
|
50
|
+
awesome_print
|
|
51
|
+
colorize
|
|
52
|
+
curb
|
|
53
|
+
curses
|
|
54
|
+
libnotify
|
|
55
|
+
sinatra
|
|
56
|
+
sqlite3
|
|
57
|
+
thin
|
|
58
|
+
method_source (0.8.2)
|
|
59
|
+
minitest (5.8.1)
|
|
60
|
+
parser (2.2.3.0)
|
|
61
|
+
ast (>= 1.1, < 3.0)
|
|
62
|
+
powerpack (0.1.1)
|
|
63
|
+
pry (0.10.3)
|
|
64
|
+
coderay (~> 1.1.0)
|
|
65
|
+
method_source (~> 0.8.1)
|
|
66
|
+
slop (~> 3.4)
|
|
67
|
+
pry-byebug (3.2.0)
|
|
68
|
+
byebug (~> 5.0)
|
|
69
|
+
pry (~> 0.10)
|
|
70
|
+
rack (1.6.4)
|
|
71
|
+
rack-protection (1.5.3)
|
|
72
|
+
rack
|
|
73
|
+
rainbow (2.0.0)
|
|
74
|
+
rspec (3.3.0)
|
|
75
|
+
rspec-core (~> 3.3.0)
|
|
76
|
+
rspec-expectations (~> 3.3.0)
|
|
77
|
+
rspec-mocks (~> 3.3.0)
|
|
78
|
+
rspec-core (3.3.2)
|
|
79
|
+
rspec-support (~> 3.3.0)
|
|
80
|
+
rspec-expectations (3.3.1)
|
|
81
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
82
|
+
rspec-support (~> 3.3.0)
|
|
83
|
+
rspec-mocks (3.3.2)
|
|
84
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
85
|
+
rspec-support (~> 3.3.0)
|
|
86
|
+
rspec-support (3.3.0)
|
|
87
|
+
rubocop (0.34.2)
|
|
88
|
+
astrolabe (~> 1.3)
|
|
89
|
+
parser (>= 2.2.2.5, < 3.0)
|
|
90
|
+
powerpack (~> 0.1)
|
|
91
|
+
rainbow (>= 1.99.1, < 3.0)
|
|
92
|
+
ruby-progressbar (~> 1.4)
|
|
93
|
+
ruby-progressbar (1.7.5)
|
|
94
|
+
simplecov (0.10.0)
|
|
95
|
+
docile (~> 1.1.0)
|
|
96
|
+
json (~> 1.8)
|
|
97
|
+
simplecov-html (~> 0.10.0)
|
|
98
|
+
simplecov-html (0.10.0)
|
|
99
|
+
sinatra (1.4.6)
|
|
100
|
+
rack (~> 1.4)
|
|
101
|
+
rack-protection (~> 1.4)
|
|
102
|
+
tilt (>= 1.3, < 3)
|
|
103
|
+
slop (3.6.0)
|
|
104
|
+
sqlite3 (1.3.11)
|
|
105
|
+
thin (1.6.4)
|
|
106
|
+
daemons (~> 1.0, >= 1.0.9)
|
|
107
|
+
eventmachine (~> 1.0, >= 1.0.4)
|
|
108
|
+
rack (~> 1.0)
|
|
109
|
+
thread_safe (0.3.5)
|
|
110
|
+
tilt (2.0.1)
|
|
111
|
+
tzinfo (1.2.2)
|
|
112
|
+
thread_safe (~> 0.1)
|
|
113
|
+
|
|
114
|
+
PLATFORMS
|
|
115
|
+
ruby
|
|
116
|
+
|
|
117
|
+
DEPENDENCIES
|
|
118
|
+
codeclimate-test-reporter
|
|
119
|
+
pry-byebug
|
|
120
|
+
rspec
|
|
121
|
+
rubocop
|
|
122
|
+
spiced_rumby!
|
|
123
|
+
|
|
124
|
+
BUNDLED WITH
|
|
125
|
+
1.10.6
|
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 L. Preston Sego III
|
|
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.
|
|
22
|
+
|
data/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Spiced Rumby [](https://travis-ci.org/NullVoxPopuli/spiced_rumby) [](https://codeclimate.com/github/NullVoxPopuli/spiced_rumby) [](https://codeclimate.com/github/NullVoxPopuli/spiced_rumby/coverage)
|
|
2
|
+
A ruby gem that acts as a [mesh-chat](https://github.com/neuravion/mesh-chat) client.
|
|
3
|
+
|
|
4
|
+

|
|
5
|
+
# Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
gem install spiced_rumby
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
# Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
$ irb
|
|
15
|
+
```
|
|
16
|
+
```ruby
|
|
17
|
+
require 'spiced_rumby'
|
|
18
|
+
SpicedRumby.start
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Or, if you just download the zip / clone the repo:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
bundle install # to install ruby dependencies
|
|
25
|
+
./run
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
# Dependencies
|
|
29
|
+
|
|
30
|
+
For sending messages
|
|
31
|
+
```bash
|
|
32
|
+
sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev
|
|
33
|
+
```
|
|
34
|
+
See [the ruby curl bindings installation](https://github.com/taf2/curb#installation) for non Ubuntu OSes.
|
|
35
|
+
|
|
36
|
+
For encryption and RSA key generation
|
|
37
|
+
```bash
|
|
38
|
+
sudo apt-get install openssl
|
|
39
|
+
```
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'bundler/gem_tasks'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module SpicedRumby
|
|
2
|
+
class CLIInput < MeshChat::CLI::Base
|
|
3
|
+
class << self
|
|
4
|
+
def autocompletes
|
|
5
|
+
commands = MeshChat::CLI::COMMAND_MAP.map{ |k, v| "/#{k}" }
|
|
6
|
+
aliases = MeshChat::Node.all.map{ |n| "#{n.alias_name}" }
|
|
7
|
+
commands + aliases
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# called every time meshchat wants a line of text from the user
|
|
12
|
+
def get_input
|
|
13
|
+
# update auto completion
|
|
14
|
+
completion = proc{ |s| self.class.autocompletes.grep(/^#{Regexp.escape(s)}/) }
|
|
15
|
+
Readline.completion_proc = completion
|
|
16
|
+
|
|
17
|
+
Readline.readline('> ', true)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
module SpicedRumby
|
|
2
|
+
class CLIOutput < MeshChat::Display::Base
|
|
3
|
+
def start
|
|
4
|
+
puts "\n"
|
|
5
|
+
alert 'Welcome to Spiced Rumby!'
|
|
6
|
+
puts "\n"
|
|
7
|
+
puts "\n"
|
|
8
|
+
yield if block_given?
|
|
9
|
+
|
|
10
|
+
MeshChat::CLI.listen_for_commands
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# TODO: find a more elegant way to handle color
|
|
14
|
+
def add_line(line)
|
|
15
|
+
puts line
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def info(msg)
|
|
19
|
+
puts msg.colorize(:light_black)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def warning(msg)
|
|
23
|
+
puts msg.colorize(:yellow)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def alert(msg)
|
|
27
|
+
puts msg.colorize(:red)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def success(msg)
|
|
31
|
+
puts msg.colorize(:green)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def chat(msg)
|
|
35
|
+
words = msg.split(' ')
|
|
36
|
+
time = words[0..1]
|
|
37
|
+
name = words[2]
|
|
38
|
+
message = words[3..words.length]
|
|
39
|
+
|
|
40
|
+
print (time.join(' ') + ' ').colorize(:light_magenta)
|
|
41
|
+
print (name + ' ').colorize(:cyan)
|
|
42
|
+
print message.join(' ') + "\n"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def whisper(msg)
|
|
46
|
+
words = msg.split(' ')
|
|
47
|
+
time = words[0..1]
|
|
48
|
+
name = words[2]
|
|
49
|
+
message = words[3..words.length]
|
|
50
|
+
|
|
51
|
+
print (time.join(' ') + ' ').colorize(:magenta)
|
|
52
|
+
print (name + ' ').colorize(:light_black)
|
|
53
|
+
print message.join(' ') + "\n"
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
data/lib/spiced_rumby.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# require the core functionality
|
|
2
|
+
require 'meshchat'
|
|
3
|
+
|
|
4
|
+
# additional functionality
|
|
5
|
+
require 'spiced_rumby/version'
|
|
6
|
+
require 'spiced_rumby/cli_input'
|
|
7
|
+
require 'spiced_rumby/cli_output'
|
|
8
|
+
|
|
9
|
+
module SpicedRumby
|
|
10
|
+
NAME = 'Spiced Rumby'
|
|
11
|
+
|
|
12
|
+
module_function
|
|
13
|
+
|
|
14
|
+
def start
|
|
15
|
+
MeshChat.start(
|
|
16
|
+
client_name: NAME,
|
|
17
|
+
client_version: VERSION,
|
|
18
|
+
display: CLIOutput,
|
|
19
|
+
input: CLIInput,
|
|
20
|
+
on_display_start: ->{ MeshChat::CLI.check_startup_settings }
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
end
|
data/run
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
current_dir = File.dirname(__FILE__)
|
|
4
|
+
# set load path (similar to how gems require files (relative to lib))
|
|
5
|
+
|
|
6
|
+
lib = current_dir + '/lib/'
|
|
7
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
require current_dir + '/lib/spiced_rumby'
|
|
11
|
+
|
|
12
|
+
SpicedRumby.start
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'bundler/setup'
|
|
3
|
+
|
|
4
|
+
require 'pry-byebug' # binding.pry to debug!
|
|
5
|
+
|
|
6
|
+
# Coverage
|
|
7
|
+
ENV['CODECLIMATE_REPO_TOKEN'] = '18ddab0ec2f7be2430569f2ffc7dee169da139b792172d3992a6aacba1f50877'
|
|
8
|
+
require 'codeclimate-test-reporter'
|
|
9
|
+
CodeClimate::TestReporter.start
|
|
10
|
+
|
|
11
|
+
# This Gem
|
|
12
|
+
require 'spiced_rumby'
|
|
13
|
+
|
|
14
|
+
SimpleCov.start do
|
|
15
|
+
add_filter "/lib/spiced_rumby/display/bash/"
|
|
16
|
+
add_filter "/lib/spiced_rumby/display/null/"
|
|
17
|
+
add_filter "/lib/spiced_rumby/display/terminal_curses/"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Dir[File.dirname(__FILE__) + '/support/**/*.rb'].each { |file| require file }
|
|
21
|
+
|
|
22
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
23
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
24
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
|
25
|
+
# loaded once.
|
|
26
|
+
#
|
|
27
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
28
|
+
RSpec::Expectations.configuration.warn_about_potential_false_positives = false
|
|
29
|
+
RSpec.configure do |config|
|
|
30
|
+
config.run_all_when_everything_filtered = true
|
|
31
|
+
config.filter_run :focus
|
|
32
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
33
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
34
|
+
# the seed, which is printed after each run.
|
|
35
|
+
# --seed 1234
|
|
36
|
+
config.order = 'random'
|
|
37
|
+
|
|
38
|
+
config.before(:each) do
|
|
39
|
+
setup_database
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module MeshChatStub
|
|
2
|
+
module Display
|
|
3
|
+
# for testing!
|
|
4
|
+
module Null
|
|
5
|
+
class UI < MeshChat::Display::Base
|
|
6
|
+
def start(*args); args.join; end
|
|
7
|
+
def add_line(*args); args.join; end
|
|
8
|
+
def info(*args); args.join; end
|
|
9
|
+
def alert(*args); args.join; end
|
|
10
|
+
def success(*args); args.join; end
|
|
11
|
+
def chat(*args); args.join; end
|
|
12
|
+
def whisper(*args); args.join; end
|
|
13
|
+
def warning(*args); args.join; end
|
|
14
|
+
def log(*args); args.join; end
|
|
15
|
+
def error(*args); args.join; end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
def mock_settings_objects
|
|
2
|
+
delete_test_files
|
|
3
|
+
|
|
4
|
+
setup_database
|
|
5
|
+
|
|
6
|
+
allow(MeshChat::Cipher).to receive(:current_encryptor){
|
|
7
|
+
MeshChat::Encryption::Passthrough
|
|
8
|
+
}
|
|
9
|
+
MeshChat::Cipher.instance_variable_set('@current_encryptor', MeshChat::Encryption::Passthrough)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
allow_any_instance_of(MeshChat::Config::Settings).to receive(:filename) { 'test-settings' }
|
|
13
|
+
s = MeshChat::Config::Settings.new
|
|
14
|
+
allow(MeshChat::Config::Settings).to receive(:instance) { s }
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
display_manager = MeshChat::Display::Manager.new(
|
|
18
|
+
MeshChatStub::Display::Null::UI
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
instance = MeshChat::Instance.new(
|
|
22
|
+
client_name: MeshChat::NAME, # name of your client
|
|
23
|
+
client_version: MeshChat::VERSION, # version of your client
|
|
24
|
+
#display: MeshChatStub::Display::Null::UI, # your class of your implementation of `Display::Base`
|
|
25
|
+
#on_display_start: ->{ MeshChat::CLI.check_startup_settings } # optional
|
|
26
|
+
)
|
|
27
|
+
MeshChat::Instance.instance_variable_set('@instance', instance)
|
|
28
|
+
|
|
29
|
+
allow(instance).to receive(:start_ui){ }
|
|
30
|
+
allow(instance).to receive(:display){ display_manager }
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def delete_test_files
|
|
34
|
+
begin
|
|
35
|
+
File.delete('test.sqlite3') if File.exist?('test.sqlite3')
|
|
36
|
+
File.delete('test-hashfile') if File.exist?('test-hashfile')
|
|
37
|
+
File.delete('test-settings') if File.exist?('test-settings')
|
|
38
|
+
File.delete('test-activeserverlist') if File.exist?('test-activeserverlist')
|
|
39
|
+
rescue => e
|
|
40
|
+
# I wonder if this would be a problem?
|
|
41
|
+
ap e.message
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def setup_database
|
|
46
|
+
# this method differs from the one defined on meshchat, in that
|
|
47
|
+
# in destroys all nodes and uses an in-memory db
|
|
48
|
+
|
|
49
|
+
ActiveRecord::Base.establish_connection(
|
|
50
|
+
:adapter => "sqlite3",
|
|
51
|
+
:database => ':memory:'
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
ActiveRecord::Migration.suppress_messages do
|
|
55
|
+
ActiveRecord::Schema.define do
|
|
56
|
+
unless table_exists? :entries
|
|
57
|
+
create_table :entries do |table|
|
|
58
|
+
table.column :alias_name, :string
|
|
59
|
+
table.column :location, :string
|
|
60
|
+
table.column :uid, :string
|
|
61
|
+
table.column :public_key, :string
|
|
62
|
+
table.column :online, :boolean, default: true, null: false
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# just to be sure
|
|
69
|
+
MeshChat::Models::Entry.destroy_all
|
|
70
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# set load path so we can use gemspec with bundler
|
|
4
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
5
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
6
|
+
require 'spiced_rumby/version'
|
|
7
|
+
|
|
8
|
+
Gem::Specification.new do |s|
|
|
9
|
+
s.name = 'spiced_rumby'
|
|
10
|
+
s.version = SpicedRumby::VERSION
|
|
11
|
+
s.platform = Gem::Platform::RUBY
|
|
12
|
+
s.license = 'MIT'
|
|
13
|
+
s.authors = ['L. Preston Sego III']
|
|
14
|
+
s.email = 'LPSego3+dev@gmail.com'
|
|
15
|
+
s.homepage = 'https://github.com/NullVoxPopuli/spiced_rumby'
|
|
16
|
+
s.summary = "SpicedRumby-#{SpicedRumby::VERSION}"
|
|
17
|
+
s.description = 'A mesh-chat Client in Ruby'
|
|
18
|
+
|
|
19
|
+
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
|
20
|
+
s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
|
21
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
|
22
|
+
s.require_paths = ['lib']
|
|
23
|
+
|
|
24
|
+
s.required_ruby_version = '>= 2.0'
|
|
25
|
+
|
|
26
|
+
s.add_dependency 'meshchat'
|
|
27
|
+
|
|
28
|
+
s.add_development_dependency 'rspec'
|
|
29
|
+
s.add_development_dependency 'pry-byebug'
|
|
30
|
+
s.add_development_dependency 'codeclimate-test-reporter'
|
|
31
|
+
s.add_development_dependency 'rubocop'
|
|
32
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: spiced_rumby
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.6.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- L. Preston Sego III
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-10-22 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: meshchat
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rspec
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: pry-byebug
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: codeclimate-test-reporter
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rubocop
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
description: A mesh-chat Client in Ruby
|
|
84
|
+
email: LPSego3+dev@gmail.com
|
|
85
|
+
executables: []
|
|
86
|
+
extensions: []
|
|
87
|
+
extra_rdoc_files: []
|
|
88
|
+
files:
|
|
89
|
+
- ".codeclimate.yml"
|
|
90
|
+
- ".gitignore"
|
|
91
|
+
- ".rspec"
|
|
92
|
+
- ".rubocop.yml"
|
|
93
|
+
- ".travis.yml"
|
|
94
|
+
- Gemfile
|
|
95
|
+
- Gemfile.lock
|
|
96
|
+
- LICENSE
|
|
97
|
+
- README.md
|
|
98
|
+
- Rakefile
|
|
99
|
+
- lib/spiced_rumby.rb
|
|
100
|
+
- lib/spiced_rumby/cli_input.rb
|
|
101
|
+
- lib/spiced_rumby/cli_output.rb
|
|
102
|
+
- lib/spiced_rumby/version.rb
|
|
103
|
+
- run
|
|
104
|
+
- spec/spec_helper.rb
|
|
105
|
+
- spec/support/display/null/ui.rb
|
|
106
|
+
- spec/support/utils.rb
|
|
107
|
+
- spiced_rumby.gemspec
|
|
108
|
+
homepage: https://github.com/NullVoxPopuli/spiced_rumby
|
|
109
|
+
licenses:
|
|
110
|
+
- MIT
|
|
111
|
+
metadata: {}
|
|
112
|
+
post_install_message:
|
|
113
|
+
rdoc_options: []
|
|
114
|
+
require_paths:
|
|
115
|
+
- lib
|
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
|
+
requirements:
|
|
118
|
+
- - ">="
|
|
119
|
+
- !ruby/object:Gem::Version
|
|
120
|
+
version: '2.0'
|
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
|
+
requirements:
|
|
123
|
+
- - ">="
|
|
124
|
+
- !ruby/object:Gem::Version
|
|
125
|
+
version: '0'
|
|
126
|
+
requirements: []
|
|
127
|
+
rubyforge_project:
|
|
128
|
+
rubygems_version: 2.4.7
|
|
129
|
+
signing_key:
|
|
130
|
+
specification_version: 4
|
|
131
|
+
summary: SpicedRumby-0.6.0
|
|
132
|
+
test_files:
|
|
133
|
+
- spec/spec_helper.rb
|
|
134
|
+
- spec/support/display/null/ui.rb
|
|
135
|
+
- spec/support/utils.rb
|
|
136
|
+
has_rdoc:
|