jets 1.8.14 → 1.9.0

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: 3e53a13510e76193e0f4b17aa1d61e6b7bdd81b89d1a23d379ab07447fc7cd88
4
- data.tar.gz: 22cf54af01c7f4f2c20b72f2eda78094f479209d39cf7939bb9dcf3d600a633d
3
+ metadata.gz: 1e5eb71c2230e8be8a4ba872178be6c843c14792bbad449cea6f2d0a21578e46
4
+ data.tar.gz: 8602cef734ac3f5579163914341e484a6a95a5e8dd4a4256dfa44a3585663779
5
5
  SHA512:
6
- metadata.gz: b0f5d9d5566f4f1065a8615ac2fa5bf04c47909db3c18940cc68e4c2856616c2ea95a8707952a9e8e98e6c43454e42f727ba8a8c048df11b403e2de6a1c41ea9
7
- data.tar.gz: 3c3ce163ccc81e749c0955f33652d1ed7640b626364f82a98033e484650c56296c5853998863e5e59b40d93f99e0fc7d1b946e095d1b53fe770f022bf2353a81
6
+ metadata.gz: 705d88b52c979388120c9a7d325b3e4616d1706b1e648f5a60971504eac7030995301f70b3ea7172098f4f11411797901366847b5c1179dc6ce8d34f9b458361
7
+ data.tar.gz: 227b1f84bac367c6acae699eebee9836695e4c9fe62178ee015df48bcf3f6aa708fca85abc60fa663f0524cb50e7b3e350e85b0c34cf800a247e97039c51c334
@@ -11,9 +11,12 @@ assignees: ''
11
11
  Hi! Thanks for considering to file a bug with Jets. Please take the time to
12
12
  answer the basic questions. Please try to be as detailed as possible.
13
13
  To be sensitive to everyone's time, if not enough details are provided, the
14
- issue may be closed without comment. Please use your best judgment. 👌
14
+ issue may be closed without comment. If you repeatedly fail to provide enough
15
+ details, you may be blocked from ever submitting issues to Jets again.
16
+ Please use your best judgment. 👍
15
17
 
16
- If you are unsure this is a bug in Jets, please consider asking your question at https://community.rubyonjets.com
18
+ If you are unsure this is a bug in Jets, please consider asking your question at:
19
+ https://community.rubyonjets.com
17
20
 
18
21
  Thanks!
19
22
  -->
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [1.9.0]
7
+ - #249 docs grammar improvements
8
+ - #252 docs cli improvements
9
+ - #254 speed up development auto reloading
10
+ - #256 dont add /dev prefix if on_cloud9
11
+
6
12
  ## [1.8.14]
7
13
  - update jets-gems
8
14
 
data/jets.gemspec CHANGED
@@ -56,6 +56,7 @@ Gem::Specification.new do |spec|
56
56
  spec.add_dependency "recursive-open-struct"
57
57
  spec.add_dependency "text-table"
58
58
  spec.add_dependency "thor"
59
+ spec.add_dependency "zeitwerk"
59
60
 
60
61
  spec.add_development_dependency "byebug"
61
62
  spec.add_development_dependency "bundler"
data/lib/jets.rb CHANGED
@@ -10,6 +10,7 @@ require "jets/camelizer"
10
10
  require "jets/version"
11
11
  require "memoist"
12
12
  require "rainbow/ext/string"
13
+ require "zeitwerk"
13
14
 
14
15
  module Jets
15
16
  RUBY_VERSION = "2.5.3"
@@ -189,9 +189,13 @@ class Jets::Application
189
189
 
190
190
  def setup_auto_load_paths
191
191
  autoload_paths = config.autoload_paths + config.extra_autoload_paths
192
- # internal_autoload_paths are last
193
- autoload_paths += internal_autoload_paths
194
- ActiveSupport::Dependencies.autoload_paths += autoload_paths
192
+ autoload_paths += internal_autoload_paths # internal_autoload_paths are last
193
+ autoload_paths.each do |path|
194
+ next unless File.exist?(path)
195
+ Jets.loader.push_dir(path)
196
+ end
197
+ Jets.loader.enable_reloading if Jets.env.development?
198
+ Jets.loader.setup
195
199
  end
196
200
 
197
201
  # Essentially folders under app folder will be the default_autoload_paths. Example:
@@ -216,6 +220,10 @@ class Jets::Application
216
220
  p.sub!('./','')
217
221
  paths << p unless exclude_autoload_path?(p)
218
222
  end
223
+
224
+ paths << "#{Jets.root}/app/shared/resources"
225
+ paths << "#{Jets.root}/app/shared/extensions"
226
+
219
227
  paths
220
228
  end
221
229
 
@@ -1,7 +1,7 @@
1
1
  ## Examples
2
2
 
3
3
  $ jets new demo
4
- Creating new project called demo.
4
+ Creating a new Jets project called demo.
5
5
  create demo/app/controllers/application_controller.rb
6
6
  create demo/app/helpers/application_helper.rb
7
7
  create demo/app/jobs/application_job.rb
@@ -36,12 +36,9 @@ module Jets::Commands
36
36
  long_desc Help.text(:server)
37
37
  option :port, default: "8888", desc: "use PORT"
38
38
  option :host, default: "127.0.0.1", desc: "listen on HOST"
39
- option :reload, type: :boolean, default: true, desc: "Enables hot-reloading for development"
40
39
  def server
41
- # shell out to shotgun for automatic reloading
42
40
  o = options
43
- server_command = o[:reload] ? "shotgun" : "rackup"
44
- command = "bundle exec #{server_command} --port #{o[:port]} --host #{o[:host]}"
41
+ command = "bundle exec rackup --port #{o[:port]} --host #{o[:host]}"
45
42
  puts "=> #{command}".color(:green)
46
43
  puts Jets::Booter.message
47
44
  Jets::Booter.check_config_ru!
@@ -12,7 +12,7 @@ class Jets::Commands::Sequence < Thor::Group
12
12
  private
13
13
  def clone_project
14
14
  unless git_installed?
15
- abort "Unable to detect git installation on your system. Git needs to be installed in order to use the --repo option."
15
+ abort "Unable to detect git installation on your system. Git needs to be installed in order to use the --repo option."
16
16
  end
17
17
 
18
18
  if File.exist?(project_folder)
@@ -26,13 +26,13 @@ private
26
26
  def confirm_jets_project
27
27
  jets_project = File.exist?("#{project_folder}/config/application.rb")
28
28
  unless jets_project
29
- puts "It does not look like the repo #{options[:repo]} is a jets project. Maybe double check that it is? Exited.".color(:red)
29
+ puts "#{options[:repo]} does not look like a Jets project. Double check your repo!".color(:red)
30
30
  exit 1
31
31
  end
32
32
  end
33
33
 
34
34
  def copy_project
35
- puts "Creating new project called #{@project_name}."
35
+ puts "Creating a new Jets project called #{@project_name}."
36
36
  directory ".", project_folder, copy_options
37
37
  end
38
38
 
@@ -65,9 +65,9 @@ private
65
65
  end
66
66
 
67
67
  unless @database
68
- # Do not even generated the config/database.yml because
69
- # jets webpacker:install bombs and tries to load the db since it sees a
70
- # config/database.yml but has there's no database pg gem configured.
68
+ # Do not even generate the config/database.yml because
69
+ # Jets webpacker:install bombs and tries to load the db since it sees a
70
+ # config/database.yml but there's no database pg gem configured.
71
71
  excludes += %w[
72
72
  database.yml
73
73
  models/application_record
@@ -35,6 +35,8 @@ class Jets::Controller
35
35
  end
36
36
 
37
37
  def dispatch!
38
+ Jets.loader.reload if Jets.env.development?
39
+
38
40
  t1 = Time.now
39
41
  log_info_start
40
42
 
@@ -45,7 +47,7 @@ class Jets::Controller
45
47
  else
46
48
  Jets.logger.info "Filter chain halted as #{@last_callback_name} rendered or redirected"
47
49
  end
48
-
50
+
49
51
  triplet = ensure_render
50
52
  run_after_actions if action_completed
51
53
  rescue Exception => exception
data/lib/jets/core.rb CHANGED
@@ -25,6 +25,11 @@ module Jets::Core
25
25
  Pathname.new(root)
26
26
  end
27
27
 
28
+ def loader
29
+ Zeitwerk::Loader.new
30
+ end
31
+ memoize :loader
32
+
28
33
  def env
29
34
  env = ENV['JETS_ENV'] || 'development'
30
35
  ENV['RAILS_ENV'] = ENV['RACK_ENV'] = env
@@ -404,10 +404,6 @@ module Jets::Lambda::Dsl
404
404
 
405
405
  def self.add_custom_resource_extensions(base)
406
406
  base_path = "#{Jets.root}/app/extensions"
407
- unless ActiveSupport::Dependencies.autoload_paths.include?(base_path)
408
- ActiveSupport::Dependencies.autoload_paths += [base_path]
409
- end
410
-
411
407
  Dir.glob("#{base_path}/**/*.rb").each do |path|
412
408
  next unless File.file?(path)
413
409
 
@@ -9,13 +9,18 @@ module Jets::CommonMethods
9
9
  end
10
10
 
11
11
  def add_stage?(url)
12
+ return false if on_cloud9?
12
13
  request.host.include?("amazonaws.com") && url.starts_with?('/')
13
14
  end
14
15
  memoize :add_stage?
15
16
 
16
17
  def on_aws?
17
- on_cloud9 = !!(request.headers['HTTP_HOST'] =~ /cloud9\..*\.amazonaws\.com/)
18
- !request.headers['HTTP_X_AMZN_TRACE_ID'].nil? && !on_cloud9
18
+ !request.headers['HTTP_X_AMZN_TRACE_ID'].nil? && !on_cloud9?
19
19
  end
20
20
  memoize :on_aws?
21
+
22
+ def on_cloud9?
23
+ !!(request.headers['HTTP_HOST'] =~ /cloud9\..*\.amazonaws\.com/)
24
+ end
25
+ memoize :on_cloud9?
21
26
  end
data/lib/jets/stack.rb CHANGED
@@ -88,7 +88,6 @@ module Jets
88
88
  end
89
89
 
90
90
  def eager_load_shared_resources!
91
- ActiveSupport::Dependencies.autoload_paths += ["#{Jets.root}/app/shared/resources"]
92
91
  Dir.glob("#{Jets.root}/app/shared/resources/**/*.rb").select do |path|
93
92
  next if !File.file?(path) or path =~ %r{/javascript/} or path =~ %r{/views/}
94
93
 
@@ -22,8 +22,6 @@ class Jets::Stack
22
22
 
23
23
  def self.included(base)
24
24
  base_path = "#{Jets.root}/app/shared/extensions"
25
- ActiveSupport::Dependencies.autoload_paths += [base_path]
26
-
27
25
  Dir.glob("#{base_path}/**/*.rb").each do |path|
28
26
  next unless File.file?(path)
29
27
 
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "1.8.14"
2
+ VERSION = "1.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.14
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-18 00:00:00.000000000 Z
11
+ date: 2019-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -388,6 +388,20 @@ dependencies:
388
388
  - - ">="
389
389
  - !ruby/object:Gem::Version
390
390
  version: '0'
391
+ - !ruby/object:Gem::Dependency
392
+ name: zeitwerk
393
+ requirement: !ruby/object:Gem::Requirement
394
+ requirements:
395
+ - - ">="
396
+ - !ruby/object:Gem::Version
397
+ version: '0'
398
+ type: :runtime
399
+ prerelease: false
400
+ version_requirements: !ruby/object:Gem::Requirement
401
+ requirements:
402
+ - - ">="
403
+ - !ruby/object:Gem::Version
404
+ version: '0'
391
405
  - !ruby/object:Gem::Dependency
392
406
  name: byebug
393
407
  requirement: !ruby/object:Gem::Requirement