Module: Polisher::Git::PkgUpdater
- Included in:
- Pkg
- Defined in:
- lib/polisher/git/pkg/updater.rb
Instance Method Summary collapse
-
#gen_sources_for(gem) ⇒ Object
Generate new sources file.
-
#ignore(gem) ⇒ Object
Update git ignore to ignore gem.
- #update_metadata(gem) ⇒ Object
-
#update_spec_to(gem) ⇒ Object
Update the local spec to the specified gem version.
-
#update_to(gem) ⇒ Object
Update the local pkg to specified gem.
Instance Method Details
#gen_sources_for(gem) ⇒ Object
Generate new sources file
23 24 25 26 27 28 29 30 |
# File 'lib/polisher/git/pkg/updater.rb', line 23 def gen_sources_for(gem) require_dep! 'awesome_spawn' require_cmd! md5sum_cmd in_repo do AwesomeSpawn.run "#{md5sum_cmd} #{gem.gem_path} > sources" File.write('sources', File.read('sources').gsub("#{GemCache::DIR}/", '')) end end |
#ignore(gem) ⇒ Object
Update git ignore to ignore gem
33 34 35 36 37 38 39 |
# File 'lib/polisher/git/pkg/updater.rb', line 33 def ignore(gem) in_repo do nl = File.exist?('.gitignore') ? "\n" : '' content = "#{nl}#{gem.name}-#{gem.version}.gem" File.open(".gitignore", 'a') { |f| f.write content } end end |
#update_metadata(gem) ⇒ Object
9 10 11 |
# File 'lib/polisher/git/pkg/updater.rb', line 9 def (gem) @version = gem.version end |
#update_spec_to(gem) ⇒ Object
Update the local spec to the specified gem version
14 15 16 17 18 19 20 |
# File 'lib/polisher/git/pkg/updater.rb', line 14 def update_spec_to(gem) in_repo do spec.update_to(gem) File.write(spec_file, spec.to_string) @dirty_spec = true end end |
#update_to(gem) ⇒ Object
Update the local pkg to specified gem
44 45 46 47 48 49 50 |
# File 'lib/polisher/git/pkg/updater.rb', line 44 def update_to(gem) gem update_spec_to gem gen_sources_for gem ignore gem self end |