Module: Gitstart::Status

Extended by:
Help, Status
Included in:
Status
Defined in:
lib/gitstart.rb

Instance Method Summary collapse

Instance Method Details

#statusObject



129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/gitstart.rb', line 129

def status
  target = Dir.pwd
  
  unless File.directory?('.git')
    ui.puts "#{target} does not appear to be a git repository"
    exit 1
  end
  
  ui.puts "Status for project at #{target}:"
  ui.indent
  ui.puts *Sh::Git.status.split("\n")
  ui.unindent
  ui.puts
end

#status_with_externalsObject



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/gitstart.rb', line 144

def status_with_externals
  status
  
  external_info_file = '.externals/externals_info.yaml'
  unless File.exist?(external_info_file)
    ui.puts "cannot locate the #{external_info_file} to load externals"
    exit 1
  end
  
  externals = YAML.load(File.open(external_info_file))
  
  externals.each do |dir, repos|
    repos.each do |ext_dir, ext_repo|
      target = File.join(dir, ext_dir)
      ui.puts "Status for external at #{target}:"
      Dir.chdir(target) do
        ui.indent
        ui.puts *Sh::Git.status.split("\n")
        ui.unindent
      end
      ui.puts
    end
  end
end