falkorlib 0.6.11 → 0.6.12

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 809f6aba9cf7153137af45ab65e4702617e346b7
4
- data.tar.gz: fe8a4009d51b091fed482c122289a47cb4d54a97
3
+ metadata.gz: 10b2bf279208b39dac37c3652bea3061a0c90404
4
+ data.tar.gz: 048f004377560479bba8d4624b7b60d6eb62166c
5
5
  SHA512:
6
- metadata.gz: bfbc07e1fd264e5c1eb71a3cdb535d368cb7b618448a2cf5c8e04e3a983d7d6b92956fc0631931365d0fae74fe0fb19d5b8308686cfc0076de256df9f4aee972
7
- data.tar.gz: 338cbf7fcd13a1424143b0b85a8cc3d503e05c7fb1218dbbb920917c85d5f1e5edcc0cbb496118488f4892d172c0f184b85314a3cd2c2f499dbffb45bff6e599
6
+ metadata.gz: 9558442aead8ca5af061f84aa741e4c5370d2bcb36ca91caf6546f200ff0bd14092c6514839994f9c97e9aa0b399c089f1aa18102aa213ed92970df64409160b
7
+ data.tar.gz: e48cbe39a9077e6765ef29db77bb6b1578d6ee7cc7457e6bed01efb8f9f99ed12b3e059ef4971fda96159ce59eb15805e558ab86a218aaa1a770384ff12249f6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- falkorlib (0.6.11)
4
+ falkorlib (0.6.12)
5
5
  artii (>= 2.1)
6
6
  awesome_print (~> 1.2)
7
7
  configatron (~> 3.2)
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Sun 2016-03-27 23:20 svarrette>
3
+ # Time-stamp: <Tue 2016-06-28 18:51 svarrette>
4
4
  ################################################################################
5
5
  # Interface for the main Bootstrapping operations
6
6
  #
@@ -204,7 +204,9 @@ module FalkorLib
204
204
  # ==== Gemfile ===
205
205
  gemfile = File.join(rootdir, 'Gemfile')
206
206
  unless File.exists?( gemfile )
207
- run %{ bundle init }
207
+ # Dir.chdir(rootdir) do
208
+ # run %{ bundle init }
209
+ # end
208
210
  info " ==> configuring Gemfile with Falkorlib"
209
211
  File.open( gemfile, 'a') do |f|
210
212
  f.puts "source 'https://rubygems.org'"
@@ -259,9 +261,9 @@ module FalkorLib
259
261
  end
260
262
  # === prepare Git submodules ===
261
263
  info " ==> prepare the relevant Git submodules"
262
- submodules = {
263
- 'gitstats' => { :url => 'https://github.com/hoxu/gitstats.git' }
264
- }
264
+ submodules = {}
265
+ #'gitstats' => { :url => 'https://github.com/hoxu/gitstats.git' }
266
+ # }
265
267
  if options[:make]
266
268
  submodules['Makefiles'] = {
267
269
  :url => 'https://github.com/Falkor/Makefiles.git',
@@ -623,15 +625,15 @@ module FalkorLib
623
625
 
624
626
  # populate the images/ directory
625
627
  baseimages = File.join( FalkorLib.templates, 'latex', 'images')
626
- images_makefile_src = "#{FalkorLib.config[:git][:submodulesdir]}/Makefiles/generic/Makefile.insubdir"
628
+ #images_makefile_src = "#{FalkorLib.config[:git][:submodulesdir]}/Makefiles/generic/Makefile.insubdir"
627
629
  images = File.join(subdir, 'images')
628
630
  info "populating the image directory"
629
631
  Dir.chdir( images ) do
630
632
  run %{ rsync -avzu #{baseimages}/ . }
631
633
  run %{ ln -s ../.root .root } unless File.exists?(File.join(images, '.root'))
632
- run %{ ln -s .root/#{images_makefile_src} Makefile } unless File.exists?(File.join(images, 'Makefile'))
634
+ #run %{ ln -s .root/#{images_makefile_src} Makefile } unless File.exists?(File.join(images, 'Makefile'))
633
635
  end
634
-
636
+ FalkorLib::Bootstrap::Link.makefile(images, { :src => true } )
635
637
 
636
638
  # default_project_dir = case type
637
639
  # when :beamer
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Sun 2016-03-27 23:48 svarrette>
3
+ # Time-stamp: <Sun 2016-03-27 23:58 svarrette>
4
4
  ################################################################################
5
5
  # Interface for Bootstrapping various symlinks within your project
6
6
  #
@@ -69,7 +69,7 @@ module FalkorLib
69
69
  Dir.chdir( path ) do
70
70
  run %{ ln -s #{dst} Makefile }
71
71
  end
72
- ap File.join(path, 'Makefile')
72
+ #ap File.join(path, 'Makefile')
73
73
  FalkorLib::Git.add(File.join(path, 'Makefile'), "Add symlink to the #{type.capitalize} Makefile")
74
74
  else
75
75
  puts " ... Makefile already setup"
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Wed 2016-02-03 00:10 svarrette>
3
+ # Time-stamp: <Tue 2016-06-28 18:50 svarrette>
4
4
  ################################################################################
5
5
  # Management of Git Flow operations
6
6
 
@@ -43,9 +43,9 @@ module FalkorLib
43
43
  ## Check if git-flow is initialized
44
44
  # def init?(path = Dir.pwd)
45
45
  # res = FalkorLib::Git.init?(path)
46
- # Dir.chdir(path) do
46
+ # Dir.chdir(path) do
47
47
  # gf_check = `git config --get-regexp 'gitflow*'`
48
- # res &= ! gf_check.empty?
48
+ # res &= ! gf_check.empty?
49
49
  # end
50
50
  # res
51
51
  # end # init?(path = Dir.pwd)
@@ -132,20 +132,22 @@ module FalkorLib
132
132
  end
133
133
  devel_branch = gitflow_branches[:develop]
134
134
  #info "checkout to the main development branch '#{devel_branch}'"
135
- exit_status = run %{
135
+ exit_status = run %{
136
136
  git checkout #{devel_branch}
137
137
  }
138
+ # git config branch.$(git rev-parse --abbrev-ref HEAD).mergeoptions --no-edit for the develop branch
139
+ exit_status = execute "git config branch.#{devel_branch}.mergeoptions --no-edit"
138
140
  if branches.include?('master') && ! gitflow_branches.values.include?( 'master' )
139
141
  warn "Your git-flow confuguration does not hold the 'master' branch any more"
140
142
  warn "You probably want to get rid of it asap by running 'git branch -d master'"
141
- end
142
- if devel_branch != 'master' &&
143
- remotes.include?( 'origin' ) &&
143
+ end
144
+ if devel_branch != 'master' &&
145
+ remotes.include?( 'origin' ) &&
144
146
  branches.include?( 'remotes/origin/master')
145
147
  warn "You might want to change the remote default branch to point to '#{devel_branch}"
146
148
  puts "=> On github: Settings > Default Branch > #{devel_branch}"
147
149
  puts "=> On the remote bare Git repository: 'git symbolic-ref HEAD refs/head/#{devel_branch}'"
148
- end
150
+ end
149
151
  end
150
152
  exit_status
151
153
  end
@@ -158,8 +160,8 @@ module FalkorLib
158
160
  error "The name '#{name}' cannot contain spaces" if name =~ /\s+/
159
161
  exit_status = 1
160
162
  Dir.chdir( FalkorLib::Git.rootdir(path) ) do
161
- exit_status = run %{
162
- git flow #{type} #{action} #{optional_args} #{name}
163
+ exit_status = run %{
164
+ git flow #{type} #{action} #{optional_args} #{name}
163
165
  }
164
166
  end
165
167
  exit_status
@@ -176,9 +178,9 @@ module FalkorLib
176
178
  end
177
179
 
178
180
  ###
179
- # Return the Gitflow branch
181
+ # Return the Gitflow branch
180
182
  # :master: Master Branch name for production releases
181
- # :develop:
183
+ # :develop:
182
184
  ##
183
185
  def branches(type = :master, dir = Dir.pwd, options = {})
184
186
  FalkorLib::Git.config("gitflow.branch.#{type}", dir)
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
3
  # git.rake - Special tasks for the management of Git operations
4
- # Time-stamp: <Mer 2014-08-20 17:17 svarrette>
4
+ # Time-stamp: <Tue 2016-06-28 19:00 svarrette>
5
5
  #
6
6
  # Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
7
7
  # http://varrette.gforge.uni.lu
@@ -60,11 +60,11 @@ namespace :git do
60
60
  end
61
61
  end
62
62
 
63
- unless FalkorLib.config.git[:submodules].empty?
63
+ unless FalkorLib.config.git[:submodules].empty? or ! File.exists?("#{git_root_dir}/.gitmodules")
64
64
  #.....................
65
65
  namespace :submodules do
66
66
  ########### init ###########
67
- desc "Initialize the Git subtrees defined in FalkorLib.config.git[:submodules]"
67
+ desc "Initialize the Git submodules (as defined in FalkorLib.config.git[:submodules] or .gitmodules)"
68
68
  task :init do |t|
69
69
  info t.full_comment
70
70
  FalkorLib::Git.submodule_init(git_root_dir)
@@ -123,9 +123,9 @@ namespace :git do
123
123
  end # namespace git
124
124
 
125
125
  task :setup => [ 'git:init' ]
126
- unless FalkorLib.config.git[:submodules].empty?
126
+ if (! FalkorLib.config.git[:submodules].empty?) or File.exists?("#{FalkorLib::Git.rootdir}/.gitmodules")
127
127
  task :setup => [ 'git:submodules:init' ]
128
- end
128
+ end
129
129
  unless FalkorLib.config.git[:subtrees].empty?
130
130
  task :setup => [ 'git:subtrees:init' ]
131
- end
131
+ end
@@ -33,7 +33,7 @@ begin
33
33
  #t.pattern = "spec/**/common_*.rb"
34
34
  #t.pattern = "spec/**/versioning_*spec.rb"
35
35
  #t.pattern = "spec/**/puppet*spec.rb"
36
- #t.pattern = "spec/**/bootstrap*spec.rb"
36
+ #t.pattern = "spec/**/bootstrap_he*spec.rb"
37
37
  #t.pattern = "spec/**/git*spec.rb"
38
38
  #t.pattern = "spec/**/error*spec.rb"
39
39
  #t.pattern = "spec/**/config*spec.rb"
@@ -19,7 +19,7 @@ module FalkorLib #:nodoc:
19
19
  # MAJOR: Defines the major version
20
20
  # MINOR: Defines the minor version
21
21
  # PATCH: Defines the patch version
22
- MAJOR, MINOR, PATCH = 0, 6, 11
22
+ MAJOR, MINOR, PATCH = 0, 6, 12
23
23
 
24
24
  module_function
25
25
 
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/ruby
2
+ #########################################
3
+ # bootstrap_spec.rb
4
+ # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
+ # Time-stamp: <Tue 2016-06-28 18:37 svarrette>
6
+ #
7
+ # @description Check the Bootstrapping operations
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
+ dir = Dir.mktmpdir
22
+
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
+ STDIN.should_receive(:gets).and_return('1')
36
+ t = FalkorLib::Bootstrap.select_forge()
37
+ t.should == :none
38
+ end
39
+
40
+ it "#select_forge -- default to github" do
41
+ STDIN.should_receive(:gets).and_return('')
42
+ t = FalkorLib::Bootstrap.select_forge(:github)
43
+ t.should == :github
44
+ end
45
+
46
+ FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys.each do |lic|
47
+ it "#select_licence -- default to #{lic}" do
48
+ STDIN.should_receive(:gets).and_return('')
49
+ t = FalkorLib::Bootstrap.select_licence(lic)
50
+ t.should == 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
+ t.should =~ /#{subject}/
60
+ t.should =~ /#{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
72
+ end
73
+
74
+ ############################################
75
+ context 'boostrap motd' do
76
+ it "#motd" do
77
+ motdfile = File.join(dir, 'motd1')
78
+ FalkorLib::Bootstrap.motd(dir, { :file => "#{motdfile}", :no_interaction => true })
79
+ t = File.exists?(motdfile)
80
+ t.should be_true
81
+ end
82
+ end
83
+
84
+ end
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # bootstrap_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Dim 2015-03-29 22:28 svarrette>
5
+ # Time-stamp: <Tue 2016-06-28 18:37 svarrette>
6
6
  #
7
7
  # @description Check the Bootstrapping operations
8
8
  #
@@ -25,16 +25,19 @@ describe FalkorLib::Bootstrap do
25
25
  }
26
26
  before :all do
27
27
  $stdout.sync = true
28
+ #FalkorLib.config[:no_interaction] = true
28
29
  end
29
30
 
30
31
  after :all do
31
32
  dirs.each do |t,d|
33
+ #next if t == :with_git
32
34
  FileUtils.remove_entry_secure d
33
35
  end
34
36
  FalkorLib.config[:no_interaction] = false
35
37
  end
36
38
 
37
39
  [ :without_git, :with_git ].each do |ctx|
40
+ #[ :with_git ].each do |ctx|
38
41
  dir = dirs[ctx]
39
42
  #############################################################
40
43
  context "Test bootstrapping operations within (#{ctx}) temporary directory #{dir} " do
@@ -42,13 +45,13 @@ describe FalkorLib::Bootstrap do
42
45
  if ctx == :with_git
43
46
  it "initialize Git in the temporary directory #{dir}" do
44
47
  c = FalkorLib::Git.init(dir)
45
- c.should == 0
48
+ c.should == 0
46
49
  t = FalkorLib::Git.init?(dir)
47
50
  t.should be_true
48
51
  end
49
52
  end
50
53
 
51
- ######### Trash creation #########
54
+ #### Trash creation #########
52
55
  it "#trash" do
53
56
  c = FalkorLib::Bootstrap.trash(dir)
54
57
  t = File.exists?( File.join(dir, FalkorLib.config[:templates][:trashdir], '.gitignore'))
@@ -71,9 +74,9 @@ describe FalkorLib::Bootstrap do
71
74
 
72
75
  ######### RVM #########
73
76
  it "#rvm" do
74
- gemset = 'mygemset'
75
- STDIN.should_receive(:gets).and_return('1')
76
- STDIN.should_receive(:gets).and_return(gemset)
77
+ gemset = File.basename(dir)
78
+ STDIN.should_receive(:gets).and_return('1') if ctx == :without_git
79
+ STDIN.should_receive(:gets).and_return('') if ctx == :without_git
77
80
  c = FalkorLib::Bootstrap.rvm(dir)
78
81
  c.should == 0
79
82
  content = {}
@@ -92,7 +95,7 @@ describe FalkorLib::Bootstrap do
92
95
  c.should == 1
93
96
  end
94
97
 
95
- it "#rvm -- change targets" do
98
+ it "#rvm -- change targets (ctx = #{ctx}; dir = #{dir})" do
96
99
  opts = {
97
100
  :ruby => '1.2.3',
98
101
  :versionfile => '.myversion',
@@ -103,43 +106,16 @@ describe FalkorLib::Bootstrap do
103
106
  c.should == 0
104
107
  content = {}
105
108
  [:versionfile, :gemsetfile].each do |type|
106
- f = File.join(dir, opts[type.to_sym])
109
+ f = File.join("#{dir}", opts[type.to_sym])
107
110
  t = File.exists?(f)
108
- t.should be_true
109
111
  content[type.to_sym] = `cat #{f}`.chomp
110
112
  end
111
113
  content[:versionfile].should == opts[:ruby]
112
114
  content[:gemsetfile].should == opts[:gemset]
113
115
  end
114
116
 
115
- it "#select_forge - none" do
116
- STDIN.should_receive(:gets).and_return('1')
117
- t = FalkorLib::Bootstrap.select_forge()
118
- t.should == :none
119
- end
120
-
121
- it "#select_forge -- default to github" do
122
- STDIN.should_receive(:gets).and_return('')
123
- t = FalkorLib::Bootstrap.select_forge(:github)
124
- t.should == :github
125
- end
126
-
127
- FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys.each do |lic|
128
- it "#select_licence -- default to #{lic}" do
129
- STDIN.should_receive(:gets).and_return('')
130
- t = FalkorLib::Bootstrap.select_licence(lic)
131
- t.should == lic
132
- end
133
- end
134
-
135
- it "#get_badge " do
136
- subject = 'licence'
137
- status = 'GPL-2.0'
138
- t = FalkorLib::Bootstrap.get_badge(subject, status)
139
- t.should =~ /#{subject}/
140
- t.should =~ /#{status.sub(/-/, '--')}/
141
- end
142
117
 
118
+ ### README creation
143
119
  it "#readme" do
144
120
  #Array.new(6).each { |e| STDIN.should_receive(:gets).and_return('') }
145
121
  #STDIN.should_receive(:gets).and_return('')
@@ -151,29 +127,24 @@ describe FalkorLib::Bootstrap do
151
127
  FalkorLib.config[:no_interaction] = false
152
128
  end
153
129
 
154
- end # context
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
+ t.should be_true
143
+ v = FalkorLib::Versioning.get_version(dir, { :source => { :filename => file }})
144
+ v.should == "#{version}"
145
+ end
155
146
 
147
+ end # context
156
148
  end # each
157
-
158
- ############################################
159
- context 'boostrap repo' do
160
- dir = dirs[:default]
161
- it '#repo' do
162
- FalkorLib.config[:no_interaction] = true
163
- FalkorLib::Bootstrap.repo(dir, { :no_interaction => true, :git_flow => false })
164
- FalkorLib.config[:no_interaction] = false
165
- end
166
- end
167
149
 
168
- ############################################
169
- context 'boostrap motd' do
170
- dir = dirs[:default]
171
- it "#motd" do
172
- motdfile = File.join(dir, 'motd1')
173
- FalkorLib::Bootstrap.motd(dir, { :file => "#{motdfile}", :no_interaction => true })
174
- t = File.exists?(motdfile)
175
- t.should be_true
176
- end
177
- end
178
-
179
150
  end
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # versioning_puppet_module_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Fri 2015-05-15 23:28 svarrette>
5
+ # Time-stamp: <Tue 2016-06-28 18:51 svarrette>
6
6
  #
7
7
  # @description Check the versioning operations on Gems
8
8
  #
@@ -35,7 +35,7 @@ describe FalkorLib::Versioning::Puppet do
35
35
  FalkorLib.config.versioning do |c|
36
36
  c[:type] = 'puppet_module'
37
37
  end
38
- end
38
+ end
39
39
 
40
40
  after :all do
41
41
  configatron.temp_end
data/spec/spec_helper.rb CHANGED
@@ -26,6 +26,25 @@ def capture(stream)
26
26
  result
27
27
  end
28
28
 
29
+ # Credits: [nu7hatch](https://gist.github.com/nu7hatch/631329)
30
+ module Helpers
31
+ # Replace standard input with faked one StringIO.
32
+ def fake_stdin(*args)
33
+ begin
34
+ $stdin = StringIO.new
35
+ $stdin.puts(args.shift) until args.empty?
36
+ $stdin.rewind
37
+ yield
38
+ ensure
39
+ $stdin = STDIN
40
+ end
41
+ end
42
+ end
43
+
44
+ RSpec.configure do |conf|
45
+ conf.include(Helpers)
46
+ end
47
+
29
48
  # require 'minitest/autorun'
30
49
  # require 'minitest/spec'
31
50
 
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.11
4
+ version: 0.6.12
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-03-27 00:00:00.000000000 Z
11
+ date: 2016-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -393,6 +393,7 @@ files:
393
393
  - lib/falkorlib/tasks/yard.rake
394
394
  - lib/falkorlib/version.rb
395
395
  - lib/falkorlib/versioning.rb
396
+ - spec/falkorlib/bootstrap_helpers_spec.rb
396
397
  - spec/falkorlib/bootstrap_spec.rb
397
398
  - spec/falkorlib/common_spec.rb
398
399
  - spec/falkorlib/config_spec.rb
@@ -479,6 +480,7 @@ specification_version: 4
479
480
  summary: Sebastien Varrette aka Falkor's Common library to share Ruby code and {rake,cap}
480
481
  tasks
481
482
  test_files:
483
+ - spec/falkorlib/bootstrap_helpers_spec.rb
482
484
  - spec/falkorlib/bootstrap_spec.rb
483
485
  - spec/falkorlib/common_spec.rb
484
486
  - spec/falkorlib/config_spec.rb