Class: Publish

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

Overview

require_relative(‘internet.rb’)

Instance Method Summary collapse

Methods inherited from Array

#add, #execute, #to_html

Instance Method Details

#updateObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/commands/publish.rb', line 3

def update
  if(Internet.available?)
    if(File.exists?('.git'))
      if(`git branch`.include?('* master'))
        Dir.glob('*.gemspec').each{|gemspec_file|
          add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
        }
      end
    end
    if(File.exists?('.svn'))
      if(`svn info`.include?('/trunk'))
        Dir.glob('*.gemspec').each{|gemspec_file|
          add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
        }
      end
    end
  end
end