falkorlib 0.6.19 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +88 -0
- data/.travis.yml +56 -4
- data/Gemfile +4 -4
- data/Gemfile.lock +55 -27
- data/Rakefile +12 -8
- data/Vagrantfile +68 -0
- data/completion/_falkor +55 -7
- data/falkorlib.gemspec +14 -12
- data/lib/falkorlib.rb +22 -21
- data/lib/falkorlib/bootstrap.rb +5 -1
- data/lib/falkorlib/bootstrap/base.rb +385 -693
- data/lib/falkorlib/bootstrap/git.rb +137 -0
- data/lib/falkorlib/bootstrap/latex.rb +186 -0
- data/lib/falkorlib/bootstrap/link.rb +108 -96
- data/lib/falkorlib/bootstrap/ruby.rb +102 -0
- data/lib/falkorlib/cli.rb +82 -26
- data/lib/falkorlib/cli/config.rb +8 -8
- data/lib/falkorlib/cli/link.rb +8 -9
- data/lib/falkorlib/cli/new.rb +25 -39
- data/lib/falkorlib/common.rb +425 -425
- data/lib/falkorlib/config.rb +114 -110
- data/lib/falkorlib/error.rb +27 -16
- data/lib/falkorlib/gem_tasks.rb +12 -11
- data/lib/falkorlib/git.rb +3 -4
- data/lib/falkorlib/git/base.rb +439 -396
- data/lib/falkorlib/git/flow.rb +163 -165
- data/lib/falkorlib/git_tasks.rb +31 -31
- data/lib/falkorlib/loader.rb +1 -1
- data/lib/falkorlib/puppet.rb +3 -5
- data/lib/falkorlib/puppet/base.rb +10 -15
- data/lib/falkorlib/puppet/modules.rb +367 -365
- data/lib/falkorlib/puppet_tasks.rb +11 -8
- data/lib/falkorlib/tasks.rb +51 -54
- data/lib/falkorlib/tasks/gem.rake +42 -43
- data/lib/falkorlib/tasks/gem.rb +12 -11
- data/lib/falkorlib/tasks/git.rake +101 -107
- data/lib/falkorlib/tasks/git.rb +31 -31
- data/lib/falkorlib/tasks/gitflow.rake +131 -141
- data/lib/falkorlib/tasks/puppet.rb +11 -8
- data/lib/falkorlib/tasks/puppet_modules.rake +143 -154
- data/lib/falkorlib/tasks/rspec.rake +94 -59
- data/lib/falkorlib/tasks/yard.rake +35 -39
- data/lib/falkorlib/version.rb +55 -55
- data/lib/falkorlib/versioning.rb +169 -167
- data/spec/falkorlib/bootstrap_helpers_spec.rb +106 -56
- data/spec/falkorlib/bootstrap_latex_spec.rb +145 -0
- data/spec/falkorlib/bootstrap_link_spec.rb +137 -0
- data/spec/falkorlib/bootstrap_ruby_spec.rb +118 -0
- data/spec/falkorlib/bootstrap_spec.rb +112 -129
- data/spec/falkorlib/git_spec.rb +94 -22
- data/spec/falkorlib/gitflow_spec.rb +54 -42
- data/spec/falkorlib/puppet_modules_spec.rb +35 -26
- data/spec/falkorlib/versioning_puppet_module_spec.rb +94 -90
- data/spec/falkorlib_spec.rb +5 -0
- data/spec/spec_helper.rb +88 -47
- data/templates/latex/article-ieee/main.tex.erb +509 -0
- data/templates/latex/article/_abstract.tex.erb +19 -0
- data/templates/latex/article/_acronyms.tex.erb +116 -0
- data/templates/latex/article/_conclusion.tex.erb +25 -0
- data/templates/latex/article/_context.tex.erb +17 -0
- data/templates/latex/article/_experiments.tex.erb +27 -0
- data/templates/latex/article/_implem.tex.erb +17 -0
- data/templates/latex/article/_introduction.tex.erb +39 -0
- data/templates/latex/article/_related_works.tex.erb +19 -0
- data/templates/latex/article/biblio.bib.erb +28 -0
- data/templates/latex/article/template.tex.erb +16 -0
- data/templates/latex/ieee/IEEEtran.bst +2409 -0
- data/templates/latex/ieee/IEEEtran.cls +6347 -0
- data/templates/motd/motd.erb +2 -1
- metadata +82 -2
@@ -0,0 +1,118 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#########################################
|
3
|
+
# bootstrap_ruby_spec.rb
|
4
|
+
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
+
# Time-stamp: <Sat 2016-11-12 02:28 svarrette>
|
6
|
+
#
|
7
|
+
# @description Check the Bootstrapping operations for ruby-based projects
|
8
|
+
#
|
9
|
+
# Copyright (c) 2013 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
10
|
+
# . http://varrette.gforge.uni.lu
|
11
|
+
##############################################################################
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'tmpdir'
|
15
|
+
require 'fileutils'
|
16
|
+
|
17
|
+
describe FalkorLib::Bootstrap do
|
18
|
+
|
19
|
+
include FalkorLib::Common
|
20
|
+
|
21
|
+
dirs = {
|
22
|
+
:without_git => Dir.mktmpdir,
|
23
|
+
:with_git => Dir.mktmpdir,
|
24
|
+
}
|
25
|
+
|
26
|
+
#_____________
|
27
|
+
before :all do
|
28
|
+
$stdout.sync = true
|
29
|
+
FalkorLib.config[:no_interaction] = true
|
30
|
+
end
|
31
|
+
|
32
|
+
#____________
|
33
|
+
after :all do
|
34
|
+
dirs.each do |t,d|
|
35
|
+
#next if t == :with_git
|
36
|
+
FileUtils.remove_entry_secure d
|
37
|
+
end
|
38
|
+
FalkorLib.config[:no_interaction] = false
|
39
|
+
end
|
40
|
+
|
41
|
+
#[ :without_git, :with_git ].each do |ctx|
|
42
|
+
[ :without_git ].each do |ctx|
|
43
|
+
# [ :with_git ].each do |ctx|
|
44
|
+
dir = dirs[ctx]
|
45
|
+
########################################################################
|
46
|
+
context "bootstrap/ruby (#{ctx}) within temporary directory '#{dir}'" do
|
47
|
+
|
48
|
+
if ctx == :with_git
|
49
|
+
it "initialize Git in the temporary directory #{dir}" do
|
50
|
+
c = FalkorLib::Git.init(dir)
|
51
|
+
expect(c).to eq(0)
|
52
|
+
t = FalkorLib::Git.init?(dir)
|
53
|
+
expect(t).to be true
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
######### RVM #########
|
58
|
+
it "#rvm -- #{ctx}" do
|
59
|
+
c = FalkorLib::Bootstrap.rvm(dir)
|
60
|
+
expect(c).to eq(0)
|
61
|
+
content = {}
|
62
|
+
[:versionfile, :gemsetfile].each do |type|
|
63
|
+
f = File.join(dir, FalkorLib.config[:rvm][type.to_sym])
|
64
|
+
t = File.exists?(f)
|
65
|
+
expect(t).to be true
|
66
|
+
content[type.to_sym] = `cat #{f}`.chomp
|
67
|
+
end
|
68
|
+
expect(content[:versionfile]).to eq(FalkorLib.config[:rvm][:version])
|
69
|
+
expect(content[:gemsetfile]).to eq(File.basename(dir))
|
70
|
+
File.read(File.realpath( File.join(dir, 'Gemfile'))) do |f|
|
71
|
+
[
|
72
|
+
'https://rubygems.org',
|
73
|
+
"gem 'falkorlib'"
|
74
|
+
].each do |pattern|
|
75
|
+
f.should include "#{pattern}"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
it "#rvm -- #{ctx} -- repeat" do
|
81
|
+
t = FalkorLib::Bootstrap.rvm(dir)
|
82
|
+
expect(t).to eq(1)
|
83
|
+
c = capture(:stdout) { FalkorLib::Bootstrap.rvm(dir, { :force => true }) }
|
84
|
+
[
|
85
|
+
"The RVM file '.ruby-version' already exists",
|
86
|
+
"The RVM file '.ruby-gemset' already exists",
|
87
|
+
"and it WILL BE overwritten"
|
88
|
+
].each do |pattern|
|
89
|
+
expect(c).to include pattern
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
it "#rvm -- change targets (ctx = #{ctx}; dir = #{dir})" do
|
95
|
+
opts = {
|
96
|
+
:ruby => '1.2.3',
|
97
|
+
:versionfile => '.myversion',
|
98
|
+
:gemset => 'newgemset',
|
99
|
+
:gemsetfile => '.mygemset'
|
100
|
+
}
|
101
|
+
c = FalkorLib::Bootstrap.rvm(dir, opts)
|
102
|
+
expect(c).to eq(0)
|
103
|
+
content = {}
|
104
|
+
[:versionfile, :gemsetfile].each do |type|
|
105
|
+
f = File.join("#{dir}", opts[type.to_sym])
|
106
|
+
expect(File.exists?(f)).to be true
|
107
|
+
content[type.to_sym] = `cat #{f}`.chomp
|
108
|
+
end
|
109
|
+
expect(content[:versionfile]).to eq(opts[:ruby])
|
110
|
+
expect(content[:gemsetfile]).to eq(opts[:gemset])
|
111
|
+
end
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
end # context "bootstrap/ruby"
|
116
|
+
end # each
|
117
|
+
|
118
|
+
end
|
@@ -2,9 +2,9 @@
|
|
2
2
|
#########################################
|
3
3
|
# bootstrap_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Wed 2016-11-09 20:17 svarrette>
|
6
6
|
#
|
7
|
-
# @description Check the Bootstrapping operations
|
7
|
+
# @description Check the basic Bootstrapping operations
|
8
8
|
#
|
9
9
|
# Copyright (c) 2013 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
10
10
|
# . http://varrette.gforge.uni.lu
|
@@ -16,135 +16,118 @@ require 'fileutils'
|
|
16
16
|
|
17
17
|
describe FalkorLib::Bootstrap do
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
19
|
+
include FalkorLib::Common
|
20
|
+
|
21
|
+
dirs = {
|
22
|
+
:without_git => Dir.mktmpdir,
|
23
|
+
:with_git => Dir.mktmpdir,
|
24
|
+
#:default => Dir.mktmpdir
|
25
|
+
}
|
26
|
+
before :all do
|
27
|
+
$stdout.sync = true
|
28
|
+
FalkorLib.config[:no_interaction] = true
|
29
|
+
end
|
30
|
+
|
31
|
+
after :all do
|
32
|
+
dirs.each do |t,d|
|
33
|
+
#next if t == :with_git
|
34
|
+
FileUtils.remove_entry_secure d
|
29
35
|
end
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
36
|
+
FalkorLib.config[:no_interaction] = false
|
37
|
+
end
|
38
|
+
|
39
|
+
[ :without_git, :with_git ].each do |ctx|
|
40
|
+
#[ :with_git ].each do |ctx|
|
41
|
+
dir = dirs[ctx]
|
42
|
+
#############################################################
|
43
|
+
context "bootstrap/base (#{ctx}) within temporary directory '#{dir}'" do
|
44
|
+
|
45
|
+
if ctx == :with_git
|
46
|
+
it "initialize Git in the temporary directory #{dir}" do
|
47
|
+
c = FalkorLib::Git.init(dir)
|
48
|
+
expect(c).to eq(0)
|
49
|
+
t = FalkorLib::Git.init?(dir)
|
50
|
+
expect(t).to be true
|
35
51
|
end
|
36
|
-
|
37
|
-
|
52
|
+
end
|
53
|
+
|
54
|
+
#### Trash creation #########
|
55
|
+
it "#trash" do
|
56
|
+
c = FalkorLib::Bootstrap.trash(dir)
|
57
|
+
t = File.exists?( File.join(dir, FalkorLib.config[:templates][:trashdir], '.gitignore'))
|
58
|
+
expect(t).to be true
|
59
|
+
expect(c).to eq(0)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "#trash - repeat on an existing trash dir" do
|
63
|
+
c = FalkorLib::Bootstrap.trash(dir)
|
64
|
+
expect(c).to eq(1)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "#trash - change target trash dir" do
|
68
|
+
newtrashname = 'tmp/mytrash'
|
69
|
+
c = FalkorLib::Bootstrap.trash(dir,newtrashname)
|
70
|
+
t = File.exists?( File.join(dir, newtrashname, '.gitignore'))
|
71
|
+
expect(t).to be true
|
72
|
+
expect(c).to eq(0)
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
### Bootstrap a VERSION file
|
77
|
+
it "#versionfile" do
|
78
|
+
f = File.join(dir, 'VERSION')
|
79
|
+
FalkorLib::Bootstrap.versionfile(dir)
|
80
|
+
t = File.exist?(f)
|
81
|
+
expect(t).to be true
|
82
|
+
v = FalkorLib::Versioning.get_version(dir)
|
83
|
+
expect(v).to eq('0.0.0')
|
84
|
+
end
|
85
|
+
|
86
|
+
it "#versionfile -- non standard file and version" do
|
87
|
+
opts = {
|
88
|
+
:file => 'version.txt',
|
89
|
+
:version => '1.2.14'
|
90
|
+
}
|
91
|
+
f = File.join(dir, opts[:file])
|
92
|
+
FalkorLib::Bootstrap.versionfile(dir, opts)
|
93
|
+
t = File.exist?(f)
|
94
|
+
expect(t).to be true
|
95
|
+
v = FalkorLib::Versioning.get_version(dir, { :source => { :filename => opts[:file] }})
|
96
|
+
expect(v).to eq(opts[:version])
|
97
|
+
end
|
98
|
+
|
99
|
+
### Message Of The Day generation
|
100
|
+
it "#motd" do
|
101
|
+
motdfile = File.join(dir, 'motd')
|
102
|
+
description = "Thats_a_description_hard_to_forge"
|
103
|
+
FalkorLib::Bootstrap.motd(dir, {
|
104
|
+
:desc => description,
|
105
|
+
:no_interaction => true })
|
106
|
+
expect(File).to exist(motdfile)
|
107
|
+
expect(File.read(File.realpath(motdfile))).to include "=== #{description} ==="
|
108
|
+
end
|
109
|
+
|
110
|
+
### README creation
|
111
|
+
it "#readme" do
|
112
|
+
readme = File.join(dir, 'README.md')
|
113
|
+
#Array.new(6).each { |e| STDIN.should_receive(:gets).and_return('') }
|
114
|
+
#STDIN.should_receive(:gets).and_return('')
|
115
|
+
#STDIN.should_receive(:gets).and_return('1')
|
116
|
+
FalkorLib::Bootstrap.readme(dir, { :no_interaction => true })
|
117
|
+
expect(File).to exist( readme )
|
118
|
+
File.read(File.realpath( readme )) do |f|
|
119
|
+
[
|
120
|
+
"## Synopsis", # from header_readme.erb
|
121
|
+
"## Issues / Feature request", # from readme_issues.erb
|
122
|
+
"### Git", # from readme_git.erb
|
123
|
+
"## Contributing" # from footer_readme.erb
|
124
|
+
].each do |pattern|
|
125
|
+
f.should include "#{pattern}"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
38
129
|
|
39
|
-
|
40
|
-
|
41
|
-
dir = dirs[ctx]
|
42
|
-
#############################################################
|
43
|
-
context "Test bootstrapping operations within (#{ctx}) temporary directory #{dir} " do
|
44
|
-
|
45
|
-
if ctx == :with_git
|
46
|
-
it "initialize Git in the temporary directory #{dir}" do
|
47
|
-
c = FalkorLib::Git.init(dir)
|
48
|
-
expect(c).to eq(0)
|
49
|
-
t = FalkorLib::Git.init?(dir)
|
50
|
-
expect(t).to be true
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
#### Trash creation #########
|
55
|
-
it "#trash" do
|
56
|
-
c = FalkorLib::Bootstrap.trash(dir)
|
57
|
-
t = File.exists?( File.join(dir, FalkorLib.config[:templates][:trashdir], '.gitignore'))
|
58
|
-
expect(t).to be true
|
59
|
-
expect(c).to eq(0)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "#trash - repeat on an existing trash dir" do
|
63
|
-
c = FalkorLib::Bootstrap.trash(dir)
|
64
|
-
expect(c).to eq(1)
|
65
|
-
end
|
66
|
-
|
67
|
-
it "#trash - change target trash dir" do
|
68
|
-
newtrashname = 'tmp/mytrash'
|
69
|
-
c = FalkorLib::Bootstrap.trash(dir,newtrashname)
|
70
|
-
t = File.exists?( File.join(dir, newtrashname, '.gitignore'))
|
71
|
-
expect(t).to be true
|
72
|
-
expect(c).to eq(0)
|
73
|
-
end
|
74
|
-
|
75
|
-
######### RVM #########
|
76
|
-
it "#rvm" do
|
77
|
-
gemset = File.basename(dir)
|
78
|
-
expect(STDIN).to receive(:gets).and_return('1') if ctx == :without_git
|
79
|
-
expect(STDIN).to receive(:gets).and_return('') if ctx == :without_git
|
80
|
-
c = FalkorLib::Bootstrap.rvm(dir)
|
81
|
-
expect(c).to eq(0)
|
82
|
-
content = {}
|
83
|
-
[:versionfile, :gemsetfile].each do |type|
|
84
|
-
f = File.join(dir, FalkorLib.config[:rvm][type.to_sym])
|
85
|
-
t = File.exists?(f)
|
86
|
-
expect(t).to be true
|
87
|
-
content[type.to_sym] = `cat #{f}`.chomp
|
88
|
-
end
|
89
|
-
expect(content[:versionfile]).to eq(FalkorLib.config[:rvm][:rubies][0])
|
90
|
-
expect(content[:gemsetfile]).to eq(gemset)
|
91
|
-
end
|
92
|
-
|
93
|
-
it "#rvm -- repeat" do
|
94
|
-
c = FalkorLib::Bootstrap.rvm(dir)
|
95
|
-
expect(c).to eq(1)
|
96
|
-
end
|
97
|
-
|
98
|
-
it "#rvm -- change targets (ctx = #{ctx}; dir = #{dir})" do
|
99
|
-
opts = {
|
100
|
-
:ruby => '1.2.3',
|
101
|
-
:versionfile => '.myversion',
|
102
|
-
:gemset => 'newgemset',
|
103
|
-
:gemsetfile => '.mygemset'
|
104
|
-
}
|
105
|
-
c = FalkorLib::Bootstrap.rvm(dir, opts)
|
106
|
-
expect(c).to eq(0)
|
107
|
-
content = {}
|
108
|
-
[:versionfile, :gemsetfile].each do |type|
|
109
|
-
f = File.join("#{dir}", opts[type.to_sym])
|
110
|
-
t = File.exists?(f)
|
111
|
-
content[type.to_sym] = `cat #{f}`.chomp
|
112
|
-
end
|
113
|
-
expect(content[:versionfile]).to eq(opts[:ruby])
|
114
|
-
expect(content[:gemsetfile]).to eq(opts[:gemset])
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
### README creation
|
119
|
-
it "#readme" do
|
120
|
-
#Array.new(6).each { |e| STDIN.should_receive(:gets).and_return('') }
|
121
|
-
#STDIN.should_receive(:gets).and_return('')
|
122
|
-
#STDIN.should_receive(:gets).and_return('1')
|
123
|
-
FalkorLib.config[:no_interaction] = true
|
124
|
-
FalkorLib::Bootstrap.readme(dir, { :no_interaction => true })
|
125
|
-
t = File.exists?(File.join(dir, 'README.md'))
|
126
|
-
expect(t).to be true
|
127
|
-
FalkorLib.config[:no_interaction] = false
|
128
|
-
end
|
129
|
-
|
130
|
-
### Bootstrap a VERSION file
|
131
|
-
it "#versionfile" do
|
132
|
-
file = 'version.txt'
|
133
|
-
version = '1.2.14'
|
134
|
-
FalkorLib.config[:no_interaction] = true
|
135
|
-
FalkorLib::Bootstrap.versionfile(dir,
|
136
|
-
{
|
137
|
-
:file => "#{file}",
|
138
|
-
:version => "#{version}",
|
139
|
-
:no_interaction => true
|
140
|
-
})
|
141
|
-
t = File.exists?(File.join(dir, file))
|
142
|
-
expect(t).to be true
|
143
|
-
v = FalkorLib::Versioning.get_version(dir, { :source => { :filename => file }})
|
144
|
-
expect(v).to eq("#{version}")
|
145
|
-
end
|
146
|
-
|
147
|
-
end # context
|
148
|
-
end # each
|
130
|
+
end # context "bootstrap/base"
|
131
|
+
end # each
|
149
132
|
|
150
133
|
end
|
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: <Sat 2016-11-12 12:30 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Git operations
|
8
8
|
#
|
@@ -17,16 +17,21 @@ describe FalkorLib::Git do
|
|
17
17
|
|
18
18
|
include FalkorLib::Common
|
19
19
|
default_branches = [ 'devel', 'production' ]
|
20
|
+
remote_name = 'custom-origin'
|
21
|
+
filename = 'custom-file.txt'
|
22
|
+
tagname = 'customtag'
|
20
23
|
|
21
24
|
dir = Dir.mktmpdir
|
22
|
-
|
25
|
+
dir2 = Dir.mktmpdir
|
26
|
+
dirs = [ dir, dir2 ]
|
23
27
|
|
24
28
|
before :all do
|
25
|
-
|
29
|
+
$stdout.sync = true
|
30
|
+
#MiniGit.debug = true
|
26
31
|
end
|
27
32
|
|
28
33
|
after :all do
|
29
|
-
|
34
|
+
dirs.each { |d| FileUtils.remove_entry_secure d }
|
30
35
|
end
|
31
36
|
|
32
37
|
#############################################################
|
@@ -37,13 +42,16 @@ describe FalkorLib::Git do
|
|
37
42
|
expect(t).to be false
|
38
43
|
end
|
39
44
|
|
40
|
-
|
41
|
-
|
45
|
+
dirs.each do |d|
|
46
|
+
it "#init - initialize a git repository" do
|
47
|
+
c = FalkorLib::Git.init(d)
|
42
48
|
expect(c).to eq(0)
|
43
|
-
t = FalkorLib::Git.init?(
|
49
|
+
t = FalkorLib::Git.init?(d)
|
44
50
|
expect(t).to be true
|
51
|
+
end
|
45
52
|
end
|
46
53
|
|
54
|
+
|
47
55
|
it "#remotes? -- should be false" do
|
48
56
|
t = FalkorLib::Git.remotes?(dir)
|
49
57
|
expect(t).to be false
|
@@ -60,8 +68,8 @@ describe FalkorLib::Git do
|
|
60
68
|
end
|
61
69
|
end
|
62
70
|
|
63
|
-
it "#
|
64
|
-
b = FalkorLib::Git.
|
71
|
+
it "#commits? - not yet any commits" do
|
72
|
+
b = FalkorLib::Git.commits?( dir )
|
65
73
|
expect(b).to be false
|
66
74
|
end
|
67
75
|
|
@@ -75,20 +83,23 @@ describe FalkorLib::Git do
|
|
75
83
|
expect(l).to be_empty
|
76
84
|
end
|
77
85
|
|
78
|
-
|
79
|
-
|
80
|
-
|
86
|
+
dirs.each do |d|
|
87
|
+
it "#add - makes a first commit" do
|
88
|
+
f = File.join(d, filename )
|
89
|
+
FileUtils.touch( f )
|
90
|
+
t = FalkorLib::Git.add(f)
|
81
91
|
expect(t).to eq(0)
|
92
|
+
end
|
82
93
|
end
|
83
94
|
|
84
95
|
it "#list_files -- should list a single files" do
|
85
96
|
l = FalkorLib::Git.list_files( dir )
|
86
|
-
expect(l).to include
|
97
|
+
expect(l).to include filename
|
87
98
|
end
|
88
99
|
|
89
100
|
|
90
|
-
it "#
|
91
|
-
b = FalkorLib::Git.
|
101
|
+
it "#commits? - no some commits have been done" do
|
102
|
+
b = FalkorLib::Git.commits?( dir )
|
92
103
|
expect(b).to be true
|
93
104
|
end
|
94
105
|
|
@@ -111,6 +122,65 @@ describe FalkorLib::Git do
|
|
111
122
|
end
|
112
123
|
end
|
113
124
|
|
125
|
+
it "#create_remote" do
|
126
|
+
r = FalkorLib::Git.create_remote(remote_name, "#{dir}", dir2, { :fetch => true })
|
127
|
+
expect(r).to be true
|
128
|
+
end
|
129
|
+
|
130
|
+
it "#remotes? -- should be true for dir2 = '#{dir2}" do
|
131
|
+
t = FalkorLib::Git.remotes?(dir2)
|
132
|
+
expect(t).to be true
|
133
|
+
end
|
134
|
+
|
135
|
+
it "#remotes" do
|
136
|
+
l = FalkorLib::Git.remotes(dir2)
|
137
|
+
expect(l).to include remote_name
|
138
|
+
end
|
139
|
+
|
140
|
+
default_branches.each do |br|
|
141
|
+
it "#grab branch '#{remote_name}/#{br}'" do
|
142
|
+
t = FalkorLib::Git.grab(br, dir2, remote_name)
|
143
|
+
expect(t).to eq(0)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
it "#publish" do
|
148
|
+
br = 'custom-branch'
|
149
|
+
c = FalkorLib::Git.create_branch(br, dir2)
|
150
|
+
expect(c).to be true
|
151
|
+
t = FalkorLib::Git.publish(br, dir2, remote_name)
|
152
|
+
expect(t).to eq(0)
|
153
|
+
end
|
154
|
+
|
155
|
+
it "#list_tag -- empty" do
|
156
|
+
l = FalkorLib::Git.list_tag( dir )
|
157
|
+
expect(l).to be_empty
|
158
|
+
end
|
159
|
+
|
160
|
+
it "#last_tag_commit -- empty" do
|
161
|
+
l = FalkorLib::Git.last_tag_commit(dir)
|
162
|
+
expect(l).to be_empty
|
163
|
+
end
|
164
|
+
|
165
|
+
it "#tag(#{tagname})" do
|
166
|
+
t = FalkorLib::Git.tag(tagname, dir)
|
167
|
+
expect(t).to be true
|
168
|
+
end
|
169
|
+
|
170
|
+
it "#list_tag" do
|
171
|
+
l = FalkorLib::Git.list_tag( dir )
|
172
|
+
expect(l).to include tagname
|
173
|
+
end
|
174
|
+
|
175
|
+
it "#last_tag_commit" do
|
176
|
+
c = FalkorLib::Git.last_tag_commit(dir)
|
177
|
+
l = FalkorLib::Git.list_tag( dir )
|
178
|
+
expect(c).to eq(l[tagname])
|
179
|
+
end
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
114
184
|
default_branches.each do |br|
|
115
185
|
it "#delete_branch #list_branch - deletes branch #{br}" do
|
116
186
|
FalkorLib::Git.delete_branch( br, dir) #, :force => true )
|
@@ -209,7 +279,7 @@ describe FalkorLib::Git do
|
|
209
279
|
if FalkorLib::Git.command? 'subtree'
|
210
280
|
FalkorLib.config.git do |c|
|
211
281
|
c[:subtrees] = {
|
212
|
-
'falkor
|
282
|
+
'falkor-lib' => {
|
213
283
|
:url => 'https://github.com/Falkor/falkorlib.git',
|
214
284
|
:branch => 'devel'
|
215
285
|
},
|
@@ -244,18 +314,20 @@ describe FalkorLib::Git do
|
|
244
314
|
end
|
245
315
|
end
|
246
316
|
|
247
|
-
|
248
|
-
|
317
|
+
[ :subtrees, :submodules ].each do |type|
|
318
|
+
it "#config_warn(#{type})" do
|
319
|
+
t = capture(:stdout) { FalkorLib::Git.config_warn(type) }
|
320
|
+
expect(t).to include "FalkorLib.config.git"
|
321
|
+
expect(t).to include "FalkorLib.config.git.submodulesdir" if type == :submodules
|
322
|
+
end
|
323
|
+
end
|
249
324
|
|
250
325
|
# shall be the last check
|
251
326
|
it "#dirty? - check dirty git directory" do
|
252
|
-
execute "echo 'toto' > #{
|
327
|
+
execute "echo 'toto' > #{File.join(dir, filename)}"
|
253
328
|
b = FalkorLib::Git.dirty?( dir )
|
254
329
|
expect(b).to be true
|
255
330
|
end
|
256
331
|
|
257
332
|
end
|
258
|
-
|
259
|
-
|
260
|
-
|
261
333
|
end
|