Permalink
Browse files

Added sh/garlic.sh shell commands for imporving garlic workflow.

  gcd [target]    cds into the specified target working repo
  gcdp [target]   cds into the specified target plugin in the working repo
  gup             cds back up to the garlic'd repo from within a working path
  gpush [branch]  from within a working repo, pushes changes back to the local garlic target, and resets
                  local changes in that target to HEAD.

This means you might have a workflow as follows (example is for a plugin):

  # run garlic, see probs in '2-2-stable'

  gcdp 2-2  # => takes you into the working repo in the '2-2-stable' target

  # fix the changes, make some commits

  gpush     # => pushes the changes back to the enclosing garlic'd repo
  gup       # => go back up there
  garlic    # => rerun garlic to see how the changes affect the other targets
  • Loading branch information...
1 parent d2e0c7f commit 6901921b1342c6b2529654e35b32c8aa9f25fae0 @ianwhite committed Jun 27, 2009
Showing with 77 additions and 4 deletions.
  1. +8 −0 History.txt
  2. +26 −0 README.textile
  3. +1 −1 Rakefile
  4. +2 −2 garlic.gemspec
  5. +1 −1 lib/garlic.rb
  6. +5 −0 lib/garlic/session.rb
  7. +34 −0 sh/garlic.sh
View
@@ -1,3 +1,11 @@
+== 0.1.9
+
+* 1 major enhancement
+ * added garlic shell commands (sh/garlic.sh) for easing the galric workflow
+ to use them, add this to your ~/.profile
+
+ source `gem environment gemdir`/gems/ianwhite-garlic*/sh/garlic.sh
+
== 0.1.8
* 1 bugfix
View
@@ -99,6 +99,32 @@ h2. Rake tasks
If you prefer to use garlic via rake tasks, then just require 'garlic/tasks' and you'll get a bunch of em.
Once required, do rake -T to see descriptions.
+h2. garlic workflow shell commands
+
+If you add the following line to your .profile
+
+ source `gem environment gemdir`/gems/ianwhite-garlic*/sh/garlic.sh
+
+Then you'll get these 4 new shell commands:
+
+ gcd [target] cds into the specified target working repo
+ gcdp [target] cds into the specified target plugin in the working repo
+ gup cds back up to the garlic'd repo from within a working path
+ gpush [branch] from within a working repo, pushes changes back to the local garlic target, and resets
+ local changes in that target to HEAD.
+
+This means you might have a workflow as follows (example is for a plugin):
+
+ # run garlic, see probs in '2-2-stable'
+
+ gcdp 2-2 # => takes you into the working repo in the '2-2-stable' target
+
+ # fix the changes, make some commits
+
+ gpush # => pushes the changes back to the enclosing garlic'd repo
+ gup # => go back up there
+ garlic # => rerun garlic to see how the changes affect the other targets
+
h2. Lend a hand
This is an early release, so there is plenty of scope for changes and improvement
View
@@ -20,7 +20,7 @@ spec = Gem::Specification.new do |s|
s.rdoc_options << "--title" << "Garlic" << "--line-numbers"
s.test_files = FileList["spec/**/*_spec.rb"]
s.files = FileList[
- "lib/**/*.rb", "templates/*.rb",
+ "lib/**/*.rb", "templates/*.rb", "bin/*", "sh/*",
"License.txt", "README.textile", "Todo.txt", "History.txt"
]
s.executables = ["garlic"]
View
@@ -6,12 +6,12 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Ian White"]
- s.date = %q{2009-02-08}
+ s.date = %q{2009-06-27}
s.default_executable = %q{garlic}
s.description = %q{Set of commands/rake-tasks for CI against multiple version of rails/deps.}
s.email = %q{ian.w.white@gmail.com}
s.executables = ["garlic"]
- s.files = ["lib/garlic/configurator.rb", "lib/garlic/generator.rb", "lib/garlic/repo.rb", "lib/garlic/session.rb", "lib/garlic/shell.rb", "lib/garlic/target.rb", "lib/garlic/tasks.rb", "lib/garlic.rb", "lib/tabtab_definitions/garlic.rb", "templates/default.rb", "templates/rspec.rb", "templates/shoulda.rb", "License.txt", "README.textile", "Todo.txt", "History.txt", "spec/garlic/repo_spec.rb", "bin/garlic"]
+ s.files = ["lib/garlic/configurator.rb", "lib/garlic/generator.rb", "lib/garlic/repo.rb", "lib/garlic/session.rb", "lib/garlic/shell.rb", "lib/garlic/target.rb", "lib/garlic/tasks.rb", "lib/garlic.rb", "lib/tabtab_definitions/garlic.rb", "templates/default.rb", "templates/rspec.rb", "templates/shoulda.rb", "bin/garlic", "sh/garlic.sh", "License.txt", "README.textile", "Todo.txt", "History.txt", "spec/garlic/repo_spec.rb"]
s.has_rdoc = true
s.homepage = %q{http://github.com/ianwhite/garlic/tree}
s.rdoc_options = ["--title", "Garlic", "--line-numbers"]
View
@@ -11,7 +11,7 @@ module Garlic
module Version
Major = 0
Minor = 1
- Tiny = 8
+ Tiny = 9
String = [Major, Minor, Tiny].join('.')
end
View
@@ -104,6 +104,11 @@ def commands
shell.run
end
+ define_command :path, "return the work dir for the specified target" do |*path_target|
+ self.run_targets = path_target.first if path_target.any?
+ puts determine_targets.first.path
+ end
+
define_command :run, "Run each garlic TARGET" do
these_targets = determine_targets
target_names, failed_names = these_targets.map{|t| t.name}, []
View
@@ -0,0 +1,34 @@
+# garlic shell helpers
+
+# cd into the work path of a garlic target
+gcd ()
+{
+ cd `garlic path $1`
+}
+
+# cd into probable plugin dir of a garlic target
+gcdp ()
+{
+ here=`pwd | sed 's/.*\///'`
+ cd `garlic path $1`/vendor/plugins/$here
+}
+
+# cd back up to enclosing garlic project
+gup ()
+{
+ cd `pwd | sed 's/\.garlic.*//'`
+}
+
+# push changes back to local garlic origin, resetting the origin
+gpush ()
+{
+ if [ `pwd | sed 's/\.garlic//'` == `pwd` ]; then
+ echo "gpush can only be used in a garlic work repo";
+ else
+ git push origin $1 2>&1 | grep -v warning;
+ here=`pwd`;
+ gup;
+ git reset --hard;
+ cd $here;
+ fi
+}

0 comments on commit 6901921

Please sign in to comment.