karo 2.1.3 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of karo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed831af592641d33332486b9518ccd2f14841f5f
4
- data.tar.gz: 57fabfc94997c544d56ead8e550530cddc87595b
3
+ metadata.gz: 63ca7082a6e2718a8c2c027623a794191a5fee07
4
+ data.tar.gz: 250465beeecb6d0bd96c02fe51823c706ce0ca3e
5
5
  SHA512:
6
- metadata.gz: 31e0ed4cf41b9453240269ae7cfebd6aa4328b2624c8ea2f6d67fd8a1fbd720cc5a7e9b74a2d1d857f2e7df79591f1b56cf0f0a5ecb72a5df7ff09aa46ec873c
7
- data.tar.gz: 17c5819988ee08dd3133c5091e0017a436681cd7479505b9bf54167c5525baaf9ee0e02360baa08a8f3545384174f8fcf68af85f154799f48701b38ba85c8685
6
+ metadata.gz: ea774911562aa8dc3e2c7a32ef2acdd9783527e9bdc7935dfd71c9a89acffd2631a93d59bc670aa7bc1330b11bb9ae8a281da3212a867bd644056617f3a7c0ee
7
+ data.tar.gz: 9399116b443b49488c23627aec7124ad2ffb2bbc007285c85fad46372124502d6403b677897bd27049ed11d5de02f52054fe343e0e7fed77a7411ec3e799097e
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v2.2.0
4
+
5
+ ### Features
6
+
7
+ - Added basic git workflow to create feature and bug fix branches
8
+
3
9
  ## v2.1.3
4
10
 
5
11
  ### Features
@@ -25,5 +25,6 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "aruba"
26
26
  spec.add_development_dependency "rake", "~> 0.9.2"
27
27
  spec.add_dependency "awesome_print"
28
+ spec.add_dependency "grit"
28
29
  spec.add_dependency "thor"
29
30
  end
@@ -1,3 +1,4 @@
1
+ require 'karo/workflow'
1
2
  require 'karo/version'
2
3
  require 'karo/common'
3
4
  require 'karo/assets'
@@ -28,6 +29,9 @@ module Karo
28
29
  desc "db [pull, push, console]", "syncs MySQL database between server and localhost"
29
30
  subcommand "db", Db
30
31
 
32
+ desc "workflow [feature, bugfix]", "basic git workflow to create feature and bugfix branches"
33
+ subcommand "workflow", Workflow
34
+
31
35
  desc "config", "displays server configuration stored in a config file"
32
36
  def config
33
37
  configuration = Config.load_configuration(options)
@@ -24,6 +24,31 @@ module Karo
24
24
  system cmd
25
25
  end
26
26
 
27
+ def git_repo
28
+ Grit::Repo.new(".")
29
+ end
30
+
31
+ def branch_exists?(name)
32
+ git_repo.branches.find { |b| b.name.start_with?(name) }
33
+ end
34
+
35
+ def create_branch(name)
36
+ run_it "git branch #{name}", options[:verbose]
37
+ end
38
+
39
+ def checkout_branch(name)
40
+ run_it "git checkout #{name}", options[:verbose]
41
+ end
42
+
43
+ def current_branch
44
+ git_repo.head.name
45
+ end
46
+
47
+ def create_and_checkout_branch(name)
48
+ create_branch name
49
+ checkout_branch name
50
+ end
51
+
27
52
  end
28
53
 
29
54
  end
@@ -1,3 +1,3 @@
1
1
  module Karo
2
- VERSION = "2.1.3"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -0,0 +1,41 @@
1
+ require 'karo/common'
2
+ require 'thor'
3
+ require 'grit'
4
+
5
+ module Karo
6
+
7
+ class Workflow < Thor
8
+
9
+ include Karo::Common
10
+
11
+ desc "feature", "create a feature branch for a given name"
12
+ def feature(name)
13
+ branch_name = "feature/#{name}"
14
+
15
+ if current_branch.eql?(branch_name)
16
+ say "You are already on #{branch_name} this feature branch", :red
17
+ elsif branch_exists? branch_name
18
+ say "Feature branch #{branch_name} already exists! so checking it out", :red
19
+ checkout_branch branch_name
20
+ else
21
+ create_and_checkout_branch branch_name
22
+ end
23
+ end
24
+
25
+ desc "bugfix", "create a bug fix branch for a given name"
26
+ def bugfix(name)
27
+ branch_name = "bugfix/#{name}"
28
+
29
+ if current_branch.eql?(branch_name)
30
+ say "You are already on #{branch_name} this bug fix branch", :red
31
+ elsif branch_exists? branch_name
32
+ say "Bug fix branch #{branch_name} already exists! so checking it out", :red
33
+ checkout_branch branch_name
34
+ else
35
+ create_and_checkout_branch branch_name
36
+ end
37
+ end
38
+
39
+ end
40
+
41
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rahul Trikha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-05 00:00:00.000000000 Z
11
+ date: 2013-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: grit
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: thor
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -152,6 +166,7 @@ files:
152
166
  - lib/karo/db.rb
153
167
  - lib/karo/templates/karo.yml
154
168
  - lib/karo/version.rb
169
+ - lib/karo/workflow.rb
155
170
  - test/tc_something.rb
156
171
  homepage: http://rahult.github.io/karo/
157
172
  licenses: