gem-depclean 0.2.2 → 0.2.3

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/.gitignore CHANGED
@@ -1,5 +1,3 @@
1
- *.sw?
2
- .DS_Store
3
1
  coverage
4
- rdoc
5
2
  pkg
3
+ rdoc
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -22,16 +22,31 @@ class Gem::Commands::WorldCommand < Gem::Command
22
22
  add_option '--init' do |v, opts|
23
23
  opts[:init] = v
24
24
  end
25
+
26
+ add_option '-e', '--edit' do |v, opts|
27
+ opts[:edit] = v
28
+ end
25
29
  end
26
30
 
27
31
  def execute
28
32
  if options[:init]
29
33
  init_world
34
+ elsif options[:edit]
35
+ edit
30
36
  else
31
37
  list
32
38
  end
33
39
  end
34
40
 
41
+ def edit
42
+ unless editor = ENV['VISUAL'] || ENV['EDITOR']
43
+ alert_error 'Please set VISUAL or EDITOR variable.'
44
+ terminate_interaction
45
+ end
46
+
47
+ system editor, world_path
48
+ end
49
+
35
50
  def add(name, version)
36
51
  open(world_path, 'r+') do |f|
37
52
  f << YAML.load(f).tap {|world|
@@ -57,7 +72,9 @@ class Gem::Commands::WorldCommand < Gem::Command
57
72
  end
58
73
 
59
74
  def list
60
- YAML.load_file(world_path).sort_by(&:first).each do |name, versions|
75
+ YAML.load_file(world_path).sort_by {|name, versions|
76
+ name.downcase
77
+ }.each do |name, versions|
61
78
  say "#{name} (#{versions.join(', ')})"
62
79
  end
63
80
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-depclean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Urashima
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-18 00:00:00 +09:00
12
+ date: 2009-10-27 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency