resin 0.0.5 → 0.0.6

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.
@@ -56,7 +56,12 @@ module Resin
56
56
  # Only enable the saving mechanism in test/development
57
57
  put '*' do
58
58
  unless request.body.nil?
59
- path = File.join(Dir.pwd, request.path)
59
+ filename = request.path.split('/')[-1]
60
+ directory = '/st/'
61
+ if filename.end_with? '.js'
62
+ directory = '/js/'
63
+ end
64
+ path = File.join(Dir.pwd, directory, filename)
60
65
  puts ">> Commiting changes to #{path}"
61
66
  File.open(path, 'w') do |fd|
62
67
  request.body.each do |line|
@@ -23,18 +23,22 @@ module Resin
23
23
  end
24
24
  end
25
25
 
26
- def embed_amber
26
+ def embed_amber(options={})
27
27
  deploy_line = ''
28
28
  unless Resin.development?
29
29
  deploy_line = "deploy: true,"
30
30
  end
31
+
32
+ on_ready_function = options[:on_ready] || ''
33
+
31
34
  return <<-END
32
35
  <script type="text/javascript" src="/js/amber.js"></script>
33
36
  <script type="text/javascript">
34
37
  loadAmber({
35
38
  #{deploy_line}
36
39
  files : [#{javascript_files}],
37
- ready : function() { }
40
+ prefix : 'js',
41
+ ready : function() { #{on_ready_function} }
38
42
  });
39
43
  </script>
40
44
  END
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-03 00:00:00.000000000 Z
12
+ date: 2012-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler