pallan-gem_import_export 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.sw?
2
+ .DS_Store
3
+ coverage
4
+ rdoc
5
+ pkg
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Peer Allan
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,7 @@
1
+ = gem_import_export
2
+
3
+ Description goes here.
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2009 Peer Allan. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "gem_import_export"
8
+ gem.summary = %Q{TODO}
9
+ gem.email = "peer@canadadrugs.com"
10
+ gem.homepage = "http://github.com/pallan/gem_import_export"
11
+ gem.authors = ["Peer Allan"]
12
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
+ end
14
+
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
+ end
18
+
19
+ require 'spec/rake/spectask'
20
+ Spec::Rake::SpecTask.new(:spec) do |spec|
21
+ spec.libs << 'lib' << 'spec'
22
+ spec.spec_files = FileList['spec/**/*_spec.rb']
23
+ end
24
+
25
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
26
+ spec.libs << 'lib' << 'spec'
27
+ spec.pattern = 'spec/**/*_spec.rb'
28
+ spec.rcov = true
29
+ end
30
+
31
+
32
+ task :default => :spec
33
+
34
+ require 'rake/rdoctask'
35
+ Rake::RDocTask.new do |rdoc|
36
+ if File.exist?('VERSION.yml')
37
+ config = YAML.load(File.read('VERSION.yml'))
38
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
39
+ else
40
+ version = ""
41
+ end
42
+
43
+ rdoc.rdoc_dir = 'rdoc'
44
+ rdoc.title = "gem_import_export #{version}"
45
+ rdoc.rdoc_files.include('README*')
46
+ rdoc.rdoc_files.include('lib/**/*.rb')
47
+ end
48
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,30 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/commands/query_command'
3
+
4
+ ##
5
+ # An alternate to Gem::Commands::QueryCommand that searches for gems starting
6
+ # with the the supplied argument.
7
+
8
+ class Gem::Commands::ExportCommand < Gem::Commands::QueryCommand
9
+
10
+ def initialize
11
+ super 'export', 'Dumps your currently installed gems into yaml'
12
+
13
+ remove_option('--name-matches')
14
+ options[:format] = 'yaml'
15
+ end
16
+
17
+ def arguments # :nodoc:
18
+ "STRING start of gem name to look for"
19
+ end
20
+
21
+ def defaults_str # :nodoc:
22
+ "--local --no-details --format yaml"
23
+ end
24
+
25
+ def usage # :nodoc:
26
+ "#{program_name} [STRING]"
27
+ end
28
+
29
+ end
30
+
@@ -0,0 +1,50 @@
1
+ require 'rubygems/command'
2
+ require 'rubygems/commands/install_command'
3
+
4
+ class Gem::Commands::ImportCommand < Gem::Commands::InstallCommand
5
+
6
+ def initialize
7
+ super
8
+ end
9
+
10
+ def arguments # :nodoc:
11
+ "GEM_LIST Yaml file with the gems to install"
12
+ end
13
+
14
+ def usage # :nodoc:
15
+ "#{program_name} GEMSPEC_FILE"
16
+ end
17
+
18
+ def execute
19
+ options[:ignore_dependencies] = true
20
+ 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
43
+ end
44
+ end
45
+ else
46
+ alert_error "Gemspec file not found: #{gemspec}"
47
+ end
48
+ end
49
+
50
+ end
@@ -0,0 +1,4 @@
1
+ require 'rubygems/command_manager'
2
+
3
+ Gem::CommandManager.instance.register_command :import
4
+ Gem::CommandManager.instance.register_command :export
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "GemImportExport" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec'
2
+
3
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
4
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
5
+ require 'gem_import_export'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pallan-gem_import_export
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Peer Allan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-10 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: peer@canadadrugs.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README.rdoc
25
+ files:
26
+ - .document
27
+ - .gitignore
28
+ - LICENSE
29
+ - README.rdoc
30
+ - Rakefile
31
+ - VERSION
32
+ - lib/rubygems/commands/export_command.rb
33
+ - lib/rubygems/commands/import_command.rb
34
+ - lib/rubygems_plugin.rb
35
+ - spec/gem_import_export_spec.rb
36
+ - spec/spec_helper.rb
37
+ has_rdoc: false
38
+ homepage: http://github.com/pallan/gem_import_export
39
+ post_install_message:
40
+ rdoc_options:
41
+ - --charset=UTF-8
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: "0"
49
+ version:
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ requirements: []
57
+
58
+ rubyforge_project:
59
+ rubygems_version: 1.2.0
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: Adds the commands to RubyGems for importing and exporting repositories using a command plugin
63
+ test_files:
64
+ - spec/gem_import_export_spec.rb
65
+ - spec/spec_helper.rb