elasticgraph-local 1.1.0 → 1.2.0

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
  SHA256:
3
- metadata.gz: f8515a33d3bbd28e480a435dbf1bef96f0e7ae908df7005d3c458485646323fe
4
- data.tar.gz: 0a053196542d573319ad04d09c8e930ae332517111b2971b130a0392691babf9
3
+ metadata.gz: 2a27223a8afbe232d8d459f80289552eba746f3b2a894804b6fdbeecc75f0d66
4
+ data.tar.gz: 20a68771c4d2e9e12c2fe037d94103e8888becb316d530f67450fa2d65ea7c75
5
5
  SHA512:
6
- metadata.gz: 0dbd333c14794ce38c6a42e15ba019213adb3b16457651ae8e637d76a0a75139d4127239abe1ff0575fc0557b2ef2acda75322a410d965be353d6a6e220f0c5f
7
- data.tar.gz: c9cb4fba1961728bed174645d0fa307573fe311daf3d688b9f537b16cf867acaf504276927e6c2958c4fe1a6a268152e3b22d5677b2490b7fe3c34004229c3b5
6
+ metadata.gz: 912e10e6189d7518fad6eb42973cdddf36731c993ce69b2e29a7bae847d1d172cb5d5be4903373e1a848112e56abd84df0550c841a7f356654153d68f6c18ef8
7
+ data.tar.gz: 6a5f761c945a7857da796b71c90255466a3a86235ad01402af932ac9cae7ef1918ac1e493972a42e18b00eed926d17985cfc46eee2827b0456266139b3a43dab
@@ -23,15 +23,15 @@ module ElasticGraph
23
23
  @output = output
24
24
  end
25
25
 
26
+ # :nocov: -- difficult to test `exec` behavior (replaces current process)
26
27
  def boot
27
- # :nocov: -- this is actually covered via a call from `boot_as_daemon` but it happens in a forked process so simplecov doesn't see it.
28
28
  halt
29
29
 
30
30
  prepare_docker_compose_run "up" do |command|
31
31
  exec(command) # we use `exec` so that our process is replaced with that one.
32
32
  end
33
- # :nocov:
34
33
  end
34
+ # :nocov:
35
35
 
36
36
  def halt
37
37
  prepare_docker_compose_run "down --volumes" do |command|
@@ -40,26 +40,11 @@ module ElasticGraph
40
40
  end
41
41
 
42
42
  def boot_as_daemon(halt_command:)
43
- with_pipe do |read_io, write_io|
44
- fork do
45
- # :nocov: -- simplecov can't track coverage that happens in another process
46
- read_io.close
47
- Process.daemon
48
- pid = Process.pid
49
- $stdout.reopen(write_io)
50
- $stderr.reopen(write_io)
51
- puts pid
52
- boot
53
- write_io.close
54
- # :nocov:
55
- end
56
-
57
- # The `Process.daemon` call in the subprocess changes the pid so we have to capture it this way instead of using
58
- # the return value of `fork`.
59
- pid = read_io.gets.to_i
43
+ halt
60
44
 
61
- @output.puts "Booting #{@variant}; monitoring logs for readiness..."
45
+ @output.puts "Booting #{@variant}; monitoring logs for readiness..."
62
46
 
47
+ pid = spawn_docker_compose_up do |read_io|
63
48
  ::Timeout.timeout(
64
49
  @daemon_timeout,
65
50
  ::Timeout::Error,
@@ -76,20 +61,46 @@ module ElasticGraph
76
61
  break if @ready_log_line.match?(line.to_s)
77
62
  end
78
63
  end
64
+ end
79
65
 
80
- @output.puts
81
- @output.puts
82
- @output.puts <<~EOS
83
- Success! #{@variant} #{@version} (pid: #{pid}) has been booted for the #{@env} environment on port #{@port}.
84
- It will continue to run in the background as a daemon. To halt it, run:
66
+ # Detach so the process continues running after this Ruby process exits.
67
+ ::Process.detach(pid)
85
68
 
86
- #{halt_command}
87
- EOS
88
- end
69
+ @output.puts
70
+ @output.puts
71
+ @output.puts <<~EOS
72
+ Success! #{@variant} #{@version} (pid: #{pid}) has been booted for the #{@env} environment on port #{@port}.
73
+ It will continue to run in the background as a daemon. To halt it, run:
74
+
75
+ #{halt_command}
76
+ EOS
89
77
  end
90
78
 
91
79
  private
92
80
 
81
+ def spawn_docker_compose_up
82
+ read_io, write_io = ::IO.pipe
83
+
84
+ pid = prepare_docker_compose_run("up") do |command|
85
+ spawn(
86
+ command,
87
+ chdir: ::Dir.pwd,
88
+ out: write_io,
89
+ err: write_io
90
+ )
91
+ end
92
+
93
+ write_io.close # We don't write from the parent process
94
+
95
+ begin
96
+ yield read_io
97
+ ensure
98
+ read_io.close
99
+ end
100
+
101
+ pid
102
+ end
103
+
93
104
  def prepare_docker_compose_run(*commands)
94
105
  name = "#{@env}-#{@version.tr(".", "_")}"
95
106
 
@@ -101,17 +112,6 @@ module ElasticGraph
101
112
  yield full_command
102
113
  end
103
114
  end
104
-
105
- def with_pipe
106
- read_io, write_io = ::IO.pipe
107
-
108
- begin
109
- yield read_io, write_io
110
- ensure
111
- read_io.close
112
- write_io.close
113
- end
114
- end
115
115
  end
116
116
  end
117
117
  end
@@ -475,14 +475,15 @@ module ElasticGraph
475
475
 
476
476
  # :nocov: -- we can't test `open` behavior through a test
477
477
  unless args.fetch(:no_open)
478
- fork do
478
+ Thread.new do
479
479
  sleep 3 # give the app a bit of time to boot before we try to open it.
480
- sh "open http://localhost:#{port}/"
480
+ url = "http://localhost:#{port}/"
481
+ system("open", url) || system("xdg-open", url)
481
482
  end
482
483
  end
483
484
  # :nocov:
484
485
 
485
- sh "ELASTICGRAPH_YAML_FILE=#{@local_config_yaml.shellescape} bundle exec rackup #{::File.join(__dir__.to_s, "config.ru").shellescape} --port #{port} #{args.fetch(:rackup_args)}"
486
+ run_rackup "ELASTICGRAPH_YAML_FILE=#{@local_config_yaml.shellescape} bundle exec rackup #{::File.join(__dir__.to_s, "config.ru").shellescape} --port #{port} #{args.fetch(:rackup_args)}"
486
487
  end
487
488
 
488
489
  namespace :index_fake_data do
@@ -522,6 +523,10 @@ module ElasticGraph
522
523
  end
523
524
  end
524
525
 
526
+ def run_rackup(command)
527
+ sh command
528
+ end
529
+
525
530
  def local_datastore_url
526
531
  @local_datastore_url ||= local_config
527
532
  .fetch("datastore")
@@ -141,12 +141,17 @@ properties:
141
141
  number_of_shards: 32
142
142
  properties:
143
143
  query_cluster:
144
- type: string
144
+ type:
145
+ - string
146
+ - 'null'
145
147
  description: Named search cluster to be used for queries on this index.
146
- The value must match be a key in the `clusters` map.
148
+ The value must match be a key in the `clusters` map. Set to `null`
149
+ to hide this index's types in the GraphQL schema returned from the
150
+ GraphQL endpoint.
147
151
  examples:
148
152
  - main
149
153
  - search_cluster
154
+ -
150
155
  index_into_clusters:
151
156
  type: array
152
157
  items:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticgraph-local
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myron Marston
@@ -17,70 +17,70 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 1.1.0
20
+ version: 1.2.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 1.1.0
27
+ version: 1.2.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: elasticgraph-graphql
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 1.1.0
34
+ version: 1.2.0
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.1.0
41
+ version: 1.2.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: elasticgraph-graphiql
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.1.0
48
+ version: 1.2.0
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 1.1.0
55
+ version: 1.2.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: elasticgraph-indexer
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 1.1.0
62
+ version: 1.2.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 1.1.0
69
+ version: 1.2.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: elasticgraph-schema_definition
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 1.1.0
76
+ version: 1.2.0
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 1.1.0
83
+ version: 1.2.0
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rackup
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -107,20 +107,20 @@ dependencies:
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '13.3'
110
+ version: '13.4'
111
111
  - - ">="
112
112
  - !ruby/object:Gem::Version
113
- version: 13.3.1
113
+ version: 13.4.2
114
114
  type: :runtime
115
115
  prerelease: false
116
116
  version_requirements: !ruby/object:Gem::Requirement
117
117
  requirements:
118
118
  - - "~>"
119
119
  - !ruby/object:Gem::Version
120
- version: '13.3'
120
+ version: '13.4'
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: 13.3.1
123
+ version: 13.4.2
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: webrick
126
126
  requirement: !ruby/object:Gem::Requirement
@@ -147,42 +147,42 @@ dependencies:
147
147
  requirements:
148
148
  - - '='
149
149
  - !ruby/object:Gem::Version
150
- version: 1.1.0
150
+ version: 1.2.0
151
151
  type: :development
152
152
  prerelease: false
153
153
  version_requirements: !ruby/object:Gem::Requirement
154
154
  requirements:
155
155
  - - '='
156
156
  - !ruby/object:Gem::Version
157
- version: 1.1.0
157
+ version: 1.2.0
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: elasticgraph-elasticsearch
160
160
  requirement: !ruby/object:Gem::Requirement
161
161
  requirements:
162
162
  - - '='
163
163
  - !ruby/object:Gem::Version
164
- version: 1.1.0
164
+ version: 1.2.0
165
165
  type: :development
166
166
  prerelease: false
167
167
  version_requirements: !ruby/object:Gem::Requirement
168
168
  requirements:
169
169
  - - '='
170
170
  - !ruby/object:Gem::Version
171
- version: 1.1.0
171
+ version: 1.2.0
172
172
  - !ruby/object:Gem::Dependency
173
173
  name: elasticgraph-opensearch
174
174
  requirement: !ruby/object:Gem::Requirement
175
175
  requirements:
176
176
  - - '='
177
177
  - !ruby/object:Gem::Version
178
- version: 1.1.0
178
+ version: 1.2.0
179
179
  type: :development
180
180
  prerelease: false
181
181
  version_requirements: !ruby/object:Gem::Requirement
182
182
  requirements:
183
183
  - - '='
184
184
  - !ruby/object:Gem::Version
185
- version: 1.1.0
185
+ version: 1.2.0
186
186
  email:
187
187
  - myron@squareup.com
188
188
  executables: []
@@ -210,10 +210,10 @@ licenses:
210
210
  - MIT
211
211
  metadata:
212
212
  bug_tracker_uri: https://github.com/block/elasticgraph/issues
213
- changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.1.0
214
- documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.1.0/
213
+ changelog_uri: https://github.com/block/elasticgraph/releases/tag/v1.2.0
214
+ documentation_uri: https://block.github.io/elasticgraph/api-docs/v1.2.0/
215
215
  homepage_uri: https://block.github.io/elasticgraph/
216
- source_code_uri: https://github.com/block/elasticgraph/tree/v1.1.0/elasticgraph-local
216
+ source_code_uri: https://github.com/block/elasticgraph/tree/v1.2.0/elasticgraph-local
217
217
  gem_category: local
218
218
  rdoc_options: []
219
219
  require_paths:
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  - !ruby/object:Gem::Version
233
233
  version: '0'
234
234
  requirements: []
235
- rubygems_version: 4.0.3
235
+ rubygems_version: 4.0.6
236
236
  specification_version: 4
237
237
  summary: Provides support for developing ElasticGraph applications locally.
238
238
  test_files: []