ezbash 1.0.0 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/ezbash +79 -97
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0fcb1dd0b5b65a9c3362c7177e387f72ac39c9b8
4
- data.tar.gz: bdf5f3e7c09ac24fe3d518ec36aa37522111d036
3
+ metadata.gz: 8bfd9afcacdec744c35523ada7f90e819d2909df
4
+ data.tar.gz: 9160f7431c931c15860a6baafe7b2262c30fad8e
5
5
  SHA512:
6
- metadata.gz: 6ac0fbfff8510df266286c2de7ce5b7e1f705cfdde4d43f9242c4f7973fe5fc458bbccc5a06c2872a64c9668a408d1f7fef494aca9cc664fcd7609550cf4720f
7
- data.tar.gz: d6041f01fd15a41c42d8108efc34621cbd7ce59ac068f583c575f7a76df58fd9664ac05ee66d7be7bdecfd65ed84246c72730868277561ec78cb2a78c5c6aa17
6
+ metadata.gz: 1ef090f8dfdc5b1422675d4e1affaee378e68afe4e2bc0c6f52b4153e44db99a2f2e06d7d2dcc3fc7272e352b922dbb910c30067602e691043ebd11c3ee848cc
7
+ data.tar.gz: a9cd6a50932040f7681e77d9c486255afa91fa5783f3641f721fe72870ccf282a700d26fec651dee0a12f28fb70257f17dd8f28878f73c08751dd32fa71ad370
data/bin/ezbash CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
- require "pretty_table"
2
+ require 'pretty_table'
3
3
 
4
4
  #Define methods
5
- def addbrew()
5
+ def addBrew()
6
6
  if `which brew` == ''
7
7
  puts 'You appear to be running MacOS without Homebrew installed.'
8
8
  puts "If you don\'t know what Homebrew is, visit 'brew.sh', if you do and would like to install it, type 'yes'. >> "
9
- userreply = gets.chomp
10
- userreply.downcase!
11
- until userselect == true
12
- if userreply == 'yes'
9
+ userReply = gets.chomp
10
+ userReply.downcase!
11
+ until userSelect == true
12
+ if userReply == 'yes'
13
13
  Kernel.system "ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'"
14
- userselect = true
15
- elsif userreply == 'no'
14
+ userSelect = true
15
+ elsif userReply == 'no'
16
16
  puts "That\'s fine! Just keep in mind, the install, uninstall, and search commands won\'t work for you."
17
- userselect = true
17
+ userSelect = true
18
18
  else
19
19
  puts 'Please say yes or no.'
20
20
  end
@@ -22,82 +22,82 @@ def addbrew()
22
22
  end
23
23
  end
24
24
 
25
- def installdeb(package)
25
+ def installDeb(package)
26
26
  Kernel.system "sudo apt-get install #{package}"
27
27
  puts "\r"
28
28
  puts "I ran: 'sudo apt-get install #{package}'"
29
29
  end
30
- def installrpm(package)
30
+ def installRpm(package)
31
31
  Kernel.system "sudo yum install #{package}"
32
32
  puts "\r"
33
33
  puts "I ran: 'sudo yum install #{package}'"
34
34
  end
35
- def installpac(package)
35
+ def installPac(package)
36
36
  Kernel.system "sudo pacman -S #{package}"
37
37
  puts "\r"
38
38
  puts "I ran: 'sudo pacman -S #{package}'"
39
39
  puts 'Shouldn\'t you know how to use pacman if you\'re using Arch? Just kidding.'
40
40
  end
41
- def installhb(package)
41
+ def installHb(package)
42
42
  Kernel.system "brew install #{package}"
43
43
  puts "\r"
44
44
  puts "I ran: 'brew install #{package}'"
45
45
  end
46
- def uninstalldeb(package)
46
+ def uninstallDeb(package)
47
47
  Kernel.system "sudo apt-get remove #{package}"
48
48
  puts "\r"
49
49
  puts "I ran: 'sudo apt-get remove #{package}'"
50
50
  end
51
- def uninstallrpm(package)
51
+ def uninstallRpm(package)
52
52
  Kernel.system "sudo yum uninstall #{package}"
53
53
  puts "\r"
54
54
  puts "I ran: 'sudo yum uninstall #{package}'"
55
55
  end
56
- def uninstallpac(package)
56
+ def uninstallPac(package)
57
57
  Kernel.system "sudo pacman -R #{package}"
58
58
  puts "\r"
59
59
  puts "I ran: 'sudo pacman -R #{package}'"
60
60
  puts 'Shouldn\'t you know how to use pacman if you\'re using Arch? Just kidding.'
61
61
  end
62
- def uninstallhb(package)
62
+ def uninstallHb(package)
63
63
  Kernel.system "brew uninstall #{package}"
64
64
  puts "\r"
65
65
  puts "I ran: 'brew uninstall #{package}'"
66
66
  end
67
- def searchdeb(package)
67
+ def searchDeb(package)
68
68
  Kernel.system "apt-cache search #{package}"
69
69
  puts "\r"
70
70
  puts "I ran: 'apt-cache search #{package}'"
71
71
  end
72
- def searchrpm(package)
72
+ def searchRpm(package)
73
73
  Kernel.system "yum search #{package}"
74
74
  puts "\r"
75
75
  puts "I ran: 'yum search #{package}'"
76
76
  end
77
- def searchpac(package)
77
+ def searchPac(package)
78
78
  Kernel.system "pacman -Ss #{package}"
79
79
  puts "\r"
80
80
  puts "I ran: 'pacman -Ss #{package}'"
81
81
  puts 'Shouldn\'t you know how to use pacman if you\'re using Arch? Just kidding.'
82
82
  end
83
- def searchhb(package)
83
+ def searchHb(package)
84
84
  Kernel.system "brew search #{package}"
85
85
  puts "\r"
86
86
  puts "I ran: 'brew search #{package}'"
87
87
  end
88
88
 
89
89
  #Detect OS
90
- osraw = `uname -a`
91
- osraw.downcase!
92
- oslin = osraw.split(' ')[5]
93
- osdar = osraw.split(' ')[3]
94
- if osdar == 'darwin' then addbrew() end
90
+ osRaw = `uname -a`
91
+ osRaw.downcase!
92
+ osLin = osRaw.split(' ')[5]
93
+ osDar = osRaw.split(' ')[3]
94
+ if osDar == 'darwin' then addBrew() end
95
95
 
96
96
  #Start Program
97
97
  puts ' '
98
98
  runOnce = false
99
- exitis = 0
100
- while exitis == 0 do
99
+ exitIs = 0
100
+ while exitIs == 0 do
101
101
  if runOnce == true then puts "\r" end
102
102
  print "Type 'help' to list possible commands. >> "
103
103
  userCommand = gets.chomp
@@ -109,24 +109,24 @@ while exitis == 0 do
109
109
  print 'Please enter the name of the program you\'d like to install. >> '
110
110
  package = gets.chomp
111
111
  package.downcase!
112
- case oslin
112
+ case osLin
113
113
  when 'ubuntu'
114
- installdeb(package)
114
+ installDeb(package)
115
115
  when 'debian'
116
- installdeb(package)
116
+ installDeb(package)
117
117
  when 'linux mint'
118
- installdeb(package)
118
+ installDeb(package)
119
119
  when 'redhat'
120
- installrpm(package)
120
+ installRpm(package)
121
121
  when 'fedora'
122
- installrpm(package)
122
+ installRpm(package)
123
123
  when 'open suse'
124
- installrpm(package)
124
+ installRpm(package)
125
125
  when 'arch'
126
- installpac(package)
126
+ installPac(package)
127
127
  else
128
- if osdar == 'darwin'
129
- installhb(package)
128
+ if osDar == 'darwin'
129
+ installHb(package)
130
130
  else
131
131
  print "\r"
132
132
  puts 'Sorry, I didn\'t recognize you\'re operating system.'
@@ -137,24 +137,24 @@ while exitis == 0 do
137
137
  print 'Please enter the name of the program you\'d like to remove. >> '
138
138
  package = gets.chomp
139
139
  package.downcase
140
- case oslin
141
- when 'ubuntu'
142
- uninstalldeb(package)
140
+ case osLin
141
+ when 'ubuntu'
142
+ uninstallDeb(package)
143
143
  when 'debian'
144
- uninstalldeb(package)
144
+ uninstallDeb(package)
145
145
  when 'linux mint'
146
- uninstalldeb(package)
146
+ uninstallDeb(package)
147
147
  when 'redhat'
148
- uninstallrpm(package)
148
+ uninstallRpm(package)
149
149
  when 'fedora'
150
- uninstallrpm(package)
150
+ uninstallRpm(package)
151
151
  when 'open suse'
152
- uninstallrpm(package)
152
+ uninstallRpm(package)
153
153
  when 'arch'
154
- uninstallpac(package)
154
+ uninstallPac(package)
155
155
  else
156
- if osdar == 'darwin'
157
- uninstallhb(package)
156
+ if osDar == 'darwin'
157
+ uninstallHb(package)
158
158
  else
159
159
  print "\r"
160
160
  puts 'Sorry, I didn\'t recognize you\'re operating system.'
@@ -165,24 +165,24 @@ while exitis == 0 do
165
165
  print 'Please enter the name of the program you\'d like to search for. >> '
166
166
  package = gets.chomp
167
167
  package.downcase!
168
- case oslin
168
+ case osLin
169
169
  when 'ubuntu'
170
- searchdeb(package)
170
+ searchDeb(package)
171
171
  when 'debian'
172
- searchdeb(package)
172
+ searchDeb(package)
173
173
  when 'linux mint'
174
- searchdeb(package)
174
+ searchDeb(package)
175
175
  when 'redhat'
176
- searchrpm(package)
176
+ searchRpm(package)
177
177
  when 'fedora'
178
- searchrpm(package)
178
+ searchRpm(package)
179
179
  when 'open suse'
180
- searchrpm(package)
180
+ searchRpm(package)
181
181
  when 'arch'
182
- searchpac(package)
182
+ searchPac(package)
183
183
  else
184
- if osdar == 'darwin'
185
- searchhb(package)
184
+ if osDar == 'darwin'
185
+ searchHb(package)
186
186
  else
187
187
  print "\r"
188
188
  puts 'Sorry, I didn\'t recognize you\'re operating system.'
@@ -192,23 +192,23 @@ while exitis == 0 do
192
192
  #File/folder manipulation
193
193
  when 'copy'
194
194
  print 'Please enter the path to the file (e.g. Downloads/report.doc) >> '
195
- cpfile = gets.chomp
195
+ cpFile = gets.chomp
196
196
  puts ' '
197
197
  print 'Please enter the destination inclduding the name of the file (e.g. Documents/report.doc) >> '
198
- cpdest = gets.chomp
199
- Kernel.system "cp -avr #{cpfile} #{cpdest}"
198
+ cpDest = gets.chomp
199
+ Kernel.system "cp -avr #{cpFile} #{cpDest}"
200
200
  puts "\r"
201
- puts "I ran: 'cp #{cpfile} #{cpdest}'"
201
+ puts "I ran: 'cp #{cpFile} #{cpDest}'"
202
202
  runOnce = true
203
203
  when 'rename'
204
204
  print 'Please enter the path to the file (e.g. Documents/report.doc). >> '
205
- cpfile = gets.chomp
205
+ cpFile = gets.chomp
206
206
  puts ' '
207
207
  print 'Please enter the new name inclduding the destination you used earlier (e.g. Documents/Essay.doc). >> '
208
- cpdest = gets.chomp
209
- Kernel.system "cp #{cpfile} #{cpdest}"
208
+ cpDest = gets.chomp
209
+ Kernel.system "cp #{cpFile} #{cpDest}"
210
210
  puts "\r"
211
- puts "I ran: 'cp #{cpfile} #{cpdest}'"
211
+ puts "I ran: 'cp #{cpFile} #{cpDest}'"
212
212
  runOnce = true
213
213
  when 'delete file'
214
214
  print 'Please enter the name of the file you\'d like to remove along with its directory (e.g. Documents/sensitive.doc). >> '
@@ -224,6 +224,13 @@ while exitis == 0 do
224
224
  puts "\r"
225
225
  puts "I ran: 'rm -R -i #{folder}'"
226
226
  runOnce = true
227
+ when 'list files'
228
+ print 'Please enter the name of the folder you\'d like to observe (e.g. Awesome_Files/Pictures). >> '
229
+ folder = gets.chomp
230
+ Kernel.system "ls #{folder}"
231
+ puts "\r"
232
+ puts "I ran: 'ls #{folder}'"
233
+ runOnce = true
227
234
  when 'create file'
228
235
  print 'Please name your new file along with its directory (e.g. Documents/newfile.doc). >> '
229
236
  file = gets.chomp
@@ -231,41 +238,18 @@ while exitis == 0 do
231
238
  puts "\r"
232
239
  puts "I ran: 'touch #{file}'"
233
240
  runOnce = true
234
- #The folowing code is broken for now. Disregard it.
235
- =begin when 'change working folder'
236
- print 'Please enter the name of the folder you like to switch to (e.g. Documents/Folder). >> '
237
- folder = gets.chomp
238
- Kernel.system "cd #{folder}"
239
- puts "I ran: 'cd #{file}'"
240
-
241
- when 'list files'
242
- print 'Please enter the folder you\'d like to list files in (e.g. Documents). >> '
243
- folder = gets.chomp
244
- Kernel.system "ls #{folder} --color=auto"
245
- puts "\r"
246
- puts "I ran: 'ls #{folder}'"
247
- =end
248
-
249
- #The following code is broken for now. Disregard it.
250
- =begin
251
- when 'edit file'
252
- print 'Please enter the name and location of the file you\'d like to edit (e.g. Documents/report.doc). >> '
253
- file = gets.chomp
254
- Kernel.system "nano #{file}"
255
- puts "\r"
256
241
  puts "I ran: 'nano #{file}'"
257
- =end
258
242
  when "compile"
259
- print 'Please enter the location of the c++ code you\'d like to compile (e.g. Projects/helloworld.cpp). '
243
+ print 'Please enter the location of the c++ code you\'d like to compile (e.g. Projects/helloworld.cpp). >> '
260
244
  code = gets.chomp
261
- print 'Please enter the name you\'d like to give your compiled program. '
245
+ print 'Please enter the name you\'d like to give your compiled program. >> '
262
246
  name = gets.chomp
263
247
  Kernel.system "g++ -o #{name} #{code}"
264
248
  puts "I ran: 'g++ -o #{name} #{code}'."
265
249
  when "run c++ program"
266
- print 'Please enter the folder your program is contained in (e.g. Documents, Projects/myfantsticproject, etc.). '
250
+ print 'Please enter the folder your program is contained in (e.g. Documents, Projects/myfantsticproject, etc.). >> '
267
251
  folder = gets.chomp
268
- print 'Please enter the name of your compiled program (e.g. helloworld, test, etc.). '
252
+ print 'Please enter the name of your compiled program (e.g. helloworld, test, etc.). >> '
269
253
  program = gets.chomp
270
254
  Kernel.system "#{folder}./#{program}"
271
255
  when 'help'
@@ -283,9 +267,7 @@ while exitis == 0 do
283
267
  ["list files", "list all of the files in a given folder (e.g. Downloads)"],
284
268
  ["compile", "compiles a c++ file (e.g. foo.cpp)"],
285
269
  ["run c++ program", "runs a c++ program compiled with the aforementioned command"],
286
- ["exit", "exits ezbash"] ]
287
- # puts "\t edit file: edits a text file in a bare-bones, quick editor (.rb, .html, .java, etc. count as text files)"
288
- # puts "\r"
270
+ ["exit", "exits ezbash"]]
289
271
  puts PrettyTable.new(commands, headers).to_s
290
272
  puts "\r"
291
273
  when 'exit'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ezbash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Saunders