sqlui 0.1.81 → 0.1.82

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fb042a1aacd5fc454eaaada78d8fb9b7f3d5ac0da3790345c7342edc01d6b78
4
- data.tar.gz: 734bb0cb942c6e8e08b74f7242354d270f8ae65b94b5103455c532d461341b1a
3
+ metadata.gz: 2ea6baae4e715638e52392661dbae71c35028d29f13b44ab9c10392e7d784bbc
4
+ data.tar.gz: 55949e1df33c47a5a8833ce0e97894f8f958eaa7767bd76767231f47e91ae377
5
5
  SHA512:
6
- metadata.gz: c51254fd5fd7f7cd0712408df40fc0a8f01ecc8c905ac77edf4ba43e6c6e6131154b7790f7bbe19424e6c478949b6d1718a10f9621016a2ee7cbff639f61fa0e
7
- data.tar.gz: 9473c16718a7743eb93d95ee05d6c51fbc1c21086033f89953264eeaf7c769f593a61f306523d38f437895f9c22662857a5cd78d36ff352650be255342c8bb09
6
+ metadata.gz: abd1e5cf01a0afdd4b1f952c1ae7ffc41f0849836187a867199a975f40efdde0d35b9db719f2f6a6b71c7cf41ed04c3415c4508c1f77e15c6f9e4393e7b1d2a3
7
+ data.tar.gz: 79776d1afa3caffe7c9332702d18a0d8cb58f9e4427dd073808b805249f809d50c2cd5a32a96bcb866fa3f5d9ca92153773283b9d278bbf393ab73c42a240abb
data/.release-version CHANGED
@@ -1 +1 @@
1
- 0.1.81
1
+ 0.1.82
@@ -53,8 +53,8 @@ module Github
53
53
  latch = CountDownLatch.new(tree_size)
54
54
  response['tree'].each do |blob|
55
55
  TreeClient.thread_pool.post do
56
- blob['content'] =
57
- get_file_content_with_caching(owner: owner, repo: repo, path: blob['path'], ref: response['sha'])
56
+ blob_response = @client.get_with_caching(blob['url'], cache_for: DEFAULT_MAX_FILE_CACHE_AGE_SECONDS)
57
+ blob['content'] = Base64.decode64(blob_response['content'])
58
58
  ensure
59
59
  latch.count_down
60
60
  end
@@ -133,18 +133,5 @@ module Github
133
133
  }
134
134
  )
135
135
  end
136
-
137
- private
138
-
139
- # Returns the contents of the file at the specified path. Uses the cache.
140
- def get_file_content_with_caching(owner:, repo:, path:, ref:)
141
- check_non_empty_string(owner: owner, repo: repo, sha: ref, path: path)
142
-
143
- response = @client.get_with_caching(
144
- "https://api.github.com/repos/#{owner}/#{repo}/contents/#{path}?ref=#{ref}",
145
- cache_for: DEFAULT_MAX_FILE_CACHE_AGE_SECONDS
146
- )
147
- Base64.decode64(response['content'])
148
- end
149
136
  end
150
137
  end
data/app/server.rb CHANGED
@@ -123,7 +123,6 @@ class Server < Sinatra::Base
123
123
  )
124
124
  # Prefetch all trees on startup. This should happen before the health endpoint is available.
125
125
  unless ENV.fetch('DISABLE_PREFETCH', '0') == '1'
126
- Sqlui.logger.info 'prefetch'
127
126
  tree_client.get_tree(
128
127
  owner: saved_config.owner,
129
128
  repo: saved_config.repo,
@@ -379,7 +378,12 @@ class Server < Sinatra::Base
379
378
  return Github::Cache.new({}, logger: Sqlui.logger) unless ENV['USE_LOCAL_SAVED_FILES']
380
379
 
381
380
  paths = Dir.glob('sql/**/*.sql')
382
- blobs = paths.map { |path| { 'path' => path, 'sha' => 'foo' } }
381
+ blobs = paths.map do |path|
382
+ {
383
+ 'path' => path,
384
+ 'url' => "https://api.github.com/repos/nicholasdower/sqlui/git/blobs/#{Base64.encode64(path)}"
385
+ }
386
+ end
383
387
  github_cache_hash = {
384
388
  'https://api.github.com/repos/nicholasdower/sqlui/git/trees/master?recursive=true' =>
385
389
  Github::Cache::Entry.new(
@@ -391,7 +395,7 @@ class Server < Sinatra::Base
391
395
  )
392
396
  }
393
397
  paths.each do |path|
394
- github_cache_hash["https://api.github.com/repos/nicholasdower/sqlui/contents/#{path}?ref=foo"] =
398
+ github_cache_hash["https://api.github.com/repos/nicholasdower/sqlui/git/blobs/#{Base64.encode64(path)}"] =
395
399
  Github::Cache::Entry.new(
396
400
  {
397
401
  'content' => Base64.encode64(File.read(path))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sqlui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.81
4
+ version: 0.1.82
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Dower