easyoperate 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/eo CHANGED
@@ -6,7 +6,7 @@
6
6
  $LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + "/../lib"))
7
7
 
8
8
  # easy debug
9
- if ARGV.delete('-d')
9
+ if ARGV.delete('--debug')
10
10
  ['rubygems','ruby-debug'].each {|x| require x}
11
11
  else
12
12
  def debugger;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.5.2"
5
+ s.version = "0.5.3"
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-02-16}
9
+ s.date = %q{2009-03-08}
10
10
  s.default_executable = %q{eo}
11
11
  s.description = %q{Eo_oE}
12
12
  s.email = %q{wosmvp@gmail.com}
data/lib/eo.rb CHANGED
@@ -1,4 +1,4 @@
1
- %w(yaml eo/repository eo/gem eo/eo readline).each {|f| require f}
1
+ %w(yaml eo/repository eo/gem eo/eo readline fileutils).each {|f| require f}
2
2
  include Readline
3
3
 
4
4
  class Eo
@@ -30,6 +30,7 @@ class Eo
30
30
 
31
31
  when /^-o$/i then open(params)
32
32
  when /^-c$/i then choose(params)
33
+ when /^-d$/i then delete(params)
33
34
 
34
35
  when /^-t$/i then type
35
36
  when /^-p$/i then push(params)
@@ -48,12 +49,13 @@ class Eo
48
49
  when /^GC$/i then gemshell(input[1])
49
50
  when /^GO$/i then gemopen(input[1])
50
51
 
51
- when /^s\w?/i then show(input[1],:skip => (input[0] =~ /^sa$/i).nil?)
52
- when /^i\w?/i then init(input[1],:skip => (input[0] =~ /^ia$/i).nil?)
53
- when /^u\w?/i then update(input[1],:skip =>(input[0] =~ /^ua$/i).nil?)
52
+ when /^S\w?/i then show(input[1],:skip => (input[0] =~ /^sa$/i).nil?)
53
+ when /^I\w?/i then init(input[1],:skip => (input[0] =~ /^ia$/i).nil?)
54
+ when /^U\w?/i then update(input[1],:skip =>(input[0] =~ /^ua$/i).nil?)
54
55
 
55
56
  when /^O$/i then open(input[1])
56
57
  when /^C$/i then choose(input[1])
58
+ when /^D$/i then delete(input[1])
57
59
  when /^T$/i then type
58
60
  when /^P$/i then push(input[1])
59
61
  when /^Q$/i then exit
@@ -76,6 +78,7 @@ class Eo
76
78
  | S /args/ : Show matched repositories <Regexp>
77
79
  | O /args/ : Open The repository's path <Regexp>
78
80
  | C /args/ : Choose One Repository <Regexp>
81
+ | D /args/ : Delete Repository <Regexp>
79
82
  | GS /args/ : Show matched Gems <Regexp>
80
83
  | GC /args/ : Choose One Gem <Regexp>
81
84
  | GO /args/ : Open The Gem's Path <Regexp>
data/lib/eo/eo.rb CHANGED
@@ -64,6 +64,15 @@ class Eo
64
64
  end
65
65
  end
66
66
 
67
+ def delete(args,opt={})
68
+ repos = pick(:key => args,:plural => true)
69
+
70
+ repos.each do |x|
71
+ puts "\e[32m Deleting #{Repos[x]._name_}:\e[0m"
72
+ Repos[x].delete
73
+ end
74
+ end
75
+
67
76
  def update(args,opt={})
68
77
  repos = pick(:key => args,:plural => true,:skip => opt[:skip])
69
78
 
data/lib/eo/repository.rb CHANGED
@@ -62,6 +62,16 @@ class Repository
62
62
  end
63
63
  alias sh shell
64
64
 
65
+ def delete
66
+ if readline("\e[33mAre Your Sure ? \e[0m") !~ /q|n/i
67
+ if self.path && !self.path.empty?
68
+ FileUtils.rm_rf(self.path)
69
+ else
70
+ puts "\e[31mDon't know how to delete the repository!\e[0m"
71
+ end
72
+ end
73
+ end
74
+
65
75
  def method_missing(m,*args)
66
76
  # method missing -> shell command
67
77
  result = system(m.to_s + " " + args.join(' '))
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Easyoperate
2
- VERSION = '0.5.2'
2
+ VERSION = '0.5.3'
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.5.2
4
+ version: 0.5.3
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-02-16 00:00:00 +08:00
12
+ date: 2009-03-08 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15