modjs-architecture 0.6.3 → 0.6.4
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.
- data/VERSION +1 -1
- data/lib/modjs-architecture.rb +14 -6
- data/modjs-architecture.gemspec +2 -3
- data/spec/fixtures/test2.module.js +1 -0
- data/spec/fixtures/update.blueprint +2 -2
- data/spec/modjs-architecture_spec.rb +2 -0
- metadata +3 -4
- data/spec/fixtures/myapp.architecture +0 -8
- data/spec/fixtures/update.architecture +0 -8
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.4
|
data/lib/modjs-architecture.rb
CHANGED
@@ -96,16 +96,24 @@ module ModJS
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def update_application_file
|
99
|
+
tmp_file = write_temp_file
|
99
100
|
app_file = "#{@root}/#{@config[:build_dir]}/#{@config[:name].downcase}.js"
|
100
101
|
|
101
|
-
|
102
|
+
ArchitectureJS::Notification.log "#{app_file} updated"
|
103
|
+
compile_application_file tmp_file
|
104
|
+
FileUtils.mv tmp_file, app_file
|
105
|
+
end
|
106
|
+
|
107
|
+
def write_temp_file
|
108
|
+
tmp_name = rand(36**10).to_s(36)
|
109
|
+
tmp_file = "#{@root}/#{tmp_name}.js"
|
110
|
+
|
111
|
+
File.open(tmp_file, "w+") do |file|
|
102
112
|
write_dependencies(file)
|
103
113
|
write_core(file)
|
104
114
|
write_autoload(file)
|
105
115
|
end
|
106
|
-
|
107
|
-
ArchitectureJS::Notification.log "#{app_file} updated"
|
108
|
-
compile_application_file app_file
|
116
|
+
tmp_file
|
109
117
|
end
|
110
118
|
|
111
119
|
def write_dependencies(file)
|
@@ -120,7 +128,7 @@ module ModJS
|
|
120
128
|
|
121
129
|
def write_core(file)
|
122
130
|
file << "/*---------- ModJS ../lib/mod.js ----------*/\n"
|
123
|
-
file << "//= require \"
|
131
|
+
file << "//= require \"lib/mod.js\"\n\n"
|
124
132
|
file << "var #{@config[:name]} = new Mod.Application('#{@config[:name]}');\n\n"
|
125
133
|
end
|
126
134
|
|
@@ -138,7 +146,7 @@ module ModJS
|
|
138
146
|
sprockets = Sprockets::Secretary.new(
|
139
147
|
root: ModJS::base_dir,
|
140
148
|
asset_root: File.expand_path(@config[:asset_root], @root),
|
141
|
-
load_path: ['repository'],
|
149
|
+
load_path: ['repository', @root],
|
142
150
|
source_files: [file],
|
143
151
|
interpolate_constants: false
|
144
152
|
)
|
data/modjs-architecture.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "modjs-architecture"
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dayton Nolan"]
|
@@ -55,15 +55,14 @@ Gem::Specification.new do |s|
|
|
55
55
|
"spec/fixtures/foo_elements.js",
|
56
56
|
"spec/fixtures/foo_model.js",
|
57
57
|
"spec/fixtures/model_name.js",
|
58
|
-
"spec/fixtures/myapp.architecture",
|
59
58
|
"spec/fixtures/myapp.blueprint",
|
60
59
|
"spec/fixtures/myapp.js",
|
61
60
|
"spec/fixtures/templates_compiled.js",
|
62
61
|
"spec/fixtures/test.js",
|
63
62
|
"spec/fixtures/test.jst",
|
64
63
|
"spec/fixtures/test.module.js",
|
64
|
+
"spec/fixtures/test2.module.js",
|
65
65
|
"spec/fixtures/test_two.jst",
|
66
|
-
"spec/fixtures/update.architecture",
|
67
66
|
"spec/fixtures/update.blueprint",
|
68
67
|
"spec/fixtures/update.js",
|
69
68
|
"spec/javascripts/application_spec.js",
|
@@ -0,0 +1 @@
|
|
1
|
+
var hey = "Hello World!";
|
@@ -3,6 +3,6 @@ src_dir: modules
|
|
3
3
|
build_dir: application
|
4
4
|
asset_root: ../
|
5
5
|
output: expanded
|
6
|
-
dependencies: ["
|
7
|
-
autoload: ["
|
6
|
+
dependencies: ["modules/test.module"]
|
7
|
+
autoload: ["modules/test.module", "modules/test2.module"]
|
8
8
|
name: myapp
|
@@ -79,6 +79,7 @@ describe ModJS::Blueprint do
|
|
79
79
|
FileUtils.rm_rf "#{TMP_DIR}/myapp.blueprint"
|
80
80
|
FileUtils.cp "#{FIXTURES}/update.blueprint", "#{TMP_DIR}/myapp.blueprint"
|
81
81
|
FileUtils.cp "#{FIXTURES}/test.module.js", "#{TMP_DIR}/modules/test.module.js"
|
82
|
+
FileUtils.cp "#{FIXTURES}/test2.module.js", "#{TMP_DIR}/modules/test2.module.js"
|
82
83
|
FileUtils.cp "#{FIXTURES}/test.jst", "#{TMP_DIR}/templates/test.jst"
|
83
84
|
FileUtils.cp "#{FIXTURES}/test_two.jst", "#{TMP_DIR}/templates/test_two.jst"
|
84
85
|
suppress_output do
|
@@ -91,6 +92,7 @@ describe ModJS::Blueprint do
|
|
91
92
|
end
|
92
93
|
|
93
94
|
it 'should compile the application file' do
|
95
|
+
puts TMP_DIR
|
94
96
|
File.exists?("#{TMP_DIR}/application/myapp.js").should be_true
|
95
97
|
end
|
96
98
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modjs-architecture
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -171,15 +171,14 @@ files:
|
|
171
171
|
- spec/fixtures/foo_elements.js
|
172
172
|
- spec/fixtures/foo_model.js
|
173
173
|
- spec/fixtures/model_name.js
|
174
|
-
- spec/fixtures/myapp.architecture
|
175
174
|
- spec/fixtures/myapp.blueprint
|
176
175
|
- spec/fixtures/myapp.js
|
177
176
|
- spec/fixtures/templates_compiled.js
|
178
177
|
- spec/fixtures/test.js
|
179
178
|
- spec/fixtures/test.jst
|
180
179
|
- spec/fixtures/test.module.js
|
180
|
+
- spec/fixtures/test2.module.js
|
181
181
|
- spec/fixtures/test_two.jst
|
182
|
-
- spec/fixtures/update.architecture
|
183
182
|
- spec/fixtures/update.blueprint
|
184
183
|
- spec/fixtures/update.js
|
185
184
|
- spec/javascripts/application_spec.js
|
@@ -210,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
210
209
|
version: '0'
|
211
210
|
segments:
|
212
211
|
- 0
|
213
|
-
hash: -
|
212
|
+
hash: -1247464605052822888
|
214
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
214
|
none: false
|
216
215
|
requirements:
|