copy_tuner_client 0.3.4 → 0.3.5
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 +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +8 -2
- data/Appraisals +2 -2
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +82 -78
- data/README.md +30 -9
- data/copy_tuner_client.gemspec +1 -1
- data/features/step_definitions/copycopter_server_steps.rb +1 -1
- data/features/step_definitions/rails_steps.rb +4 -4
- data/gemfiles/4.1.gemfile +1 -1
- data/gemfiles/4.2.gemfile +1 -1
- data/lib/copy_tuner_client/engine.rb +2 -1
- data/lib/copy_tuner_client/simple_form_extention.rb +2 -1
- data/lib/copy_tuner_client/translation_log.rb +2 -1
- data/lib/copy_tuner_client/version.rb +1 -1
- data/spec/copy_tuner_client/cache_spec.rb +27 -27
- data/spec/copy_tuner_client/client_spec.rb +20 -20
- data/spec/copy_tuner_client/configuration_spec.rb +63 -63
- data/spec/copy_tuner_client/i18n_backend_spec.rb +32 -32
- data/spec/copy_tuner_client/poller_spec.rb +8 -8
- data/spec/copy_tuner_client/prefixed_logger_spec.rb +5 -5
- data/spec/copy_tuner_client/process_guard_spec.rb +10 -10
- data/spec/copy_tuner_client/request_sync_spec.rb +12 -12
- data/spec/copy_tuner_client_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- data/spec/support/fake_copy_tuner_app.rb +1 -0
- data/spec/support/fake_logger.rb +2 -2
- metadata +7 -9
- data/tmp/projects.json +0 -1
@@ -7,11 +7,11 @@ describe CopyTunerClient::PrefixedLogger do
|
|
7
7
|
subject { CopyTunerClient::PrefixedLogger.new(prefix, output_logger) }
|
8
8
|
|
9
9
|
it "provides the prefix" do
|
10
|
-
subject.prefix.
|
10
|
+
expect(subject.prefix).to eq(prefix)
|
11
11
|
end
|
12
12
|
|
13
13
|
it "provides the logger" do
|
14
|
-
subject.original_logger.
|
14
|
+
expect(subject.original_logger).to eq(output_logger)
|
15
15
|
end
|
16
16
|
|
17
17
|
[:debug, :info, :warn, :error, :fatal].each do |level|
|
@@ -19,7 +19,7 @@ describe CopyTunerClient::PrefixedLogger do
|
|
19
19
|
message = 'hello'
|
20
20
|
subject.send(level, message)
|
21
21
|
|
22
|
-
output_logger.
|
22
|
+
expect(output_logger).to have_entry(level, "#{prefix} #{thread_info} #{message}")
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -28,10 +28,10 @@ describe CopyTunerClient::PrefixedLogger do
|
|
28
28
|
|
29
29
|
subject.flush
|
30
30
|
|
31
|
-
output_logger.
|
31
|
+
expect(output_logger).to have_received(:flush)
|
32
32
|
end
|
33
33
|
|
34
34
|
it "doesn't call flush for a logger that doesn't respond to flush" do
|
35
|
-
|
35
|
+
expect { subject.flush }.not_to raise_error
|
36
36
|
end
|
37
37
|
end
|
@@ -25,7 +25,7 @@ describe CopyTunerClient::ProcessGuard do
|
|
25
25
|
|
26
26
|
process_guard.start
|
27
27
|
|
28
|
-
poller.
|
28
|
+
expect(poller).to have_received(:start)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "registers passenger hooks from the passenger master" do
|
@@ -36,8 +36,8 @@ describe CopyTunerClient::ProcessGuard do
|
|
36
36
|
process_guard = build_process_guard(:logger => logger)
|
37
37
|
process_guard.start
|
38
38
|
|
39
|
-
logger.
|
40
|
-
poller.
|
39
|
+
expect(logger).to have_entry(:info, "Registered Phusion Passenger fork hook")
|
40
|
+
expect(poller).to have_received(:start).never
|
41
41
|
end
|
42
42
|
|
43
43
|
it "starts polling from a passenger worker" do
|
@@ -49,7 +49,7 @@ describe CopyTunerClient::ProcessGuard do
|
|
49
49
|
process_guard.start
|
50
50
|
passenger.spawn
|
51
51
|
|
52
|
-
poller.
|
52
|
+
expect(poller).to have_received(:start)
|
53
53
|
end
|
54
54
|
|
55
55
|
it "registers unicorn hooks from the unicorn master" do
|
@@ -62,8 +62,8 @@ describe CopyTunerClient::ProcessGuard do
|
|
62
62
|
process_guard = build_process_guard(:logger => logger)
|
63
63
|
process_guard.start
|
64
64
|
|
65
|
-
logger.
|
66
|
-
poller.
|
65
|
+
expect(logger).to have_entry(:info, "Registered Unicorn fork hook")
|
66
|
+
expect(poller).to have_received(:start).never
|
67
67
|
end
|
68
68
|
|
69
69
|
it "starts polling from a unicorn worker" do
|
@@ -77,7 +77,7 @@ describe CopyTunerClient::ProcessGuard do
|
|
77
77
|
process_guard.start
|
78
78
|
unicorn.spawn
|
79
79
|
|
80
|
-
poller.
|
80
|
+
expect(poller).to have_received(:start)
|
81
81
|
end
|
82
82
|
|
83
83
|
it "flushes when the process terminates" do
|
@@ -89,7 +89,7 @@ describe CopyTunerClient::ProcessGuard do
|
|
89
89
|
end
|
90
90
|
Process.wait
|
91
91
|
|
92
|
-
cache.
|
92
|
+
expect(cache).to be_written
|
93
93
|
end
|
94
94
|
|
95
95
|
it "flushes after running a resque job" do
|
@@ -103,8 +103,8 @@ describe CopyTunerClient::ProcessGuard do
|
|
103
103
|
process_guard.start
|
104
104
|
job.fork_and_perform
|
105
105
|
|
106
|
-
cache.
|
107
|
-
logger.
|
106
|
+
expect(cache).to be_written
|
107
|
+
expect(logger).to have_entry(:info, "Registered Resque after_perform hook")
|
108
108
|
end
|
109
109
|
|
110
110
|
it "doesn't fail if only Resque is defined and not Resque::Job" do
|
@@ -11,18 +11,18 @@ describe CopyTunerClient::RequestSync do
|
|
11
11
|
|
12
12
|
it "invokes the upstream app" do
|
13
13
|
result = subject.call(env)
|
14
|
-
app.
|
15
|
-
result.
|
14
|
+
expect(app).to have_received(:call).with(env)
|
15
|
+
expect(result).to eq(response)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "flushes defaults" do
|
19
19
|
subject.call(env)
|
20
|
-
cache.
|
20
|
+
expect(cache).to have_received(:flush)
|
21
21
|
end
|
22
22
|
|
23
23
|
it "downloads new copy" do
|
24
24
|
subject.call(env)
|
25
|
-
cache.
|
25
|
+
expect(cache).to have_received(:download)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -38,11 +38,11 @@ describe CopyTunerClient::RequestSync, 'serving assets' do
|
|
38
38
|
|
39
39
|
it "does not flush defaults" do
|
40
40
|
subject.call(env)
|
41
|
-
cache.
|
41
|
+
expect(cache).to have_received(:flush).never
|
42
42
|
end
|
43
43
|
it "does not download new copy" do
|
44
44
|
subject.call(env)
|
45
|
-
cache.
|
45
|
+
expect(cache).to have_received(:download).never
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -57,11 +57,11 @@ describe CopyTunerClient::RequestSync do
|
|
57
57
|
subject { CopyTunerClient::RequestSync.new(app, :cache => cache, :interval => 10, :last_synced => Time.now) }
|
58
58
|
it "does not flush defaults" do
|
59
59
|
subject.call(env)
|
60
|
-
cache.
|
60
|
+
expect(cache).to have_received(:flush).never
|
61
61
|
end
|
62
62
|
it "does not download new copy" do
|
63
63
|
subject.call(env)
|
64
|
-
cache.
|
64
|
+
expect(cache).to have_received(:download).never
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -69,11 +69,11 @@ describe CopyTunerClient::RequestSync do
|
|
69
69
|
subject { CopyTunerClient::RequestSync.new(app, :cache => cache, :interval => 10, :last_synced => Time.now - 60) }
|
70
70
|
it "flushes defaults" do
|
71
71
|
subject.call(env)
|
72
|
-
cache.
|
72
|
+
expect(cache).to have_received(:flush)
|
73
73
|
end
|
74
74
|
it "downloads new copy" do
|
75
75
|
subject.call(env)
|
76
|
-
cache.
|
76
|
+
expect(cache).to have_received(:download)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -81,11 +81,11 @@ describe CopyTunerClient::RequestSync do
|
|
81
81
|
subject { CopyTunerClient::RequestSync.new(app, :cache => cache, :interval => 10) }
|
82
82
|
it "flushes defaults" do
|
83
83
|
subject.call(env)
|
84
|
-
cache.
|
84
|
+
expect(cache).to have_received(:flush)
|
85
85
|
end
|
86
86
|
it "downloads new copy" do
|
87
87
|
subject.call(env)
|
88
|
-
cache.
|
88
|
+
expect(cache).to have_received(:download)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -8,12 +8,12 @@ describe CopyTunerClient do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'delegates cache to the configuration object' do
|
11
|
-
CopyTunerClient.cache.
|
12
|
-
CopyTunerClient.configuration.
|
11
|
+
expect(CopyTunerClient.cache).to eq('cache')
|
12
|
+
expect(CopyTunerClient.configuration).to have_received(:cache).once
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'delegates client to the configuration object' do
|
16
|
-
CopyTunerClient.client.
|
17
|
-
CopyTunerClient.configuration.
|
16
|
+
expect(CopyTunerClient.client).to eq('client')
|
17
|
+
expect(CopyTunerClient.configuration).to have_received(:client).once
|
18
18
|
end
|
19
19
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -17,7 +17,7 @@ Dir.glob(File.join(PROJECT_ROOT, 'spec', 'support', '**', '*.rb')).each do |file
|
|
17
17
|
end
|
18
18
|
|
19
19
|
WebMock.disable_net_connect!
|
20
|
-
ShamRack.
|
20
|
+
ShamRack.at('copy-tuner.com', 443).mount(FakeCopyTunerApp.new)
|
21
21
|
|
22
22
|
RSpec.configure do |config|
|
23
23
|
config.include ClientSpecHelpers
|
@@ -158,6 +158,7 @@ class FakeCopyTunerApp < Sinatra::Base
|
|
158
158
|
def self.open_project_data
|
159
159
|
MUTEX.synchronize do
|
160
160
|
project_file = File.expand_path('../../../tmp/projects.json', __FILE__)
|
161
|
+
FileUtils.mkdir_p File.dirname(project_file)
|
161
162
|
|
162
163
|
if File.exist? project_file
|
163
164
|
data = JSON.parse(IO.read(project_file))
|
data/spec/support/fake_logger.rb
CHANGED
@@ -47,11 +47,11 @@ RSpec::Matchers.define :have_entry do |severity, entry|
|
|
47
47
|
logger.has_entry?(severity, entry)
|
48
48
|
end
|
49
49
|
|
50
|
-
|
50
|
+
failure_message do
|
51
51
|
"Expected #{severity}(#{entry.inspect}); got entries:\n\n#{entries}"
|
52
52
|
end
|
53
53
|
|
54
|
-
|
54
|
+
failure_message_when_negated do
|
55
55
|
"Unexpected #{severity}(#{entry.inspect}); got entries:\n\n#{entries}"
|
56
56
|
end
|
57
57
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: copy_tuner_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SonicGarden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: sham_rack
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -288,7 +288,6 @@ files:
|
|
288
288
|
- spec/support/fake_unicorn.rb
|
289
289
|
- spec/support/middleware_stack.rb
|
290
290
|
- spec/support/writing_cache.rb
|
291
|
-
- tmp/projects.json
|
292
291
|
- ui/views/copytuner/index.html.erb
|
293
292
|
- ui/views/layouts/copytuner_default.html.erb
|
294
293
|
homepage: https://github.com/SonicGarden/copy-tuner-ruby-client
|
@@ -310,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
309
|
version: '0'
|
311
310
|
requirements: []
|
312
311
|
rubyforge_project:
|
313
|
-
rubygems_version: 2.2
|
312
|
+
rubygems_version: 2.5.2
|
314
313
|
signing_key:
|
315
314
|
specification_version: 4
|
316
315
|
summary: Client for the CopyTuner copy management service
|
@@ -341,4 +340,3 @@ test_files:
|
|
341
340
|
- spec/support/fake_unicorn.rb
|
342
341
|
- spec/support/middleware_stack.rb
|
343
342
|
- spec/support/writing_cache.rb
|
344
|
-
has_rdoc:
|
data/tmp/projects.json
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{}
|