Class: Publish

Inherits:
Array show all
Defined in:
lib/tasks/publish.rb

Instance Attribute Summary

Attributes inherited from Array

#env

Instance Method Summary collapse

Methods inherited from Array

#add, #add_passive, #add_quiet, #execute, #has_command?, #initialize, #log_debug_info, #to_html

Constructor Details

This class inherits a constructor from Array

Instance Method Details

#updateObject


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/tasks/publish.rb', line 8

def update
  add_quiet "<%Git.tag('#{Rake.application.original_dir}','#{VERSION}')%>" if File.exist?(".git") && defined?(VERSION)

  if Internet.available?
    if File.exist?(".git") && `git branch`.include?("* master")
      Dir.glob("*.gemspec").each do |gemspec_file|
        add_passive "gem push #{Gemspec.gemfile(gemspec_file)}" unless Gemspec.published? gemspec_file
      end
    end
    if File.exist?(".svn") && `svn info`.include?("/trunk")
      Dir.glob("*.gemspec").each do |gemspec_file|
        add_quiet "gem push #{Gemspec.gemfile(gemspec_file)}" unless Gemspec.published? gemspec_file
      end
    end
  end
end