aka2 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5979f6f83b36d5295da781063dd5e4a9b8bf7859
4
- data.tar.gz: 9f602556ff2756f6044ddf737f2d1ef457337d94
3
+ metadata.gz: 786de0de3b83d830707958649eefe21a15ea2170
4
+ data.tar.gz: b96dee6dba6635ce7246a7df16a79527f2f377b0
5
5
  SHA512:
6
- metadata.gz: 5e471b8793ae2f78e6082523bd6b5ca3d96dd4d1baddd036bdac22a699230c1c5194f07f7c78a63df849b69f85f5c54b74a95759694077262f5be1e1d2f174c3
7
- data.tar.gz: 897ca354a6d39bf01173372295e4fb60511a82ea0f78e037d327b01cfbbe14b65ce700d8147a26be2ce09c6d17b6c7524ebecfa18f420c013ca7e8dd49149f48
6
+ metadata.gz: 227a648cf372eaf4f8cc5c8318538883f150572212caf46484605bfc6b673972eb9ae6b02357aa904da18fc15d395aa45e40d241bb7503ab59075246fa804bf9
7
+ data.tar.gz: 99cfb490b8e746df54e169ca41b508182ce3c4abe3407b4eba43fb0fde0215c104f3445b4feebb4ebaca52e47161903336da7619274dd22ebac4397cb5c8c1ea
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aka2 (0.1.2)
4
+ aka2 (0.1.4)
5
5
  colorize (~> 0)
6
6
  net-scp (~> 1.2, >= 1.2.1)
7
7
  safe_yaml (~> 1.0, >= 1.0.4)
data/README.md CHANGED
@@ -7,8 +7,12 @@ aka2 requires ruby and is built for bash and zsh users.
7
7
  ## Installation
8
8
 
9
9
  $ gem install aka2
10
- $ aka setup2
10
+ $ aka setup
11
11
 
12
+ If you wish to reinstall aka setup
13
+
14
+ $ aka setup --reset
15
+
12
16
  ## Usage
13
17
 
14
18
  $ aka generate hello="echo helloworld"
data/changelog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.1.4
2
+
3
+ * Rename method names
4
+ * Add reset function for user to re-setup aka
5
+
1
6
  ## v0.1.3
2
7
 
3
8
  * Fix setup_aka3 bug for bashrc user
data/lib/aka.rb CHANGED
@@ -130,27 +130,32 @@ module Aka
130
130
  #
131
131
  # SETUP
132
132
  #
133
- desc "setup", "setup aka"
133
+ desc "setup_old", "setup aka"
134
134
  method_options :force => :boolean
135
- def setup
136
- setup_aka
135
+ def setup_old
136
+ setup_aka_old
137
137
  end
138
138
 
139
139
  #
140
140
  # first step: set config file
141
141
  #
142
- desc "setup2", "Gem - Setup aka"
143
- method_options :force => :boolean
144
- def setup2
142
+ desc "setup", "Gem - Setup aka"
143
+ method_options :reset => :boolean
144
+ def setup
145
145
  configDir = "#{Dir.home}/.aka"
146
+ if options.reset? && File.exist?("#{configDir}")
147
+ FileUtils.rm_r("#{configDir}")
148
+ puts "#{configDir} is removed"
149
+ end
150
+
146
151
  if File.exist?("#{configDir}/.config")
147
- # list
148
- puts "config file is exist in #{configDir}"
152
+ puts ".aka config file is exist in #{configDir}"
153
+ puts "Please run [aka setup --reset] to remove aka file and setup again"
149
154
  else
150
- setup_config #create and setup .config file
151
- # setup_aka2 #setup aka
152
- setup_aka3 #put value in .config file
153
- setup_autosource # create, link source file
155
+ setup_config # create and setup .config file
156
+ setup_aka # put value in .config file
157
+ setup_autosource # create, link source file
158
+ puts "Congratulation, aka is setup in #{configDir}"
154
159
  end
155
160
  end
156
161
 
@@ -217,14 +222,14 @@ module Aka
217
222
  #
218
223
  # LIST OUT
219
224
  #
220
- desc "list", "list alias (short alias: l)"
225
+ desc "list_old", "list alias (short alias: l)"
221
226
  method_options :force => :boolean
222
- def list(args=nil)
227
+ def list_old(args=nil)
223
228
  if args != nil
224
- showlast(args.to_i)
229
+ showlast_old(args.to_i)
225
230
  else
226
231
  value = readYML("#{Dir.home}/.aka/.config")["list"]
227
- showlast(value.to_i) #this is unsafe
232
+ showlast_old(value.to_i) #this is unsafe
228
233
  end
229
234
 
230
235
  #total of #{} exports #functions
@@ -235,14 +240,14 @@ module Aka
235
240
  #
236
241
  # LIST OUT - ryan - remove numbering
237
242
  #
238
- desc "list2", "list alias (short alias: l)"
243
+ desc "list", "list alias (short alias: l)"
239
244
  method_options :force => :boolean
240
- def list2(args=nil)
245
+ def list(args=nil)
241
246
  if args != nil
242
- showlast2(args.to_i)
247
+ showlast(args.to_i)
243
248
  else
244
249
  value = readYML("#{Dir.home}/.aka/.config")["list"]
245
- showlast2(value.to_i) #this is unsafe
250
+ showlast(value.to_i) #this is unsafe
246
251
  end
247
252
 
248
253
  #total of #{} exports #functions
@@ -254,10 +259,10 @@ module Aka
254
259
  #
255
260
  # USAGE
256
261
  #
257
- desc "usage [number]", "show commands usage based on history"
262
+ desc "usage_old [number]", "show commands usage based on history"
258
263
  # method_options :least, :type => :boolean, :aliases => '-l', :desc => 'show the least used commands'
259
264
  # method_options :clear, :type => :boolean, :aliases => '-c', :desc => 'clear the dot history file'
260
- def usage(args=nil)
265
+ def usage_old(args=nil)
261
266
  if args
262
267
  if options.least
263
268
  showUsage(args.to_i, true) if args
@@ -267,10 +272,10 @@ module Aka
267
272
  else
268
273
  if options.least
269
274
  value = readYML("#{Dir.home}/.aka/.config")["usage"]
270
- showlast(value.to_i, true) #this is unsafe
275
+ showlast_old(value.to_i, true) #this is unsafe
271
276
  else
272
277
  value = readYML("#{Dir.home}/.aka/.config")["usage"]
273
- showlast(value.to_i) #this is unsafe
278
+ showlast_old(value.to_i) #this is unsafe
274
279
  end
275
280
  end
276
281
 
@@ -280,12 +285,12 @@ module Aka
280
285
  end
281
286
 
282
287
  #
283
- # USAGE2 - ryan - remove numbering in front
288
+ # USAGE - ryan - remove numbering in front
284
289
  #
285
- desc "usage2 [number]", "show commands usage based on history"
290
+ desc "usage [number]", "show commands usage based on history"
286
291
  # method_options :least, :type => :boolean, :aliases => '-l', :desc => 'show the least used commands'
287
292
  # method_options :clear, :type => :boolean, :aliases => '-c', :desc => 'clear the dot history file'
288
- def usage2(args=nil)
293
+ def usage(args=nil)
289
294
  if args
290
295
  if options.least
291
296
  showUsage(args.to_i, true) if args
@@ -295,10 +300,10 @@ module Aka
295
300
  else
296
301
  if options.least
297
302
  value = readYML("#{Dir.home}/.aka/.config")["usage"]
298
- showlast2(value.to_i, true) #this is unsafe
303
+ showlast(value.to_i, true) #this is unsafe
299
304
  else
300
305
  value = readYML("#{Dir.home}/.aka/.config")["usage"]
301
- showlast2(value.to_i) #this is unsafe
306
+ showlast(value.to_i) #this is unsafe
302
307
  end
303
308
  end
304
309
 
@@ -682,8 +687,8 @@ module Aka
682
687
  end
683
688
  end
684
689
 
685
- # setup_aka
686
- def setup_aka
690
+ # setup_aka_old
691
+ def setup_aka_old
687
692
  append_with_newline("export HISTSIZE=10000","/etc/profile")
688
693
  trap = "sigusr2() { unalias $1;}
689
694
  sigusr1() { source #{readYML("#{Dir.home}/.aka/.config")["dotfile"]}; history -a; echo 'reloaded dot file'; }
@@ -693,8 +698,8 @@ trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
693
698
  puts "Done. Please restart this shell.".red
694
699
  end
695
700
 
696
- # setup_aka2 by ryan - check bash file first
697
- def setup_aka2
701
+ # setup_aka_old2 by ryan - check bash file first
702
+ def setup_aka_old2
698
703
  if File.exist?("#{Dir.home}/.zshrc") #if zshec exist
699
704
  setZSHRC2
700
705
  append_with_newline("\nexport HISTSIZE=10000","#{Dir.home}/.zshrc")
@@ -718,8 +723,8 @@ trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
718
723
  puts "Done. Please restart this shell.".red
719
724
  end
720
725
 
721
- # setup_aka3 by ryan - set value in config file
722
- def setup_aka3
726
+ # setup_aka by ryan - set value in config file
727
+ def setup_aka
723
728
  if File.exist?("#{Dir.home}/.zshrc") #if zshec exist
724
729
  setZSHRC2
725
730
  elsif File.exist?("#{Dir.home}/.bashrc") #if bashrc exist
@@ -819,7 +824,7 @@ trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
819
824
  end
820
825
 
821
826
  # show last
822
- def showlast howmany=10
827
+ def showlast_old howmany=10
823
828
  str = checkConfigFile(readYML("#{Dir.home}/.aka/.config")["dotfile"])
824
829
 
825
830
  if content = File.open(str).read
@@ -852,7 +857,7 @@ trap 'sigusr2 $(cat ~/sigusr1-args)' SIGUSR2\n".pretty
852
857
  end
853
858
 
854
859
  # show last2 - ryan - remove number
855
- def showlast2 howmany=10
860
+ def showlast howmany=10
856
861
  str = checkConfigFile(readYML("#{Dir.home}/.aka/.config")["dotfile"])
857
862
 
858
863
  if content = File.open(str).read
data/lib/aka/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Aka
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
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.3
4
+ version: 0.1.4
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-05 00:00:00.000000000 Z
12
+ date: 2015-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: net-scp
@@ -137,7 +137,6 @@ files:
137
137
  - README.md
138
138
  - Rakefile
139
139
  - aka.gemspec
140
- - aka2-0.1.0.gem
141
140
  - bin/aka
142
141
  - bin/console
143
142
  - bin/setup