falkorlib 0.6.9 → 0.6.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/Gemfile.lock +1 -1
- data/lib/falkorlib/bootstrap.rb +2 -2
- data/lib/falkorlib/bootstrap/base.rb +3 -81
- data/lib/falkorlib/bootstrap/link.rb +110 -0
- data/lib/falkorlib/cli/link.rb +15 -9
- data/lib/falkorlib/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 809f6aba9cf7153137af45ab65e4702617e346b7
|
4
|
+
data.tar.gz: fe8a4009d51b091fed482c122289a47cb4d54a97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfbc07e1fd264e5c1eb71a3cdb535d368cb7b618448a2cf5c8e04e3a983d7d6b92956fc0631931365d0fae74fe0fb19d5b8308686cfc0076de256df9f4aee972
|
7
|
+
data.tar.gz: 338cbf7fcd13a1424143b0b85a8cc3d503e05c7fb1218dbbb920917c85d5f1e5edcc0cbb496118488f4892d172c0f184b85314a3cd2c2f499dbffb45bff6e599
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/falkorlib/bootstrap.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Sun 2016-03-27 23:21 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# Management of Bootstrapping operations
|
6
6
|
|
@@ -11,5 +11,5 @@ module FalkorLib #:nodoc:
|
|
11
11
|
end # module FalkorLib
|
12
12
|
|
13
13
|
require "falkorlib/bootstrap/base"
|
14
|
+
require "falkorlib/bootstrap/link"
|
14
15
|
#require "falkorlib/bootstrap/repo"
|
15
|
-
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Sun 2016-03-27 23:20 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# Interface for the main Bootstrapping operations
|
6
6
|
#
|
@@ -482,7 +482,7 @@ module FalkorLib
|
|
482
482
|
[ :latex ].each do |type|
|
483
483
|
erbfiles << "readme_#{type}.erb" if options[type.to_sym] and File.exist?( File.join(templatedir, "readme_#{type}.erb"))
|
484
484
|
end
|
485
|
-
erbfiles << "readme_issues.erb"
|
485
|
+
erbfiles << "readme_issues.erb"
|
486
486
|
erbfiles << "readme_git.erb" if FalkorLib::Git.init?(dir)
|
487
487
|
erbfiles << "readme_gitflow.erb" if FalkorLib::GitFlow.init?(dir)
|
488
488
|
erbfiles << "readme_rvm.erb" if config[:type].include?(:rvm)
|
@@ -513,84 +513,6 @@ module FalkorLib
|
|
513
513
|
#
|
514
514
|
end # readme
|
515
515
|
|
516
|
-
###### rootlink ######
|
517
|
-
# Create a symlink '.root' targeting the relative path to the git root directory
|
518
|
-
# Supported options:
|
519
|
-
# * :name [string] name of the symlink ('.root' by default)
|
520
|
-
##
|
521
|
-
def rootlink(dir = Dir.pwd, options = {})
|
522
|
-
raise FalkorLib::ExecError "Not used in a Git repository" unless FalkorLib::Git.init?
|
523
|
-
path = normalized_path(dir)
|
524
|
-
relative_path_to_root = (Pathname.new( FalkorLib::Git.rootdir(dir) ).relative_path_from Pathname.new( File.realpath(path)))
|
525
|
-
if "#{relative_path_to_root}" == "."
|
526
|
-
FalkorLib::Common.warning "Already at the root directory of the Git repository"
|
527
|
-
FalkorLib::Common.really_continue?
|
528
|
-
end
|
529
|
-
target = options[:name] ? options[:name] : '.root'
|
530
|
-
puts "Entering '#{relative_path_to_root}'"
|
531
|
-
unless File.exists?( File.join(path, target))
|
532
|
-
warning "creating the symboling link '#{target}' which points to '#{relative_path_to_root}'" if options[:verbose]
|
533
|
-
# Format: ln_s(old, new, options = {}) -- Creates a symbolic link new which points to old.
|
534
|
-
#FileUtils.ln_s "#{relative_path_to_root}", "#{target}"
|
535
|
-
Dir.chdir( path ) do
|
536
|
-
run %{ ln -s #{relative_path_to_root} #{target} }
|
537
|
-
end
|
538
|
-
FalkorLib::Git.add(File.join(path, target), "Add symlink to the root directory as .root")
|
539
|
-
else
|
540
|
-
puts " ... the symbolic link '#{target}' already exists"
|
541
|
-
end
|
542
|
-
end # rootlink
|
543
|
-
|
544
|
-
###### makefile_link ######
|
545
|
-
# Create a symlink to the one of Falkor's Makefile, typically bring as a Git submodule
|
546
|
-
# Supported options:
|
547
|
-
# * :force [boolean] force action
|
548
|
-
# * :latex [boolean] Makefile to compile LaTeX documents
|
549
|
-
# * :gnuplot [boolean] Makefile to compile GnuPlot scripts
|
550
|
-
# * :markdown [boolean] Makefile to convert Markdown files to HTML
|
551
|
-
# * :target [string] Path to target
|
552
|
-
# * :repo [string] Path to Falkor's Makefile repository
|
553
|
-
##
|
554
|
-
def makefile_link(dir = Dir.pwd, options = {})
|
555
|
-
path = normalized_path(dir)
|
556
|
-
rootdir = FalkorLib::Git.rootdir(path)
|
557
|
-
info "Create a symlink to the one of Falkor's Makefile"
|
558
|
-
# Add Falkor's Makefiles
|
559
|
-
submodules = FalkorLib.config[:git][:submodules]
|
560
|
-
submodules['Makefiles'] = {
|
561
|
-
:url => 'https://github.com/Falkor/Makefiles.git',
|
562
|
-
:branch => 'devel'
|
563
|
-
} if submodules['Makefiles'].nil?
|
564
|
-
FalkorLib::Git.submodule_init(rootdir, submodules)
|
565
|
-
FalkorLib::Bootstrap.rootlink(dir)
|
566
|
-
dst = File.join('.root', options[:refdir])
|
567
|
-
ap options
|
568
|
-
makefile = 'Makefile'
|
569
|
-
type = 'latex'
|
570
|
-
# recall to place the default option (--latex) at the last position
|
571
|
-
[ :gnuplot, :images, :generic, :markdown] .each do |e|
|
572
|
-
if options[e.to_sym]
|
573
|
-
type = e.to_s
|
574
|
-
break
|
575
|
-
end
|
576
|
-
end
|
577
|
-
makefile = 'Makefile.insubdir' if options[:generic]
|
578
|
-
makefile = 'Makefile.to_html' if options[:markdown]
|
579
|
-
dst = File.join(dst, type, makefile)
|
580
|
-
unless File.exists?( File.join(path, 'Makefile'))
|
581
|
-
info "Bootstrapping #{type.capitalize} Makefile (as symlink to Falkor's Makefile)"
|
582
|
-
really_continue?
|
583
|
-
Dir.chdir( path ) do
|
584
|
-
run %{ ln -s #{dst} Makefile }
|
585
|
-
end
|
586
|
-
ap File.join(path, 'Makefile')
|
587
|
-
FalkorLib::Git.add(File.join(path, 'Makefile'), "Add symlink to the #{type.capitalize} Makefile")
|
588
|
-
else
|
589
|
-
puts " ... Makefile already setup"
|
590
|
-
end
|
591
|
-
end # makefile_link
|
592
|
-
|
593
|
-
|
594
516
|
|
595
517
|
|
596
518
|
###### latex ######
|
@@ -659,7 +581,7 @@ module FalkorLib
|
|
659
581
|
run %{ mkdir -p #{project_dir}/images } unless File.directory?("#{subdir}/images")
|
660
582
|
end
|
661
583
|
info "populating '#{project_dir}'"
|
662
|
-
|
584
|
+
FalkorLib::Bootstrap::Link.root(subdir, { :verbose => true} )
|
663
585
|
# Prepare the links from the sub-module files
|
664
586
|
[ 'Makefile', '_style.sty', '.gitignore', 'beamerthemeFalkor.sty' ].each do |f|
|
665
587
|
next if (f =~ /beamer/) and (type != :beamer)
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
################################################################################
|
3
|
+
# Time-stamp: <Sun 2016-03-27 23:48 svarrette>
|
4
|
+
################################################################################
|
5
|
+
# Interface for Bootstrapping various symlinks within your project
|
6
|
+
#
|
7
|
+
require "falkorlib"
|
8
|
+
require "falkorlib/common"
|
9
|
+
require 'erb' # required for module generation
|
10
|
+
require 'artii'
|
11
|
+
require 'facter'
|
12
|
+
|
13
|
+
include FalkorLib::Common
|
14
|
+
|
15
|
+
|
16
|
+
module FalkorLib
|
17
|
+
module Bootstrap
|
18
|
+
module Link
|
19
|
+
|
20
|
+
module_function
|
21
|
+
|
22
|
+
###### makefile ######
|
23
|
+
# Create a symlink to the one of Falkor's Makefile, typically bring as a Git submodule
|
24
|
+
# Supported options:
|
25
|
+
# * :force [boolean] force action
|
26
|
+
# * :latex [boolean] Makefile to compile LaTeX documents
|
27
|
+
# * :gnuplot [boolean] Makefile to compile GnuPlot scripts
|
28
|
+
# * :markdown [boolean] Makefile to convert Markdown files to HTML
|
29
|
+
# * :refdir [string] Path to Falkor's Makefile repository
|
30
|
+
# * :src [boolean] Path to latex_src
|
31
|
+
##
|
32
|
+
def makefile(dir = Dir.pwd, options = {})
|
33
|
+
path = normalized_path(dir)
|
34
|
+
rootdir = FalkorLib::Git.rootdir(path)
|
35
|
+
info "Create a symlink to the one of Falkor's Makefile"
|
36
|
+
# Add Falkor's Makefiles
|
37
|
+
submodules = FalkorLib.config[:git][:submodules]
|
38
|
+
submodules['Makefiles'] = {
|
39
|
+
:url => 'https://github.com/Falkor/Makefiles.git',
|
40
|
+
:branch => 'devel'
|
41
|
+
} if submodules['Makefiles'].nil?
|
42
|
+
FalkorLib::Git.submodule_init(rootdir, submodules)
|
43
|
+
FalkorLib::Bootstrap::Link.root(dir)
|
44
|
+
dst = File.join('.root', options[:refdir])
|
45
|
+
makefile_d = '.makefile.d'
|
46
|
+
unless File.exists?(File.join(path, makefile_d))
|
47
|
+
Dir.chdir( path ) do
|
48
|
+
run %{ ln -s #{dst} #{makefile_d} }
|
49
|
+
FalkorLib::Git.add(File.join(path, makefile_d), "Add symlink '#{makefile_d}' to Falkor's Makefile directory")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
#ap options
|
53
|
+
makefile = 'Makefile'
|
54
|
+
type = 'latex'
|
55
|
+
# recall to place the default option (--latex) at the last position
|
56
|
+
[ :gnuplot, :images, :generic, :markdown] .each do |e|
|
57
|
+
if options[e.to_sym]
|
58
|
+
type = e.to_s
|
59
|
+
break
|
60
|
+
end
|
61
|
+
end
|
62
|
+
type = 'latex_src' if options[:src]
|
63
|
+
makefile = 'Makefile.insubdir' if options[:generic]
|
64
|
+
makefile = 'Makefile.to_html' if options[:markdown]
|
65
|
+
dst = File.join(makefile_d, type, makefile)
|
66
|
+
unless File.exists?( File.join(path, 'Makefile'))
|
67
|
+
info "Bootstrapping #{type.capitalize} Makefile (as symlink to Falkor's Makefile)"
|
68
|
+
really_continue?
|
69
|
+
Dir.chdir( path ) do
|
70
|
+
run %{ ln -s #{dst} Makefile }
|
71
|
+
end
|
72
|
+
ap File.join(path, 'Makefile')
|
73
|
+
FalkorLib::Git.add(File.join(path, 'Makefile'), "Add symlink to the #{type.capitalize} Makefile")
|
74
|
+
else
|
75
|
+
puts " ... Makefile already setup"
|
76
|
+
end
|
77
|
+
end # makefile_link
|
78
|
+
|
79
|
+
###### rootlink ######
|
80
|
+
# Create a symlink '.root' targeting the relative path to the git root directory
|
81
|
+
# Supported options:
|
82
|
+
# * :name [string] name of the symlink ('.root' by default)
|
83
|
+
##
|
84
|
+
def root(dir = Dir.pwd, options = {})
|
85
|
+
raise FalkorLib::ExecError "Not used in a Git repository" unless FalkorLib::Git.init?
|
86
|
+
path = normalized_path(dir)
|
87
|
+
relative_path_to_root = (Pathname.new( FalkorLib::Git.rootdir(dir) ).relative_path_from Pathname.new( File.realpath(path)))
|
88
|
+
if "#{relative_path_to_root}" == "."
|
89
|
+
FalkorLib::Common.warning "Already at the root directory of the Git repository"
|
90
|
+
FalkorLib::Common.really_continue?
|
91
|
+
end
|
92
|
+
target = options[:name] ? options[:name] : '.root'
|
93
|
+
puts "Entering '#{relative_path_to_root}'"
|
94
|
+
unless File.exists?( File.join(path, target))
|
95
|
+
warning "creating the symboling link '#{target}' which points to '#{relative_path_to_root}'" if options[:verbose]
|
96
|
+
# Format: ln_s(old, new, options = {}) -- Creates a symbolic link new which points to old.
|
97
|
+
#FileUtils.ln_s "#{relative_path_to_root}", "#{target}"
|
98
|
+
Dir.chdir( path ) do
|
99
|
+
run %{ ln -s #{relative_path_to_root} #{target} }
|
100
|
+
end
|
101
|
+
FalkorLib::Git.add(File.join(path, target), "Add symlink to the root directory as .root")
|
102
|
+
else
|
103
|
+
puts " ... the symbolic link '#{target}' already exists"
|
104
|
+
end
|
105
|
+
end # rootlink
|
106
|
+
|
107
|
+
|
108
|
+
end # module Link
|
109
|
+
end # module Bootstrap
|
110
|
+
end # module FalkorLib
|
data/lib/falkorlib/cli/link.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Sun 2016-03-27 23:47 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require 'thor'
|
@@ -21,23 +21,29 @@ module FalkorLib
|
|
21
21
|
#......................................
|
22
22
|
desc "rootdir [options]", "Create a symlink '.root' which targets the root of the repository"
|
23
23
|
def rootdir(dir = Dir.pwd)
|
24
|
-
FalkorLib::Bootstrap.
|
24
|
+
FalkorLib::Bootstrap::Link.root(dir, options)
|
25
25
|
end # rootdir
|
26
26
|
|
27
27
|
|
28
28
|
###### make ######
|
29
|
-
method_option :latex, :default => true, :type => :boolean, :aliases => '-l',
|
30
|
-
|
31
|
-
method_option :
|
32
|
-
|
33
|
-
method_option :
|
29
|
+
method_option :latex, :default => true, :type => :boolean, :aliases => '-l',
|
30
|
+
:desc => "Makefile to compile LaTeX documents"
|
31
|
+
method_option :gnuplot, :type => :boolean, :aliases => ['--plot', '-p'],
|
32
|
+
:desc => "Makefile to compile GnuPlot scripts"
|
33
|
+
method_option :generic, :type => :boolean, :aliases => '-g',
|
34
|
+
:desc => "Generic Makefile for sub directory"
|
35
|
+
method_option :markdown, :type => :boolean, :aliases => '-m',
|
36
|
+
:desc => "Makefile to convert Markdown files to HTML"
|
37
|
+
method_option :images, :type => :boolean, :aliases => [ '-i', '--img' ],
|
38
|
+
:desc => "Makefile to optimize images"
|
34
39
|
method_option :refdir, :default => "#{FalkorLib.config[:git][:submodulesdir]}/Makefiles",
|
35
40
|
:aliases => '-d', :desc => "Path to Falkor's Makefile repository (Relative to Git root dir)"
|
36
|
-
method_option :
|
41
|
+
method_option :src, :type => :boolean, :aliases => [ '--src', '-s' ],
|
42
|
+
:desc => "Path to Falkor's Makefile for latex_src"
|
37
43
|
#......................................
|
38
44
|
desc "make [options]", "Create a symlink to one of Falkor's Makefile, set as Git submodule"
|
39
45
|
def make(dir = Dir.pwd)
|
40
|
-
FalkorLib::Bootstrap.
|
46
|
+
FalkorLib::Bootstrap::Link.makefile(dir, options)
|
41
47
|
end # make
|
42
48
|
|
43
49
|
|
data/lib/falkorlib/version.rb
CHANGED
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.6.
|
4
|
+
version: 0.6.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Varrette
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -363,6 +363,7 @@ files:
|
|
363
363
|
- lib/falkorlib.rb
|
364
364
|
- lib/falkorlib/bootstrap.rb
|
365
365
|
- lib/falkorlib/bootstrap/base.rb
|
366
|
+
- lib/falkorlib/bootstrap/link.rb
|
366
367
|
- lib/falkorlib/cli.rb
|
367
368
|
- lib/falkorlib/cli/config.rb
|
368
369
|
- lib/falkorlib/cli/link.rb
|