atomy 0.6.12 → 0.7.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
  SHA1:
3
- metadata.gz: 068466b3dfc8c044b62bb9f9ee89d2b26fe1ae2b
4
- data.tar.gz: bd823b4edeca86beb03b073e6be4dae391713678
3
+ metadata.gz: c3cde8f2dfde4e4ef9b44378e3f34dad86a0bf6f
4
+ data.tar.gz: c9a49d6929d7c678a51324ac73324ec5f634d59a
5
5
  SHA512:
6
- metadata.gz: 93862742056c9c253d3b8e8eb1d3ba3ef795e33938469e18b55c3b2de16e9335f987040122f1c174ab07fe46d26a44a280eb4c9ff8fc181f71e6c5e9463c4d21
7
- data.tar.gz: 015bab9f5314108b9c83f5a6f7f19569872b36b06b796dabf8e5f6c674e61bfda7ea5a79342986dcbf9b2c0249edf732b83b9d7db0d00f36edbc798e951657a1
6
+ metadata.gz: 9bb5963c57be61b977db39df7aac6922da343157d9e35ec2911cfeba1db9fc4f19c3425606e8363d1b95f48b9fa4d079ad4dee40a95723f2a05a5b50b06a8e58
7
+ data.tar.gz: a635a73bf15dfdd26998b637bceb8f9e6bd1d71bcf4fc0ac17339230f43cec13a08cbab5f841fd81a4c7efd3ce234bc5d52c9f206c5de0e3a7ef87015f0d1da3
data/Gemfile CHANGED
@@ -9,5 +9,4 @@ end
9
9
  group "development" do
10
10
  gem "pry"
11
11
  gem "benchmark-ips"
12
- gem "rubinius-profiler"
13
12
  end
@@ -81,6 +81,14 @@ module Atomy
81
81
  end
82
82
 
83
83
  def require(path)
84
+ synchronized_load(path, false)
85
+ end
86
+
87
+ def load(path)
88
+ synchronized_load(path, true)
89
+ end
90
+
91
+ def synchronized_load(path, check_up_to_date)
84
92
  file = find_source(path)
85
93
 
86
94
  return super unless file
@@ -114,7 +122,7 @@ module Atomy
114
122
  end
115
123
 
116
124
  begin
117
- mod = load_atomy(file)
125
+ mod = load_atomy(file, check_up_to_date)
118
126
  else
119
127
  req.module = mod
120
128
  req.passed!
@@ -126,13 +134,17 @@ module Atomy
126
134
  end
127
135
 
128
136
  def register_feature(file, mod)
129
- LOADED_MODULES[file] = mod
137
+ LOADED_MODULES[file] = {
138
+ module: mod,
139
+ time: Time.now
140
+ }
141
+
130
142
  $LOADED_FEATURES << file
131
143
  end
132
144
 
133
- def load_atomy(file)
134
- if loaded?(file)
135
- LOADED_MODULES[file]
145
+ def load_atomy(file, check_up_to_date)
146
+ if loaded?(file, check_up_to_date)
147
+ LOADED_MODULES[file][:module]
136
148
  else
137
149
  _, mod = run_script(file)
138
150
  register_feature(file, mod)
@@ -149,7 +161,7 @@ module Atomy
149
161
  mod.file = file.to_sym
150
162
 
151
163
  compiled_file_name = CodeTools::Compiler.compiled_name(file)
152
- if should_load_compiled_file(compiled_file_name, file)
164
+ if compiled_file_up_to_date(compiled_file_name, file)
153
165
  code_loader = Rubinius::CodeLoader.new(compiled_file_name)
154
166
  code = code_loader.load_compiled_file(compiled_file_name, 0, 0)
155
167
 
@@ -219,15 +231,25 @@ module Atomy
219
231
 
220
232
  private
221
233
 
222
- def loaded?(file)
223
- $LOADED_FEATURES.include?(file)
234
+ def loaded?(file, check_up_to_date)
235
+ loaded = LOADED_MODULES[file]
236
+ return false unless loaded
237
+
238
+ if check_up_to_date
239
+ return false if File.mtime(file) > loaded[:time]
240
+
241
+ compiled_file = CodeTools::Compiler.compiled_name(file)
242
+ return false unless compiled_file_up_to_date(compiled_file, file)
243
+ end
244
+
245
+ true
224
246
  end
225
247
 
226
248
  def source_extension
227
249
  ".ay"
228
250
  end
229
251
 
230
- def should_load_compiled_file(compiled_file, source_file)
252
+ def compiled_file_up_to_date(compiled_file, source_file)
231
253
  return false unless compiled_file
232
254
  return false unless File.exists?(compiled_file)
233
255
 
data/lib/atomy/module.rb CHANGED
@@ -70,8 +70,7 @@ module Atomy
70
70
  end
71
71
 
72
72
  def load(path)
73
- _, mod = Atomy::CodeLoader.run_script(path)
74
- mod
73
+ Atomy::CodeLoader.load(path)
75
74
  end
76
75
 
77
76
  def inspect
data/lib/atomy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Atomy
2
- VERSION = "0.6.12"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.12
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Suraci
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-28 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kpeg