falkorlib 0.6.18 → 0.6.19

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: 3d745eb3bcd94aa27c60e45fab7c691aee85d3c0
4
- data.tar.gz: 36aa55df010f3b05816d13e9795625ebdba47d62
3
+ metadata.gz: 2991193ba63366cf054fbf23cafb5b36dfaa2bc9
4
+ data.tar.gz: 59f153625348b86b00d58631c88c8fd4635f8b67
5
5
  SHA512:
6
- metadata.gz: 971806266da376608f5c867d232274b0d00d23e6a68e762db2fc68fc0c641ca7cf55180ca50312697f4b44c7b819e41b115fb26042c8e75c8d11b22474d8fc8d
7
- data.tar.gz: 4f56c78980b1fd8053b94c9409a9e854ff7b84403894766cb722c32d274cd9633a539b42d8716afb023d581aeb06c3b19175557c58865b6d953ea56d98a65f86
6
+ metadata.gz: d8907de32c3abb0988912fc1165501d946f1fc9bdfb7f50aeeb6a838edea4346915a9407bc6c6dc0dc757a805a3ce47e3efc39e0e83906bc790c783e6485ffe6
7
+ data.tar.gz: c9dda2e193d2c72a498c60b631aeba60044d842f3131108c9f788b1bf8d8c80dca172ee1cef07610ee180a7b6eb3fa876b375a0b0cc9a1f97fdc40e9ed15eb34
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- falkorlib (0.6.18)
4
+ falkorlib (0.6.19)
5
5
  artii (>= 2.1)
6
6
  awesome_print (~> 1.2)
7
7
  configatron (~> 3.2)
@@ -30,6 +30,7 @@ GEM
30
30
  coderay (1.1.0)
31
31
  configatron (3.2.0)
32
32
  deep_merge (1.0.1)
33
+ diff-lcs (1.2.5)
33
34
  diffy (3.1.0)
34
35
  docile (1.1.5)
35
36
  ethon (0.7.0)
@@ -71,6 +72,19 @@ GEM
71
72
  json
72
73
  websocket (~> 1.0)
73
74
  rake (10.5.0)
75
+ rspec (3.5.0)
76
+ rspec-core (~> 3.5.0)
77
+ rspec-expectations (~> 3.5.0)
78
+ rspec-mocks (~> 3.5.0)
79
+ rspec-core (3.5.4)
80
+ rspec-support (~> 3.5.0)
81
+ rspec-expectations (3.5.0)
82
+ diff-lcs (>= 1.2.0, < 2.0)
83
+ rspec-support (~> 3.5.0)
84
+ rspec-mocks (3.5.0)
85
+ diff-lcs (>= 1.2.0, < 2.0)
86
+ rspec-support (~> 3.5.0)
87
+ rspec-support (3.5.0)
74
88
  rubygems-tasks (0.2.4)
75
89
  safe_yaml (0.9.7)
76
90
  simplecov (0.8.2)
@@ -112,6 +126,7 @@ DEPENDENCIES
112
126
  falkorlib!
113
127
  pry
114
128
  rake
129
+ rspec (~> 3.0)
115
130
  rubygems-tasks (~> 0.2)
116
131
  thor-zsh_completion
117
132
  travis (~> 1.6)
@@ -119,4 +134,4 @@ DEPENDENCIES
119
134
  yard (~> 0.8)
120
135
 
121
136
  BUNDLED WITH
122
- 1.11.2
137
+ 1.13.5
data/falkorlib.gemspec CHANGED
@@ -95,7 +95,7 @@ Gem::Specification.new do |s|
95
95
  #
96
96
  #s.add_development_dependency("rake", ">= 10.1.0") #"~> 0.9.2")
97
97
  s.add_development_dependency("bundler", "~> 1.0")
98
- #s.add_development_dependency 'rspec', '~> 2.7', '>= 2.7.0'
98
+ s.add_development_dependency 'rspec', '~> 3.0' #, '>= 2.7.0'
99
99
  s.add_development_dependency("pry", "~> 0.9")
100
100
  s.add_development_dependency("yard", "~> 0.8")
101
101
  #s.add_development_dependency("minitest", "~> 5.3")
@@ -25,6 +25,7 @@
25
25
  # rspec and options of the rake task defined below can be found on
26
26
  # http://relishapp.com/rspec
27
27
  #
28
+ require 'rspec/core'
28
29
  begin
29
30
  require "rspec/core/rake_task"
30
31
  desc "Run RSpec code examples '*_spec.rb' from the spec/ directory"
@@ -50,19 +51,19 @@ begin
50
51
  t.verbose = true
51
52
 
52
53
  # Use rcov for code coverage?
53
- t.rcov = false
54
+ #t.rcov = false
54
55
 
55
56
  # Path to rcov.
56
- t.rcov_path = "rcov"
57
+ #t.rcov_path = "rcov"
57
58
 
58
59
  # Command line options to pass to rcov. See 'rcov --help' about this
59
- t.rcov_opts = []
60
+ #t.rcov_opts = []
60
61
 
61
62
  # Command line options to pass to ruby. See 'ruby --help' about this
62
63
  t.ruby_opts = []
63
64
 
64
65
  # Path to rspec
65
- t.rspec_path = "rspec"
66
+ #t.rspec_path = "rspec"
66
67
 
67
68
  # Command line options to pass to rspec. See 'rspec --help' about this
68
69
  #t.rspec_opts = ["--color", "--backtrace"]
@@ -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, 18
22
+ MAJOR, MINOR, PATCH = 0, 6, 19
23
23
 
24
24
  module_function
25
25
 
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # bootstrap_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Tue 2016-06-28 18:37 svarrette>
5
+ # Time-stamp: <Sun 2016-10-16 22:02 svarrette>
6
6
  #
7
7
  # @description Check the Bootstrapping operations
8
8
  #
@@ -32,22 +32,22 @@ describe FalkorLib::Bootstrap do
32
32
 
33
33
  context 'helper functions' do
34
34
  it "#select_forge - none" do
35
- STDIN.should_receive(:gets).and_return('1')
35
+ expect(STDIN).to receive(:gets).and_return('1')
36
36
  t = FalkorLib::Bootstrap.select_forge()
37
- t.should == :none
37
+ expect(t).to eq(:none)
38
38
  end
39
39
 
40
40
  it "#select_forge -- default to github" do
41
- STDIN.should_receive(:gets).and_return('')
41
+ expect(STDIN).to receive(:gets).and_return('')
42
42
  t = FalkorLib::Bootstrap.select_forge(:github)
43
- t.should == :github
43
+ expect(t).to eq(:github)
44
44
  end
45
45
 
46
46
  FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys.each do |lic|
47
47
  it "#select_licence -- default to #{lic}" do
48
- STDIN.should_receive(:gets).and_return('')
48
+ expect(STDIN).to receive(:gets).and_return('')
49
49
  t = FalkorLib::Bootstrap.select_licence(lic)
50
- t.should == lic
50
+ expect(t).to eq(lic)
51
51
  end
52
52
  end
53
53
 
@@ -56,8 +56,8 @@ describe FalkorLib::Bootstrap do
56
56
  subject = 'licence'
57
57
  status = 'GPL-2.0'
58
58
  t = FalkorLib::Bootstrap.get_badge(subject, status)
59
- t.should =~ /#{subject}/
60
- t.should =~ /#{status.sub(/-/, '--')}/
59
+ expect(t).to match(/#{subject}/)
60
+ expect(t).to match(/#{status.sub(/-/, '--')}/)
61
61
  end
62
62
  end # context
63
63
 
@@ -77,7 +77,7 @@ describe FalkorLib::Bootstrap do
77
77
  motdfile = File.join(dir, 'motd1')
78
78
  FalkorLib::Bootstrap.motd(dir, { :file => "#{motdfile}", :no_interaction => true })
79
79
  t = File.exists?(motdfile)
80
- t.should be_true
80
+ expect(t).to be true
81
81
  end
82
82
  end
83
83
 
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # bootstrap_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Tue 2016-06-28 18:37 svarrette>
5
+ # Time-stamp: <Sun 2016-10-16 22:05 svarrette>
6
6
  #
7
7
  # @description Check the Bootstrapping operations
8
8
  #
@@ -45,9 +45,9 @@ describe FalkorLib::Bootstrap do
45
45
  if ctx == :with_git
46
46
  it "initialize Git in the temporary directory #{dir}" do
47
47
  c = FalkorLib::Git.init(dir)
48
- c.should == 0
48
+ expect(c).to eq(0)
49
49
  t = FalkorLib::Git.init?(dir)
50
- t.should be_true
50
+ expect(t).to be true
51
51
  end
52
52
  end
53
53
 
@@ -55,44 +55,44 @@ describe FalkorLib::Bootstrap do
55
55
  it "#trash" do
56
56
  c = FalkorLib::Bootstrap.trash(dir)
57
57
  t = File.exists?( File.join(dir, FalkorLib.config[:templates][:trashdir], '.gitignore'))
58
- t.should be_true
59
- c.should == 0
58
+ expect(t).to be true
59
+ expect(c).to eq(0)
60
60
  end
61
61
 
62
62
  it "#trash - repeat on an existing trash dir" do
63
63
  c = FalkorLib::Bootstrap.trash(dir)
64
- c.should == 1
64
+ expect(c).to eq(1)
65
65
  end
66
66
 
67
67
  it "#trash - change target trash dir" do
68
68
  newtrashname = 'tmp/mytrash'
69
69
  c = FalkorLib::Bootstrap.trash(dir,newtrashname)
70
70
  t = File.exists?( File.join(dir, newtrashname, '.gitignore'))
71
- t.should be_true
72
- c.should == 0
71
+ expect(t).to be true
72
+ expect(c).to eq(0)
73
73
  end
74
74
 
75
75
  ######### RVM #########
76
76
  it "#rvm" do
77
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
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
80
  c = FalkorLib::Bootstrap.rvm(dir)
81
- c.should == 0
81
+ expect(c).to eq(0)
82
82
  content = {}
83
83
  [:versionfile, :gemsetfile].each do |type|
84
84
  f = File.join(dir, FalkorLib.config[:rvm][type.to_sym])
85
85
  t = File.exists?(f)
86
- t.should be_true
86
+ expect(t).to be true
87
87
  content[type.to_sym] = `cat #{f}`.chomp
88
88
  end
89
- content[:versionfile].should == FalkorLib.config[:rvm][:rubies][0]
90
- content[:gemsetfile].should == gemset
89
+ expect(content[:versionfile]).to eq(FalkorLib.config[:rvm][:rubies][0])
90
+ expect(content[:gemsetfile]).to eq(gemset)
91
91
  end
92
92
 
93
93
  it "#rvm -- repeat" do
94
94
  c = FalkorLib::Bootstrap.rvm(dir)
95
- c.should == 1
95
+ expect(c).to eq(1)
96
96
  end
97
97
 
98
98
  it "#rvm -- change targets (ctx = #{ctx}; dir = #{dir})" do
@@ -103,15 +103,15 @@ describe FalkorLib::Bootstrap do
103
103
  :gemsetfile => '.mygemset'
104
104
  }
105
105
  c = FalkorLib::Bootstrap.rvm(dir, opts)
106
- c.should == 0
106
+ expect(c).to eq(0)
107
107
  content = {}
108
108
  [:versionfile, :gemsetfile].each do |type|
109
109
  f = File.join("#{dir}", opts[type.to_sym])
110
110
  t = File.exists?(f)
111
111
  content[type.to_sym] = `cat #{f}`.chomp
112
112
  end
113
- content[:versionfile].should == opts[:ruby]
114
- content[:gemsetfile].should == opts[:gemset]
113
+ expect(content[:versionfile]).to eq(opts[:ruby])
114
+ expect(content[:gemsetfile]).to eq(opts[:gemset])
115
115
  end
116
116
 
117
117
 
@@ -123,7 +123,7 @@ describe FalkorLib::Bootstrap do
123
123
  FalkorLib.config[:no_interaction] = true
124
124
  FalkorLib::Bootstrap.readme(dir, { :no_interaction => true })
125
125
  t = File.exists?(File.join(dir, 'README.md'))
126
- t.should be_true
126
+ expect(t).to be true
127
127
  FalkorLib.config[:no_interaction] = false
128
128
  end
129
129
 
@@ -139,9 +139,9 @@ describe FalkorLib::Bootstrap do
139
139
  :no_interaction => true
140
140
  })
141
141
  t = File.exists?(File.join(dir, file))
142
- t.should be_true
142
+ expect(t).to be true
143
143
  v = FalkorLib::Versioning.get_version(dir, { :source => { :filename => file }})
144
- v.should == "#{version}"
144
+ expect(v).to eq("#{version}")
145
145
  end
146
146
 
147
147
  end # context
@@ -39,7 +39,7 @@ describe FalkorLib::Common do
39
39
  # Check the color functions
40
40
  @print_test_conf.values.collect{ |e| e[:color] }.each do |color|
41
41
  it "##{color} - check #{color} text" do
42
- STDOUT.should_receive(:puts).with(send("#{color}", "#{color} text"))
42
+ expect(STDOUT).to receive(:puts).with(send("#{color}", "#{color} text"))
43
43
  puts send("#{color}", "#{color} text")
44
44
  end
45
45
  end
@@ -47,11 +47,11 @@ describe FalkorLib::Common do
47
47
  # Check the prining messages
48
48
  @print_test_conf.each do |method,conf|
49
49
  it "##{method} - put a #{method} message" do
50
- ((method == :error) ? STDERR : STDOUT).should_receive(:puts).with(send("#{conf[:color]}", "#{conf[:prefix]} #{method} text"))
50
+ expect((method == :error) ? STDERR : STDOUT).to receive(:puts).with(send("#{conf[:color]}", "#{conf[:prefix]} #{method} text"))
51
51
  if (method == :error)
52
- lambda {
52
+ expect {
53
53
  send("#{method}", "#{method} text")
54
- }.should raise_error #(SystemExit)
54
+ }.to raise_error #(SystemExit)
55
55
  else
56
56
  send("#{method}", "#{method} text")
57
57
  end
@@ -62,18 +62,18 @@ describe FalkorLib::Common do
62
62
  ['', 'default'].each do |default_answer|
63
63
  @query = "Am I a query"
64
64
  it "#ask - ask '#{@query}' with default answer '#{default_answer}' and no answer" do
65
- STDIN.should_receive(:gets).and_return('')
65
+ expect(STDIN).to receive(:gets).and_return('')
66
66
  results = capture(:stdout) {
67
67
  answer = ask(@query, default_answer)
68
68
  if default_answer.empty?
69
- answer.should be_empty
69
+ expect(answer).to be_empty
70
70
  else
71
- answer.should == default_answer
71
+ expect(answer).to eq(default_answer)
72
72
  end
73
73
  }
74
- results.should =~ /#{@query}/;
74
+ expect(results).to match(/#{@query}/);
75
75
  unless default_answer.empty?
76
- results.should =~ /Default: #{default_answer}/;
76
+ expect(results).to match(/Default: #{default_answer}/);
77
77
  end
78
78
  end
79
79
  end
@@ -81,48 +81,48 @@ describe FalkorLib::Common do
81
81
  # Check the really_continue? function
82
82
  [ '', 'Yes', 'y', 'Y', 'yes' ].each do |answer|
83
83
  it "#really_continue? - should really continue after answer '#{answer}'" do
84
- STDIN.should_receive(:gets).and_return(answer)
84
+ expect(STDIN).to receive(:gets).and_return(answer)
85
85
  results = capture(:stdout) { really_continue? }
86
- results.should =~ /=> Do you really want to continue/;
87
- results.should =~ /Default: Yes/;
86
+ expect(results).to match(/=> Do you really want to continue/);
87
+ expect(results).to match(/Default: Yes/);
88
88
  end
89
89
  next if answer.empty?
90
90
  it "#really_continue? - should really continue (despite default answer 'No') after answer '#{answer}'" do
91
- STDIN.should_receive(:gets).and_return(answer)
91
+ expect(STDIN).to receive(:gets).and_return(answer)
92
92
  results = capture(:stdout) { really_continue?('No') }
93
- results.should =~ /=> Do you really want to continue/;
94
- results.should =~ /Default: No/;
93
+ expect(results).to match(/=> Do you really want to continue/);
94
+ expect(results).to match(/Default: No/);
95
95
  end
96
96
  end
97
97
 
98
98
  [ '', 'No', 'n', 'N', 'no' ].each do |answer|
99
99
  it "#really_continue? - should not continue (despite default answer 'No') and exit after answer '#{answer}'" do
100
- STDIN.should_receive(:gets).and_return(answer)
100
+ expect(STDIN).to receive(:gets).and_return(answer)
101
101
  results = capture(:stdout) {
102
- lambda{
102
+ expect{
103
103
  really_continue?('No')
104
- }.should raise_error (SystemExit)
104
+ }.to raise_error (SystemExit)
105
105
  }
106
- results.should =~ /=> Do you really want to continue/;
107
- results.should =~ /Default: No/;
106
+ expect(results).to match(/=> Do you really want to continue/);
107
+ expect(results).to match(/Default: No/);
108
108
  end
109
109
  next if answer.empty?
110
110
  it "#really_continue? - should not continue and exit after answer '#{answer}'" do
111
- STDIN.should_receive(:gets).and_return(answer)
111
+ expect(STDIN).to receive(:gets).and_return(answer)
112
112
  results = capture(:stdout) {
113
- lambda{
113
+ expect{
114
114
  really_continue?
115
- }.should raise_error (SystemExit)
115
+ }.to raise_error (SystemExit)
116
116
  }
117
- results.should =~ /=> Do you really want to continue/;
118
- results.should =~ /Default: Yes/;
117
+ expect(results).to match(/=> Do you really want to continue/);
118
+ expect(results).to match(/Default: Yes/);
119
119
  end
120
120
  end
121
121
 
122
122
  # Check the command? function
123
123
  [ 'sqgfyueztruyjf', 'ruby' ].each do |command|
124
124
  it "#command? - check the command '#{command}'" do
125
- command?(command).should ((command == 'ruby') ? be_true : be_false)
125
+ expect(command?(command)).to be ((command == 'ruby') ? true : false)
126
126
  end
127
127
  end
128
128
  end
@@ -131,38 +131,38 @@ describe FalkorLib::Common do
131
131
  b = capture(:stdout) {
132
132
  nice_execute("echo toto")
133
133
  }
134
- b.split("\n").should include '** [out] toto'
134
+ expect(b.split("\n")).to include '** [out] toto'
135
135
  end
136
136
 
137
137
  it "#nice_execute -- check stderr output" do
138
138
  b = capture(:stderr) {
139
139
  nice_execute("echo 'toto' 1>&2")
140
140
  }
141
- b.should == red("** [err] toto\n")
141
+ expect(b).to eq(red("** [err] toto\n"))
142
142
  end
143
143
 
144
144
  it "#execute" do
145
145
  b = execute("echo toto")
146
- b.to_i.should == 0
146
+ expect(b.to_i).to eq(0)
147
147
  end
148
148
 
149
149
  it "#not_implemented" do
150
150
  b = capture(:stderr) {
151
151
  expect { not_implemented }.to raise_error (SystemExit)
152
152
  }
153
- b.should =~ /NOT YET IMPLEMENTED/
153
+ expect(b).to match(/NOT YET IMPLEMENTED/)
154
154
  end
155
155
 
156
156
  it "#exec_or_exit - should exit" do
157
157
  expect { exec_or_exit "false" }.to raise_error (SystemExit)
158
158
  end
159
159
  it "#exec_or_exit - should NOT exit" do
160
- expect { exec_or_exit "true" }.not_to raise_error (SystemExit)
160
+ expect { exec_or_exit "true" }.not_to raise_error # (SystemExit)
161
161
  end
162
162
 
163
163
  it "#execute_in_dir -- should execute the command in /tmp" do
164
164
  b = execute_in_dir('/tmp', "pwd | grep -Fq '/tmp'")
165
- b.should == 0
165
+ expect(b).to eq(0)
166
166
  end
167
167
 
168
168
 
@@ -171,7 +171,7 @@ describe FalkorLib::Common do
171
171
  echo toto
172
172
  echo tata
173
173
  }
174
- b.to_i.should == 0
174
+ expect(b.to_i).to eq(0)
175
175
  end
176
176
 
177
177
 
@@ -180,9 +180,9 @@ describe FalkorLib::Common do
180
180
 
181
181
  it "#load_config - load the correct hash from YAML" do
182
182
  file_config = {:domain => "foo.com", :nested => { 'a1' => 2 }}
183
- YAML.stub(:load_file).and_return(file_config)
183
+ allow(YAML).to receive(:load_file).and_return(file_config)
184
184
  loaded = load_config('/tmp') # /tmp to ensure existing target
185
- loaded.should == file_config
185
+ expect(loaded).to eq(file_config)
186
186
  end
187
187
 
188
188
  it "#store_config - should store the correct hash to YAML" do
@@ -190,7 +190,7 @@ describe FalkorLib::Common do
190
190
  f = Tempfile.new('toto')
191
191
  store_config(f.path, file_config, { :no_interaction => true })
192
192
  copy_file_config = YAML::load_file(f.path)
193
- copy_file_config.should == file_config
193
+ expect(copy_file_config).to eq(file_config)
194
194
  end
195
195
 
196
196
  end
@@ -199,32 +199,32 @@ describe FalkorLib::Common do
199
199
  context 'Test list selection functions' do
200
200
 
201
201
  it "#list_items - Exit on 0" do
202
- STDIN.should_receive(:gets).and_return('0')
202
+ expect(STDIN).to receive(:gets).and_return('0')
203
203
  expect { list_items("#{dir}/*") }.to raise_error (SystemExit)
204
204
  end
205
205
 
206
206
  it "#list_items -- select files only" do
207
- STDIN.should_receive(:gets).and_return('1')
207
+ expect(STDIN).to receive(:gets).and_return('1')
208
208
  f = list_items("#{dir}/*", { :only_files => true })
209
- f.should =~ /\/file.?\.txt$/
209
+ expect(f).to match(/\/file.?\.txt$/)
210
210
  end
211
211
 
212
212
  it "#list_items -- select files only with pattern exclude" do
213
- STDIN.should_receive(:gets).and_return('1')
213
+ expect(STDIN).to receive(:gets).and_return('1')
214
214
  f = list_items("#{dir}/*", { :only_files => true, :pattern_exclude => [ 'file1' ] })
215
- f.should == "#{dir}/file2.txt"
215
+ expect(f).to eq("#{dir}/file2.txt")
216
216
  end
217
217
 
218
218
  it "#list_items -- select dirs only" do
219
- STDIN.should_receive(:gets).and_return('1')
219
+ expect(STDIN).to receive(:gets).and_return('1')
220
220
  f = list_items("#{dir}/*", { :only_dirs => true })
221
- f.should =~ /\/dir.?$/
221
+ expect(f).to match(/\/dir.?$/)
222
222
  end
223
223
 
224
224
  it "#list_items -- select dirs only with pattern exclude" do
225
- STDIN.should_receive(:gets).and_return('1')
225
+ expect(STDIN).to receive(:gets).and_return('1')
226
226
  f = list_items("#{dir}/*", { :only_dirs => true, :pattern_exclude => [ 'dir1' ] })
227
- f.should == "#{dir}/dir2"
227
+ expect(f).to eq("#{dir}/dir2")
228
228
  end
229
229
 
230
230
  it "#list_items -- exit on empty list" do