lucian 0.2.1 → 0.2.2

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: a4db5bd34779a0ebf839a2508d5be8946b6a615e
4
- data.tar.gz: c45ab073249fc954b42485ed2cfba509668d2bf7
3
+ metadata.gz: a92a8e50dd1ca9bb20ae757862b84197950b1f9b
4
+ data.tar.gz: a848e6d9e7481d87b2de9d7e5872a161d2fb1162
5
5
  SHA512:
6
- metadata.gz: 4e8b9470b1c06b3118c0cdf32fefd417ba93c7777e3adee984e6c61c4c3832dcb1c5a85b1164d331ba5dc9386e7057c1c07c8976ea3b1c171cf08319838c072a
7
- data.tar.gz: 01f01d97c96e8f47236725cad42d9b37fc367b9d213cb8097f1fd099d72ac8ab7e2a70274db64a46ca43e73825c28c0903d1d4d58abbacff67ade9e426c52f5c
6
+ metadata.gz: 0972c9950862c8f49590187837b3bf50895b8444e2cb94c4cc888e614d0af552123439bd7721c008df7e8baaa3491ba600e994212a822f67a41ccd3eec6ef3ed
7
+ data.tar.gz: 1cd71a8b799c70d295b37cb3e72d08ef55b2b93f9e3a0d9d5e3aa25f83761d9193a0a227fbdfe136842e37d95765764ca3146f6e91a69745e169f808f3dc7565
data/exe/lucian CHANGED
@@ -28,6 +28,9 @@ end.parse!
28
28
 
29
29
  if options[:init].nil?
30
30
  lucian = Lucian::Engine.new(nil, options[:example])
31
- lucian.run
32
- lucian.shutdown
31
+ begin
32
+ lucian.run
33
+ ensure
34
+ lucian.shutdown
35
+ end
33
36
  end
data/lib/lucian/engine.rb CHANGED
@@ -18,7 +18,7 @@ module Lucian
18
18
  @lucian_directory = @compose_directory+'/'+DIRECTORY
19
19
  @lucian_helper = @lucian_directory+'/'+HELPER
20
20
  #@lucian_files = fetch_lucian_files(@lucian_directory)
21
- @network_name = File.basename(@compose_directory).gsub!(/[^0-9A-Za-z]/, '')
21
+ @network_name = File.basename(@compose_directory).gsub!(/[^0-9A-Za-z]/, '')+"_default"
22
22
  $LOAD_PATH.unshift(@lucian_directory) unless $LOAD_PATH.include?(@lucian_directory)
23
23
  @docker_compose = Docker::Compose.new
24
24
  @examples = examples
@@ -40,11 +40,11 @@ module Lucian
40
40
  def shutdown
41
41
  # NOTE Check if running in docker or not
42
42
  if ENV["LUCIAN_DOCKER"] == nil
43
- @docker_compose.down
44
43
  stop_lucian_container
45
44
  remove_lucian_container
45
+ @docker_compose.down
46
46
  end
47
- # remove_lucian_image # NOTE Bot sure we need to remove this or not
47
+ # remove_lucian_image # NOTE Not sure we need to remove this or not
48
48
  end
49
49
 
50
50
  ##
@@ -70,7 +70,8 @@ module Lucian
70
70
  # Start lucian docker connect to compose
71
71
  def start_lucian_docker
72
72
  image = build_lucian_image
73
- run_lucian_image(image)
73
+ container = run_lucian_image(image)
74
+ connect_container_to_network(container)
74
75
  end
75
76
 
76
77
  ##
@@ -128,6 +129,22 @@ module Lucian
128
129
  return container
129
130
  end
130
131
 
132
+ ##
133
+ # Connect running container to compose network
134
+ def connect_container_to_network(container=Lucian.container)
135
+ raise "Container can not be nil" if container.nil?
136
+ raise "Couldn't fetch docker-compose network's name" if @network_name.nil?
137
+ network = Docker::Network.all.find do |nw|
138
+ nw.info["Name"] == @network_name
139
+ end
140
+ raise "Couldn't find compose's network" if network.nil?
141
+ begin
142
+ network.connect(container.id)
143
+ BoardCaster.print("Join lucian container to #{@network_name} network ..", "yellow")
144
+ rescue Docker::Error::ServerError
145
+ end
146
+ end
147
+
131
148
  ##
132
149
  # Remove docker image
133
150
  def remove_lucian_image(image=Lucian.image)
@@ -1,3 +1,3 @@
1
1
  module Lucian
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -21,9 +21,29 @@ module RSpec::Core
21
21
  run_docker_services
22
22
  result = run_lucian_test
23
23
  if result[2].to_i != 0
24
- puts result.to_s
25
-
26
- raise result[1]
24
+ pending_cut = result[0].join("\n").gsub("\n", "--_n").match(/(PENDING.*)FAILING/)[0] rescue nil
25
+ failing_cut = result[0].join("\n").gsub("\n", "--_n").match(/(FAILING.*)Finished/)[0] rescue nil
26
+ unless pending_cut.nil? # Pending present?
27
+ # TODO Add pending logic here
28
+ end
29
+ unless failing_cut.nil? # Failing present?
30
+ failing_cases = failing_cut.scan(/\|=:.*:=\|/)
31
+ failing_cases.each do |_case|
32
+ data_cases = _case.split(":=|").collect{|message|
33
+ message.gsub("|=:","").split(":|-|:").collect{|_em|
34
+ _em.gsub("--_n", "\n")
35
+ }
36
+ }
37
+ data_cases.each do |to_report|
38
+ #description = to_report[0]
39
+ lines = to_report[1]
40
+ traces = to_report[2]
41
+ error = StandardError.new(traces)
42
+ error.set_backtrace([lines])
43
+ raise error
44
+ end
45
+ end
46
+ end
27
47
  end
28
48
  else
29
49
  run_before_example
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanapat Sainak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-14 00:00:00.000000000 Z
11
+ date: 2016-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core