rgitflow 0.2.0.pre.alpha.pre.21 → 0.2.0.pre.alpha.pre.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTI5OTVjNzgyZmUwMWI4N2IyYjFhZWY1Njg3YTMwYjNlYTBmODFmNw==
4
+ N2RhM2RjMjM0MDY1MjNhOTNkYmY1ZWYzYzhiN2U2MTlhOTYxZmQ5MQ==
5
5
  data.tar.gz: !binary |-
6
- NzdiNjA5NjlhYTMxNTNhZDdiNDNlNjBiZTFkM2Q1NDdlZGQ2ODNkYg==
6
+ NmU2MGJjNmIwZGQwYzg1Nzg2NGRjMmE4YWExN2ZkMmRiZTRjOGJjNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YmE1NTM0Y2ZlNmE4OWExNWM0YTYyMDg3NTM3NjVkM2FiMGE2NmUxNzFjNWQ2
10
- ZDM2YWE1ZGI3ZTIzOWIyNTY0NmQwYzJlMDJlODRjYWUzZWJhMGUzNWM2NDRh
11
- MGQ1MmYwZWNhNWU3NjJiNjgzNWQ0N2U1MmM2NWY1OWU1NmVjNTU=
9
+ YmMzOWFjNmQ2YzI5ZDE3Mjk0YmQxZmViOWZiYTM2MGIxOGEzN2E5MzIxNWEz
10
+ YmExYzYxYmNlY2Y0ZWFkMDM0YjRkYjhmZjE2ZWRhOWRmMjhmNDUwN2Y1MmFh
11
+ MmJiYzUxZDJjMDI5M2JjZWM0ZmJiNzBiNGRiNjkyMzNiMGY2NmQ=
12
12
  data.tar.gz: !binary |-
13
- ODQzNDQ0N2RiMzRjMzgzZmVmMjYyYTliMWVkZGFjYWQ0YmFhNzU4MmFmMjZl
14
- NmQ0OGFkMGY0YjZhYmQ1NzM0NDQzZWRkMjk2M2QxYTE5MjA5MjE3OTBlOGQy
15
- MTlhZWE1MTliNDE0NDBkYTdmMWIzZDhjZTkyOWQxNmFhMTFlMGU=
13
+ OTViZTg1OTU1YzIzZWI2NjIzMmM5MmMzOWU1MTkyMTg5MzA4NmU1MTk3NWVm
14
+ ZmRlNTAxYzk0MzgwMTUxNjE3ZjRiMWI4MjY5OGRjMDJkZTVlZWM5YzMwNzYz
15
+ Zjk4ZDdhZGRhYTI1NDJiMGQxYTRhOGI2ODhjYzYyOGNiZTVmZTc=
@@ -13,7 +13,8 @@ module RGitFlow
13
13
  :develop => 'develop',
14
14
  :feature => 'feature',
15
15
  :hotfix => 'hotfix',
16
- :release => 'release'
16
+ :release => 'release',
17
+ :tag => 'v%s'
17
18
  }
18
19
 
19
20
  def self.load
@@ -13,13 +13,4 @@ Git::Lib.class_eval do
13
13
  command('push', arr_opts + [branch])
14
14
  command('push', ['--tags'] + arr_opts) if opts[:tags]
15
15
  end
16
-
17
- def diff_shortstat(obj1 = 'HEAD', obj2 = nil, opts = {})
18
- diff_opts = ['--shortstat']
19
- diff_opts << obj1
20
- diff_opts << obj2 if obj2.is_a?(String)
21
- diff_opts << '--' << opts[:path_limiter] if opts[:path_limiter].is_a? String
22
-
23
- command('diff', diff_opts)
24
- end
25
16
  end
@@ -21,17 +21,17 @@ module RGitFlow
21
21
  end
22
22
 
23
23
  def install
24
- require 'rgitflow/tasks/scm/status'
25
- RGitFlow::Tasks::SCM::Status.new @git
24
+ require 'rgitflow/tasks/scm/tasks'
25
+ RGitFlow::Tasks::SCM.install_tasks :git => @git
26
26
 
27
27
  require 'rgitflow/tasks/feature/tasks'
28
- RGitFlow::Tasks::Feature.install_tasks({:git => @git})
28
+ RGitFlow::Tasks::Feature.install_tasks :git => @git
29
29
 
30
30
  require 'rgitflow/tasks/hotfix/tasks'
31
- RGitFlow::Tasks::Hotfix.install_tasks({:git => @git})
31
+ RGitFlow::Tasks::Hotfix.install_tasks :git => @git
32
32
 
33
33
  require 'rgitflow/tasks/release/tasks'
34
- RGitFlow::Tasks::Release.install_tasks({:git => @git})
34
+ RGitFlow::Tasks::Release.install_tasks :git => @git
35
35
  end
36
36
  end
37
37
  end
@@ -15,7 +15,7 @@ module RGitFlow
15
15
  attr_reader :git
16
16
 
17
17
  def initialize(git = nil)
18
- @git = git || Git.open(Pathname.pwd)
18
+ @git = git || Git.open(Dir.pwd)
19
19
  end
20
20
 
21
21
  def install
@@ -15,7 +15,7 @@ module RGitFlow
15
15
  attr_reader :git
16
16
 
17
17
  def initialize(git = nil)
18
- @git = git || Git.open(Pathname.pwd)
18
+ @git = git || Git.open(Dir.pwd)
19
19
  end
20
20
 
21
21
  def install
@@ -5,7 +5,8 @@ module RGitFlow
5
5
  class Release
6
6
  class Finish < RGitFlow::Tasks::Task
7
7
  def initialize(git)
8
- super(git, 'finish', 'Finish a release branch', ['rgitflow', 'release'])
8
+ super(git, 'finish', 'Finish a release branch',
9
+ ['rgitflow', 'release'], ['install'])
9
10
  end
10
11
 
11
12
  protected
@@ -16,16 +17,22 @@ module RGitFlow
16
17
  branch = @git.current_branch
17
18
 
18
19
  unless branch.start_with? RGitFlow::Config.options[:release]
19
- error 'Cannot finish a release branch unless you are in a release branch'
20
+ error %Q(Cannot finish a release branch unless you are in a release
21
+ branch)
20
22
  abort
21
23
  end
22
24
 
25
+ msg = %Q(merging #{branch} into #{RGitFlow::Config.options[:master]})
26
+
23
27
  @git.branch(RGitFlow::Config.options[:master]).checkout
24
- @git.merge branch, "merging #{branch} into #{RGitFlow::Config.options[:master]}"
28
+ @git.merge branch, msg
29
+
30
+ invoke 'rgitflow:scm:tag'
25
31
 
26
32
  @git.push
33
+ # force re-creation of develop branch
27
34
  if @git.is_remote_branch? branch
28
- @git.push('origin', branch, {:delete => true})
35
+ @git.push('origin', branch, { :delete => true })
29
36
  end
30
37
 
31
38
  @git.branch(branch).delete
@@ -15,7 +15,7 @@ module RGitFlow
15
15
  attr_reader :git
16
16
 
17
17
  def initialize(git = nil)
18
- @git = git || Git.open(Pathname.pwd)
18
+ @git = git || Git.open(Dir.pwd)
19
19
  end
20
20
 
21
21
  def install
@@ -2,7 +2,7 @@ require 'rgitflow/tasks/task'
2
2
 
3
3
  module RGitFlow
4
4
  module Tasks
5
- module SCM
5
+ class SCM
6
6
  class Status < RGitFlow::Tasks::Task
7
7
  def initialize(git)
8
8
  super(git, 'status', 'Check the status of the repository', ['rgitflow', 'scm'])
@@ -23,7 +23,7 @@ module RGitFlow
23
23
  end
24
24
 
25
25
  def dirty?
26
- @git.dirty?
26
+ @git.diff.size > 0
27
27
  end
28
28
 
29
29
  def print_status
@@ -0,0 +1,75 @@
1
+ require 'rgitflow/tasks/task'
2
+
3
+ module RGitFlow
4
+ module Tasks
5
+ class SCM
6
+ class Tag < RGitFlow::Tasks::Task
7
+ def initialize(git)
8
+ super(git, 'tag', 'Tags the repository',
9
+ ['rgitflow', 'scm'])
10
+ end
11
+
12
+ protected
13
+
14
+ def run
15
+ status 'Creating tag...'
16
+ if dirty?
17
+ error 'There are uncommitted changes in the repository!'
18
+
19
+ print_status
20
+
21
+ abort
22
+ else
23
+ status 'There are no uncommitted changes in the repository.'
24
+ end
25
+ tag = ENV['TAG'] || ("#{RGitFlow::Config.options[:tag]}" %
26
+ RGitFlow::VERSION.to_s)
27
+ unless @git.tags.select { |t| t.name == tag }.length == 0
28
+ error 'Cannot create a tag that already exists!'
29
+ abort
30
+ end
31
+ @git.add_tag tag, { :m => "tagging as #{tag}" }
32
+
33
+ @git.push 'origin', @git.current_branch, { :tags => true }
34
+
35
+ status 'Successfully created tag!'
36
+ end
37
+
38
+ def dirty?
39
+ @git.dirty?
40
+ end
41
+
42
+ def print_status
43
+ added = []
44
+ modified = []
45
+ deleted = []
46
+
47
+ @git.diff.each { |f|
48
+ if f.type == 'new'
49
+ added << f
50
+ elsif f.type == 'modified'
51
+ modified << f
52
+ elsif f.type == 'deleted'
53
+ deleted << f
54
+ end
55
+ }
56
+
57
+ debug 'added'
58
+ msg = %Q(#{ANSI::Constants::GREEN}#{ANSI::Constants::BRIGHT}
59
+ #{f.path}#{ANSI::Constants::CLEAR})
60
+ added.each { |f| debug " #{msg}" }
61
+
62
+ debug 'modified'
63
+ msg = %Q(#{ANSI::Constants::YELLOW}#{ANSI::Constants::BRIGHT}
64
+ #{f.path}#{ANSI::Constants::CLEAR})
65
+ modified.each { |f| debug " #{msg}" }
66
+
67
+ debug 'deleted'
68
+ msg = %Q(#{ANSI::Constants::RED}#{ANSI::Constants::BRIGHT}
69
+ #{f.path}#{ANSI::Constants::CLEAR})
70
+ deleted.each { |f| debug " #{msg}" }
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,27 @@
1
+ module RGitFlow
2
+ module Tasks
3
+ class SCM
4
+ autoload :Status, 'rgitflow/tasks/scm/status'
5
+ autoload :Tag, 'rgitflow/tasks/scm/tag'
6
+
7
+ class << self
8
+ attr_accessor :instance
9
+
10
+ def install_tasks(opts = {})
11
+ new(opts[:git]).install
12
+ end
13
+ end
14
+
15
+ attr_reader :git
16
+
17
+ def initialize(git = nil)
18
+ @git = git || Git.open(Dir.pwd)
19
+ end
20
+
21
+ def install
22
+ Status.new @git
23
+ Tag.new @git
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,5 +1,3 @@
1
- require 'rgitflow/printing'
2
-
3
1
  require 'rake'
4
2
  require 'rake/tasklib'
5
3
 
@@ -7,6 +5,7 @@ module RGitFlow
7
5
  module Tasks
8
6
  class Task < ::Rake::TaskLib
9
7
  include RGitFlow::Printing
8
+ include RGitFlow::Console
10
9
  # The namespaces of the task
11
10
  # @return [Array<String>] the task namespaces
12
11
  attr_accessor :namespaces
@@ -19,6 +18,10 @@ module RGitFlow
19
18
  # @return [String] the task description
20
19
  attr_accessor :description
21
20
 
21
+ # The dependencies of the task
22
+ # @return [Array<String>] the dependencies of the task
23
+ attr_accessor :dependencies
24
+
22
25
  # Runs a +Proc+ before the task
23
26
  # @return [Proc] a proc to call before running the task
24
27
  attr_accessor :before
@@ -27,11 +30,13 @@ module RGitFlow
27
30
  # @return [Proc] a proc to call after running the task
28
31
  attr_accessor :after
29
32
 
30
- def initialize(git, name, description, namespaces = ['rgitflow'])
33
+ def initialize(git, name, description, namespaces = ['rgitflow'],
34
+ dependencies = [])
31
35
  @git = git
32
36
  @name = name
33
37
  @description = description
34
38
  @namespaces = namespaces
39
+ @dependencies = dependencies
35
40
 
36
41
  yield self if block_given?
37
42
 
@@ -41,8 +46,10 @@ module RGitFlow
41
46
  protected
42
47
 
43
48
  def define
49
+ full_name = [*@namespaces, @name].join(":")
50
+
44
51
  desc @description unless ::Rake.application.last_comment
45
- task([*@namespaces, @name].join(":")) do
52
+ task full_name => @dependencies do
46
53
  before.call if before.is_a?(Proc)
47
54
  run
48
55
  after.call if after.is_a?(Proc)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgitflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre.alpha.pre.21
4
+ version: 0.2.0.pre.alpha.pre.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Harrah
@@ -152,8 +152,6 @@ files:
152
152
  - lib/rgitflow/console.rb
153
153
  - lib/rgitflow/core_ext/object.rb
154
154
  - lib/rgitflow/core_ext/symbol_hash.rb
155
- - lib/rgitflow/git_ext/base.rb
156
- - lib/rgitflow/git_ext/diff.rb
157
155
  - lib/rgitflow/git_ext/lib.rb
158
156
  - lib/rgitflow/install.rb
159
157
  - lib/rgitflow/printing.rb
@@ -167,6 +165,8 @@ files:
167
165
  - lib/rgitflow/tasks/release/start.rb
168
166
  - lib/rgitflow/tasks/release/tasks.rb
169
167
  - lib/rgitflow/tasks/scm/status.rb
168
+ - lib/rgitflow/tasks/scm/tag.rb
169
+ - lib/rgitflow/tasks/scm/tasks.rb
170
170
  - lib/rgitflow/tasks/task.rb
171
171
  - lib/rgitflow/version.rb
172
172
  - rgitflow.gemspec
@@ -1,9 +0,0 @@
1
- require 'git/base'
2
-
3
- Git::Base.class_eval do
4
- def dirty?
5
- puts '0 files changed, 0 insertions(+), 0 deletions(-)'
6
- puts diff.diff_shortstat.to_s.strip
7
- '0 files changed, 0 insertions(+), 0 deletions(-)' != diff.diff_shortstat.to_s.strip
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- require 'git/diff'
2
-
3
- Git::Diff.class_eval do
4
-
5
- def diff_shortstat
6
- unless @cached_shortstat
7
- @cached_shortstat = @base.lib.diff_shortstat(@from, @to, {:path_limiter => @path})
8
- end
9
- end
10
-
11
- end