falkorlib 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +11 -10
- data/Rakefile +6 -15
- data/lib/falkorlib/config.rb +2 -2
- data/lib/falkorlib/gem_tasks.rb +29 -0
- data/lib/falkorlib/git/base.rb +11 -5
- data/lib/falkorlib/tasks/gem.rake +104 -0
- data/lib/falkorlib/tasks/gem.rb +29 -0
- data/lib/falkorlib/tasks/gitflow.rake +18 -1
- data/lib/falkorlib/tasks/rspec.rake +2 -2
- data/lib/falkorlib/version.rb +1 -1
- data/lib/falkorlib/versioning.rb +8 -10
- data/spec/falkorlib/git_spec.rb +3 -2
- data/spec/falkorlib/gitflow_spec.rb +40 -40
- data/spec/falkorlib/versioning_spec.rb +69 -64
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e319bb2ed3e993edc52ceceb6c66fa8f24003e4
|
4
|
+
data.tar.gz: 3df0f1ddaa99fae1752c5071d5b59899f9541d28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61aa9c7a4ebe03537b4abbb6a781f4a3448b32cc88f296dc8c5df7c261895ee66270e1c63427ee2977590a7d22611c9cd2a0ac27a2808a88bbeafc305f4b27b6
|
7
|
+
data.tar.gz: 6793c79f88f90bb513d5e8077bcc6643006a0c595b7309727d119ca42040d8b6de575d5b4bdf036f67b8ae95a3257f0443fc16165becf316b338acf8812e19c3
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
-*- mode: markdown; mode: auto-fill; fill-column: 80 -*-
|
2
2
|
|
3
|
-
|
3
|
+
[![Version ](https://badge.fury.io/rb/falkorlib.png)](http://badge.fury.io/rb/falkorlib)
|
4
|
+
[![Build Status](https://travis-ci.org/Falkor/falkorlib.png)](https://travis-ci.org/Falkor/falkorlib)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/Falkor/falkorlib.png)](https://codeclimate.com/github/Falkor/falkorlib)
|
6
|
+
[![Inline docs ](http://inch-ci.org/github/Falkor/falkorlib.svg)](http://inch-ci.org/github/Falkor/falkorlib)
|
7
|
+
[![Gittip
|
8
|
+
](http://img.shields.io/gittip/Falkor.svg)](http://gittip.com/Falkor)
|
9
|
+
|
4
10
|
_____ _ _ _ _ _
|
5
11
|
| ___|_ _| | | _____ _ __| | (_) |__
|
6
12
|
| |_ / _` | | |/ / _ \| '__| | | | '_ \
|
@@ -9,18 +15,13 @@
|
|
9
15
|
|
10
16
|
|
11
17
|
Copyright (c) 2012-2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
12
|
-
https://github.com/Falkor/falkorlib
|
13
|
-
|
14
|
-
|
15
|
-
# FalkorLib
|
16
|
-
|
17
|
-
[![Build Status](https://travis-ci.org/Falkor/falkorlib.png)](https://travis-ci.org/Falkor/falkorlib)
|
18
18
|
|
19
19
|
Sebastien Varrette aka Falkor's Common library to share Ruby code and `{rake,cap}`
|
20
|
-
tasks.
|
20
|
+
tasks.
|
21
21
|
|
22
|
-
* [
|
23
|
-
* [
|
22
|
+
* [MIT Licence](Licence.md)
|
23
|
+
* [Official Gem site](https://rubygems.org/gems/falkorlib)
|
24
|
+
* [GitHub Homepage](https://github.com/Falkor/falkorlib)
|
24
25
|
|
25
26
|
## Installation
|
26
27
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
##############################################################################
|
2
2
|
# Rakefile - Configuration file for rake (http://rake.rubyforge.org/)
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Ven 2014-06-20 00:10 svarrette>
|
4
4
|
#
|
5
5
|
# Copyright (c) 2012 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
6
6
|
# . http://varrette.gforge.uni.lu
|
@@ -23,16 +23,6 @@ require 'rake/clean'
|
|
23
23
|
CLEAN.add 'pkg'
|
24
24
|
CLOBBER.add 'doc'
|
25
25
|
|
26
|
-
#.....................
|
27
|
-
#namespace :gem do
|
28
|
-
require 'rubygems/tasks'
|
29
|
-
Gem::Tasks.new do |tasks|
|
30
|
-
tasks.console.command = 'pry'
|
31
|
-
tasks.sign.checksum = true
|
32
|
-
tasks.sign.pgp = true
|
33
|
-
end
|
34
|
-
#end # namespace gem
|
35
|
-
|
36
26
|
#__________________ My own rake tasks __________________
|
37
27
|
lib = File.expand_path('../lib', __FILE__)
|
38
28
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
@@ -52,11 +42,12 @@ FalkorLib.config.gitflow do |c|
|
|
52
42
|
}
|
53
43
|
end
|
54
44
|
|
45
|
+
require "falkorlib/tasks/git" # OR require "falkorlib/git_tasks"
|
46
|
+
require "falkorlib/tasks/gem" # OR require "falkorlib/gem_tasks"
|
55
47
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
48
|
+
# [ 'rspec', 'yard' ] .each do |tasks|
|
49
|
+
# load "falkorlib/tasks/#{tasks}.rake"
|
50
|
+
# end
|
60
51
|
|
61
52
|
# desc "clean the directory"
|
62
53
|
# task :clean => :clobber_package do
|
data/lib/falkorlib/config.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Ven 2014-06-20 12:04 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# FalkorLib Configuration
|
6
6
|
#
|
@@ -37,7 +37,7 @@ module FalkorLib #:nodoc:
|
|
37
37
|
end
|
38
38
|
|
39
39
|
|
40
|
-
module Config
|
40
|
+
module Config #:nodoc:
|
41
41
|
# Defaults global settings
|
42
42
|
DEFAULTS = {
|
43
43
|
:debug => false,
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
################################################################################
|
3
|
+
# Time-stamp: <Ven 2014-06-20 00:10 svarrette>
|
4
|
+
################################################################################
|
5
|
+
#
|
6
|
+
# FalkorLib rake tasks to pilot Gem operations
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'rake'
|
10
|
+
require 'falkorlib'
|
11
|
+
require 'falkorlib/tasks'
|
12
|
+
|
13
|
+
module FalkorLib #:nodoc:
|
14
|
+
|
15
|
+
# Rake tasks to pilot Gem operations
|
16
|
+
class GemTasks
|
17
|
+
include Rake::DSL if defined? Rake::DSL
|
18
|
+
|
19
|
+
# Install the gem tasks for Rake
|
20
|
+
def install_tasks
|
21
|
+
load 'falkorlib/tasks/gem.rake'
|
22
|
+
load 'falkorlib/tasks/yard.rake'
|
23
|
+
load 'falkorlib/tasks/rspec.rake'
|
24
|
+
end
|
25
|
+
end # class FalkorLib::GemTasks
|
26
|
+
end # module FalkorLib
|
27
|
+
|
28
|
+
# Now install them ;)
|
29
|
+
FalkorLib::GemTasks.new.install_tasks
|
data/lib/falkorlib/git/base.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Ven 2014-06-20 09:15 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# Interface for the main Git operations
|
6
6
|
#
|
@@ -99,10 +99,16 @@ module FalkorLib #:nodoc:
|
|
99
99
|
#MiniGit[userconf] = default_val
|
100
100
|
end
|
101
101
|
end
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
102
|
+
exit_status = 1
|
103
|
+
Dir.chdir( path ) do
|
104
|
+
execute "git init" unless FalkorLib.config.debug
|
105
|
+
exit_status = $?.to_i
|
106
|
+
end
|
107
|
+
# #puts "#init #{path}"
|
108
|
+
# Dir.chdir( "#{path}" ) do
|
109
|
+
# %x[ pwd && git init ] unless FalkorLib.config.debug
|
110
|
+
# end
|
111
|
+
exit_status
|
106
112
|
end
|
107
113
|
|
108
114
|
# Return the Git working tree from the proposed path (current directory by default)
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
################################################################################
|
3
|
+
# gem.rake - Special tasks for the management of Gem operations
|
4
|
+
# Time-stamp: <Ven 2014-06-20 15:00 svarrette>
|
5
|
+
#
|
6
|
+
# Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
7
|
+
# http://varrette.gforge.uni.lu
|
8
|
+
################################################################################
|
9
|
+
|
10
|
+
require 'falkorlib'
|
11
|
+
require 'falkorlib/tasks'
|
12
|
+
require 'falkorlib/git'
|
13
|
+
require 'rubygems/tasks'
|
14
|
+
|
15
|
+
#.....................
|
16
|
+
namespace :gem do
|
17
|
+
Gem::Tasks::Console.new(:command => 'pry')
|
18
|
+
|
19
|
+
########### gem:release ###########
|
20
|
+
desc "Release the gem "
|
21
|
+
task :release => [ :build ] do |t|
|
22
|
+
pkgdir = Gem::Tasks::Project::PKG_DIR
|
23
|
+
Dir.glob("*.gemspec") do |gemspecfile|
|
24
|
+
spec = Gem::Specification::load(gemspecfile)
|
25
|
+
name = spec.name
|
26
|
+
version = spec.version
|
27
|
+
gem = File.join( pkgdir , "#{name}-#{version}.gem")
|
28
|
+
unless File.exists?( gem )
|
29
|
+
warn "Unable to find the built gem '#{gem}'... Thus exiting."
|
30
|
+
next
|
31
|
+
end
|
32
|
+
info t.comment + " '#{gem}'"
|
33
|
+
really_continue?
|
34
|
+
a = run %{
|
35
|
+
gem push #{gem}
|
36
|
+
}
|
37
|
+
error "Unable to publish the gem '#{gem}'" if a.to_i != 0
|
38
|
+
end
|
39
|
+
end # task gem:release
|
40
|
+
task :publish, :release
|
41
|
+
|
42
|
+
########### info ###########
|
43
|
+
desc "Informations on the gem"
|
44
|
+
task :info do |t|
|
45
|
+
require "rubygems"
|
46
|
+
Dir.glob("*.gemspec") do |gemspecfile|
|
47
|
+
spec = Gem::Specification::load(gemspecfile)
|
48
|
+
info t.comment + " '#{spec.name}' (version #{spec.version})"
|
49
|
+
puts <<-eos
|
50
|
+
- Summary: #{spec.summary}
|
51
|
+
- Author: #{spec.author} #{spec.email}
|
52
|
+
- Licence: #{spec.license}
|
53
|
+
- Homepage: #{spec.homepage}
|
54
|
+
- Description: #{spec.description}
|
55
|
+
eos
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
end # task info
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
end # namespace gem
|
65
|
+
|
66
|
+
# Until [Issue#13](https://github.com/postmodern/rubygems-tasks/issues/13) it solved,
|
67
|
+
# I have to remain in the global tasks not embedded in a namespace
|
68
|
+
#Gem::Tasks::Install.new
|
69
|
+
Gem::Tasks::Build::Gem.new(:sign => true)
|
70
|
+
Gem::Tasks::Sign::Checksum.new
|
71
|
+
Gem::Tasks::Sign::PGP.new
|
72
|
+
|
73
|
+
# Enhance the build to sign the built gem
|
74
|
+
Rake::Task['build'].enhance do
|
75
|
+
Rake::Task["sign"].invoke if File.directory?(File.join(ENV['HOME'], '.gnupg') )
|
76
|
+
end
|
77
|
+
|
78
|
+
# Gem::Tasks.new(
|
79
|
+
# :console => false,
|
80
|
+
# :install => false,
|
81
|
+
# :sign => false,
|
82
|
+
# :build => false,
|
83
|
+
# :release => true
|
84
|
+
# ) do |tasks|
|
85
|
+
# tasks.scm.tag.format = "release-%s",
|
86
|
+
# tasks.scm.tag.sign = true
|
87
|
+
# end
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
# Gem::Tasks.new(:console => false, :release => false, :sign => true) do |tasks|
|
92
|
+
# # tasks.build = {
|
93
|
+
# # :tar => true,
|
94
|
+
# # :zip => true
|
95
|
+
# # },
|
96
|
+
|
97
|
+
|
98
|
+
# # #tasks.scm.tag.format = "release-%s",
|
99
|
+
# # #tasks.scm.tag.sign = true,
|
100
|
+
# # #tasks.console.command = 'pry'
|
101
|
+
# # # tasks.scm.tag = false
|
102
|
+
# # # tasks.sign.checksum = true
|
103
|
+
# # # tasks.sign.pgp = true
|
104
|
+
# end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
################################################################################
|
3
|
+
# Time-stamp: <Ven 2014-06-20 00:10 svarrette>
|
4
|
+
################################################################################
|
5
|
+
#
|
6
|
+
# FalkorLib rake tasks to pilot Gem operations
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'rake'
|
10
|
+
require 'falkorlib'
|
11
|
+
require 'falkorlib/tasks'
|
12
|
+
|
13
|
+
module FalkorLib #:nodoc:
|
14
|
+
|
15
|
+
# Rake tasks to pilot Gem operations
|
16
|
+
class GemTasks
|
17
|
+
include Rake::DSL if defined? Rake::DSL
|
18
|
+
|
19
|
+
# Install the gem tasks for Rake
|
20
|
+
def install_tasks
|
21
|
+
load 'falkorlib/tasks/gem.rake'
|
22
|
+
load 'falkorlib/tasks/yard.rake'
|
23
|
+
load 'falkorlib/tasks/rspec.rake'
|
24
|
+
end
|
25
|
+
end # class FalkorLib::GemTasks
|
26
|
+
end # module FalkorLib
|
27
|
+
|
28
|
+
# Now install them ;)
|
29
|
+
FalkorLib::GemTasks.new.install_tasks
|
@@ -1,6 +1,6 @@
|
|
1
1
|
################################################################################
|
2
2
|
# gitflow.rake - Special tasks for the management of Git [Flow] operations
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Ven 2014-06-20 14:55 svarrette>
|
4
4
|
#
|
5
5
|
# Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
6
6
|
# http://varrette.gforge.uni.lu
|
@@ -104,6 +104,16 @@ namespace :version do
|
|
104
104
|
expected_branch = FalkorLib.config[:gitflow][:prefix][:release] + release_version
|
105
105
|
if (current_branch == expected_branch)
|
106
106
|
FalkorLib::Versioning.set_version(release_version)
|
107
|
+
if (! FalkorLib.config[:versioning].nil?) &&
|
108
|
+
FalkorLib.config[:versioning][:type] == 'gem' &&
|
109
|
+
File.exists?(File.join(FalkorLib::Git.rootdir, 'Gemfile'))
|
110
|
+
info "Updating Gemfile information"
|
111
|
+
run %{
|
112
|
+
# Update cache info
|
113
|
+
bundle list > /dev/null
|
114
|
+
git commit -s -m "Update Gemfile.lock accordingly" Gemfile.lock
|
115
|
+
}
|
116
|
+
end
|
107
117
|
warning "The version number has already been bumped"
|
108
118
|
warning "==> run 'rake version:release' to finalize the release and merge the current version of the repository into the '#{FalkorLib.config[:gitflow][:branches][:master]}' branch"
|
109
119
|
else
|
@@ -131,6 +141,13 @@ namespace :version do
|
|
131
141
|
git push origin
|
132
142
|
}
|
133
143
|
end
|
144
|
+
if (! FalkorLib.config[:versioning].nil?) &&
|
145
|
+
FalkorLib.config[:versioning][:type] == 'gem'
|
146
|
+
warn "About to push the released new gem (version #{version}) to the gem server (rybygems.org)"
|
147
|
+
really_continue?
|
148
|
+
Rake::Task['gem:release'].invoke
|
149
|
+
end
|
150
|
+
|
134
151
|
#Rake::Task['git:push'].invoke
|
135
152
|
end # task version:release
|
136
153
|
|
@@ -31,8 +31,8 @@ begin
|
|
31
31
|
RSpec::Core::RakeTask.new(:rspec) do |t|
|
32
32
|
# Glob pattern to match files.
|
33
33
|
#t.pattern = "spec/**/test_*.rb"
|
34
|
-
t.pattern = "spec/**/*_spec.rb"
|
35
|
-
#t.pattern = "spec/**/
|
34
|
+
#t.pattern = "spec/**/*_spec.rb"
|
35
|
+
#t.pattern = "spec/**/git_spec.rb"
|
36
36
|
|
37
37
|
# Whether or not to fail Rake when an error occurs (typically when
|
38
38
|
# examples fail).
|
data/lib/falkorlib/version.rb
CHANGED
data/lib/falkorlib/versioning.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Ven 2014-06-20 14:16 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
6
6
|
#
|
@@ -121,19 +121,17 @@ module FalkorLib #:nodoc:
|
|
121
121
|
git commit -s -m "bump to version '#{version}'" #{source[:filename]}
|
122
122
|
}
|
123
123
|
exit_status = $?.to_i
|
124
|
-
if (type == 'gem' && File.exists?(File.join(rootdir, 'Gemfile')) )
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
124
|
+
# if (type == 'gem' && File.exists?(File.join(rootdir, 'Gemfile')) )
|
125
|
+
# run %{
|
126
|
+
# sleep 2
|
127
|
+
# bundle update falkorlib
|
128
|
+
# git commit -s -m "Update Gemfile.lock accordingly" Gemfile.lock
|
129
|
+
# } if command?( 'bundle' )
|
130
|
+
# end
|
130
131
|
end
|
131
132
|
exit_status
|
132
133
|
end
|
133
134
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
135
|
## Return a new version number based on
|
138
136
|
# @param oldversion the old version (format: x.y.z)
|
139
137
|
# @param level the level of bumping (either :major, :minor, :patch)
|
data/spec/falkorlib/git_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# git_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Ven 2014-06-20 09:15 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Git operations
|
8
8
|
#
|
@@ -38,7 +38,8 @@ describe FalkorLib::Git do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "#init - initialize a git repository" do
|
41
|
-
FalkorLib::Git.init(dir)
|
41
|
+
c = FalkorLib::Git.init(dir)
|
42
|
+
c.should == 0
|
42
43
|
t = FalkorLib::Git.init?(dir)
|
43
44
|
t.should be_true
|
44
45
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# gitflow_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Jeu 2014-06-19 22:10 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Git Flow operations -- see https://github.com/nvie/gitflow
|
8
8
|
#
|
@@ -14,53 +14,53 @@ require 'spec_helper'
|
|
14
14
|
require 'tmpdir'
|
15
15
|
|
16
16
|
describe FalkorLib::GitFlow do
|
17
|
-
|
18
17
|
include FalkorLib::Common
|
19
|
-
|
20
|
-
dir = Dir.mktmpdir
|
21
|
-
afile = File.join(dir, 'a_file')
|
22
18
|
|
23
|
-
|
24
|
-
FileUtils.remove_entry_secure dir
|
25
|
-
end
|
19
|
+
if command?('git_flow')
|
26
20
|
|
27
|
-
#############################################################
|
28
|
-
context "Test git-flow operations within temporary directory " do
|
29
21
|
|
30
|
-
|
31
|
-
|
32
|
-
t.should be_false
|
33
|
-
end
|
22
|
+
dir = Dir.mktmpdir
|
23
|
+
afile = File.join(dir, 'a_file')
|
34
24
|
|
35
|
-
|
36
|
-
|
37
|
-
i = FalkorLib::GitFlow.init(dir)
|
38
|
-
i.should == 0
|
39
|
-
t = FalkorLib::Git.init?(dir)
|
40
|
-
t.should be_true
|
25
|
+
after :all do
|
26
|
+
FileUtils.remove_entry_secure dir
|
41
27
|
end
|
42
|
-
|
43
|
-
#['feature', 'hotfix', 'support'].each do |op|
|
44
|
-
['feature'].each do |op|
|
45
|
-
name = 'toto'
|
46
|
-
it "#start -- should start a '#{op}' GitFlow operation" do
|
47
|
-
a = FalkorLib::GitFlow.start(op, name, dir)
|
48
|
-
a.should == 0
|
49
|
-
br = FalkorLib::Git.branch?( dir )
|
50
|
-
br.should == "#{op}/#{name}"
|
51
|
-
end
|
52
28
|
|
53
|
-
|
54
|
-
|
55
|
-
a = FalkorLib::GitFlow.finish(op, name, dir)
|
56
|
-
a.should == 0
|
57
|
-
br = FalkorLib::Git.branch?( dir )
|
58
|
-
br.should == FalkorLib.config[:gitflow][:branches][:develop]
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
29
|
+
#############################################################
|
30
|
+
context "Test git-flow operations within temporary directory " do
|
62
31
|
|
63
|
-
|
32
|
+
it "#init? - fails on non-git directory" do
|
33
|
+
t = FalkorLib::Git.init?(dir)
|
34
|
+
t.should be_false
|
35
|
+
end
|
64
36
|
|
37
|
+
it "#init - initialize a git-flow repository" do
|
38
|
+
STDIN.should_receive(:gets).and_return('Yes')
|
39
|
+
i = FalkorLib::GitFlow.init(dir)
|
40
|
+
i.should == 0
|
41
|
+
t = FalkorLib::Git.init?(dir)
|
42
|
+
t.should be_true
|
43
|
+
end
|
65
44
|
|
45
|
+
#['feature', 'hotfix', 'support'].each do |op|
|
46
|
+
['feature'].each do |op|
|
47
|
+
name = 'toto'
|
48
|
+
it "#start -- should start a '#{op}' GitFlow operation" do
|
49
|
+
a = FalkorLib::GitFlow.start(op, name, dir)
|
50
|
+
a.should == 0
|
51
|
+
br = FalkorLib::Git.branch?( dir )
|
52
|
+
br.should == "#{op}/#{name}"
|
53
|
+
end
|
66
54
|
|
55
|
+
it "#finish -- should finish a '#{op}' GitFlow operation" do
|
56
|
+
STDIN.should_receive(:gets).and_return("Test #{op} operation") if [ 'hotfix', 'support' ].include?(op)
|
57
|
+
a = FalkorLib::GitFlow.finish(op, name, dir)
|
58
|
+
a.should == 0
|
59
|
+
br = FalkorLib::Git.branch?( dir )
|
60
|
+
br.should == FalkorLib.config[:gitflow][:branches][:develop]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# gitflow_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Ven 2014-06-20 09:10 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Git Flow operations -- see https://github.com/nvie/gitflow
|
8
8
|
#
|
@@ -37,72 +37,77 @@ describe FalkorLib::Versioning do
|
|
37
37
|
context 'Test versioning operations within temporary directory' do
|
38
38
|
|
39
39
|
it "#get_version -- get default version #{default_version}" do
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
if command?('git_flow')
|
41
|
+
STDIN.should_receive(:gets).and_return('Yes')
|
42
|
+
t = FalkorLib::GitFlow.init(dir)
|
43
|
+
t.should == 0
|
44
|
+
else
|
45
|
+
t = FalkorLib::Git.init(dir)
|
46
|
+
t.should be_true
|
47
|
+
end
|
48
|
+
v = FalkorLib::Versioning.get_version(dir)
|
44
49
|
v.should == default_version
|
45
50
|
end
|
46
51
|
|
47
|
-
it "#get_version -- should get the '#{workingversion[:default]}' version set in the file #{versionfile}" do
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
it "#set_version -- set version #{default_version} in version file #{versionfile}" do
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should do something" do
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
it "#set_version -- restore versionfile and add it to git" do
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
end
|
87
|
-
|
88
|
-
FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
end
|
52
|
+
# it "#get_version -- should get the '#{workingversion[:default]}' version set in the file #{versionfile}" do
|
53
|
+
# execute "echo #{workingversion[:default]} > #{dir}/#{versionfile}"
|
54
|
+
# v = FalkorLib::Versioning.get_version(dir)
|
55
|
+
# v.should == workingversion[:default]
|
56
|
+
# end
|
57
|
+
|
58
|
+
# it "#set_version -- set version #{default_version} in version file #{versionfile}" do
|
59
|
+
# STDIN.should_receive(:gets).and_return('no')
|
60
|
+
# v = FalkorLib::Versioning.set_version(default_version, dir)
|
61
|
+
# v.should == 0
|
62
|
+
# v = FalkorLib::Versioning.get_version(dir)
|
63
|
+
# v.should == default_version
|
64
|
+
# end
|
65
|
+
|
66
|
+
# FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
67
|
+
# it "#set_version #bump -- #{level} bump version number from #{workingversion[:default]} to #{workingversion[level.to_sym]}" do
|
68
|
+
# # restore version file
|
69
|
+
# execute "echo #{workingversion[:default]} > #{dir}/#{versionfile}"
|
70
|
+
# v = FalkorLib::Versioning.get_version(dir)
|
71
|
+
# v.should == workingversion[:default]
|
72
|
+
# v2 = FalkorLib::Versioning.bump(v, level.to_sym)
|
73
|
+
# v2.should == workingversion[level.to_sym]
|
74
|
+
# STDIN.should_receive(:gets).and_return('no')
|
75
|
+
# d = FalkorLib::Versioning.set_version(v2, dir)
|
76
|
+
# d.should == 0
|
77
|
+
# v3 = FalkorLib::Versioning.get_version(dir)
|
78
|
+
# v3.should == v2
|
79
|
+
# end
|
80
|
+
# end
|
81
|
+
|
82
|
+
# it "should do something" do
|
83
|
+
|
84
|
+
# end
|
85
|
+
|
86
|
+
|
87
|
+
# it "#set_version -- restore versionfile and add it to git" do
|
88
|
+
# STDIN.should_receive(:gets).and_return('Yes')
|
89
|
+
# t = FalkorLib::Versioning.set_version(workingversion[:default], dir)
|
90
|
+
# t.should == 0
|
91
|
+
# end
|
92
|
+
|
93
|
+
# FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
94
|
+
# it "#set_version #bump -- #{level} bump version number from #{workingversion[:default]} to #{workingversion[level.to_sym]} with git commit" do
|
95
|
+
# if FalkorLib::Versioning.get_version(dir) != workingversion[:default]
|
96
|
+
# STDIN.should_receive(:gets).and_return('Yes')
|
97
|
+
# t = FalkorLib::Versioning.set_version(workingversion[:default], dir)
|
98
|
+
# t.should == 0
|
99
|
+
# end
|
100
|
+
# v = FalkorLib::Versioning.get_version(dir)
|
101
|
+
# v.should == workingversion[:default]
|
102
|
+
# v2 = FalkorLib::Versioning.bump(v, level.to_sym)
|
103
|
+
# v2.should == workingversion[level.to_sym]
|
104
|
+
# STDIN.should_receive(:gets).and_return('Yes')
|
105
|
+
# d = FalkorLib::Versioning.set_version(v2, dir)
|
106
|
+
# d.should == 0
|
107
|
+
# v3 = FalkorLib::Versioning.get_version(dir)
|
108
|
+
# v3.should == v2
|
109
|
+
# end
|
110
|
+
# end
|
106
111
|
|
107
112
|
end
|
108
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falkorlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Varrette
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -229,12 +229,15 @@ files:
|
|
229
229
|
- lib/falkorlib.rb
|
230
230
|
- lib/falkorlib/common.rb
|
231
231
|
- lib/falkorlib/config.rb
|
232
|
+
- lib/falkorlib/gem_tasks.rb
|
232
233
|
- lib/falkorlib/git.rb
|
233
234
|
- lib/falkorlib/git/base.rb
|
234
235
|
- lib/falkorlib/git/flow.rb
|
235
236
|
- lib/falkorlib/git_tasks.rb
|
236
237
|
- lib/falkorlib/loader.rb
|
237
238
|
- lib/falkorlib/tasks.rb
|
239
|
+
- lib/falkorlib/tasks/gem.rake
|
240
|
+
- lib/falkorlib/tasks/gem.rb
|
238
241
|
- lib/falkorlib/tasks/git.rake
|
239
242
|
- lib/falkorlib/tasks/git.rb
|
240
243
|
- lib/falkorlib/tasks/gitflow.rake
|