zashoku 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -5
- data/bin/zashoku +1 -12
- data/config/daemon.yml +0 -7
- data/config/view.yml +0 -4
- data/lib/core/config/config.rb +2 -8
- data/lib/core/config/daemon_config.rb +1 -1
- data/lib/core/config/view_config.rb +1 -1
- data/lib/core/formatter.rb +0 -1
- data/lib/core/module.rb +8 -8
- data/lib/core/net/client.rb +13 -4
- data/lib/core/net/server.rb +1 -0
- data/lib/core/options.rb +9 -2
- data/lib/core/view.rb +3 -13
- data/lib/daemon.rb +23 -10
- data/lib/generator/app_generator.rb +12 -0
- data/lib/generator/module_generator.rb +11 -0
- data/lib/generator.rb +58 -25
- data/lib/viewer.rb +13 -9
- data/lib/zashoku.rb +25 -4
- metadata +86 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e99bb8738a8d367c416d66c40130b91e07e9a76
|
4
|
+
data.tar.gz: f45b7cef607b9e640d89dec4999976c178918cd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab0df30b379d34a69274ca6ba17f63a1dd42ada0d52f1a1413fb7039d40d900bc9bf888b0faa4b1e41b5fbd419c6a9168b809e13032b9dff45032877e7252ed0
|
7
|
+
data.tar.gz: a40c62b9937bd0a060285324667d88b9498e7d8992cb3e849543cb5e98a98bdc31312285eace7c57ee09896324d48e8993f8d58ec221c2a17559c8605cb3ac08
|
data/README.md
CHANGED
@@ -1,16 +1,25 @@
|
|
1
|
-
# zashoku
|
1
|
+
# zashoku座食
|
2
2
|
command line application framework
|
3
3
|
|
4
4
|
## features
|
5
|
-
+ for lazy people
|
5
|
+
+ good for lazy people
|
6
6
|
+ generators
|
7
7
|
+ optimized view
|
8
8
|
+ mvc
|
9
9
|
+ client / server model
|
10
|
+
+ rendering support for asian characters
|
11
|
+
|
12
|
+
## examples
|
13
|
+
#### create new app
|
14
|
+
`zashoku -g app <name>`
|
15
|
+
|
16
|
+
#### create new module
|
17
|
+
`zashoku -g module <name>`
|
18
|
+
|
10
19
|
|
11
20
|
## installation
|
12
21
|
`gem install zashoku`
|
13
22
|
|
14
|
-
##
|
15
|
-
+ [rubydoc.info](http://www.rubydoc.info/gems/zashoku/)
|
16
|
-
+ [
|
23
|
+
## resources
|
24
|
+
+ [rubydoc.info/gems/zashoku](http://www.rubydoc.info/gems/zashoku/)
|
25
|
+
+ [rubygems.org/gems/zashoku](https://www.rubygems.org/gems/zashoku)
|
data/bin/zashoku
CHANGED
@@ -1,17 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
if File.exist?(File.join(File.dirname(__FILE__), '../lib/zashoku.rb'))
|
6
|
-
require_relative '../lib/zashoku'
|
7
|
-
end
|
8
|
-
# rescue LoadError
|
9
|
-
# require 'zashoku'
|
10
|
-
end
|
11
|
-
|
12
|
-
unless defined? Zashoku
|
13
|
-
puts 'cant find zashoku library'
|
14
|
-
exit
|
15
|
-
end
|
4
|
+
require_relative '../lib/zashoku'
|
16
5
|
|
17
6
|
Zashoku.main(ARGV)
|
data/config/daemon.yml
CHANGED
data/config/view.yml
CHANGED
data/lib/core/config/config.rb
CHANGED
@@ -5,7 +5,7 @@ require 'fileutils'
|
|
5
5
|
|
6
6
|
module Zashoku
|
7
7
|
class Config < Controller
|
8
|
-
CONF_DIR = File.join(Dir.home, '.config/
|
8
|
+
CONF_DIR = File.join(Dir.home, '.config/', Zashoku::AppName)
|
9
9
|
CONF_FILE = File.join(CONF_DIR, '/conf.yml')
|
10
10
|
|
11
11
|
def initialize
|
@@ -39,7 +39,7 @@ module Zashoku
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def user_conf
|
42
|
-
|
42
|
+
Util.get_yaml(self.class::CONF_FILE)
|
43
43
|
end
|
44
44
|
|
45
45
|
def pref_model(title, value, trail)
|
@@ -86,11 +86,5 @@ module Zashoku
|
|
86
86
|
def save
|
87
87
|
File.open(self.class::CONF_FILE, 'w') { |f| f.write(YAML.dump(@conf)) }
|
88
88
|
end
|
89
|
-
|
90
|
-
def read(file)
|
91
|
-
YAML.safe_load(File.open(file, 'r', &:read))
|
92
|
-
rescue
|
93
|
-
{}
|
94
|
-
end
|
95
89
|
end
|
96
90
|
end
|
data/lib/core/formatter.rb
CHANGED
@@ -96,7 +96,6 @@ module Zashoku
|
|
96
96
|
def self.format_line(string, obj)
|
97
97
|
pfs = pre_format(string, obj)
|
98
98
|
len = pfs.reduce(0) { |l, s| l + Unicode::DisplayWidth.of(s[0]) } + 1
|
99
|
-
Zashoku.logger.debug("formatting #{pfs}, len: #{len}\n--->#{Util::Term.cols} - #{len} / #{pfs.length - 1}")
|
100
99
|
buffer = pfs.length > 1 ? (Util::Term.cols - len) / (pfs.length - 1) : 0
|
101
100
|
|
102
101
|
buffer -= (Util::Term.cols - len - buffer)
|
data/lib/core/module.rb
CHANGED
@@ -4,15 +4,9 @@ require 'yaml'
|
|
4
4
|
|
5
5
|
module Zashoku
|
6
6
|
module Module
|
7
|
-
LoadPaths = [
|
8
|
-
File.join(Zashoku::Root, 'lib/core/modules/'),
|
9
|
-
File.join(Zashoku::Root, 'modules/'),
|
10
|
-
File.join(Dir.home, '.config/zashoku/modules/')
|
11
|
-
].freeze
|
12
|
-
|
13
7
|
def self.require_module(mod)
|
14
8
|
mod = mod.downcase
|
15
|
-
LoadPaths.map do |path|
|
9
|
+
Zashoku::LoadPaths.map do |path|
|
16
10
|
mod_path = File.join(path, "#{mod}/lib/#{mod}.rb")
|
17
11
|
next unless File.exist?(mod_path)
|
18
12
|
begin
|
@@ -31,7 +25,13 @@ module Zashoku
|
|
31
25
|
|
32
26
|
def self.require_all(modules)
|
33
27
|
modules.map do |mod|
|
34
|
-
|
28
|
+
if require_module(mod)
|
29
|
+
Zashoku.logger.debug("loaded module #{mod}")
|
30
|
+
Zashoku.const_get(mod)
|
31
|
+
else
|
32
|
+
Zashoku.logger.debug("failed to load module #{mod}")
|
33
|
+
nil
|
34
|
+
end
|
35
35
|
end.compact
|
36
36
|
end
|
37
37
|
|
data/lib/core/net/client.rb
CHANGED
@@ -9,7 +9,7 @@ module Zashoku
|
|
9
9
|
class Client
|
10
10
|
attr_accessor :callbacks
|
11
11
|
|
12
|
-
def initialize(port, host =
|
12
|
+
def initialize(port, host = Zashoku::Host)
|
13
13
|
@socket = connect(host, port)
|
14
14
|
@alive = true
|
15
15
|
|
@@ -26,6 +26,18 @@ module Zashoku
|
|
26
26
|
@semaphore = Mutex.new
|
27
27
|
end
|
28
28
|
|
29
|
+
def self.command(host, port, msg, args = {})
|
30
|
+
sock = TCPSocket.new(host, port)
|
31
|
+
sock.puts(JSON.generate({'msg' => msg}.merge(args)))
|
32
|
+
result = sock.readline
|
33
|
+
sock.close
|
34
|
+
JSON.parse(result).map { |k, v| "#{k}: #{v}\n" }.join
|
35
|
+
rescue Errno::ECONNREFUSED
|
36
|
+
"error: could not connect connect to server\n"
|
37
|
+
rescue EOFError
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
|
29
41
|
def connect(host, port)
|
30
42
|
TCPSocket.new(host, port)
|
31
43
|
rescue Errno::ECONNREFUSED
|
@@ -55,10 +67,8 @@ module Zashoku
|
|
55
67
|
def command(msg, args = {})
|
56
68
|
return unless alive?
|
57
69
|
@semaphore.synchronize {
|
58
|
-
id = Random.rand
|
59
70
|
|
60
71
|
payload = { 'msg' => msg }.merge(args)
|
61
|
-
Zashoku.logger.debug("client.command #{id} #{payload}")
|
62
72
|
@command_queue << JSON.generate(payload)
|
63
73
|
|
64
74
|
result = @result_queue.pop
|
@@ -84,7 +94,6 @@ module Zashoku
|
|
84
94
|
|
85
95
|
def distribute_results!
|
86
96
|
response = JSON.parse(@socket.readline)
|
87
|
-
Zashoku.logger.debug("distributing #{response.class} #{response.length}")
|
88
97
|
if response['event']
|
89
98
|
@event_queue << response
|
90
99
|
else
|
data/lib/core/net/server.rb
CHANGED
data/lib/core/options.rb
CHANGED
@@ -6,6 +6,8 @@ class Options
|
|
6
6
|
def self.parse(args)
|
7
7
|
options = {
|
8
8
|
daemon: false,
|
9
|
+
server: true,
|
10
|
+
server_command: nil,
|
9
11
|
generate: false,
|
10
12
|
template: nil,
|
11
13
|
generate_name: nil
|
@@ -14,8 +16,13 @@ class Options
|
|
14
16
|
parser = OptionParser.new do |opts|
|
15
17
|
opts.banner = 'Usage: zashoku [options]'
|
16
18
|
|
17
|
-
opts.on('-
|
18
|
-
options[:
|
19
|
+
opts.on('-s [COMMAND]', '--server [COMMAND]', 'pass commands to the server') do |cmd|
|
20
|
+
options[:server] = true
|
21
|
+
options[:server_command] = cmd || 'start'
|
22
|
+
end
|
23
|
+
|
24
|
+
opts.on('-d', '--daemon', 'daemonize the server') do |d|
|
25
|
+
options[:daemonize] = true
|
19
26
|
end
|
20
27
|
|
21
28
|
opts.on('-g TEMPLATE', '--generate TEMPLATE', 'generate a template') do |template|
|
data/lib/core/view.rb
CHANGED
@@ -24,11 +24,8 @@ module Zashoku
|
|
24
24
|
@old_rows = Term.rows
|
25
25
|
|
26
26
|
# @win = Curses::Window.new(0,0,0,0)
|
27
|
-
Zashoku.logger.debug('refreshing')
|
28
|
-
refresh
|
29
|
-
|
30
|
-
dirty_all_lines
|
31
27
|
@view = [0, Term.rows - 3]
|
28
|
+
refresh
|
32
29
|
end
|
33
30
|
|
34
31
|
def dirty_all_lines
|
@@ -96,7 +93,6 @@ module Zashoku
|
|
96
93
|
@selected = i
|
97
94
|
@expanded = i
|
98
95
|
end
|
99
|
-
#adjust_view
|
100
96
|
|
101
97
|
arr = [@expanded, oexpanded] - [-1]
|
102
98
|
@dirty_lines = arr.min.step(@view[1]).to_a
|
@@ -144,9 +140,7 @@ module Zashoku
|
|
144
140
|
@dirty_lines += [os, @selected]
|
145
141
|
|
146
142
|
adjust_view
|
147
|
-
|
148
|
-
changed
|
149
|
-
notify_observers
|
143
|
+
changed!
|
150
144
|
end
|
151
145
|
|
152
146
|
def fix_cursor
|
@@ -210,8 +204,6 @@ module Zashoku
|
|
210
204
|
)
|
211
205
|
|
212
206
|
@items_formatted = Zashoku::Formatter.items(get_format, @items)
|
213
|
-
changed
|
214
|
-
notify_observers
|
215
207
|
end
|
216
208
|
|
217
209
|
def draw_line(line_on)
|
@@ -247,9 +239,7 @@ module Zashoku
|
|
247
239
|
line_on = @view[0]
|
248
240
|
lines_to_draw = @view[1]
|
249
241
|
|
250
|
-
|
251
|
-
lo = "\e[1;1H"
|
252
|
-
print lo + @cl['m'] + @title_formatted + "\e[K"
|
242
|
+
print "\e[1;1H#{@cl['m']}#{@title_formatted}\e[K"
|
253
243
|
|
254
244
|
while line_on < lines_to_draw
|
255
245
|
draw_line(line_on) if @dirty_lines.include?(line_on)
|
data/lib/daemon.rb
CHANGED
@@ -4,7 +4,6 @@ require 'json'
|
|
4
4
|
require 'logger'
|
5
5
|
require 'socket'
|
6
6
|
require 'thread'
|
7
|
-
require 'warning'
|
8
7
|
|
9
8
|
require_relative 'core/controller'
|
10
9
|
require_relative 'core/config/daemon_config'
|
@@ -29,28 +28,32 @@ module Zashoku
|
|
29
28
|
|
30
29
|
class Daemon
|
31
30
|
def initialize
|
31
|
+
@semaphore = Mutex.new
|
32
|
+
|
33
|
+
Zashoku.logger = Logger.new(STDOUT)
|
32
34
|
# Load conf
|
33
35
|
Zashoku.conf = DaemonConfig.new
|
34
36
|
# Load modules
|
35
|
-
Zashoku.modules = Zashoku::Module.load(Zashoku
|
37
|
+
Zashoku.modules = Zashoku::Module.load(Zashoku::DaemonModules)
|
36
38
|
# Update conf with module defaults
|
37
39
|
Zashoku.conf.reload
|
38
40
|
|
39
|
-
#initialize logger
|
40
|
-
Zashoku.logger = Logger.new(STDOUT)
|
41
|
-
|
42
41
|
Zashoku.controllers =
|
43
42
|
Zashoku.modules.keys.zip(Zashoku.modules.values.map(&:controller)).to_h
|
44
43
|
|
45
|
-
@server = Net::Server.new(12_345)
|
46
|
-
@server.handler = method(:respond)
|
47
|
-
|
48
44
|
Zashoku.controllers.each_value { |c| c.add_observer(self) }
|
49
45
|
|
50
|
-
# $stdout.reopen(
|
51
|
-
# $stderr.reopen(
|
46
|
+
# $stdout.reopen(file, 'w')
|
47
|
+
# $stderr.reopen(file, 'w')
|
52
48
|
# $stdout.sync = true
|
53
49
|
# $stderr.sync = true
|
50
|
+
end
|
51
|
+
|
52
|
+
def listen
|
53
|
+
lay_traps!
|
54
|
+
@server = Net::Server.new(Zashoku::Port)
|
55
|
+
@server.handler = method(:respond)
|
56
|
+
Zashoku.logger.debug('server listening')
|
54
57
|
sleep
|
55
58
|
end
|
56
59
|
|
@@ -70,11 +73,21 @@ module Zashoku
|
|
70
73
|
Zashoku.command(message)
|
71
74
|
when 'disconnect'
|
72
75
|
nil
|
76
|
+
when 'stop'
|
77
|
+
cleanup
|
73
78
|
else
|
74
79
|
'what?'
|
75
80
|
end
|
76
81
|
end
|
77
82
|
|
83
|
+
def lay_traps!
|
84
|
+
Signal.trap('INT') do
|
85
|
+
Thread.new do
|
86
|
+
@semaphore.synchronize { cleanup }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
78
91
|
def cleanup
|
79
92
|
@server.exit
|
80
93
|
exit
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Zashoku
|
4
|
+
module Generator
|
5
|
+
class AppGenerator < Generator
|
6
|
+
def generate!
|
7
|
+
generated << transfer('app', @name_path)
|
8
|
+
generated << transfer('module', Pathname.new(File.join(@name_path, 'modules', @name)))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
data/lib/generator.rb
CHANGED
@@ -4,41 +4,74 @@ require 'fileutils'
|
|
4
4
|
require 'pathname'
|
5
5
|
|
6
6
|
module Zashoku
|
7
|
-
|
7
|
+
module Generator
|
8
8
|
TemplateDir = File.join(Zashoku::Root, 'templates')
|
9
|
-
LowerCaseIdentifier = '<module_name>'
|
10
|
-
UpperCaseIdentifier = '<Module_name>'
|
11
9
|
Extensions = 'rb,yml,md,gemspec'
|
12
10
|
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
def self.generate(template, name)
|
12
|
+
raise 'error, no name given' unless name
|
13
|
+
generator =
|
14
|
+
case template
|
15
|
+
when 'module'
|
16
|
+
require_relative 'generator/module_generator'
|
17
|
+
ModuleGenerator.new(name)
|
18
|
+
when 'app'
|
19
|
+
require_relative 'generator/app_generator'
|
20
|
+
AppGenerator.new(name)
|
21
|
+
else
|
22
|
+
raise "Template #{template} not found"
|
23
|
+
end
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
.to_s
|
24
|
-
.gsub(/#{LowerCaseIdentifier}/, @name)
|
25
|
-
.gsub(/#{UpperCaseIdentifier}/, @name.capitalize)
|
25
|
+
generator.generate!
|
26
|
+
puts "generated #{generator.generated.join(', ')}"
|
26
27
|
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
class Generator
|
30
|
+
attr_accessor :generated
|
31
|
+
|
32
|
+
def initialize(name)
|
33
|
+
@generated = []
|
34
|
+
@name = name
|
35
|
+
@name_path = Pathname.new(File.absolute_path(@name))
|
36
|
+
end
|
35
37
|
|
36
|
-
|
38
|
+
def pairs
|
39
|
+
@pairs || @pairs = {
|
40
|
+
/<name>/ => @name,
|
41
|
+
/<Name>/ => @name.capitalize
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def refactor(thing)
|
46
|
+
pairs.reduce(thing.to_s) { |f, t| f = f.gsub(t[0], t[1]) }
|
47
|
+
end
|
37
48
|
|
38
|
-
|
39
|
-
|
49
|
+
def transfer(template, output)
|
50
|
+
input_dir = Pathname.new(File.join(TemplateDir, template))
|
51
|
+
output_dir = Pathname.new(output)
|
52
|
+
raise "path #{output_dir} already exists" if Dir.exist?(output_dir)
|
53
|
+
Dir.glob("#{input_dir}/**/*").each do |file|
|
54
|
+
next if Dir.exist?(file)
|
55
|
+
|
56
|
+
new_file =
|
57
|
+
File.join(
|
58
|
+
output_dir,
|
59
|
+
refactor(Pathname.new(file).relative_path_from(input_dir))
|
60
|
+
)
|
61
|
+
|
62
|
+
FileUtils.mkdir_p(File.dirname(new_file))
|
63
|
+
|
64
|
+
File.open(new_file, 'w') do |f|
|
65
|
+
f.print refactor(File.open(file, 'r', &:read))
|
66
|
+
end
|
67
|
+
|
68
|
+
FileUtils.chmod(File.stat(file).mode, new_file)
|
40
69
|
end
|
70
|
+
|
71
|
+
output
|
41
72
|
end
|
73
|
+
|
74
|
+
def generate!; end
|
42
75
|
end
|
43
76
|
end
|
44
77
|
end
|
data/lib/viewer.rb
CHANGED
@@ -52,33 +52,37 @@ module Zashoku
|
|
52
52
|
def initialize
|
53
53
|
@semaphore = Mutex.new
|
54
54
|
|
55
|
+
Zashoku.logger = Logger.new(
|
56
|
+
File.join(Zashoku::AppRoot, "#{Zashoku::AppName}.log")
|
57
|
+
)
|
58
|
+
|
55
59
|
Zashoku.conf = ViewConfig.new
|
56
60
|
|
57
|
-
Zashoku.modules = Zashoku::Module.load(
|
58
|
-
Zashoku.conf.get(%w[modules enabled])
|
59
|
-
)
|
61
|
+
Zashoku.modules = Zashoku::Module.load(Zashoku::ViewerModules)
|
60
62
|
Zashoku.conf.reload
|
61
63
|
|
62
|
-
Zashoku.logger = Logger.new('zashoku_log.log')
|
63
|
-
|
64
64
|
# note: start daemon if not running
|
65
|
-
Zashoku.client = Net::Client.new(
|
65
|
+
Zashoku.client = Net::Client.new(Zashoku::Port)
|
66
66
|
Zashoku.client.callbacks << method(:handle_event)
|
67
67
|
|
68
68
|
@views = Zashoku.modules.keys.zip(Zashoku.modules.map do |_k, m|
|
69
69
|
m.view
|
70
70
|
end).to_h
|
71
|
-
|
72
71
|
@view = @views.keys.first
|
72
|
+
|
73
73
|
init_screen
|
74
74
|
lay_traps!
|
75
75
|
Thread.abort_on_exception = true
|
76
76
|
Thread.new { scan_keyboard! }
|
77
|
+
|
78
|
+
init_view(@view) if @view
|
79
|
+
sleep
|
80
|
+
end
|
81
|
+
|
82
|
+
def init_view(view)
|
77
83
|
@views[@view].add_observer(self, :draw_view)
|
78
84
|
@views[@view].refresh
|
79
85
|
draw_view
|
80
|
-
|
81
|
-
sleep
|
82
86
|
end
|
83
87
|
|
84
88
|
def lay_traps!
|
data/lib/zashoku.rb
CHANGED
@@ -3,9 +3,20 @@
|
|
3
3
|
require_relative 'core/options'
|
4
4
|
|
5
5
|
module Zashoku
|
6
|
-
Version = [1,
|
6
|
+
Version = [1, 1, 0].freeze
|
7
7
|
Root = File.expand_path('../', __dir__)
|
8
8
|
|
9
|
+
AppRoot = Root unless const_defined?(:AppRoot)
|
10
|
+
AppName = 'zashoku' unless const_defined?(:AppName)
|
11
|
+
ViewerModules = [] unless const_defined?(:ViewerModules)
|
12
|
+
DaemonModules = [] unless const_defined?(:DaemonModules)
|
13
|
+
Host = 'localhost' unless const_defined?(:Host)
|
14
|
+
Port = 12_345 unless const_defined?(:Port)
|
15
|
+
|
16
|
+
LoadPaths = [
|
17
|
+
File.join(Zashoku::AppRoot, 'modules')
|
18
|
+
].freeze
|
19
|
+
|
9
20
|
autoload :Generator, File.join(Root, 'lib/generator')
|
10
21
|
autoload :Viewer, File.join(Root, 'lib/viewer')
|
11
22
|
autoload :Daemon, File.join(Root, 'lib/daemon')
|
@@ -25,11 +36,21 @@ module Zashoku
|
|
25
36
|
Zashoku.modules = []
|
26
37
|
|
27
38
|
if options[:generate]
|
28
|
-
Generator.
|
29
|
-
elsif options[:
|
30
|
-
|
39
|
+
Generator.generate(options[:template], options[:generate_name])
|
40
|
+
elsif options[:server_command]
|
41
|
+
command_server(options[:server_command])
|
31
42
|
else
|
32
43
|
Viewer.new.run
|
33
44
|
end
|
34
45
|
end
|
46
|
+
|
47
|
+
def self.command_server(command)
|
48
|
+
case command
|
49
|
+
when 'start'
|
50
|
+
Daemon.new.listen
|
51
|
+
else
|
52
|
+
require_relative 'core/net/client'
|
53
|
+
print Net::Client.command(Zashoku::Host, Zashoku::Port, command)
|
54
|
+
end
|
55
|
+
end
|
35
56
|
end
|
metadata
CHANGED
@@ -1,15 +1,95 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zashoku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- annacrombie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
12
|
-
dependencies:
|
11
|
+
date: 2017-10-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: curses
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.2.4
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.2.4
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: highline
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.7'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 1.7.8
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.7'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.7.8
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: json
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '2.1'
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 2.1.0
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.1'
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 2.1.0
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: unicode-display_width
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '1.3'
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.3.0
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 1.3.0
|
13
93
|
description: inspired by cmus, vim, and rails
|
14
94
|
email: meotleft@gmail.com
|
15
95
|
executables:
|
@@ -36,6 +116,8 @@ files:
|
|
36
116
|
- "./lib/core/view.rb"
|
37
117
|
- "./lib/daemon.rb"
|
38
118
|
- "./lib/generator.rb"
|
119
|
+
- "./lib/generator/app_generator.rb"
|
120
|
+
- "./lib/generator/module_generator.rb"
|
39
121
|
- "./lib/viewer.rb"
|
40
122
|
- "./lib/zashoku.rb"
|
41
123
|
- bin/zashoku
|
@@ -51,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
133
|
requirements:
|
52
134
|
- - ">="
|
53
135
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
136
|
+
version: 2.4.0
|
55
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
138
|
requirements:
|
57
139
|
- - ">="
|