easyoperate 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +26 -16
- data/lib/easyoperate.rb +1 -1
- data/lib/eo.rb +3 -3
- data/lib/eo/eo.rb +10 -10
- data/lib/eo/scm.rb +4 -8
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -4,36 +4,46 @@
|
|
4
4
|
$ sudo gem install easyoperate
|
5
5
|
|
6
6
|
== Why && How To Use:
|
7
|
-
|
7
|
+
|
8
|
+
### ~/.eorc
|
8
9
|
vim-rails:
|
9
|
-
path: ~/vim/vim-rails/
|
10
|
+
path: ~/vim/vim-rails/ # Local path
|
10
11
|
|
11
|
-
repo: git://github.com/tpope/vim-rails.git
|
12
|
+
repo: git://github.com/tpope/vim-rails.git # Remote path
|
12
13
|
|
13
14
|
autorun: 'puts "Thanks to Tim Pope";cp_autoload;cp_plugin'
|
14
|
-
|
15
|
+
# Splited by ';' , when init or update,this will autorun,
|
16
|
+
# first print "Thanks to Tim Pope"
|
17
|
+
# then copy autoload/rails.vim to ~/.vim/autoload/
|
18
|
+
# then copy plugin/rails.vim to ~/.vim/plugin/
|
15
19
|
|
16
|
-
|
20
|
+
scm: # svn/git,default is git
|
17
21
|
|
18
|
-
|
22
|
+
cmd: # Where you can define your methods
|
19
23
|
cp_autoload: `cp autoload/rails.vim ~/.vim/autoload/`
|
20
24
|
cp_plugin: `cp plugin/rails.vim '~/.vim/plugin/`
|
21
25
|
example: 'puts "Hi,This is example method"'
|
22
|
-
|
23
|
-
|
24
|
-
|
26
|
+
# you can run example when choose vim-rails use $ eo -c vim-rails,
|
27
|
+
# will print "Hi,This is example method"
|
28
|
+
|
29
|
+
### Other Commands:
|
30
|
+
$ eo -i vim-rails => initialise vim-rails:
|
31
|
+
clone source from github to the path your specify
|
32
|
+
$ eo -c vim-rails => Select vim-rails
|
25
33
|
$ eo -u vim-rails => Update vim-rails
|
26
|
-
|
34
|
+
run 'git pull' in vim-rails's path
|
35
|
+
$ eo -u => Update all repository in ~/.eorc <Regexp>
|
27
36
|
|
28
|
-
== More Help
|
37
|
+
== More Help ?
|
29
38
|
|
30
|
-
<
|
39
|
+
<Shell>
|
31
40
|
$ eo -h for help
|
32
|
-
<
|
41
|
+
<Program>
|
33
42
|
$ h for help
|
34
43
|
|
35
44
|
|
36
|
-
Copyright (c) 2008
|
45
|
+
Copyright (c) 2008 GPL3
|
37
46
|
|
38
|
-
|
39
|
-
|
47
|
+
Author : Jinzhu Zhang
|
48
|
+
Web : http://www.zhangjinzhu.com
|
49
|
+
Email : wosmvp (no-spam) gmail (no-spam) com
|
data/lib/easyoperate.rb
CHANGED
data/lib/eo.rb
CHANGED
@@ -6,7 +6,7 @@ class Eo
|
|
6
6
|
|
7
7
|
parser = OptionParser.new do |opts|
|
8
8
|
opts.banner = <<-BANNER.gsub(/^ /,'')
|
9
|
-
Usage: #{File.basename($0)} [options]
|
9
|
+
Usage: #{File.basename($0)} [options] [ARGS]
|
10
10
|
|
11
11
|
Options are:
|
12
12
|
BANNER
|
@@ -16,7 +16,7 @@ class Eo
|
|
16
16
|
end
|
17
17
|
|
18
18
|
opts.on_tail("-v", "--version","Show version information.") do
|
19
|
-
puts Easyoperate::VERSION; exit
|
19
|
+
puts "\e[33mEo_oE : v" + Easyoperate::VERSION + "\e[0m"; exit
|
20
20
|
end
|
21
21
|
|
22
22
|
opts.on("-u [ARGS]", "--update","Update Repository. <Regexp>") do |args|
|
@@ -27,7 +27,7 @@ class Eo
|
|
27
27
|
self.show(args)
|
28
28
|
end
|
29
29
|
|
30
|
-
opts.on("-c [ARGS]", "--choose","Choose
|
30
|
+
opts.on("-c [ARGS]", "--choose","Choose Repository.") do |args|
|
31
31
|
self.choose(args)
|
32
32
|
end
|
33
33
|
|
data/lib/eo/eo.rb
CHANGED
@@ -17,7 +17,7 @@ class Eo
|
|
17
17
|
class << self
|
18
18
|
def run
|
19
19
|
loop do
|
20
|
-
printf("\e[33mInput Commands (q
|
20
|
+
printf("\e[33mInput Commands (q:quit h:help): \e[0m")
|
21
21
|
input = STDIN.gets.split(' ',2)
|
22
22
|
input[1] ? input[1].strip! : next
|
23
23
|
|
@@ -35,7 +35,7 @@ class Eo
|
|
35
35
|
def help
|
36
36
|
puts "Usage:"
|
37
37
|
puts " S /args/ : Show matched repositories <Regexp>"
|
38
|
-
puts " C /args/ : Choose
|
38
|
+
puts " C /args/ : Choose One Repository <Regexp>"
|
39
39
|
puts " U /args/ : Update matched Repository <Regexp>"
|
40
40
|
puts " I /args/ : Initialize matched Repository <Regexp>"
|
41
41
|
puts " Q : Quit"
|
@@ -47,10 +47,10 @@ class Eo
|
|
47
47
|
repos = pick(args,false)
|
48
48
|
puts "\e[33mAll Repo match < #{args} > :\e[0m"
|
49
49
|
repos.each_index do |x|
|
50
|
-
printf "\e[32m %-
|
51
|
-
printf("\n") if (x+1)%
|
50
|
+
printf "\e[32m %-22s\e[0m" % [repos[x].rstrip]
|
51
|
+
printf("\n") if (x+1)%3==0
|
52
52
|
end
|
53
|
-
puts "\n" if repos.size%
|
53
|
+
puts "\n" if repos.size%3 != 0
|
54
54
|
end
|
55
55
|
|
56
56
|
def choose(*args)
|
@@ -58,7 +58,7 @@ class Eo
|
|
58
58
|
if repos && repos = repos.to_s
|
59
59
|
return false unless exist_path(repos)
|
60
60
|
loop do
|
61
|
-
printf("\e[01;34m#{repos.first} >> \e[0m")
|
61
|
+
printf("\e[01;34m#{repos.first} (h:help)>> \e[0m")
|
62
62
|
input = STDIN.gets.strip
|
63
63
|
break if input =~ /\A\s*q\s*\Z/
|
64
64
|
exit if input =~ /\A\s*Q\s*\Z/
|
@@ -82,7 +82,7 @@ class Eo
|
|
82
82
|
def update(*args)
|
83
83
|
repos = pick(args,false)
|
84
84
|
repos.each do |x|
|
85
|
-
puts "\e[
|
85
|
+
puts "\e[32m Updating #{Repo[x]['path']}:\e[0m"
|
86
86
|
next if !exist_path(x)
|
87
87
|
Repo[x].update
|
88
88
|
end
|
@@ -109,10 +109,10 @@ class Eo
|
|
109
109
|
puts "\e[33mPlease Choose One of them : \e[0m"
|
110
110
|
|
111
111
|
args.each_index do |x|
|
112
|
-
printf "\e[32m%-2d\e[0m %-
|
113
|
-
printf "\n" if (x+1)%
|
112
|
+
printf "\e[32m%-2d\e[0m %-22s" % [x+1,args[x].rstrip]
|
113
|
+
printf "\n" if (x+1)%3 == 0
|
114
114
|
end
|
115
|
-
printf "\n" if args.size%
|
115
|
+
printf "\n" if args.size%3 != 0
|
116
116
|
|
117
117
|
num = choose_range(args.size)
|
118
118
|
return num ? [args[num-1]] : false
|
data/lib/eo/scm.rb
CHANGED
@@ -27,13 +27,9 @@ class Scm < Hash
|
|
27
27
|
old_commit = now_commit
|
28
28
|
scm_update
|
29
29
|
new_commit = now_commit
|
30
|
-
if new_commit
|
31
|
-
|
32
|
-
|
33
|
-
if self['autorun']
|
34
|
-
self['autorun'].split(';').each do |x|
|
35
|
-
eval x
|
36
|
-
end
|
30
|
+
if new_commit != old_commit && self['autorun']
|
31
|
+
self['autorun'].split(';').each do |x|
|
32
|
+
eval x
|
37
33
|
end
|
38
34
|
end
|
39
35
|
end
|
@@ -86,7 +82,7 @@ class Scm < Hash
|
|
86
82
|
when /git/ then return `git log --pretty=format:%H -1`
|
87
83
|
when /svn/ then return `svn -l 1 log -q | grep "\w" | awk '{print $1}'`
|
88
84
|
else
|
89
|
-
puts "\e[31mSorry,
|
85
|
+
puts "\e[31mSorry,Only Support SVN/GIT\e[0m"
|
90
86
|
exit
|
91
87
|
end
|
92
88
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easyoperate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jinzhu Zhang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-14 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|