pallan-gem_import_export 0.0.1 → 0.0.2

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -0,0 +1,48 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{gem_import_export}
5
+ s.version = "0.0.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Peer Allan"]
9
+ s.date = %q{2009-05-11}
10
+ s.email = %q{peer@canadadrugs.com}
11
+ s.extra_rdoc_files = [
12
+ "LICENSE",
13
+ "README.rdoc"
14
+ ]
15
+ s.files = [
16
+ ".document",
17
+ ".gitignore",
18
+ "LICENSE",
19
+ "README.rdoc",
20
+ "Rakefile",
21
+ "VERSION",
22
+ "gem_import_export.gemspec",
23
+ "lib/rubygems/commands/export_command.rb",
24
+ "lib/rubygems/commands/import_command.rb",
25
+ "lib/rubygems_plugin.rb",
26
+ "spec/gem_import_export_spec.rb",
27
+ "spec/spec_helper.rb"
28
+ ]
29
+ s.homepage = %q{http://github.com/pallan/gem_import_export}
30
+ s.rdoc_options = ["--charset=UTF-8"]
31
+ s.require_paths = ["lib"]
32
+ s.rubygems_version = %q{1.3.3}
33
+ s.summary = %q{TODO}
34
+ s.test_files = [
35
+ "spec/gem_import_export_spec.rb",
36
+ "spec/spec_helper.rb"
37
+ ]
38
+
39
+ if s.respond_to? :specification_version then
40
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
41
+ s.specification_version = 3
42
+
43
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
44
+ else
45
+ end
46
+ else
47
+ end
48
+ end
@@ -1,29 +1,51 @@
1
1
  require 'rubygems/command'
2
- require 'rubygems/commands/query_command'
3
2
 
4
3
  ##
5
4
  # An alternate to Gem::Commands::QueryCommand that searches for gems starting
6
5
  # with the the supplied argument.
7
6
 
8
- class Gem::Commands::ExportCommand < Gem::Commands::QueryCommand
7
+ class Gem::Commands::ExportCommand < Gem::Command
9
8
 
10
9
  def initialize
11
10
  super 'export', 'Dumps your currently installed gems into yaml'
12
-
13
- remove_option('--name-matches')
14
- options[:format] = 'yaml'
15
11
  end
16
12
 
17
13
  def arguments # :nodoc:
18
- "STRING start of gem name to look for"
14
+ "GEMFILE location to save the export to"
19
15
  end
20
16
 
21
17
  def defaults_str # :nodoc:
22
- "--local --no-details --format yaml"
18
+ ""
23
19
  end
24
20
 
25
21
  def usage # :nodoc:
26
- "#{program_name} [STRING]"
22
+ "#{program_name} GEMFILE"
23
+ end
24
+
25
+ def execute
26
+
27
+ export_file = get_one_optional_argument
28
+
29
+ unless export_file then
30
+ raise Gem::CommandLineError,
31
+ "Please specify a file to save the export to"
32
+ end
33
+
34
+ dep = Gem::Dependency.new //, Gem::Requirement.default
35
+ specs = Gem.source_index.search dep
36
+
37
+ gems = []
38
+
39
+ specs.map do |spec|
40
+ gems << {
41
+ :name => spec.name,
42
+ :version => spec.version.to_s,
43
+ :install_options => ''
44
+ }
45
+ end
46
+
47
+ output = {'sources' => Gem.sources, 'gems' => gems}
48
+ say output.to_yaml
27
49
  end
28
50
 
29
51
  end
@@ -16,34 +16,39 @@ class Gem::Commands::ImportCommand < Gem::Commands::InstallCommand
16
16
  end
17
17
 
18
18
  def execute
19
+ gemspec = get_one_gem_name
20
+
21
+ unless gemspec then
22
+ raise Gem::CommandLineError,
23
+ "Please specify a gem yaml file on the command line"
24
+ end
25
+
26
+ unless File.exist?(gemspec) then
27
+ raise Gem::CommandLineError,
28
+ "Specified file #{gemspec} does not exist"
29
+ end
30
+
19
31
  options[:ignore_dependencies] = true
20
32
  installed_gems = []
21
- gemspec = get_one_gem_name
22
- if File.exist?(gemspec)
23
- data = YAML.load_file( gemspec )
24
- data['gems'].each do |g|
25
- gem_name = g[:name]
26
- g[:versions].each do |version|
27
- begin
28
- inst = Gem::DependencyInstaller.new options
29
- inst.install g[:name], version
30
-
31
- inst.installed_gems.each do |spec|
32
- say "Successfully installed #{spec.full_name}"
33
- end
34
-
35
- installed_gems.push(*inst.installed_gems)
36
- rescue Gem::InstallError => e
37
- alert_error "Error installing #{gem_name}:\n\t#{e.message}"
38
- exit_code |= 1
39
- rescue Gem::GemNotFoundException => e
40
- alert_error e.message
41
- exit_code |= 2
42
- end
33
+
34
+ data = YAML.load_file( gemspec )
35
+ data['gems'].each do |g|
36
+ begin
37
+ inst = Gem::DependencyInstaller.new options
38
+ inst.install g[:name], g[:version]
39
+
40
+ inst.installed_gems.each do |spec|
41
+ say "Successfully installed #{spec.full_name}"
43
42
  end
43
+
44
+ installed_gems.push(*inst.installed_gems)
45
+ rescue Gem::InstallError => e
46
+ alert_error "Error installing #{gem_name}:\n\t#{e.message}"
47
+ exit_code |= 1
48
+ rescue Gem::GemNotFoundException => e
49
+ alert_error e.message
50
+ exit_code |= 2
44
51
  end
45
- else
46
- alert_error "Gemspec file not found: #{gemspec}"
47
52
  end
48
53
  end
49
54
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pallan-gem_import_export
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peer Allan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-10 00:00:00 -07:00
12
+ date: 2009-05-11 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -29,6 +29,7 @@ files:
29
29
  - README.rdoc
30
30
  - Rakefile
31
31
  - VERSION
32
+ - gem_import_export.gemspec
32
33
  - lib/rubygems/commands/export_command.rb
33
34
  - lib/rubygems/commands/import_command.rb
34
35
  - lib/rubygems_plugin.rb
@@ -59,7 +60,7 @@ rubyforge_project:
59
60
  rubygems_version: 1.2.0
60
61
  signing_key:
61
62
  specification_version: 3
62
- summary: Adds the commands to RubyGems for importing and exporting repositories using a command plugin
63
+ summary: TODO
63
64
  test_files:
64
65
  - spec/gem_import_export_spec.rb
65
66
  - spec/spec_helper.rb