guard-i18next 0.1a → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/guard/i18next.rb +5 -5
- data/lib/guard/i18next/version.rb +1 -1
- metadata +21 -5
data/lib/guard/i18next.rb
CHANGED
@@ -7,7 +7,7 @@ module Guard
|
|
7
7
|
class I18next < Guard
|
8
8
|
|
9
9
|
DEFAULT_OPTIONS = {
|
10
|
-
:output => Pathname.pwd.join('app', 'assets', 'javascripts', 'i18n')
|
10
|
+
:output => Pathname.pwd.join('app', 'assets', 'javascripts', 'i18n'),
|
11
11
|
:namespace => '(global || window).Locales'
|
12
12
|
}
|
13
13
|
|
@@ -31,7 +31,7 @@ module Guard
|
|
31
31
|
# @raise [:task_has_failed] when stop has failed
|
32
32
|
#
|
33
33
|
def run_on_change(paths)
|
34
|
-
Dir::mkdir(options
|
34
|
+
Dir::mkdir(options[:output]) unless File.directory?(options[:output])
|
35
35
|
|
36
36
|
paths.each do |locale_path|
|
37
37
|
filename = File.basename(locale_path, ".yml")
|
@@ -41,10 +41,10 @@ module Guard
|
|
41
41
|
|
42
42
|
locale_key = locale.keys[0]
|
43
43
|
content = locale[locale_key]
|
44
|
-
File.open(options
|
44
|
+
File.open(options[:output] + "/#{filename}.js", "w") do |f|
|
45
45
|
# Initialize namespace (if it hasn't been already)
|
46
|
-
f.puts "#{options
|
47
|
-
f.puts options
|
46
|
+
f.puts "#{options[:namespace]} = #{options[:namespace]} != null ? #{options[:namespace]} : {}"
|
47
|
+
f.puts options[:namespace] + "[#{locale_key}] = " + content.to_json
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-i18next
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jared Scott
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-10-
|
13
|
+
date: 2012-10-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -44,6 +44,22 @@ dependencies:
|
|
44
44
|
- - ! '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.6'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ~>
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.6'
|
47
63
|
description: Automatically generate js files from locales files for consumption by
|
48
64
|
i18next.js.
|
49
65
|
email:
|
@@ -71,9 +87,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
88
|
none: false
|
73
89
|
requirements:
|
74
|
-
- - ! '
|
90
|
+
- - ! '>='
|
75
91
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
92
|
+
version: '0'
|
77
93
|
requirements: []
|
78
94
|
rubyforge_project:
|
79
95
|
rubygems_version: 1.8.24
|