jets 0.5.4 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05f493298a24d9f81047427851d58c6a2b07d210c1712e92bbe7f75b26d17933
4
- data.tar.gz: daaa2abacea4002f91a0d4a9d49085c25618b3d6ce7df00c856a04aa6b13d9f5
3
+ metadata.gz: f1ab6e5098560d1702587c1b6b7f49e9f6d2a315f48122de5090c372df485aa8
4
+ data.tar.gz: 5e5ac74eac851362e414c1e4f85127a88cbac2cb161a2fcbfb19bd933bf311b1
5
5
  SHA512:
6
- metadata.gz: 76f11fd73231957fb357babf695267f5bf37b955fa2d9bcc916979412dc07315a37027dbab1f0a252dc5b3f6017f2aaf2216797090420ab5ad414c3e0a441319
7
- data.tar.gz: 625f09d4db4790fd7765031932f16f67adc8b116d2e7b07a1972962f6319d46a887b2bcb36dbc7cbe00fafc29b3628913e281b55335c4456ffaacb5096de22ed
6
+ metadata.gz: 386a5732285bd3aea9ddf3b47d5873e09a168aec0c88f247eb82dcd14a3d9a3b6d63137f61b1c630f82d93346d15231bedaa5aaf3b944397c60f913a808fe27f
7
+ data.tar.gz: 771b40cc30dafc61600e0a15e0a85aafd68a69a1cca808bcb86d18646e60769a3ad27be938acaac8c360aebeb2d8adeb898d8540be7d1c4c723f828677cfd582
data/CHANGELOG.md CHANGED
@@ -3,6 +3,11 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.5.5]
7
+ - clean old git submodules from cache to reduce cache bloat
8
+ - dont prewarm after deploy if disabled :pull request #12
9
+ - update docs
10
+
6
11
  ## [0.5.4]
7
12
  - add route check before cloudformation update: pull request #11
8
13
  - hide confusing debugging logs for node shim for user
data/Gemfile.lock CHANGED
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- jets (0.5.4)
14
+ jets (0.5.5)
15
15
  actionpack
16
16
  actionview
17
17
  activerecord
@@ -4,6 +4,7 @@ require "colorize"
4
4
  require "socket"
5
5
  require "net/http"
6
6
  require "action_view"
7
+ require "bundler" # for clean_old_submodules only
7
8
 
8
9
  # Some important folders to help understand how jets builds a project:
9
10
  #
@@ -72,7 +73,7 @@ class Jets::Builders
72
73
  Dir.chdir(full(tmp_app_root)) do
73
74
  # These commands run from project root
74
75
  start_app_root_setup
75
- bundle_install
76
+ bundle
76
77
  finish_app_root_setup
77
78
  create_zip_file
78
79
  end
@@ -301,6 +302,12 @@ EOL
301
302
  end
302
303
  time :create_zip_file
303
304
 
305
+ def bundle
306
+ clean_old_submodules
307
+ bundle_install
308
+ end
309
+ time :bundle
310
+
304
311
  # Installs gems on the current target system: both compiled and non-compiled.
305
312
  # If user is on a macosx machine, macosx gems will be installed.
306
313
  # If user is on a linux machine, linux gems will be installed.
@@ -330,7 +337,38 @@ EOL
330
337
 
331
338
  puts 'Bundle install success.'
332
339
  end
333
- time :bundle_install
340
+
341
+ # When using submodules, bundler leaves old submodules behind. Over time this inflates
342
+ # the size of the the bundled gems. So we'll clean it up.
343
+ def clean_old_submodules
344
+ lockfile = "#{cache_area}/Gemfile.lock"
345
+ # https://stackoverflow.com/questions/38800129/parsing-a-gemfile-lock-with-bundler
346
+ parser = Bundler::LockfileParser.new(Bundler.read_file(Bundler.default_lockfile))
347
+ specs = parser.specs
348
+
349
+ # specs = Bundler.load.specs
350
+ # IE: spec.source.to_s: "https://github.com/tongueroo/webpacker.git (at jets@a8c4661)"
351
+ submoduled_specs = specs.select do |spec|
352
+ spec.source.to_s =~ /@\w+\)/
353
+ end
354
+
355
+ # find git shas to keep
356
+ # IE: ["a8c4661", "abc4661"]
357
+ git_shas = submoduled_specs.map do |spec|
358
+ md = spec.source.to_s.match(/@(\w+)\)/)
359
+ git_sha = md[1]
360
+ end
361
+ puts "git_shas #{git_shas.inspect}"
362
+
363
+ # IE: /tmp/jets/demo/cache/bundled/gems/ruby/2.5.0/bundler/gems/webpacker-a8c46614c675
364
+ Dir.glob("#{cache_area}/bundled/gems/ruby/2.5.0/bundler/gems/*").each do |path|
365
+ sha = path.split('-').last[0..6] # only first 7 chars of the git sha
366
+ unless git_shas.include?(sha)
367
+ puts "Removing old submoduled gem: #{path}"
368
+ FileUtils.rm_rf(path) # REMOVE old submodule directory
369
+ end
370
+ end
371
+ end
334
372
 
335
373
  def copy_gemfiles
336
374
  FileUtils.mkdir_p(cache_area)
@@ -124,13 +124,16 @@ function request(event, handler, callback) {
124
124
  });
125
125
 
126
126
  client.on('error', function(error) {
127
- log("Socket error %o", error);
127
+ log("Socket error:");
128
+ log(error);
128
129
  log("Retrying request");
129
130
  setTimeout(function() {
130
131
  if (fs.existsSync(TMP_LOG_PATH)) {
131
132
  var contents = fs.readFileSync(TMP_LOG_PATH, 'utf8');
132
- log("subprocess output:");
133
- log(contents);
133
+ if (contents != "") {
134
+ log("subprocess output:", "debug");
135
+ log(contents, "debug");
136
+ }
134
137
  }
135
138
  request(event, handler, callback);
136
139
  }, 500);
data/lib/jets/cfn/ship.rb CHANGED
@@ -83,6 +83,8 @@ class Jets::Cfn
83
83
 
84
84
  def prewarm
85
85
  return unless @options[:stack_type] == :full # s3 bucket is available
86
+ return unless Jets.config.prewarm.enable
87
+
86
88
  puts "Prewarming application..."
87
89
  if Jets::PreheatJob::CONCURRENCY > 1
88
90
  Jets::PreheatJob.perform_now(:torch, {quiet: true})
@@ -2,7 +2,7 @@
2
2
  .bundle
3
3
  .byebug_history
4
4
  .DS_Store
5
- .env.*.deploy
5
+ .env.*.remote
6
6
  .env.production
7
7
  .env.staging
8
8
  /node_modules
@@ -43,7 +43,7 @@ module Jets
43
43
  def serve
44
44
  # child process
45
45
  server = TCPServer.new(8080) # Server bind to port 8080
46
- puts "Ruby server started on port #{PORT}"
46
+ puts "Ruby server started on port #{PORT}" if ENV['FOREGROUND'] || ENV['JETS_DEBUG'] || ENV['C9_USER']
47
47
  input_completed = false
48
48
  loop do
49
49
  event, handler = nil, nil
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "0.5.4"
2
+ VERSION = "0.5.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen