Class: Commands::Status
- Inherits:
-
Object
- Object
- Commands::Status
- Defined in:
- lib/commands/status.rb
Instance Method Summary collapse
-
#options ⇒ Object
holds the options that were passed you can set any initial defaults here.
- #register(opts, global_options) ⇒ Object
-
#required_options ⇒ Object
required options.
- #run(global_options) ⇒ Object
Instance Method Details
#options ⇒ Object
holds the options that were passed you can set any initial defaults here
13 14 15 16 |
# File 'lib/commands/status.rb', line 13 def @options ||= { } end |
#register(opts, global_options) ⇒ Object
24 25 26 27 28 |
# File 'lib/commands/status.rb', line 24 def register(opts, ) opts. = "Usage: status" opts.description = "Shows the git status of all repos in the config. Expects to be called from within a top level repo." end |
#required_options ⇒ Object
required options
19 20 21 22 |
# File 'lib/commands/status.rb', line 19 def @required_options ||= Set.new [ ] end |
#run(global_options) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/commands/status.rb', line 30 def run() # see if we can open the config file - we append the .config suffix # the file is expected to be in JSON format # determine config_name by extracting parent of our directory config_name = "#{Dir.pwd}".split("/")[-2] if config_name.nil? raise "No version directory found. This command must be run from within one of your top level repos." end # try to make sure the repo is available EbmSharedLib.prepare_config_repo info = EbmSharedLib.read_repo_config(config_name) # Back up to version parent dir. This directory contains the top level repos. top_dir = File.("#{Dir.pwd}/..") repos = info[:repos] repos.each do |repo| if repo[:create_dev_branch] repo_name = EbmSharedLib.get_repo_name(repo[:git_path]) repo_path = "#{top_dir}/#{repo_name}" puts("\n#{repo_name} status:\n"); cmd = "git status" if EbmSharedLib::CL.do_cmd_result(cmd, repo_path) != 0 raise "Git status failed for #{repo_name}. Make sure you run the command from within a top level repo directory." end end end end |