aka2 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/changelog.md +6 -0
- data/lib/aka.rb +242 -199
- data/lib/aka/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23306527f5f14dff1376ec38781c574c1bc087f6
|
4
|
+
data.tar.gz: 9e17ad0b8def61e51a0f22aea50c8588453011cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5ecc7170e2431375731d8a9fe0b6a5bfd616da4e00cbff7e9943c8041d940c2b6284ec9ee98d2ff3cbaaafac16e92d1f5a6c39754243e5ac364b756f1772e76
|
7
|
+
data.tar.gz: 1e748466b93b74facfa5236bcaa297988e6d526cde128b860a82157fa1dfe6800be507a06bcf187fae4cc3f37ec9977ad2bb8d5493de058560f814496de82e42
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/changelog.md
CHANGED
data/lib/aka.rb
CHANGED
@@ -23,35 +23,50 @@ module Aka
|
|
23
23
|
"h" => "help"
|
24
24
|
|
25
25
|
#
|
26
|
-
#
|
27
|
-
# aka
|
28
|
-
desc "
|
26
|
+
# Where is your dotfile
|
27
|
+
# aka where
|
28
|
+
desc "where", "locate your dotfile"
|
29
|
+
def where
|
30
|
+
puts readYML("#{Dir.home}/.aka/.config")["dotfile"]
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# UPLOAD
|
35
|
+
#
|
36
|
+
#aka upload --from ~/Desktop/TwitterAPI.rb --login admin@162.243.249.154:22000 --to /home/admin
|
37
|
+
desc "upload", "upload a dot file"
|
29
38
|
method_options :from => :string
|
30
39
|
method_options :to => :string
|
31
40
|
method_options :login => :string
|
32
|
-
def
|
41
|
+
def upload
|
33
42
|
if options.from and options.to and options.login
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
password = get_password()
|
44
|
+
|
45
|
+
if File.exists?(options.from)
|
46
|
+
success = true
|
47
|
+
begin
|
48
|
+
arr = split(options.login)
|
49
|
+
result = Net::SCP.upload!(arr[1], #remote
|
50
|
+
arr.first, #username
|
51
|
+
options.from, #local_path
|
52
|
+
options.to, #remote_path
|
53
|
+
:ssh => {:port => arr[2],
|
54
|
+
:password => password})
|
55
|
+
rescue Exception => e
|
56
|
+
puts "\n#{e}"
|
57
|
+
success = false
|
58
|
+
end
|
59
|
+
|
60
|
+
puts "\nDone." if success
|
61
|
+
else
|
62
|
+
puts "Cannot find #{options.from}"
|
47
63
|
end
|
48
|
-
puts "\nDone." if success
|
49
64
|
else
|
50
|
-
puts "Some options are missing
|
51
|
-
puts "--
|
52
|
-
puts "--to
|
53
|
-
puts "--from
|
54
|
-
puts "aka
|
65
|
+
puts "Some options are missing:"
|
66
|
+
puts "--of -> #{options.of}"
|
67
|
+
puts "--to -> #{options.to}"
|
68
|
+
puts "--from -> #{options.from}"
|
69
|
+
puts "aka up --of some_string --to some_string --from some_string"
|
55
70
|
end
|
56
71
|
end
|
57
72
|
|
@@ -127,15 +142,6 @@ module Aka
|
|
127
142
|
end
|
128
143
|
end
|
129
144
|
|
130
|
-
#
|
131
|
-
# SETUP_old
|
132
|
-
#
|
133
|
-
# desc "setup_old", "setup aka"
|
134
|
-
# method_options :force => :boolean
|
135
|
-
# def setup_old
|
136
|
-
# setup_aka_old
|
137
|
-
# end
|
138
|
-
|
139
145
|
#
|
140
146
|
# first step: set config file
|
141
147
|
#
|
@@ -222,35 +228,24 @@ module Aka
|
|
222
228
|
end #if args
|
223
229
|
end
|
224
230
|
|
225
|
-
#
|
226
|
-
# LIST OUT
|
227
|
-
#
|
228
|
-
# desc "list_old", "list alias (short alias: l)"
|
229
|
-
# method_options :force => :boolean
|
230
|
-
# def list_old(args=nil)
|
231
|
-
# if args != nil
|
232
|
-
# showlast_old(args.to_i)
|
233
|
-
# else
|
234
|
-
# value = readYML("#{Dir.home}/.aka/.config")["list"]
|
235
|
-
# showlast_old(value.to_i) #this is unsafe
|
236
|
-
# end
|
237
|
-
#
|
238
|
-
# #total of #{} exports #functions
|
239
|
-
# puts "A total of #{count()} aliases,#{count_export} exports and #{count_function} functions from #{readYML("#{Dir.home}/.aka/.config")["dotfile"]}"
|
240
|
-
# reload_dot_file
|
241
|
-
# end
|
242
|
-
|
243
231
|
#
|
244
232
|
# LIST OUT - ryan - remove numbering
|
245
233
|
#
|
246
234
|
desc "list", "list alias (short alias: l)"
|
247
235
|
method_options :force => :boolean
|
236
|
+
method_options :number => :boolean
|
248
237
|
def list(args=nil)
|
249
238
|
if args != nil
|
250
|
-
showlast(args.to_i)
|
239
|
+
showlast(options.number,args.to_i) #user input
|
251
240
|
else
|
252
241
|
value = readYML("#{Dir.home}/.aka/.config")["list"]
|
253
|
-
|
242
|
+
puts value.class
|
243
|
+
if value.class == Fixnum
|
244
|
+
showlast(options.number,value.to_i)
|
245
|
+
else
|
246
|
+
puts "List value is not defined in #{Dir.home}/.aka/.config"
|
247
|
+
showlast(options.number,50)
|
248
|
+
end
|
254
249
|
end
|
255
250
|
|
256
251
|
#total of #{} exports #functions
|
@@ -259,34 +254,6 @@ module Aka
|
|
259
254
|
reload_dot_file
|
260
255
|
end
|
261
256
|
|
262
|
-
#
|
263
|
-
# USAGE
|
264
|
-
#
|
265
|
-
# desc "usage_old [number]", "show commands usage based on history"
|
266
|
-
# # method_options :least, :type => :boolean, :aliases => '-l', :desc => 'show the least used commands'
|
267
|
-
# # method_options :clear, :type => :boolean, :aliases => '-c', :desc => 'clear the dot history file'
|
268
|
-
# def usage_old(args=nil)
|
269
|
-
# if args
|
270
|
-
# if options.least
|
271
|
-
# showUsage(args.to_i, true) if args
|
272
|
-
# else
|
273
|
-
# showUsage(args.to_i) if args
|
274
|
-
# end
|
275
|
-
# else
|
276
|
-
# if options.least
|
277
|
-
# value = readYML("#{Dir.home}/.aka/.config")["usage"]
|
278
|
-
# showlast_old(value.to_i, true) #this is unsafe
|
279
|
-
# else
|
280
|
-
# value = readYML("#{Dir.home}/.aka/.config")["usage"]
|
281
|
-
# showlast_old(value.to_i) #this is unsafe
|
282
|
-
# end
|
283
|
-
# end
|
284
|
-
#
|
285
|
-
# if options[:clear]
|
286
|
-
# puts "clear the dot history file"
|
287
|
-
# end
|
288
|
-
# end
|
289
|
-
|
290
257
|
#
|
291
258
|
# USAGE - ryan - remove numbering in front
|
292
259
|
#
|
@@ -315,29 +282,6 @@ module Aka
|
|
315
282
|
end
|
316
283
|
end
|
317
284
|
|
318
|
-
|
319
|
-
#
|
320
|
-
# INSTALL
|
321
|
-
#
|
322
|
-
# desc "install [name]", "install aka"
|
323
|
-
# method_options :force => :boolean
|
324
|
-
# def install
|
325
|
-
# if File.exist? "#{Dir.pwd}/aka"
|
326
|
-
# if File.exist? "/usr/local/bin/aka"
|
327
|
-
# if yes? "aka exists. Do you want to replace it? (yN)"
|
328
|
-
# FileUtils.rm("/usr/local/bin/aka")
|
329
|
-
# system("ln -s #{Dir.pwd}/aka /usr/local/bin/aka")
|
330
|
-
# puts "aka replaced."
|
331
|
-
# end
|
332
|
-
# else
|
333
|
-
# result = system("ln -s #{Dir.pwd}/aka /usr/local/bin/aka")
|
334
|
-
# puts "aka installed."
|
335
|
-
# end
|
336
|
-
# else
|
337
|
-
# puts "Cannot find aka.".red
|
338
|
-
# end
|
339
|
-
# end
|
340
|
-
|
341
285
|
#
|
342
286
|
# INIT
|
343
287
|
#
|
@@ -511,7 +455,9 @@ module Aka
|
|
511
455
|
str = checkConfigFile(readYML("#{Dir.home}/.aka/.config")["dotfile"])
|
512
456
|
|
513
457
|
File.open(str, 'a') { |file| file.write("\n" +full_command) }
|
514
|
-
puts "#{print_out_command} is added to #{readYML("#{Dir.home}/.aka/.config")["dotfile"]}"
|
458
|
+
# puts "#{print_out_command} is added to #{readYML("#{Dir.home}/.aka/.config")["dotfile"]}"
|
459
|
+
puts "Created: ".green + "#{print_out_command}"
|
460
|
+
|
515
461
|
return true
|
516
462
|
else
|
517
463
|
puts "The alias is already present."
|
@@ -577,7 +523,10 @@ module Aka
|
|
577
523
|
if answer.first == input
|
578
524
|
content_array.delete_at(index) and write_with_newline(content_array)
|
579
525
|
print_out_command = "aka g #{input}=#{line.split("=")[1]}"
|
580
|
-
puts
|
526
|
+
# puts "removed: #{print_out_command} is removed from #{str}".red
|
527
|
+
|
528
|
+
puts "Removed: ".red + "#{print_out_command}"
|
529
|
+
|
581
530
|
return true
|
582
531
|
end
|
583
532
|
end
|
@@ -601,7 +550,9 @@ module Aka
|
|
601
550
|
content_array.each_with_index { |line, index|
|
602
551
|
if line == "source \"/home/ryan/.aka/autosource\""
|
603
552
|
content_array.delete_at(index) and write_with_newline(content_array)
|
604
|
-
puts "---> removed: source \"/home/ryan/.aka/autosource\""
|
553
|
+
# puts "---> removed: source \"/home/ryan/.aka/autosource\""
|
554
|
+
puts "Removed: ".red + "source \"/home/ryan/.aka/autosource\""
|
555
|
+
|
605
556
|
return true
|
606
557
|
end
|
607
558
|
}
|
@@ -723,41 +674,7 @@ module Aka
|
|
723
674
|
end
|
724
675
|
end
|
725
676
|
|
726
|
-
|
727
|
-
# def setup_aka_old
|
728
|
-
# append_with_newline("export HISTSIZE=10000","/etc/profile")
|
729
|
-
# trap = "sigusr2() { unalias $1;}
|
730
|
-
# sigusr1() { source #{readYML("#{Dir.home}/.aka/.config")["dotfile"]}; history -a; echo 'reloaded dot file'; }
|
731
|
-
# trap sigusr1 SIGUSR1
|
732
|
-
# trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
|
733
|
-
# append(trap, readYML("#{Dir.home}/.aka/.config")['profile'])
|
734
|
-
# puts "Done. Please restart this shell.".red
|
735
|
-
# end
|
736
|
-
#
|
737
|
-
# # setup_aka_old2 by ryan - check bash file first
|
738
|
-
# def setup_aka_old2
|
739
|
-
# if File.exist?("#{Dir.home}/.zshrc") #if zshec exist
|
740
|
-
# setZSHRC2
|
741
|
-
# append_with_newline("\nexport HISTSIZE=10000","#{Dir.home}/.zshrc")
|
742
|
-
# elsif
|
743
|
-
# File.exist?("#{Dir.home}/.bashrc") #if bashrc exist
|
744
|
-
# setBASHRC2
|
745
|
-
# append_with_newline("\nexport HISTSIZE=10000","#{Dir.home}/.bashrc")
|
746
|
-
# elsif File.exist?("#{Dir.home}/.bash_profile") #if bash_profile exist
|
747
|
-
# setBASH2
|
748
|
-
# append_with_newline("\nexport HISTSIZE=10000","#{Dir.home}/.bash_profile")
|
749
|
-
# else
|
750
|
-
# puts "Currently aka2 just support zshrc, bashrc and bash_profile"
|
751
|
-
# puts "Pleaes contact aka2 creator for more info."
|
752
|
-
# end
|
753
|
-
#
|
754
|
-
# trap = "sigusr2() { unalias $1;}
|
755
|
-
# sigusr1() { source #{readYML("#{Dir.home}/.aka/.config")["dotfile"]}; history -a; echo 'reloaded dot file'; }
|
756
|
-
# trap sigusr1 SIGUSR1
|
757
|
-
# trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
|
758
|
-
# append(trap, readYML("#{Dir.home}/.aka/.config")['profile'])
|
759
|
-
# puts "Done. Please restart this shell.".red
|
760
|
-
# end
|
677
|
+
|
761
678
|
|
762
679
|
# setup_aka by ryan - set value in config file
|
763
680
|
def setup_aka
|
@@ -943,7 +860,7 @@ module Aka
|
|
943
860
|
end
|
944
861
|
|
945
862
|
# show last2 - ryan - remove number
|
946
|
-
def showlast
|
863
|
+
def showlast(list_number=false,howmany=10)
|
947
864
|
str = checkConfigFile(readYML("#{Dir.home}/.aka/.config")["dotfile"])
|
948
865
|
|
949
866
|
if content = File.open(str).read
|
@@ -961,14 +878,22 @@ module Aka
|
|
961
878
|
if total_aliases.count > howmany
|
962
879
|
total_aliases.last(howmany).each_with_index do |line, index|
|
963
880
|
splitted= line.split('=')
|
964
|
-
|
881
|
+
if list_number
|
882
|
+
puts "#{total_aliases.count - howmany + index+1}. aka g " + splitted[0].split(" ")[1] + "=" + splitted[1].red
|
883
|
+
else
|
884
|
+
puts "aka g " + splitted[0].split(" ")[1] + "=" + splitted[1].red
|
885
|
+
end
|
965
886
|
# puts "#{total_aliases.count - howmany + index+1}. " + splitted[0] + "=" + splitted[1].red
|
966
887
|
end
|
967
888
|
else
|
968
889
|
total_aliases.last(howmany).each_with_index do |line, index|
|
969
890
|
splitted= line.split('=')
|
970
891
|
# puts "#{index+1}. " + splitted[0] + "=" + splitted[1].red
|
971
|
-
|
892
|
+
if list_number
|
893
|
+
puts "#{index+1}. aka g " + splitted[0].split(" ")[1] + "=" + splitted[1].red
|
894
|
+
else
|
895
|
+
puts "aka g " + splitted[0].split(" ")[1] + "=" + splitted[1].red
|
896
|
+
end
|
972
897
|
end
|
973
898
|
end
|
974
899
|
puts ""
|
@@ -1129,61 +1054,6 @@ module Aka
|
|
1129
1054
|
return result + " #{percent.round(2)}%"
|
1130
1055
|
end
|
1131
1056
|
|
1132
|
-
|
1133
|
-
# command :config do |c|
|
1134
|
-
# c.action do |args, options|
|
1135
|
-
# # theyml = Hash.new
|
1136
|
-
# # theyml["location"] = "~/.aka/.location"
|
1137
|
-
# # theyml["global"] = "/Users/ytbryan/.bash_profile"
|
1138
|
-
# # theyml["groups"] = "~/.aka/groups"
|
1139
|
-
# # theyml["remote"] = "255, admin, 12.12.12.233"
|
1140
|
-
# # theyml["path"] = "~/.aka"
|
1141
|
-
# # writeYML("#{Dir.home}/.aka/.config", theyml)
|
1142
|
-
# FileUtils.touch(readYML("#{Dir.home}/.aka/.config")["location"])
|
1143
|
-
# end
|
1144
|
-
# end
|
1145
|
-
#
|
1146
|
-
# command :readconfig do |c|
|
1147
|
-
# c.action do |args, options|
|
1148
|
-
# puts "readYML('#{Dir.home}/.aka/.config')['location'] ->#{readYML("#{Dir.home}/.aka/.config")["location"].class} -> #{readYML("#{Dir.home}/.aka/.config")["location"]}"
|
1149
|
-
# puts "readYML("#{Dir.home}/.aka/.config")["location"] -> #{ readYML("#{Dir.home}/.aka/.config")["location"].class} -> #{ readYML("#{Dir.home}/.aka/.config")["location"]}"
|
1150
|
-
# puts "#{program(:path_to_location).class} -> #{program(:path_to_location)}"
|
1151
|
-
# end
|
1152
|
-
# end
|
1153
|
-
#
|
1154
|
-
|
1155
|
-
###########################
|
1156
|
-
### DEVELOPMENT
|
1157
|
-
###########################
|
1158
|
-
|
1159
|
-
# command :build do |c|
|
1160
|
-
# c.syntax = 'aka build [options]'
|
1161
|
-
# c.summary = 'build the VERSION file and run tests'
|
1162
|
-
# c.action do |args, options|
|
1163
|
-
# write(program(:version), './VERSION')
|
1164
|
-
# puts "VERSION #{program(:version)} created at #{Time.now.strftime("%I:%M%p, %A, %d %b %Y")}"
|
1165
|
-
# end
|
1166
|
-
# end
|
1167
|
-
|
1168
|
-
# command :install do |c|
|
1169
|
-
# c.syntax = 'aka copy [options]'
|
1170
|
-
# c.summary = 'copy a local copy of aka to /usr/local/bin'
|
1171
|
-
# c.action do |args, options|
|
1172
|
-
# result = system("sudo cp aka /usr/local/bin")
|
1173
|
-
# puts "Installed aka #{program(:version)} into /usr/local/bin (#{Time.now.strftime("%I:%M%p,%a,%d %b %Y")}).".red if result == true
|
1174
|
-
# puts "" if result == true
|
1175
|
-
# end
|
1176
|
-
# end
|
1177
|
-
#
|
1178
|
-
# command :uninstall do |c|
|
1179
|
-
# c.syntax = 'aka uninstall [options]'
|
1180
|
-
# c.summary = 'uninstall aka'
|
1181
|
-
# c.action do |args, options|
|
1182
|
-
# input = ask "Confirm that you want to uninstall aka? (y/N)"
|
1183
|
-
# system("sudo rm -rf ~/.aka; sudo rm -rf /usr/local/bin/aka;") if input == "y"
|
1184
|
-
# end
|
1185
|
-
# end
|
1186
|
-
|
1187
1057
|
def add_to_proj fullalias
|
1188
1058
|
values = fullalias.split("=")
|
1189
1059
|
yml = readYML("#{Dir.pwd}/.aka")
|
@@ -1324,3 +1194,176 @@ class String
|
|
1324
1194
|
!!(self =~ /\A[-+]?[0-9]+\z/)
|
1325
1195
|
end
|
1326
1196
|
end
|
1197
|
+
|
1198
|
+
__END__
|
1199
|
+
|
1200
|
+
#
|
1201
|
+
# LIST OUT
|
1202
|
+
#
|
1203
|
+
# desc "list_old", "list alias (short alias: l)"
|
1204
|
+
# method_options :force => :boolean
|
1205
|
+
# def list_old(args=nil)
|
1206
|
+
# if args != nil
|
1207
|
+
# showlast_old(args.to_i)
|
1208
|
+
# else
|
1209
|
+
# value = readYML("#{Dir.home}/.aka/.config")["list"]
|
1210
|
+
# showlast_old(value.to_i) #this is unsafe
|
1211
|
+
# end
|
1212
|
+
#
|
1213
|
+
# #total of #{} exports #functions
|
1214
|
+
# puts "A total of #{count()} aliases,#{count_export} exports and #{count_function} functions from #{readYML("#{Dir.home}/.aka/.config")["dotfile"]}"
|
1215
|
+
# reload_dot_file
|
1216
|
+
# end
|
1217
|
+
|
1218
|
+
|
1219
|
+
|
1220
|
+
# command :config do |c|
|
1221
|
+
# c.action do |args, options|
|
1222
|
+
# # theyml = Hash.new
|
1223
|
+
# # theyml["location"] = "~/.aka/.location"
|
1224
|
+
# # theyml["global"] = "/Users/ytbryan/.bash_profile"
|
1225
|
+
# # theyml["groups"] = "~/.aka/groups"
|
1226
|
+
# # theyml["remote"] = "255, admin, 12.12.12.233"
|
1227
|
+
# # theyml["path"] = "~/.aka"
|
1228
|
+
# # writeYML("#{Dir.home}/.aka/.config", theyml)
|
1229
|
+
# FileUtils.touch(readYML("#{Dir.home}/.aka/.config")["location"])
|
1230
|
+
# end
|
1231
|
+
# end
|
1232
|
+
#
|
1233
|
+
# command :readconfig do |c|
|
1234
|
+
# c.action do |args, options|
|
1235
|
+
# puts "readYML('#{Dir.home}/.aka/.config')['location'] ->#{readYML("#{Dir.home}/.aka/.config")["location"].class} -> #{readYML("#{Dir.home}/.aka/.config")["location"]}"
|
1236
|
+
# puts "readYML("#{Dir.home}/.aka/.config")["location"] -> #{ readYML("#{Dir.home}/.aka/.config")["location"].class} -> #{ readYML("#{Dir.home}/.aka/.config")["location"]}"
|
1237
|
+
# puts "#{program(:path_to_location).class} -> #{program(:path_to_location)}"
|
1238
|
+
# end
|
1239
|
+
# end
|
1240
|
+
#
|
1241
|
+
|
1242
|
+
###########################
|
1243
|
+
### DEVELOPMENT
|
1244
|
+
###########################
|
1245
|
+
|
1246
|
+
# command :build do |c|
|
1247
|
+
# c.syntax = 'aka build [options]'
|
1248
|
+
# c.summary = 'build the VERSION file and run tests'
|
1249
|
+
# c.action do |args, options|
|
1250
|
+
# write(program(:version), './VERSION')
|
1251
|
+
# puts "VERSION #{program(:version)} created at #{Time.now.strftime("%I:%M%p, %A, %d %b %Y")}"
|
1252
|
+
# end
|
1253
|
+
# end
|
1254
|
+
|
1255
|
+
# command :install do |c|
|
1256
|
+
# c.syntax = 'aka copy [options]'
|
1257
|
+
# c.summary = 'copy a local copy of aka to /usr/local/bin'
|
1258
|
+
# c.action do |args, options|
|
1259
|
+
# result = system("sudo cp aka /usr/local/bin")
|
1260
|
+
# puts "Installed aka #{program(:version)} into /usr/local/bin (#{Time.now.strftime("%I:%M%p,%a,%d %b %Y")}).".red if result == true
|
1261
|
+
# puts "" if result == true
|
1262
|
+
# end
|
1263
|
+
# end
|
1264
|
+
#
|
1265
|
+
# command :uninstall do |c|
|
1266
|
+
# c.syntax = 'aka uninstall [options]'
|
1267
|
+
# c.summary = 'uninstall aka'
|
1268
|
+
# c.action do |args, options|
|
1269
|
+
# input = ask "Confirm that you want to uninstall aka? (y/N)"
|
1270
|
+
# system("sudo rm -rf ~/.aka; sudo rm -rf /usr/local/bin/aka;") if input == "y"
|
1271
|
+
# end
|
1272
|
+
# end
|
1273
|
+
|
1274
|
+
#
|
1275
|
+
# SETUP_old
|
1276
|
+
#
|
1277
|
+
# desc "setup_old", "setup aka"
|
1278
|
+
# method_options :force => :boolean
|
1279
|
+
# def setup_old
|
1280
|
+
# setup_aka_old
|
1281
|
+
# end
|
1282
|
+
|
1283
|
+
#
|
1284
|
+
# USAGE
|
1285
|
+
#
|
1286
|
+
# desc "usage_old [number]", "show commands usage based on history"
|
1287
|
+
# # method_options :least, :type => :boolean, :aliases => '-l', :desc => 'show the least used commands'
|
1288
|
+
# # method_options :clear, :type => :boolean, :aliases => '-c', :desc => 'clear the dot history file'
|
1289
|
+
# def usage_old(args=nil)
|
1290
|
+
# if args
|
1291
|
+
# if options.least
|
1292
|
+
# showUsage(args.to_i, true) if args
|
1293
|
+
# else
|
1294
|
+
# showUsage(args.to_i) if args
|
1295
|
+
# end
|
1296
|
+
# else
|
1297
|
+
# if options.least
|
1298
|
+
# value = readYML("#{Dir.home}/.aka/.config")["usage"]
|
1299
|
+
# showlast_old(value.to_i, true) #this is unsafe
|
1300
|
+
# else
|
1301
|
+
# value = readYML("#{Dir.home}/.aka/.config")["usage"]
|
1302
|
+
# showlast_old(value.to_i) #this is unsafe
|
1303
|
+
# end
|
1304
|
+
# end
|
1305
|
+
#
|
1306
|
+
# if options[:clear]
|
1307
|
+
# puts "clear the dot history file"
|
1308
|
+
# end
|
1309
|
+
# end
|
1310
|
+
|
1311
|
+
|
1312
|
+
#
|
1313
|
+
# INSTALL
|
1314
|
+
#
|
1315
|
+
# desc "install [name]", "install aka"
|
1316
|
+
# method_options :force => :boolean
|
1317
|
+
# def install
|
1318
|
+
# if File.exist? "#{Dir.pwd}/aka"
|
1319
|
+
# if File.exist? "/usr/local/bin/aka"
|
1320
|
+
# if yes? "aka exists. Do you want to replace it? (yN)"
|
1321
|
+
# FileUtils.rm("/usr/local/bin/aka")
|
1322
|
+
# system("ln -s #{Dir.pwd}/aka /usr/local/bin/aka")
|
1323
|
+
# puts "aka replaced."
|
1324
|
+
# end
|
1325
|
+
# else
|
1326
|
+
# result = system("ln -s #{Dir.pwd}/aka /usr/local/bin/aka")
|
1327
|
+
# puts "aka installed."
|
1328
|
+
# end
|
1329
|
+
# else
|
1330
|
+
# puts "Cannot find aka.".red
|
1331
|
+
# end
|
1332
|
+
# end
|
1333
|
+
|
1334
|
+
|
1335
|
+
# setup_aka_old
|
1336
|
+
# def setup_aka_old
|
1337
|
+
# append_with_newline("export HISTSIZE=10000","/etc/profile")
|
1338
|
+
# trap = "sigusr2() { unalias $1;}
|
1339
|
+
# sigusr1() { source #{readYML("#{Dir.home}/.aka/.config")["dotfile"]}; history -a; echo 'reloaded dot file'; }
|
1340
|
+
# trap sigusr1 SIGUSR1
|
1341
|
+
# trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
|
1342
|
+
# append(trap, readYML("#{Dir.home}/.aka/.config")['profile'])
|
1343
|
+
# puts "Done. Please restart this shell.".red
|
1344
|
+
# end
|
1345
|
+
#
|
1346
|
+
# # setup_aka_old2 by ryan - check bash file first
|
1347
|
+
# def setup_aka_old2
|
1348
|
+
# if File.exist?("#{Dir.home}/.zshrc") #if zshec exist
|
1349
|
+
# setZSHRC2
|
1350
|
+
# append_with_newline("\nexport HISTSIZE=10000","#{Dir.home}/.zshrc")
|
1351
|
+
# elsif
|
1352
|
+
# File.exist?("#{Dir.home}/.bashrc") #if bashrc exist
|
1353
|
+
# setBASHRC2
|
1354
|
+
# append_with_newline("\nexport HISTSIZE=10000","#{Dir.home}/.bashrc")
|
1355
|
+
# elsif File.exist?("#{Dir.home}/.bash_profile") #if bash_profile exist
|
1356
|
+
# setBASH2
|
1357
|
+
# append_with_newline("\nexport HISTSIZE=10000","#{Dir.home}/.bash_profile")
|
1358
|
+
# else
|
1359
|
+
# puts "Currently aka2 just support zshrc, bashrc and bash_profile"
|
1360
|
+
# puts "Pleaes contact aka2 creator for more info."
|
1361
|
+
# end
|
1362
|
+
#
|
1363
|
+
# trap = "sigusr2() { unalias $1;}
|
1364
|
+
# sigusr1() { source #{readYML("#{Dir.home}/.aka/.config")["dotfile"]}; history -a; echo 'reloaded dot file'; }
|
1365
|
+
# trap sigusr1 SIGUSR1
|
1366
|
+
# trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
|
1367
|
+
# append(trap, readYML("#{Dir.home}/.aka/.config")['profile'])
|
1368
|
+
# puts "Done. Please restart this shell.".red
|
1369
|
+
# end
|
data/lib/aka/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aka2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Lim
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-08-
|
12
|
+
date: 2015-08-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-scp
|