Class: Gem::Src
- Inherits:
-
Object
- Object
- Gem::Src
- Defined in:
- lib/rubygems_plugin.rb
Constant Summary collapse
- IRREGULAR_REPOSITORIES =
{'activesupport' => nil, 'actionview' => nil, 'actionpack' => nil, 'activemodel' => nil, 'activerecord' => nil, 'activejob' => nil, 'actionmailer' => nil, 'actioncable' => nil, 'railties' => nil, 'activeresource' => 'https://github.com/rails/activeresource.git', 'autoparse' => 'https://github.com/google/autoparse.git', 'aws-sdk-rails' => 'https://github.com/aws/aws-sdk-rails.git', 'bson' => 'https://github.com/mongodb/bson-ruby.git', 'compass-core' => 'https://github.com/Compass/compass.git', 'compass-import-once' => 'https://github.com/Compass/compass.git', 'cool.io' => 'https://github.com/tarcieri/cool.io.git', 'cucumber-core' => 'https://github.com/cucumber/cucumber-ruby-core.git', 'cucumber-wire' => 'https://github.com/cucumber/cucumber-ruby-wire.git', 'diff-lcs' => 'https://github.com/halostatue/diff-lcs.git', 'elasticsearch-api' => 'https://github.com/elastic/elasticsearch-ruby.git', 'elasticsearch-transport' => 'https://github.com/elastic/elasticsearch-ruby.git', 'erubis' => 'https://github.com/kwatch/erubis.git', 'geocoder' => 'https://github.com/alexreisner/geocoder', 'hirb' => 'https://github.com/cldwalker/hirb', 'html2haml' => 'https://github.com/haml/html2haml', 'io-console' => nil, 'kaminari-actionview' => nil, 'kaminari-activerecord' => nil, 'kaminari-core' => nil, 'meta_request' => 'https://github.com/dejan/rails_panel', 'method_source' => 'https://github.com/banister/method_source', 'origin' => 'https://github.com/mongoid/origin', 'padrino' => 'https://github.com/padrino/padrino-framework', 'padrino-admin' => nil, 'padrino-cache' => nil, 'padrino-core' => nil, 'padrino-gen' => nil, 'padrino-helpers' => nil, 'padrino-mailer' => nil, 'padrino-performance' => nil, 'padrino-support' => nil, 'paranoia' => 'https://github.com/rubysherpas/paranoia', 'pdf-core' => 'https://github.com/prawnpdf/pdf-core', 'pg' => nil, 'rack-mini-profiler' => 'https://github.com/MiniProfiler/rack-mini-profiler', 'raindrops' => 'https://github.com/tmm1/raindrops', 'redis-actionpack' => 'https://github.com/redis-store/redis-actionpack', 'redis-activesupport' => 'https://github.com/redis-store/redis-activesupport', 'redis-rack' => 'https://github.com/redis-store/redis-rack', 'redis-rails' => 'https://github.com/redis-store/redis-rails', 'rouge' => 'https://github.com/jneen/rouge', 'spreadsheet' => 'https://github.com/zdavatz/spreadsheet', 'thin' => 'https://github.com/macournoyer/thin', 'uniform_notifier' => 'https://github.com/flyerhzm/uniform_notifier'}.freeze
Instance Attribute Summary collapse
-
#installer ⇒ Object
readonly
Returns the value of attribute installer.
Instance Method Summary collapse
-
#git_clone_homepage_or_source_code_uri_or_homepage_uri_or_github_organization_uri ⇒ Object
Guess the git repo from the gemspec and perform git clone.
-
#initialize(installer) ⇒ Src
constructor
A new instance of Src.
-
#remote_add_src_and_origin ⇒ Object
git remote add from the installed gem to the cloned repo so that we can easily transfer patches.
-
#repositorize_installed_gem ⇒ Object
git init the installed gem so that we can directly edit the files there.
Constructor Details
#initialize(installer) ⇒ Src
Returns a new instance of Src.
12 13 14 |
# File 'lib/rubygems_plugin.rb', line 12 def initialize(installer) @installer, @tested_repositories = installer, [] end |
Instance Attribute Details
#installer ⇒ Object (readonly)
Returns the value of attribute installer.
10 11 12 |
# File 'lib/rubygems_plugin.rb', line 10 def installer @installer end |
Instance Method Details
#git_clone_homepage_or_source_code_uri_or_homepage_uri_or_github_organization_uri ⇒ Object
Guess the git repo from the gemspec and perform git clone
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rubygems_plugin.rb', line 17 def git_clone_homepage_or_source_code_uri_or_homepage_uri_or_github_organization_uri return false if skip_clone? return false if File.exist? clone_dir now = Time.now if IRREGULAR_REPOSITORIES.key? installer.spec.name return git_clone IRREGULAR_REPOSITORIES[installer.spec.name] end result = git_clone(installer.spec.homepage) || git_clone(github_url(installer.spec.homepage)) || git_clone(source_code_uri) || git_clone(homepage_uri) || git_clone(github_url(homepage_uri)) || git_clone(github_organization_uri(installer.spec.name)) if verbose? puts "gem-src: #{installer.spec.name} - !!! Failed to find a repo." if result.nil? puts "gem-src: #{installer.spec.name} - #{Time.now - now}s" end result end |
#remote_add_src_and_origin ⇒ Object
git remote add from the installed gem to the cloned repo so that we can easily transfer patches
50 51 52 53 54 55 56 57 |
# File 'lib/rubygems_plugin.rb', line 50 def remote_add_src_and_origin if File.directory?(clone_dir) && File.directory?(gem_dir) puts "gem-src: #{installer.spec.name} - adding remotes..." if verbose? `cd #{gem_dir} && git remote add src #{clone_dir}` origin = `cd #{clone_dir} && git remote get-url origin`.chomp `cd #{gem_dir} && git remote set-url origin #{origin}` if origin end end |
#repositorize_installed_gem ⇒ Object
git init the installed gem so that we can directly edit the files there
42 43 44 45 46 47 |
# File 'lib/rubygems_plugin.rb', line 42 def repositorize_installed_gem if File.directory? gem_dir puts "gem-src: #{installer.spec.name} - repositorizing..." if verbose? `cd #{gem_dir} && ! git rev-parse --is-inside-work-tree 2> /dev/null && git init && git checkout -qb gem-src_init && git add -A && git commit -m 'Initial commit by gem-src'` end end |