coruro-ruby 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +24 -1
- data/Rakefile +6 -1
- data/bin/cucumber +29 -0
- data/coruro-ruby.gemspec +1 -0
- data/lib/coruro/mailcatcher_adapter.rb +38 -6
- data/lib/coruro/unbundle.rb +10 -0
- data/lib/coruro/version.rb +1 -1
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71a5d3e1787f47c033936119a26d2c6527396ea5e746094629c0c5a5c5a99a6f
|
4
|
+
data.tar.gz: 33dcd558ba6801a828c529c4d2225c1d10019ab9400e5150a72aebb4e604f3a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2545fdeb45d13a95cf5d55a1066fdbe7202e28b23a09e11eddc5cb438997dce3cbe33444ad3607a04ad5bfb670d843e1ddfa84e3e7e4f469da523dd93e9e7f20
|
7
|
+
data.tar.gz: 7b65f398522715dfeba93789a47b1c268e4c48aa6e228c114679bfb24f0702718e996387049821dce43b5f1446eb255b7339f87172ca388306ed01789b26d677
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,40 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
coruro-ruby (0.
|
4
|
+
coruro-ruby (0.4.0)
|
5
5
|
mail (~> 2.7.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
backports (3.11.1)
|
11
|
+
builder (3.2.3)
|
10
12
|
coderay (1.1.2)
|
13
|
+
cucumber (3.1.0)
|
14
|
+
builder (>= 2.1.2)
|
15
|
+
cucumber-core (~> 3.1.0)
|
16
|
+
cucumber-expressions (~> 5.0.4)
|
17
|
+
cucumber-wire (~> 0.0.1)
|
18
|
+
diff-lcs (~> 1.3)
|
19
|
+
gherkin (~> 5.0)
|
20
|
+
multi_json (>= 1.7.5, < 2.0)
|
21
|
+
multi_test (>= 0.1.2)
|
22
|
+
cucumber-core (3.1.0)
|
23
|
+
backports (>= 3.8.0)
|
24
|
+
cucumber-tag_expressions (~> 1.1.0)
|
25
|
+
gherkin (>= 5.0.0)
|
26
|
+
cucumber-expressions (5.0.13)
|
27
|
+
cucumber-tag_expressions (1.1.1)
|
28
|
+
cucumber-wire (0.0.1)
|
29
|
+
diff-lcs (1.3)
|
30
|
+
gherkin (5.0.0)
|
11
31
|
mail (2.7.0)
|
12
32
|
mini_mime (>= 0.1.1)
|
13
33
|
method_source (0.9.0)
|
14
34
|
mini_mime (1.0.0)
|
15
35
|
minitest (5.11.1)
|
36
|
+
multi_json (1.13.1)
|
37
|
+
multi_test (0.1.2)
|
16
38
|
pry (0.11.3)
|
17
39
|
coderay (~> 1.1.0)
|
18
40
|
method_source (~> 0.9.0)
|
@@ -24,6 +46,7 @@ PLATFORMS
|
|
24
46
|
DEPENDENCIES
|
25
47
|
bundler (~> 1.16)
|
26
48
|
coruro-ruby!
|
49
|
+
cucumber (~> 3)
|
27
50
|
minitest (~> 5.0)
|
28
51
|
pry
|
29
52
|
rake (~> 10.0)
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
|
+
require "cucumber/rake/task"
|
3
4
|
|
4
5
|
Rake::TestTask.new(:test) do |t|
|
5
6
|
t.libs << "test"
|
@@ -7,4 +8,8 @@ Rake::TestTask.new(:test) do |t|
|
|
7
8
|
t.test_files = FileList["test/**/*_test.rb"]
|
8
9
|
end
|
9
10
|
|
10
|
-
|
11
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
12
|
+
t.cucumber_opts = "features --format pretty"
|
13
|
+
end
|
14
|
+
|
15
|
+
task :default => [:test, :features]
|
data/bin/cucumber
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'cucumber' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require "pathname"
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require "rubygems"
|
27
|
+
require "bundler/setup"
|
28
|
+
|
29
|
+
load Gem.bin_path("cucumber", "cucumber")
|
data/coruro-ruby.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency "mail", "~> 2.7.0"
|
26
26
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.16"
|
28
|
+
spec.add_development_dependency "cucumber", "~> 3"
|
28
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
29
30
|
spec.add_development_dependency "minitest", "~> 5.0"
|
30
31
|
spec.add_development_dependency "pry"
|
@@ -2,6 +2,7 @@ require 'net/http'
|
|
2
2
|
require 'json'
|
3
3
|
require 'open3'
|
4
4
|
require 'singleton'
|
5
|
+
require_relative 'unbundle'
|
5
6
|
|
6
7
|
class Coruro
|
7
8
|
class Configuration
|
@@ -11,9 +12,18 @@ class Coruro
|
|
11
12
|
end
|
12
13
|
|
13
14
|
def http_root
|
14
|
-
|
15
|
+
config.fetch(:http_root, 'http://localhost:1080')
|
16
|
+
end
|
17
|
+
|
18
|
+
def expose_stream?(stream)
|
19
|
+
!expose_streams[stream].nil?
|
20
|
+
end
|
21
|
+
|
22
|
+
def expose_streams
|
23
|
+
config.fetch(:expose_streams, {})
|
15
24
|
end
|
16
25
|
end
|
26
|
+
|
17
27
|
# Translates between Curoro and Mailcatcher's API
|
18
28
|
class MailcatcherAdapter
|
19
29
|
attr_accessor :runner, :timeout, :config
|
@@ -79,13 +89,17 @@ class Coruro
|
|
79
89
|
# Allows for launching and terminating mailcatcher programmaticaly
|
80
90
|
class Runner
|
81
91
|
include Singleton
|
82
|
-
attr_accessor :stdin, :stdout, :stderr, :thread
|
92
|
+
attr_accessor :stdin, :stdout, :stderr, :thread
|
83
93
|
|
84
94
|
|
85
95
|
def start(config)
|
86
96
|
return if up?(config)
|
97
|
+
new_env = Unbundle.all(ENV)
|
87
98
|
self.stdin, self.stdout, self.stderr, self.thread =
|
88
|
-
Open3.popen3(
|
99
|
+
Open3.popen3(new_env, 'mailcatcher -f --ip=0.0.0.0', { unsetenv_others:true })
|
100
|
+
|
101
|
+
debug_stream(:stdout, config: config)
|
102
|
+
debug_stream(:stderr, config: config)
|
89
103
|
end
|
90
104
|
|
91
105
|
def up?(config)
|
@@ -96,12 +110,30 @@ class Coruro
|
|
96
110
|
end
|
97
111
|
|
98
112
|
def stop
|
113
|
+
|
99
114
|
return unless self.thread
|
100
|
-
|
101
|
-
|
102
|
-
|
115
|
+
streams.each do |(_, stream)|
|
116
|
+
stream.close
|
117
|
+
end
|
103
118
|
`kill -9 #{ thread[:pid] }`
|
104
119
|
end
|
120
|
+
|
121
|
+
private def debug_stream(stream_name, config:)
|
122
|
+
if config.expose_stream?(stream_name)
|
123
|
+
stream_target = config.expose_streams[stream_name]
|
124
|
+
stream = streams[stream_name]
|
125
|
+
Thread.new {
|
126
|
+
while line = stream.gets do
|
127
|
+
stream_target.puts(line)
|
128
|
+
end
|
129
|
+
}
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
private def streams
|
135
|
+
{ stderr: stderr, stdout: stdout, stdin: stdin }
|
136
|
+
end
|
105
137
|
end
|
106
138
|
end
|
107
139
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Unbundle
|
2
|
+
def self.all(env)
|
3
|
+
env.keys.grep(/BUNDLER_ORIG/).reduce({}) do |new_env, env_var|
|
4
|
+
orig_val = ENV[env_var]
|
5
|
+
val = orig_val == "BUNDLER_ENVIRONMENT_PRESERVER_INTENTIONALLY_NIL" ? nil : orig_val
|
6
|
+
new_env[env_var.gsub("BUNDLER_ORIG_", "")] = val
|
7
|
+
new_env
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/coruro/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coruro-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zee Spencer
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.16'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cucumber
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,12 +108,14 @@ files:
|
|
94
108
|
- README.md
|
95
109
|
- Rakefile
|
96
110
|
- bin/console
|
111
|
+
- bin/cucumber
|
97
112
|
- bin/rake
|
98
113
|
- bin/setup
|
99
114
|
- coruro-ruby.gemspec
|
100
115
|
- lib/coruro.rb
|
101
116
|
- lib/coruro/mailcatcher_adapter.rb
|
102
117
|
- lib/coruro/message.rb
|
118
|
+
- lib/coruro/unbundle.rb
|
103
119
|
- lib/coruro/version.rb
|
104
120
|
homepage: https://github.com/wecohere/coruro
|
105
121
|
licenses:
|