Skip to content

dsabeti/sprout-git

 
 

Repository files navigation

sprout-git cookbook

Build Status

Recipes to install git related tools on OS X.

Prerequisites

Quickstart

bundle
bundle exec soloist

Cookbook Usage

Recent changes:

  • the projects attributes have changed from an array of tuples:

    node_attributes:
      sprout:
        git:
          projects:
            - # e.g. ~/workspace/foo
              - foo
              - https://github.com/pivotal-sprout/sprout-git.git
    

    to an array of hashes:

    node_attributes:
      sprout:
        git:
          projects:
            - # e.g. ~/workspace/foo
              url: https://github.com/pivotal-sprout/sprout-git.git
              name: foo
    

    the tuple syntax is deprecated but will continue to work for the near term until enough people have transitioned. See the Attributes section for more details an the new syntax.

  • the projects attributes now include a way to run arbitrary commands on the freshly cloned repo:

The commands will be run in sequence. If one of the commands fails (retunrs non-zero) subsequen commands continue to run and the Sprout run is not affected. Future runs of sprout would not re-run these commands unless the repo was previously deleted. i.e. they only get run on a fresh clone of the project.

node_attributes:
  sprout:
    git:
      projects:
        - # an example that initializes submodules, installs all gems, sets up the databases, runs rspec, and executes other arbitrary commands even with some failing
          url: https://github.com/pivotal-sprout/sprout-git.git
          post_clone_commands:
            - git submodule update --init
            - gem install bundler
            - bundle
            - rake db:create db:migrate
            - RAILS_ENV=test rake db:create db:migrate
            - rake spec
            - false
            - echo "I'm still run even though the last command failed"
  • Projects no longer explicity set master's upstream branch to origin/master

This is done when the repo is cloned so sprout does not need to explicitly do this.

  • Projects using the new hash syntax no longer automatically do a git submodule update --init

If the project needs to have submodules initialized then those entries should include the command as a post-clone command. If the soloistrc is still using the legacy tuple syntax which cannot specify post_clone_commands then we continue to run the submodule update --init on all projects regardless of whether they have submodules.

Attributes:

NOTE: All preferences are namespaced under sprout => git they include:

  • prefix — the email prefix to used by git-pair — default is 'pair'
  • domain — email address domain to be used by git-pair — default is 'example.com'
  • authors — a list of authors to install either into the ~/.pairs or ~/.git-authors files — default is empty. see the soloistrc file for examples.
  • global_config A set of configurations to be installed globally by the global_config recipe. — see config.rb
  • base_aliases A set of git aliases like ci,br, etc to install. Used by the aliases recipe — dfault is empty. see the soloistrc or aliases.rb files for examples.
  • aliases — an additional set of custom aliases to be installed in addition to the base_aliases. Used by the aliases recipe — default is empty. see the soloistrc or aliases.rb files for examples.
  • projects — The list of repositories to automatically clone. Used by the projects recipe — this is empty by default see the soloistrc or the attributes/projects.rb files for examples. it contains an array of project hashes with the following keys:
    • urlrequired — The repo url to clone clone. — e.g. https://example.com/some/repo.git
    • nameoptional — The name of the local folder containing the repo. — e.g. my_repo
    • workspace_pathoptional — The path to clone into. — e.g. ~/personal_projects or /abs/path/to/personal_projects
    • post_clone_commandsoptional — A list of commands to run on the freshly cloned repository. Note this is only run on a fresh clone. Future runs of sprout will not cause these commands to be re-run. — Some example commands could include:
      • gem install bundler
      • bundle
      • rake db:create:all db:test:prepare default
      • pod install
      • git submodule update --init
  • workspace_directory — the location under the users home to clone the projects unless otherwise specified by the project config. Used by the projects recipe — default is 'workspace'

Recipes:

  • sprout-git — default recipe
  • sprout-git::aliases — installs common git aliases such as git st
  • sprout-git::authors — install ~/.git-authors file used by git-duet ; note: this is not in the default recipe
  • sprout-git::default_editor — installs bash-it plugin to set default git editor
  • sprout-git::git_scripts — installs pivotal [git_scripts] onto to the system using system ruby. Also installs/overwrites the ~/.pairs file. ; note: this is not in the default recipe
  • sprout-git::global_config — adds global git configurations defined by the sprout => git => global_config node attributes
  • sprout-git::global_ignore — adds basic global git ignore file
  • sprout-git::install — install git using homebrew
  • sprout-git::projects — clones all projects defined byt the sprout => git => projects node attribute ; note: this is not in the default recipe

Contributing

Before committing

bundle
bundle exec rake

The default rake task includes rubocop, foodcritic, unit specs

bundle
bundle exec rake rubocop
bundle
bundle exec rake foodcritic

Unit specs

Unit specs use ServerSpec

bundle
bundle exec rake spec:unit

Integration specs

Integrations specs will run the default recipe on the host system (destructive) and make assertions on the system after install.

Note: It has a precondition that git-pair is not already installed on the system.

bundle
bundle exec rake spec:integration

foo

About

Recipes to manage git on OS X

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 95.4%
  • HTML 4.5%
  • Shell 0.1%