easyoperate 0.4.0 → 0.4.1

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.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.4.1 2009-2-1
2
+ * Ruby 1.9 compatible
3
+
1
4
  == 0.3.0 2008-12-26
2
5
 
3
6
  * Show All Install Gems, Goto Gem's Path ...
data/Rakefile CHANGED
@@ -10,30 +10,4 @@ Echoe.new('easyoperate', Easyoperate::VERSION) do |p|
10
10
  p.email = "wosmvp@gmail.com"
11
11
  p.ignore_pattern = ["TODO"]
12
12
  p.rubyforge_name = "easyoperate"
13
-
14
- #FIXME##############################
15
- p.install_message = "\e[31m
16
-
17
- Attention Please ( <= v0.3.0 ):
18
- ~/.eorc renamed to ~/.eo/repos
19
- Add new config file ~/.eo/config
20
-
21
- #{require 'fileutils'
22
- FileUtils.mkdir_p(File.join("#{ENV['HOME']}",".eo"))
23
-
24
- origin = File.join("#{ENV['HOME']}",".eorc")
25
- repos = File.join("#{ENV['HOME']}",".eo/repos")
26
- config = File.join("#{ENV['HOME']}",".eo/config")
27
-
28
- if File.exist?(origin) && !File.exist?(repos)
29
- FileUtils.cp(origin,repos)
30
- end
31
-
32
- if !File.exist?(config)
33
- example = File.join(File.dirname(__FILE__),'example/config')
34
- FileUtils.cp(example,config)
35
- end
36
- }
37
- \e[0m"
38
- ########################################
39
13
  end
data/easyoperate.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{easyoperate}
5
- s.version = "0.4.0"
5
+ s.version = "0.4.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jinzhu Zhang"]
9
- s.date = %q{2009-01-02}
9
+ s.date = %q{2009-02-02}
10
10
  s.default_executable = %q{eo}
11
11
  s.description = %q{Eo_oE}
12
12
  s.email = %q{wosmvp@gmail.com}
@@ -15,14 +15,6 @@ Gem::Specification.new do |s|
15
15
  s.files = ["Manifest", "test/test_helper.rb", "test/test_eo_cli.rb", "test/test_easyoperate.rb", "bin/eo", "example/config", "example/repos", "Rakefile", "History.txt", "lib/version.rb", "lib/eo.rb", "lib/eo/scm/git.rb", "lib/eo/scm/svn.rb", "lib/eo/eo.rb", "lib/eo/repository.rb", "lib/eo/gem.rb", "README.rdoc", "easyoperate.gemspec"]
16
16
  s.has_rdoc = true
17
17
  s.homepage = %q{http://www.zhangjinzhu.com}
18
- s.post_install_message = %q{
19
-
20
- Attention Please ( <= v0.3.0 ):
21
- ~/.eorc renamed to ~/.eo/repos
22
- Add new config file ~/.eo/config
23
-
24
-
25
- }
26
18
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Easyoperate", "--main", "README.rdoc"]
27
19
  s.require_paths = ["lib"]
28
20
  s.rubyforge_project = %q{easyoperate}
data/lib/eo/eo.rb CHANGED
@@ -16,7 +16,7 @@ class Eo
16
16
  format_display(@formated_scm)
17
17
  end
18
18
 
19
- def show(*args)
19
+ def show(args)
20
20
  puts "\e[33mAll Repo match < #{args} > :\e[0m"
21
21
  repos = pick(args,false) # single:false => allow choose many
22
22
  format_display(repos) if repos
@@ -24,13 +24,13 @@ class Eo
24
24
 
25
25
  def open(args)
26
26
  repos = pick(args)
27
- system([Config['open'],Repos[repos.to_s].path].join(' ')) if repos
27
+ system([Config['open'],Repos[repos.first].path].join(' ')) if repos
28
28
  end
29
29
 
30
- def choose(*args)
30
+ def choose(args)
31
31
  repos = pick(args)
32
32
 
33
- if repos && repos = repos.to_s # Convert Array To String
33
+ if repos && repos = repos.first # Get First Array
34
34
  return false unless exist_path(repos)
35
35
  loop do
36
36
  printf("\e[01;34m#{repos} (h:help)>> \e[0m")
@@ -43,7 +43,7 @@ class Eo
43
43
  end
44
44
  end
45
45
 
46
- def init(*args)
46
+ def init(args)
47
47
  repos = pick(args,false)
48
48
 
49
49
  repos.each do |x|
@@ -56,7 +56,7 @@ class Eo
56
56
  end
57
57
  end
58
58
 
59
- def update(*args)
59
+ def update(args)
60
60
  repos = pick(args,false)
61
61
 
62
62
  repos.each do |x|
data/lib/eo.rb CHANGED
@@ -16,62 +16,52 @@ class Eo
16
16
 
17
17
  class << self
18
18
  def execute(args)
19
- case args.first
20
- when "-gs" then self.gemshow(args[1,args.size])
21
- when "-gc" then self.gemshell(args[1,args.size])
22
- when "-go" then self.gemopen(args[1,args.size])
23
- when "-s" then self.show(args[1,args.size])
24
- when "-o" then self.open(args[1,args.size])
25
- when "-c" then self.choose(args[1,args.size])
26
- when "-i" then self.init(args[1,args.size])
27
- when "-u" then self.update(args[1,args.size])
28
- when "-t" then self.type
29
- when "-v" then puts "\e[33mEo_oE : v" + Easyoperate::VERSION + "\e[0m"
30
- when "-h" then
31
- puts <<-DOC.gsub(/^(\s*\|)/,'')
32
- |Usage: #{File.basename($0)} [options] [ARGS]
19
+ params = (args.size > 1) ? args[1,args.size].join : ''
33
20
 
34
- |Options are:
35
- | -i Initialize Repository. <Regexp>
36
- | -t Show All Support Scm
37
- | -u Update Repository. <Regexp>
38
- | -s Show All Repositories. <Regexp>
39
- | -o Open The repository's path <Regexp>
40
- | -c Choose Repository. <Regexp>
41
- | -gs Show All Gems. <Regexp>
42
- | -gc Choose Gem. <Regexp>
43
- | -go Open The Gem's Path <Regexp>
44
- | -v Show version information.
45
- DOC
21
+ case args.first
22
+ when /^-gs$/i then gemshow(params)
23
+ when /^-gc$/i then gemshell(params)
24
+ when /^-go$/i then gemopen(params)
25
+ when /^-s$/i then show(params)
26
+ when /^-o$/i then open(params)
27
+ when /^-c$/i then choose(params)
28
+ when /^-i$/i then init(params)
29
+ when /^-u$/i then update(params)
30
+ when /^-t$/i then type
31
+ when /^-v$/i then puts "\e[33mEo_oE : v#{Easyoperate::VERSION}\e[0m"
32
+ when /^-(h|help)$/i then help
46
33
  else self.run
47
34
  end
48
35
  end
49
36
 
50
-
51
37
  def run
52
38
  loop do
53
39
  printf("\e[33mInput Commands (q:quit h:help): \e[0m")
54
40
  input = (STDIN.gets || exit).rstrip.split(' ',2)
55
41
 
56
42
  case input[0].to_s
57
- when /GS/i then gemshow(input[1])
58
- when /GC/i then gemshell(input[1])
59
- when /GO/i then gemopen(input[1])
60
- when /S/i then show(input[1])
61
- when /O/i then open(input[1])
62
- when /C/i then choose(input[1])
63
- when /U/i then update(input[1])
64
- when /I/i then init(input[1])
65
- when /T/i then type
66
- when /Q/i then exit
67
- else help
43
+ when /^GS$/i then gemshow(input[1])
44
+ when /^GC$/i then gemshell(input[1])
45
+ when /^GO$/i then gemopen(input[1])
46
+ when /^S$/i then show(input[1])
47
+ when /^O$/i then open(input[1])
48
+ when /^C$/i then choose(input[1])
49
+ when /^U$/i then update(input[1])
50
+ when /^I$/i then init(input[1])
51
+ when /^T$/i then type
52
+ when /^Q$/i then exit
53
+ when /^V$/i then
54
+ puts "\e[33mEo_oE : v" + Easyoperate::VERSION + "\e[0m"
55
+ when /^H|HELP$/i then help
56
+ else puts "\e[31mError Command\e[0m"
68
57
  end
69
58
  end
70
59
  end
71
60
 
72
- def help
73
- puts <<-DOC.gsub(/^(\s*\|)/,'')
74
- |Usage:
61
+ def help(shell=true)
62
+ puts <<-DOC.gsub(/^(\s*)/,'').gsub(/^\|(\s*)/,'\1' + (shell ? '-':''))
63
+ Usage:
64
+
75
65
  | I /args/ : Initialize matched Repository <Regexp>
76
66
  | U /args/ : Update matched Repository <Regexp>
77
67
  | T : Show All Support Scm
@@ -83,7 +73,9 @@ class Eo
83
73
  | GO /args/ : Open The Gem's Path <Regexp>
84
74
  | Q : Quit
85
75
  | H : Show this help message.
86
- |e.g:\n \e[32m s v.*m\e[0m
76
+ | V : Show version information.
77
+ #{shell ? "e.g: \n \e[032m $ eo -S v.*m\e[0m" :
78
+ "e.g:\n \e[32m s v.*m\e[0m" }
87
79
  DOC
88
80
  end
89
81
  end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Easyoperate
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  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.4.0
4
+ version: 0.4.1
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: 2009-01-02 00:00:00 +08:00
12
+ date: 2009-02-02 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -59,7 +59,7 @@ files:
59
59
  - easyoperate.gemspec
60
60
  has_rdoc: true
61
61
  homepage: http://www.zhangjinzhu.com
62
- post_install_message: "\e[31m\n\n Attention Please ( <= v0.3.0 ):\n ~/.eorc renamed to ~/.eo/repos\n Add new config file ~/.eo/config\n\n \n \e[0m"
62
+ post_install_message:
63
63
  rdoc_options:
64
64
  - --line-numbers
65
65
  - --inline-source