falkorlib 0.6.19 → 0.7.0
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 +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
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# bootstrap_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Thu 2016-11-03 21:38 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Bootstrapping operations
|
8
8
|
#
|
@@ -16,69 +16,119 @@ require 'fileutils'
|
|
16
16
|
|
17
17
|
describe FalkorLib::Bootstrap do
|
18
18
|
|
19
|
-
|
19
|
+
include FalkorLib::Common
|
20
20
|
|
21
|
-
|
21
|
+
dir = Dir.mktmpdir
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
before :all do
|
24
|
+
$stdout.sync = true
|
25
|
+
#FalkorLib.config[:no_interaction] = true
|
26
|
+
end
|
27
|
+
|
28
|
+
after :all do
|
29
|
+
FileUtils.remove_entry_secure dir
|
30
|
+
#FalkorLib.config[:no_interaction] = false
|
31
|
+
end
|
32
|
+
|
33
|
+
context 'helper functions' do
|
34
|
+
it "#select_forge - none" do
|
35
|
+
expect(STDIN).to receive(:gets).and_return('1')
|
36
|
+
t = FalkorLib::Bootstrap.select_forge()
|
37
|
+
expect(t).to eq(:none)
|
26
38
|
end
|
27
39
|
|
28
|
-
|
29
|
-
|
30
|
-
|
40
|
+
it "#select_forge -- default to github" do
|
41
|
+
expect(STDIN).to receive(:gets).and_return('')
|
42
|
+
t = FalkorLib::Bootstrap.select_forge(:github)
|
43
|
+
expect(t).to eq(:github)
|
31
44
|
end
|
32
45
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
it "#select_forge -- default to github" do
|
41
|
-
expect(STDIN).to receive(:gets).and_return('')
|
42
|
-
t = FalkorLib::Bootstrap.select_forge(:github)
|
43
|
-
expect(t).to eq(:github)
|
44
|
-
end
|
45
|
-
|
46
|
-
FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys.each do |lic|
|
47
|
-
it "#select_licence -- default to #{lic}" do
|
48
|
-
expect(STDIN).to receive(:gets).and_return('')
|
49
|
-
t = FalkorLib::Bootstrap.select_licence(lic)
|
50
|
-
expect(t).to eq(lic)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
### Badges
|
55
|
-
it "#get_badge " do
|
56
|
-
subject = 'licence'
|
57
|
-
status = 'GPL-2.0'
|
58
|
-
t = FalkorLib::Bootstrap.get_badge(subject, status)
|
59
|
-
expect(t).to match(/#{subject}/)
|
60
|
-
expect(t).to match(/#{status.sub(/-/, '--')}/)
|
61
|
-
end
|
62
|
-
end # context
|
63
|
-
|
64
|
-
|
65
|
-
############################################
|
66
|
-
context 'boostrap repo' do
|
67
|
-
it '#repo' do
|
68
|
-
FalkorLib.config[:no_interaction] = true
|
69
|
-
FalkorLib::Bootstrap.repo(dir, { :no_interaction => true, :git_flow => false })
|
70
|
-
FalkorLib.config[:no_interaction] = false
|
71
|
-
end
|
46
|
+
FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys.each do |lic|
|
47
|
+
it "#select_licence -- default to #{lic}" do
|
48
|
+
expect(STDIN).to receive(:gets).and_return('')
|
49
|
+
t = FalkorLib::Bootstrap.select_licence(lic)
|
50
|
+
expect(t).to eq(lic)
|
51
|
+
end
|
72
52
|
end
|
73
53
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
54
|
+
### Badges
|
55
|
+
it "#get_badge " do
|
56
|
+
subject = 'licence'
|
57
|
+
status = 'GPL-2.0'
|
58
|
+
t = FalkorLib::Bootstrap.get_badge(subject, status)
|
59
|
+
expect(t).to match(/#{subject}/)
|
60
|
+
expect(t).to match(/#{status.sub(/-/, '--')}/)
|
82
61
|
end
|
62
|
+
end # context
|
63
|
+
|
64
|
+
############################################
|
65
|
+
#context 'bootstrap/base' do
|
66
|
+
# it "#trash " do
|
67
|
+
# FalkorLib.config[:no_interaction] = true
|
68
|
+
# FalkorLib::Bootstrap.trash(dir)
|
69
|
+
# default_trashdir = File.join(dir, FalkorLib.config[:templates][:trashdir])
|
70
|
+
# t = File.directory?( default_trashdir )
|
71
|
+
# expect(t).to be true
|
72
|
+
# t = File.exist?(File.join(default_trashdir, '.gitignore'))
|
73
|
+
# expect(t).to be true
|
74
|
+
# end
|
75
|
+
|
76
|
+
# it "#trash -- with non standard trash dir (dir = '#{dir}')" do
|
77
|
+
# trash = '.trashtoto'
|
78
|
+
# FalkorLib::Bootstrap.trash(dir, trash)
|
79
|
+
# trashdir = File.join(dir, trash)
|
80
|
+
# t = File.directory?( trashdir )
|
81
|
+
# expect(t).to be true
|
82
|
+
# t = File.exist?(File.join(trashdir, '.gitignore'))
|
83
|
+
# expect(t).to be true
|
84
|
+
# end
|
85
|
+
|
86
|
+
# it "#versionfile" do
|
87
|
+
# f = File.join(dir, 'VERSION')
|
88
|
+
# FalkorLib::Bootstrap.versionfile(dir)
|
89
|
+
# t = File.exist?(f)
|
90
|
+
# expect(t).to be true
|
91
|
+
# content = `cat #{f}`.chomp
|
92
|
+
# expect(content).to eq('0.0.0')
|
93
|
+
# end
|
94
|
+
|
95
|
+
# it "#versionfile -- non standard file and version" do
|
96
|
+
# opts = {
|
97
|
+
# :file => 'version.txt',
|
98
|
+
# :version => '1.2.3'
|
99
|
+
# }
|
100
|
+
# f = File.join(dir, opts[:file])
|
101
|
+
# FalkorLib::Bootstrap.versionfile(dir, opts)
|
102
|
+
# t = File.exist?(f)
|
103
|
+
# expect(t).to be true
|
104
|
+
# content = `cat #{f}`.chomp
|
105
|
+
# expect(content).to eq(opts[:version])
|
106
|
+
# end
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
# end
|
113
|
+
|
114
|
+
|
115
|
+
# ############################################
|
116
|
+
# context 'boostrap repo' do
|
117
|
+
# it '#repo' do
|
118
|
+
# FalkorLib.config[:no_interaction] = true
|
119
|
+
# FalkorLib::Bootstrap.repo(dir, { :no_interaction => true, :git_flow => false })
|
120
|
+
# FalkorLib.config[:no_interaction] = false
|
121
|
+
# end
|
122
|
+
# end
|
123
|
+
|
124
|
+
# ############################################
|
125
|
+
# context 'boostrap motd' do
|
126
|
+
# it "#motd" do
|
127
|
+
# motdfile = File.join(dir, 'motd1')
|
128
|
+
# FalkorLib::Bootstrap.motd(dir, { :file => "#{motdfile}", :no_interaction => true })
|
129
|
+
# t = File.exists?(motdfile)
|
130
|
+
# expect(t).to be true
|
131
|
+
# end
|
132
|
+
# end
|
83
133
|
|
84
134
|
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# coding: utf-8
|
3
|
+
#########################################
|
4
|
+
# bootstrap_latex_spec.rb
|
5
|
+
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
6
|
+
# Time-stamp: <Sun 2016-11-13 21:37 svarrette>
|
7
|
+
#
|
8
|
+
# @description Check the Bootstrapping operations for LaTeX-based projects
|
9
|
+
#
|
10
|
+
# Copyright (c) 2013 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
11
|
+
# . http://varrette.gforge.uni.lu
|
12
|
+
##############################################################################
|
13
|
+
|
14
|
+
require 'spec_helper'
|
15
|
+
require 'tmpdir'
|
16
|
+
require 'fileutils'
|
17
|
+
|
18
|
+
describe FalkorLib::Bootstrap do
|
19
|
+
|
20
|
+
include FalkorLib::Common
|
21
|
+
|
22
|
+
dir = Dir.mktmpdir
|
23
|
+
supported_latex_types = [ :article ]
|
24
|
+
# I give up on making the compilation working on travis (it currently fails
|
25
|
+
# with the message 'LaTeX Error: There's no line here to end. l.57') -- see build
|
26
|
+
# [#326.1](https://travis-ci.org/Falkor/falkorlib/jobs/175603403) for instance.
|
27
|
+
# not figure out the problem as it works fine on vagrant/ubuntu-precise and mac.
|
28
|
+
supported_latex_types << :beamer unless ENV['TRAVIS_CI_RUN']
|
29
|
+
|
30
|
+
#_____________
|
31
|
+
before :all do
|
32
|
+
$stdout.sync = true
|
33
|
+
FalkorLib.config[:no_interaction] = true
|
34
|
+
end
|
35
|
+
|
36
|
+
#____________
|
37
|
+
after :all do
|
38
|
+
FileUtils.remove_entry_secure dir
|
39
|
+
FalkorLib.config[:no_interaction] = false
|
40
|
+
end
|
41
|
+
|
42
|
+
########################################################################
|
43
|
+
context "bootstrap/latex within temporary directory '#{dir}'" do
|
44
|
+
|
45
|
+
it "#latex -- unsupported type" do
|
46
|
+
expect { FalkorLib::Bootstrap::latex(dir, :toto) }.to raise_error (SystemExit)
|
47
|
+
end
|
48
|
+
|
49
|
+
###### LaTeX slides
|
50
|
+
supported_latex_types.each do |type|
|
51
|
+
it "#latex(#{type})" do
|
52
|
+
name = "latex-#{type}"
|
53
|
+
projectdir = case type
|
54
|
+
when :beamer
|
55
|
+
'slides'
|
56
|
+
when :article
|
57
|
+
'articles'
|
58
|
+
end
|
59
|
+
subdirname = File.join(projectdir, "#{Time.now.year}", name)
|
60
|
+
subdir = File.join(dir, subdirname)
|
61
|
+
srcdir = File.join(subdir, 'src')
|
62
|
+
trashdir = File.join(srcdir, FalkorLib.config[:templates][:trashdir])
|
63
|
+
imagedir = File.join(srcdir, 'images')
|
64
|
+
c = FalkorLib::Bootstrap::latex(dir, type, {
|
65
|
+
:name => name
|
66
|
+
})
|
67
|
+
# check that everything was set accordingly
|
68
|
+
expect(FalkorLib::Git.init?(dir)).to be true
|
69
|
+
|
70
|
+
# check expected git submodules
|
71
|
+
submodules = [ 'Makefiles' ]
|
72
|
+
submodules << 'beamerthemeFalkor' if type == :beamer
|
73
|
+
submodules.each do |d|
|
74
|
+
expect(Dir.exist?( File.join(dir, FalkorLib.config.git[:submodulesdir], d))).to be true
|
75
|
+
end
|
76
|
+
|
77
|
+
# check main files at the root directory
|
78
|
+
main_root_files = [ '.gitmodules', 'VERSION', 'README.md' ]
|
79
|
+
main_root_files.each do |f|
|
80
|
+
expect(File.exist?(File.join(dir, f))).to be true
|
81
|
+
end
|
82
|
+
|
83
|
+
# check main LaTeX project directory
|
84
|
+
expect(Dir.exist?(subdir)).to be true
|
85
|
+
main_files = [ '.root', '.makefile.d', 'Makefile']
|
86
|
+
main_files.each do |f|
|
87
|
+
file = File.join(subdir, f)
|
88
|
+
expect(File.exist?(file)).to be true
|
89
|
+
end
|
90
|
+
v = File.readlink(File.join(subdir, 'Makefile'))
|
91
|
+
expect(v).to include '.makefile.d/latex_src'
|
92
|
+
|
93
|
+
# check src directory
|
94
|
+
expect(Dir.exist?(srcdir)).to be true
|
95
|
+
src_latex_symlinks = [ 'Makefile', '_style.sty', '.gitignore' ]
|
96
|
+
src_latex_symlinks.each do |f|
|
97
|
+
file = File.join(srcdir, f)
|
98
|
+
expect(File.exist?(file)).to be true
|
99
|
+
expect(File.readlink(file)).to include '.makefile.d/latex'
|
100
|
+
end
|
101
|
+
|
102
|
+
src_latex_files = [ "#{name}.tex" ]
|
103
|
+
src_latex_files << '_content.md' if type == :beamer
|
104
|
+
src_latex_files = [ '_abstract.tex', '_conclusion.tex', '_experiments.tex', '_introduction.tex', 'biblio.bib', '_related_works.tex' ] if type == :article
|
105
|
+
src_latex_files.each do |f|
|
106
|
+
file = File.join(srcdir, f)
|
107
|
+
expect(File.exist?(file)).to be true
|
108
|
+
end
|
109
|
+
if type == :beamer
|
110
|
+
[ 'beamerthemeFalkor' ].each do |f|
|
111
|
+
file = File.join(srcdir, "#{f}.sty")
|
112
|
+
expect(File.exist?(file)).to be true
|
113
|
+
expect(File.readlink(file)).to include File.join(FalkorLib.config[:git][:submodulesdir], f)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
# trash dir
|
117
|
+
expect(Dir.exist?(trashdir)).to be true
|
118
|
+
# check images dir
|
119
|
+
expect(Dir.exist?(imagedir)).to be true
|
120
|
+
main_files.each do |f|
|
121
|
+
file = File.join(imagedir, f)
|
122
|
+
expect(File.exist?(file)).to be true
|
123
|
+
end
|
124
|
+
image_makefile = File.join(imagedir, 'Makefile')
|
125
|
+
expect(File.readlink(image_makefile)).to include '.makefile.d/images'
|
126
|
+
|
127
|
+
# Finally try to compile it
|
128
|
+
if command?('make') && command?('pandoc')
|
129
|
+
[ "#{srcdir}", "#{subdir}" ].each do |d|
|
130
|
+
t = run %( make -C #{d} )
|
131
|
+
expect(t).to eq(0)
|
132
|
+
pdf = File.join(srcdir, "#{name}.pdf")
|
133
|
+
expect(File.exist?(pdf)).to be true
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
end # context "bootstrap/latex"
|
144
|
+
|
145
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#########################################
|
3
|
+
# bootstrap_link_spec.rb
|
4
|
+
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
+
# Time-stamp: <Sun 2016-11-13 06:46 svarrette>
|
6
|
+
#
|
7
|
+
# @description Check the Bootstrapping operations for [sym]link
|
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::Link do
|
18
|
+
|
19
|
+
include FalkorLib::Common
|
20
|
+
|
21
|
+
dir = Dir.mktmpdir
|
22
|
+
subdirname = 'sub/dir'
|
23
|
+
supported_makefiles = [
|
24
|
+
:repo, :generic, :latex, :src, :gnuplot, :images, :markdown
|
25
|
+
]
|
26
|
+
makefile_d = '.makefile.d'
|
27
|
+
|
28
|
+
#_____________
|
29
|
+
before :all do
|
30
|
+
$stdout.sync = true
|
31
|
+
FalkorLib.config[:no_interaction] = true
|
32
|
+
end
|
33
|
+
|
34
|
+
#____________
|
35
|
+
after :all do
|
36
|
+
FileUtils.remove_entry_secure dir
|
37
|
+
FalkorLib.config[:no_interaction] = false
|
38
|
+
end
|
39
|
+
|
40
|
+
########################################################################
|
41
|
+
context "bootstrap/link within temporary directory '#{dir}'" do
|
42
|
+
|
43
|
+
subdir = File.join(dir, subdirname)
|
44
|
+
dotroot = File.join(subdir, '.root')
|
45
|
+
|
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
|
+
|
53
|
+
### '.root' symlink
|
54
|
+
it "#root" do
|
55
|
+
FileUtils.mkdir_p( subdir )
|
56
|
+
c = FalkorLib::Bootstrap::Link.root(subdir)
|
57
|
+
expect(c).to eq(0)
|
58
|
+
t = File.exists?(dotroot)
|
59
|
+
expect(t).to be true
|
60
|
+
v = File.readlink(dotroot)
|
61
|
+
expect(v).to eq('../..')
|
62
|
+
end
|
63
|
+
|
64
|
+
it "#root again, link already existing" do
|
65
|
+
t = FalkorLib::Bootstrap::Link.root(subdir)
|
66
|
+
expect(t).to eq(1)
|
67
|
+
c = capture(:stdout) { FalkorLib::Bootstrap::Link.root(subdir) }
|
68
|
+
expect(c).to include "the symbolic link '.root' already exists"
|
69
|
+
end
|
70
|
+
|
71
|
+
it "#root -- different symlink name" do
|
72
|
+
linkname = '.custom-root'
|
73
|
+
custom_dotroot = File.join(subdir, linkname)
|
74
|
+
c = FalkorLib::Bootstrap::Link.root(subdir, { :name => linkname })
|
75
|
+
expect(c).to eq(0)
|
76
|
+
t = File.exists?(custom_dotroot)
|
77
|
+
expect(t).to be true
|
78
|
+
v = File.readlink(custom_dotroot)
|
79
|
+
expect(v).to eq('../..')
|
80
|
+
end
|
81
|
+
|
82
|
+
it "#root -- at git rootdir" do
|
83
|
+
c = capture(:stdout) { FalkorLib::Bootstrap::Link.root(dir) }
|
84
|
+
expect(c).to include 'Already at the root directory of the Git repository'
|
85
|
+
end
|
86
|
+
|
87
|
+
###### My favorite Makefiles
|
88
|
+
supported_makefiles.each do |type|
|
89
|
+
|
90
|
+
workdir = File.join(dir, "#{type}")
|
91
|
+
makefile = File.join(workdir, 'Makefile')
|
92
|
+
dotmakefile_d = File.join(workdir, makefile_d)
|
93
|
+
|
94
|
+
it "#makefile -- type '#{type}'" do
|
95
|
+
FileUtils.mkdir_p(workdir)
|
96
|
+
c = FalkorLib::Bootstrap::Link.makefile(workdir, { type.to_sym => true })
|
97
|
+
expect(c).to eq(0)
|
98
|
+
|
99
|
+
# check existence of symlinks
|
100
|
+
d = File.exists?(dotmakefile_d)
|
101
|
+
expect(d).to be true
|
102
|
+
t = File.exists?(makefile)
|
103
|
+
expect(t).to be true
|
104
|
+
|
105
|
+
# check targets of symlinks
|
106
|
+
vd = File.readlink(dotmakefile_d)
|
107
|
+
expect(vd).to include File.join(FalkorLib.config[:git][:submodulesdir], 'Makefiles')
|
108
|
+
|
109
|
+
v = File.readlink(makefile)
|
110
|
+
expect(v).to include "#{type}"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
type = 'latex'
|
115
|
+
it "#makefile -- again (type #{type}), links already existing" do
|
116
|
+
workdir = File.join(dir, type) # for instance
|
117
|
+
makefile = File.join(workdir, 'Makefile')
|
118
|
+
pre_check = File.exists?(makefile)
|
119
|
+
expect(pre_check).to be true
|
120
|
+
|
121
|
+
t = FalkorLib::Bootstrap::Link.makefile(workdir, { type.to_sym => true })
|
122
|
+
expect(t).to eq(1)
|
123
|
+
c = capture(:stdout) {
|
124
|
+
FalkorLib::Bootstrap::Link.makefile(workdir, { type.to_sym => true })
|
125
|
+
}
|
126
|
+
[
|
127
|
+
"the git submodule 'Makefiles' is already setup",
|
128
|
+
"the symbolic link '.root' already exists",
|
129
|
+
"Makefile already setup"
|
130
|
+
].each do |pattern|
|
131
|
+
expect(c).to include pattern
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
end # context "bootstrap/link"
|
136
|
+
|
137
|
+
end
|