alki-reload 0.3.1 → 0.3.2

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
  SHA1:
3
- metadata.gz: be36a892fb4393ecba3d020801a03c8b985a6310
4
- data.tar.gz: 2de7375d65893da50750ad67b2e24d3ff7619cb0
3
+ metadata.gz: 65642f82e0d553cec6756fedc41accc08f648750
4
+ data.tar.gz: 6abe7c4cd9206ba8399a9fb3dc41233a04d9ce72
5
5
  SHA512:
6
- metadata.gz: 22a60b747ee36f7ac4fdbe5ce3eaedcd7b00af3e90b8fc84e6132d22d695f6e14f0b7c84b4363340d8158bae5b755f5833b9f40bdb7f1a10e5586f35716a86d8
7
- data.tar.gz: eb07452afb7353eb4e2a44343a3a03ff83233015886f4d83382daa9d1a5fadac9d6b83fc58e7638fed37db5ea94d000e03ec054988d99b66230200b53397665f
6
+ metadata.gz: d1a31ba7529595181497607d8546da97d36e07706a073952242c8bb754bf1cdb83f85c250396c3c43e1eb77bd7db3460feaf450c5d66f5adca189e98847ed5fe
7
+ data.tar.gz: fd14180efcbca8774f7f716c6db2378c44a6263775f0344434205bf3c871cedbca2d98d0dfd63d33b5fcf70f8e59bb5733910dde1a7f163df655b5d394e0268e
data/Gemfile CHANGED
@@ -2,3 +2,6 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in alki-reload.gemspec
4
4
  gemspec
5
+
6
+ gem 'rake'
7
+ gem 'alki-testing'
data/README.adoc CHANGED
@@ -34,9 +34,7 @@ will not actively watch files or actively hook into services. Setting `enable` t
34
34
  .config/assembly.rb
35
35
  ```ruby
36
36
  Alki do
37
- mount :reloader, 'alki/reload' do
38
- set(:enable) { true }
39
- end
37
+ try_mount :reloader, 'alki/reload', enable: true
40
38
  # ...
41
39
  end
42
40
  ```
@@ -51,30 +49,50 @@ of development mode.
51
49
  Alki do
52
50
  set(:development?) { ENV['APP_ENV'] != 'production' }
53
51
 
54
- mount :reloader, 'alki/reload' do
52
+ try_mount :reloader, 'alki/reload' do
55
53
  set(:enable) { development? }
56
54
  end
57
55
  # ...
58
56
  end
59
57
  ```
60
58
 
61
- ### Main Loops
62
-
63
- A problem that naturally comes up is how to reload an application, while the application is running.
64
- Most applications, when running, spend most of their time inside a "main loop". If it's a server,
65
- it might be the loop listening for incoming data, if it's a console application it might be the loop
66
- waiting for user input.
59
+ In addition, using `try_mount` instead of the normal `mount`
60
+ will only mount the reloader if the gem can be found,
61
+ which can be controlled using Bundler.
67
62
 
68
- Because the main loop is always running, there is never an opportunity to reload it. Alki::Reload
69
- provides a feature to help work around this.
70
-
71
- First off, because the service the main loop is in can't be reloaded, it should be made as small and
72
- simple as possible, offloading all other functionality into secondary services that it takes as
73
- dependencies.
63
+ ### Main Loops
74
64
 
75
- Second, it should be tagged with a `main_loop` tag. By tagging your main loop service, Alki::Reload will
76
- actively hook into the service and wrap it's dependencies with wrapper objects that will pick up the
77
- new version of those dependencies whenever the project is reloaded.
65
+ One of the core issues in code reloading is when to actually do
66
+ the reload.
67
+ If your Assembly is called from some other code
68
+ (such as a Rails application),
69
+ then reloading can just be done between calls into the assembly.
70
+
71
+ But, if the entire application is running inside the assembly, then
72
+ a way to reload the assembly while it's still running is needed.
73
+
74
+ Most applications spend most of their time inside a "main loop".
75
+ If it's a server,
76
+ it might be the loop listening for incoming data,
77
+ if it's a console application
78
+ it might be the loop waiting for user input.
79
+
80
+ Because the main loop is always running,
81
+ there is never an opportunity to reload it.
82
+ Alki::Reload provides a feature to help work around this.
83
+
84
+ First off, because the service the main loop is in can't be reloaded,
85
+ it should be made as small and simple as possible,
86
+ offloading all other functionality
87
+ into secondary services that it takes
88
+ as dependencies.
89
+
90
+ Second, it should be tagged with a `main_loop` tag.
91
+ By tagging your main loop service,
92
+ Alki::Reload will actively hook into the service
93
+ and wrap it's dependencies with wrapper objects
94
+ that will pick up the new version of those dependencies
95
+ whenever the project is reloaded.
78
96
 
79
97
  Alki::Loader must be enabled for this feature to be active.
80
98
 
@@ -122,7 +140,7 @@ is running the prompt and handler can be changed and reloaded.
122
140
  By default, `lib`, `config` and any files or directories configured in
123
141
  https://github.com/alki-project/alki-loader[Alki::Loader] are watched.
124
142
 
125
- Additional directories can be added by overriding the dirs element. Additional directories must also
143
+ Additional directories can be added by overriding the `dirs` element. Additional directories must also
126
144
  be in `$LOAD_PATH`.
127
145
 
128
146
  .config/assembly.rb
data/Rakefile CHANGED
@@ -1,2 +1,3 @@
1
1
  require "bundler/gem_tasks"
2
- task :default => :spec
2
+ require 'alki/testing/tasks'
3
+ task :default => :test
data/alki-reload.gemspec CHANGED
@@ -20,9 +20,6 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.13"
24
- spec.add_development_dependency "rake", "~> 10.0"
25
23
  spec.add_dependency "listen", "~> 3.0"
26
- spec.add_dependency "alki", "~> 0.12"
27
- spec.add_dependency "alki-testing", "~> 0.1"
24
+ spec.add_dependency "alki", "~> 0.13.1"
28
25
  end
data/bin/alki ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'alki' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("alki", "alki")
data/bin/bundler ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'bundler' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("bundler", "bundler")
data/bin/listen ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'listen' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("listen", "listen")
data/bin/rake ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rake' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require "rubygems"
15
+ require "bundler/setup"
16
+
17
+ load Gem.bin_path("rake", "rake")
@@ -10,7 +10,6 @@ module Alki
10
10
 
11
11
  def __getobj__
12
12
  if !@obj || @instance_version != @instance.__version__
13
- @ref.executor = @instance.assembly_executor
14
13
  @obj = @ref.call
15
14
  @instance_version = @instance.__version__
16
15
  end
@@ -1,5 +1,5 @@
1
1
  module Alki
2
2
  module Reload
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,43 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alki-reload
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Edlefsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-25 00:00:00.000000000 Z
11
+ date: 2017-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.13'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.13'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
13
  - !ruby/object:Gem::Dependency
42
14
  name: listen
43
15
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +30,14 @@ dependencies:
58
30
  requirements:
59
31
  - - "~>"
60
32
  - !ruby/object:Gem::Version
61
- version: '0.12'
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.12'
69
- - !ruby/object:Gem::Dependency
70
- name: alki-testing
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.1'
33
+ version: 0.13.1
76
34
  type: :runtime
77
35
  prerelease: false
78
36
  version_requirements: !ruby/object:Gem::Requirement
79
37
  requirements:
80
38
  - - "~>"
81
39
  - !ruby/object:Gem::Version
82
- version: '0.1'
40
+ version: 0.13.1
83
41
  description:
84
42
  email:
85
43
  - matt.edlefsen@gmail.com
@@ -94,6 +52,10 @@ files:
94
52
  - README.adoc
95
53
  - Rakefile
96
54
  - alki-reload.gemspec
55
+ - bin/alki
56
+ - bin/bundler
57
+ - bin/listen
58
+ - bin/rake
97
59
  - config/assembly.rb
98
60
  - lib/alki/reload.rb
99
61
  - lib/alki/reload/assembly_delegator.rb
@@ -125,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
87
  version: '0'
126
88
  requirements: []
127
89
  rubyforge_project:
128
- rubygems_version: 2.5.2
90
+ rubygems_version: 2.6.12
129
91
  signing_key:
130
92
  specification_version: 4
131
93
  summary: Automatic reloading of alki projects