iniquity 0.0.15 → 0.0.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/iniquity +14 -3
  3. data/bin/iqmod +28 -16
  4. data/bin/iqterm +47 -0
  5. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3f9001f15929c9f44e4c3546d735956a27966b0b4cc694f8a713047543c7f0fd
4
- data.tar.gz: 2569087434e51adf14359e51975b0188d6a6cca76ad7257eda40cbbb1b1a4952
3
+ metadata.gz: 5ec2fa013429fed19f81402fc56fc0be516efe6f8e8f266e3f8d4e9e81fe199b
4
+ data.tar.gz: 83fbdc3240335b39db1f4347defcced20ae6558a7698421edad5f1db4e88b40d
5
5
  SHA512:
6
- metadata.gz: 3f9b730e269728db1d80c6bc12baced11ec991469894c84145fd99a41eebbe484f4c86e953316e419a48ce266cb1cca61d9330f07a5f9f85db82a1b38099231b
7
- data.tar.gz: e135fe80131248f09c1747babb1e6ae6b6dc847f2fbde85f5fef8254455f44985fc0f361fba57be6bcf0622de87c49c3aa77d2e46a66564b4b4a32fd29dd4dd9
6
+ metadata.gz: 2f3cc9682bd01693e20e43b39553af5e0ac78aab0120e594a634c70335007524298815f9dbb11d94a0c5f225e2254fdc162bccbe0fcb1b0c86c1dcaf3ece9874
7
+ data.tar.gz: c65e9888f1608dc76c517c8fd452c4a29209fb21694c47b803d25996e61490e9801cfaa7037f2948666c90741975f214af51ecd2ba68bcce259ff85f5b298e5b
data/bin/iniquity CHANGED
@@ -27,12 +27,13 @@ ENV["INIQUITY_SYSTEM"] = SYSTEM
27
27
  require "inifile"
28
28
  require "thin"
29
29
  require "socksify"
30
+ require "sqlite3"
30
31
 
31
32
  class Telnet < EM::Connection
32
33
 
33
34
  def initialize
34
35
  super
35
- send_data "\nIniquity BBS 0.0.15 - Telnet Service\n"
36
+ send_data "\nIniquity BBS 0.0.16 - Telnet Service\n"
36
37
  end
37
38
 
38
39
  def post_init
@@ -80,17 +81,27 @@ IO.readlines(artwork).each do |line|
80
81
  puts line.force_encoding(Encoding::IBM437).encode(Encoding::UTF_8)
81
82
  end
82
83
 
84
+ DB = SQLite3::Database.new "#{SYSTEM}/iniquity.db"
85
+
83
86
  # If "init" passed...
84
87
  if ARGV[0] && ARGV[0] == "init"
85
88
  new_system_file = File.new(SYSTEM + "/iniquity.ini", "w")
86
89
  new_system_file.puts "[profile]\nname=NewBBS\n"
87
- new_system_file.puts "\n[ipm]\nsources=iniquitybbs\n"
90
+ new_system_file.puts "\n[iqmod]\nsources=iniquitybbs\n"
88
91
  new_system_file.puts "\n[telnet]\nenabled=yes\n"
89
92
  new_system_file.puts "port=3023\n"
90
93
  new_system_file.puts "\n[rest]\nenabled=yes\n"
91
94
  new_system_file.puts "port=3080\n"
92
95
  new_system_file.close
93
- abort "iniquity - Initialized directory as a new system.\n\n"
96
+
97
+ DB.execute <<-SQL
98
+ create table system (
99
+ name varchar(30),
100
+ val int
101
+ );
102
+ SQL
103
+
104
+ abort "\niniquity - Initialized directory as a new system.\n\n"
94
105
  end
95
106
 
96
107
  if File.exists?(SYSTEM + "/iniquity.ini")
data/bin/iqmod CHANGED
@@ -46,28 +46,28 @@ else
46
46
  abort "iqmod - An Iniquity system must have an iniquity.ini file.\n\n"
47
47
  end
48
48
 
49
- # Find all available iqmod packages across all sources...
50
- available_packages = []
49
+ # Find all available modules across all GitHub sources...
50
+ available_modules = []
51
51
 
52
52
  if CONFIG["iqmod"]["sources"]
53
53
  CONFIG["iqmod"]["sources"].split(",").each do |source|
54
54
 
55
55
  repositories = Github.repos.list user: "#{source}"
56
56
 
57
- repositories.each do |pkg|
58
- if pkg.name.match(/^ip/)
59
- available_packages.push(pkg)
57
+ repositories.each do |iqmod|
58
+ if iqmod.name.match(/^iqmod/)
59
+ available_modules.push(iqmod)
60
60
  end
61
61
  end
62
62
  end
63
63
  end
64
64
 
65
- installed_packages = []
65
+ installed_modules = []
66
66
 
67
67
  Dir.chdir SYSTEM
68
- Dir.glob('iqmod*').select { |pkg|
69
- if File.directory? pkg
70
- installed_packages.push pkg
68
+ Dir.glob('iqmod*').select { |iqmod|
69
+ if File.directory? iqmod
70
+ installed_modules.push iqmod
71
71
  end
72
72
  }
73
73
 
@@ -78,7 +78,7 @@ if ARGV[0] && ARGV[0] == "install"
78
78
 
79
79
  if ARGV[0]
80
80
  ARGV.each do |install|
81
- available_packages.each do |iqmod|
81
+ available_modules.each do |iqmod|
82
82
 
83
83
  if install == iqmod.name
84
84
  next if Dir.exists? SYSTEM + "/#{iqmod.name}"
@@ -96,7 +96,7 @@ if ARGV[0] && ARGV[0] == "install"
96
96
 
97
97
  FileUtils.mv SYSTEM + "/#{iqmod.name}-master", SYSTEM + "/#{iqmod.name}"
98
98
  FileUtils.rm SYSTEM + "/#{iqmod.name}.zip"
99
- puts "iqmod - Installed #{iqmod.name}\n\n"
99
+ puts "iqmod - Installed #{iqmod.name}.\n\n"
100
100
  end
101
101
  end
102
102
  end
@@ -117,24 +117,36 @@ if ARGV[0] && ARGV[0] == "uninstall"
117
117
  end
118
118
  end
119
119
 
120
+ # If "search" passed.
121
+ if ARGV[0] && ARGV[0] == "search"
122
+
123
+ #ARGV.shift
124
+
125
+ if ARGV[0]
126
+ ARGV.each do |search|
127
+ abort "iqmod - Sorry, search doesn't work yet.\n\n"
128
+ end
129
+ end
130
+ end
131
+
120
132
  # If no options passed.
121
133
  unless ARGV[0]
122
134
 
123
- if available_packages.length > 0
135
+ if available_modules.length > 0
124
136
  puts "iqmod - Modules available for installation.\n\n"
125
137
 
126
- available_packages.each do |iqmod|
138
+ available_modules.each do |iqmod|
127
139
  puts iqmod.name
128
140
  puts iqmod.description
129
- #puts "https://github.com/#{iqmod.full_name}/archive/master.zip"
141
+ puts "https://github.com/#{iqmod.full_name}/archive/master.zip"
130
142
  puts ""
131
143
  end
132
144
  end
133
145
 
134
- if installed_packages.length > 0
146
+ if installed_modules.length > 0
135
147
  puts "iqmod - Modules currently installed.\n\n"
136
148
 
137
- installed_packages.each do |iqmod|
149
+ installed_modules.each do |iqmod|
138
150
  puts iqmod
139
151
  end
140
152
  end
data/bin/iqterm CHANGED
@@ -29,6 +29,9 @@ require "github_api"
29
29
  require "highline"
30
30
  require "open-uri"
31
31
  require "zip"
32
+ require 'rubygems'
33
+ require 'eventmachine'
34
+ require "socksify"
32
35
 
33
36
  ### Iniquity Terminal Utility
34
37
 
@@ -45,3 +48,47 @@ if File.exists?(SYSTEM + "/iniquity.ini")
45
48
  else
46
49
  abort "iqterm - An Iniquity system must have an iniquity.ini file.\n\n"
47
50
  end
51
+
52
+ class BBSTerm < EM::Connection
53
+
54
+ def post_init
55
+ @initialization = true
56
+ init_buffer
57
+ end
58
+
59
+ def init_buffer
60
+ @read_buffer = ""
61
+ end
62
+
63
+ def receive_data(data)
64
+ @read_buffer += data.force_encoding(Encoding::IBM437).encode(Encoding::UTF_8)
65
+
66
+ if @initialization and @read_buffer =~ /\e\[6n/
67
+ @initialization = false
68
+ send_data "\e[6n\r\n"
69
+ end
70
+
71
+ @read_buffer.gsub!(/\r\n/, "\n")
72
+ print @read_buffer
73
+
74
+ init_buffer
75
+ end
76
+ end
77
+
78
+ class STDINReader < EM::Connection
79
+
80
+ def initialize(em)
81
+ @em = em
82
+ end
83
+
84
+ def receive_data(data)
85
+ my_data = data.force_encoding(Encoding::UTF_8).encode(Encoding::IBM437)
86
+ my_data.gsub!(/\n/, "\r\n")
87
+ EM.next_tick { @em.send_data(my_data) }
88
+ end
89
+ end
90
+
91
+ EM.run do
92
+ obj = EM.connect(ARGV[0] || "localhost", ARGV[1] || 3023, BBSTerm)
93
+ EM.attach($stdin, STDINReader, obj)
94
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iniquity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Stephenson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-19 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: sqlite3
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
195
209
  description: A re-imagining of the iconic BBS software.
196
210
  email: ispyhumanfly@gmail.com
197
211
  executables: