lib/pivotoolz/git_branch.rb in pivotoolz-0.2.0 vs lib/pivotoolz/git_branch.rb in pivotoolz-1.0.0
- old
+ new
@@ -12,15 +12,19 @@
author = set_author
category = set_category(story['story_type'])
description = set_description(story['name'])
pivotal_id = story['id']
- "#{author}/#{category}/#{description}-#{pivotal_id}"
+ create_branch("#{author}/#{category}/#{description}-#{pivotal_id}")
end
private
+ def create_branch(branch_name)
+ `git checkout -b #{branch_name}`
+ end
+
def get_pivotal_story(pivotal_id)
unless ENV['PIVOTAL_TRACKER_API_TOKEN']
puts "!: You need to set the 'PIVOTAL_TRACKER_API_TOKEN' environment variable"
exit
end
@@ -61,8 +65,8 @@
description.gsub!(/ +/,'-') # collapse spacing and replace spaces with dashes
description[0 .. 45].gsub(/-$/, '')
end
def self.usage_message
- "Usage : bin/git-branch-it [pivotal_story_id]"
+ "Usage : pv-git-branch '[pivotal_story_id]'"
end
end