Skip to content

Commit 557d12f

Browse files
committed
I18n specs passing need to clean up name spaces
1 parent d4a73c8 commit 557d12f

File tree

15 files changed

+90
-75
lines changed

15 files changed

+90
-75
lines changed

ruby/hyper-i18n/Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ source "https://rubygems.org"
33
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
44
#gem "opal-jquery", git: "https://github.com/opal/opal-jquery.git", branch: "master"
55
gem 'hyper-spec', path: '../hyper-spec'
6-
gem 'hyperloop-config', path: '../hyperloop-config'
6+
gem 'hyperstack-config', path: '../hyperstack-config'
7+
gem 'hyper-state', path: '../hyper-state'
78
gem 'hyper-store', path: '../hyper-store'
89
gem 'hyper-component', path: '../hyper-component'
910
gem 'hyper-operation', path: '../hyper-operation'

ruby/hyper-i18n/Gemfile.lock

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
GIT
2-
remote: https://github.com/opal/opal-jquery.git
3-
revision: 6249dfaf406ecd7199079b4f4d9dc67cfdf4d602
4-
branch: master
5-
specs:
6-
opal-jquery (0.4.3)
7-
opal (>= 0.10.0, < 0.12.0)
8-
91
PATH
102
remote: ../hyper-component
113
specs:
12-
hyper-component (1.0.0.lap28)
13-
hyper-store (= 1.0.0.lap28)
14-
hyperloop-config (= 1.0.0.lap28)
4+
hyper-component (0.1)
5+
hyper-state (= 0.1)
6+
hyperstack-config (= 0.1)
157
libv8 (~> 6.3.0)
168
mini_racer (~> 0.1.15)
179
opal (>= 0.11.0, < 0.12.0)
@@ -21,29 +13,28 @@ PATH
2113
PATH
2214
remote: ../hyper-model
2315
specs:
24-
hyper-model (1.0.0.lap28)
16+
hyper-model (0.1)
17+
activemodel
2518
activerecord (>= 4.0.0)
26-
hyper-component (= 1.0.0.lap28)
27-
hyper-operation (= 1.0.0.lap28)
19+
hyper-component (= 0.1)
20+
hyper-operation (= 0.1)
21+
hyper-store (= 0.1)
2822

2923
PATH
3024
remote: ../hyper-operation
3125
specs:
32-
hyper-operation (1.0.0.lap28)
26+
hyper-operation (0.1)
3327
activerecord (>= 4.0.0)
34-
hyper-component (= 1.0.0.lap28)
35-
hyperloop-config (= 1.0.0.lap28)
36-
libv8 (~> 6.3.0)
37-
mini_racer (~> 0.1.15)
28+
hyper-component (= 0.1)
3829
mutations
3930
opal-activesupport (~> 0.3.1)
4031

4132
PATH
4233
remote: ../hyper-spec
4334
specs:
44-
hyper-spec (1.0.0.lap28)
35+
hyper-spec (0.1)
4536
capybara
46-
chromedriver-helper
37+
chromedriver-helper (= 1.2.0)
4738
libv8 (~> 6.3.0)
4839
method_source
4940
mini_racer (~> 0.1.15)
@@ -57,28 +48,38 @@ PATH
5748
unparser
5849
webdrivers
5950

51+
PATH
52+
remote: ../hyper-state
53+
specs:
54+
hyper-state (0.1)
55+
hyperstack-config (= 0.1)
56+
opal (>= 0.11.0, < 0.12.0)
57+
6058
PATH
6159
remote: ../hyper-store
6260
specs:
63-
hyper-store (1.0.0.lap28)
64-
hyperloop-config (= 1.0.0.lap28)
61+
hyper-store (0.1)
62+
hyper-state (= 0.1)
63+
hyperstack-config (= 0.1)
6564
opal (>= 0.11.0, < 0.12.0)
6665

6766
PATH
68-
remote: ../hyperloop-config
67+
remote: ../hyperstack-config
6968
specs:
70-
hyperloop-config (1.0.0.lap28)
69+
hyperstack-config (0.1)
7170
libv8 (~> 6.3.0)
71+
listen (~> 3.0)
7272
mini_racer (~> 0.1.15)
7373
opal (>= 0.11.0, < 0.12.0)
7474
opal-browser (~> 0.2.0)
7575
uglifier
76+
websocket
7677

7778
PATH
7879
remote: .
7980
specs:
80-
hyper-i18n (1.0.0.lap28)
81-
hyper-operation (= 1.0.0.lap28)
81+
hyper-i18n (0.1.0)
82+
hyper-operation (= 0.1.0)
8283
i18n
8384

8485
GEM
@@ -140,13 +141,14 @@ GEM
140141
babel-source (>= 4.0, < 6)
141142
execjs (~> 2.0)
142143
builder (3.2.3)
143-
capybara (3.7.2)
144+
capybara (3.10.1)
144145
addressable
145146
mini_mime (>= 0.1.3)
146147
nokogiri (~> 1.8)
147148
rack (>= 1.6.0)
148149
rack-test (>= 0.6.3)
149-
xpath (~> 3.1)
150+
regexp_parser (~> 1.2)
151+
xpath (~> 3.2)
150152
childprocess (0.9.0)
151153
ffi (~> 1.0, >= 1.0.11)
152154
chromedriver-helper (1.2.0)
@@ -176,6 +178,10 @@ GEM
176178
railties (>= 4.2.0)
177179
thor (>= 0.14, < 2.0)
178180
libv8 (6.3.292.48.1)
181+
listen (3.1.5)
182+
rb-fsevent (~> 0.9, >= 0.9.4)
183+
rb-inotify (~> 0.9, >= 0.9.7)
184+
ruby_dep (~> 1.2)
179185
loofah (2.2.2)
180186
crass (~> 1.0.2)
181187
nokogiri (>= 1.5.9)
@@ -207,6 +213,8 @@ GEM
207213
opal-browser (0.2.0)
208214
opal
209215
paggio
216+
opal-jquery (0.4.3)
217+
opal (>= 0.10.0, < 0.12.0)
210218
opal-rails (0.9.5)
211219
jquery-rails
212220
opal (>= 0.11.0, < 0.12)
@@ -260,12 +268,16 @@ GEM
260268
rainbow (2.2.2)
261269
rake
262270
rake (10.5.0)
271+
rb-fsevent (0.10.3)
272+
rb-inotify (0.9.10)
273+
ffi (>= 0.5.0, < 2)
263274
react-rails (2.4.7)
264275
babel-transpiler (>= 0.7.0)
265276
connection_pool
266277
execjs
267278
railties (>= 3.2)
268279
tilt
280+
regexp_parser (1.2.0)
269281
rspec (3.8.0)
270282
rspec-core (~> 3.8.0)
271283
rspec-expectations (~> 3.8.0)
@@ -278,7 +290,7 @@ GEM
278290
rspec-mocks (3.8.0)
279291
diff-lcs (>= 1.2.0, < 2.0)
280292
rspec-support (~> 3.8.0)
281-
rspec-rails (3.8.0)
293+
rspec-rails (3.8.1)
282294
actionpack (>= 3.0)
283295
activesupport (>= 3.0)
284296
railties (>= 3.0)
@@ -295,10 +307,11 @@ GEM
295307
ruby-progressbar (~> 1.7)
296308
unicode-display_width (~> 1.0, >= 1.0.1)
297309
ruby-progressbar (1.10.0)
310+
ruby_dep (1.5.0)
298311
rubyzip (1.2.2)
299-
selenium-webdriver (3.14.0)
312+
selenium-webdriver (3.141.0)
300313
childprocess (~> 0.5)
301-
rubyzip (~> 1.2)
314+
rubyzip (~> 1.2, >= 1.2.2)
302315
sourcemap (0.1.1)
303316
sprockets (3.7.2)
304317
concurrent-ruby (~> 1.0)
@@ -325,14 +338,15 @@ GEM
325338
equalizer (~> 0.0.9)
326339
parser (>= 2.3.1.2, < 2.6)
327340
procto (~> 0.0.2)
328-
webdrivers (3.4.0)
341+
webdrivers (3.4.3)
329342
nokogiri (~> 1.6)
330343
rubyzip (~> 1.0)
331344
selenium-webdriver (~> 3.0)
345+
websocket (1.2.8)
332346
websocket-driver (0.7.0)
333347
websocket-extensions (>= 0.1.0)
334348
websocket-extensions (0.1.3)
335-
xpath (3.1.0)
349+
xpath (3.2.0)
336350
nokogiri (~> 1.8)
337351

338352
PLATFORMS
@@ -346,9 +360,9 @@ DEPENDENCIES
346360
hyper-model!
347361
hyper-operation!
348362
hyper-spec!
363+
hyper-state!
349364
hyper-store!
350-
hyperloop-config!
351-
opal-jquery!
365+
hyperstack-config!
352366
opal-rails (~> 0.9.4)
353367
pry
354368
puma

ruby/hyper-i18n/hyper-i18n.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
1010
spec.authors = ['adamcreekroad']
1111
spec.email = ['[email protected]']
1212

13-
spec.summary = 'HyperI18n seamlessly brings Rails I18n into your Hyperloop application.'
14-
spec.homepage = 'https://www.github.com/ruby-hyperloop/hyper-i18n'
13+
spec.summary = 'HyperI18n seamlessly brings Rails I18n into your Hyperstack application.'
14+
spec.homepage = 'https://www.github.com/ruby-hyperstack/hyper-i18n'
1515
spec.license = 'MIT'
1616

1717
spec.files = `git ls-files`.split("\n")

ruby/hyper-i18n/lib/hyper-i18n.rb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
1-
require 'hyperloop-config'
2-
Hyperloop.import 'hyper-i18n'
1+
require 'hyperstack-config'
2+
Hyperstack.import 'hyper-i18n'
33

44
require 'hyper-component'
55
require 'hyper-operation'
6+
require 'hyper-state'
67

78
require 'hyper-i18n/helper_methods'
89
require 'hyper-i18n/operations/localize'
910
require 'hyper-i18n/operations/translate'
1011
require 'hyper-i18n/i18n'
12+
require 'hyper-i18n/version'
1113

1214
if RUBY_ENGINE == 'opal'
13-
require 'hyper-store'
14-
1515
require 'hyper-i18n/active_model/name'
1616
require 'hyper-i18n/active_record/class_methods'
17-
require 'hyper-i18n/hyperloop/component/mixin'
18-
17+
require 'hyper-i18n/hyperstack/component'
1918
require 'hyper-i18n/stores/i18n_store'
2019
else
2120
require 'opal'
2221

23-
require 'hyper-i18n/version'
24-
2522
Opal.append_path File.expand_path('../', __FILE__).untaint
2623
end

ruby/hyper-i18n/lib/hyper-i18n/hyperloop/component/mixin.rb

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module Hyperstack
2+
module Component
3+
def t(attribute, opts = {})
4+
namespace = self.class.name.underscore.gsub(%r{::|/}, '.')
5+
6+
HyperI18n::I18n.t("#{namespace}.#{attribute}", opts)
7+
end
8+
9+
def l(time, format = :default, opts = {})
10+
HyperI18n::I18n.l(time, format, opts)
11+
end
12+
end
13+
end

ruby/hyper-i18n/lib/hyper-i18n/i18n.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
module HyperI18n
33
class I18n
44
extend HelperMethods
5-
include React::IsomorphicHelpers
5+
include Hyperstack::Component::IsomorphicHelpers
66

77
before_first_mount do
88
if RUBY_ENGINE != 'opal'
99
@server_data_cache = { t: {}, l: {} }
1010
else
1111
unless on_opal_server? || no_initial_data?
12-
I18nStore.mutate.translations(JSON.from_object(`window.HyperI18nInitialData.t`))
13-
I18nStore.mutate.localizations(JSON.from_object(`window.HyperI18nInitialData.l`))
12+
I18nStore.translations = JSON.from_object(`window.HyperI18nInitialData.t`)
13+
I18nStore.localizations = JSON.from_object(`window.HyperI18nInitialData.l`)
1414
end
1515
end
1616
end

ruby/hyper-i18n/lib/hyper-i18n/operations/localize.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module HyperI18n
2-
class Localize < Hyperloop::ServerOp
2+
class Localize < Hyperstack::ServerOp
33
include HelperMethods
44

55
param :acting_user, nils: true

ruby/hyper-i18n/lib/hyper-i18n/operations/translate.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module HyperI18n
2-
class Translate < Hyperloop::ServerOp
2+
class Translate < Hyperstack::ServerOp
33
param :acting_user, nils: true
44
param :attribute
55
param :opts
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
module HyperI18n
2-
class I18nStore < Hyperloop::Store
3-
state translations: {}, scope: :class, reader: true
4-
state localizations: {}, scope: :class, reader: true
2+
class I18nStore
3+
include Hyperstack::State::Observable
4+
class << self
5+
observer(:translations) { @translations ||= {} }
6+
observer(:localizations) { @localizations ||= {} }
7+
state_writer :translations, :localizations
8+
end
59
end
610
end

0 commit comments

Comments
 (0)