joosy-rails 1.0.0.alpha.3 → 1.0.0.alpha.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/joosy/rails/controller.rb +13 -0
- data/lib/joosy/rails/engine.rb +14 -0
- data/lib/joosy/rails/version.rb +1 -1
- data/lib/joosy/rails.rb +2 -0
- data/lib/rails/generators/joosy/application_generator.rb +21 -1
- data/lib/rails/generators/joosy/templates/layout.html.erb +19 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d97d285b9b7bd10b7817b37c9891081348603389
|
4
|
+
data.tar.gz: b58084afe8f93527ef5c278e8585c4147f024a45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77d1101c8e2c2e51d8618a725ae1bd3fd8ea73e8104a353c675fc4b254376630c6067934dbd0fbd588944fe26ad3bf448066bdb60b2a38ec383b41e8195bd4ad
|
7
|
+
data.tar.gz: 8f7c0078e7fb50ee4d00a2ff66203fa9403d0d2c58813616cf836ab3d40a73b571a82ba89223b5545639fd952ecd20d8c33151df05b1c058ddf0e9f0671e6f5f
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Joosy
|
2
|
+
module Rails
|
3
|
+
class ServeController < ActionController::Base
|
4
|
+
def index
|
5
|
+
@base = request.env['SCRIPT_NAME']
|
6
|
+
layout = 'joosy'
|
7
|
+
layout << "/#{params[:application]}" if params[:application]
|
8
|
+
|
9
|
+
render text: '', layout: layout
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/joosy/rails/engine.rb
CHANGED
@@ -10,3 +10,17 @@ module Joosy
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
module ActionDispatch::Routing
|
14
|
+
class Mapper
|
15
|
+
def joosy(route, options={})
|
16
|
+
extender = route.last == '/' ? '(*x)' : '(/*x)'
|
17
|
+
|
18
|
+
match route => 'joosy/rails/serve#index',
|
19
|
+
via: :get,
|
20
|
+
as: (options[:application] ? "joosy_#{options[:application]}" : "joosy"),
|
21
|
+
defaults: {route: route, application: options[:application]},
|
22
|
+
anchor: false,
|
23
|
+
format: false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/joosy/rails/version.rb
CHANGED
data/lib/joosy/rails.rb
CHANGED
@@ -5,7 +5,7 @@ module Joosy
|
|
5
5
|
class ApplicationGenerator < Base
|
6
6
|
argument :name, type: :string, optional: true
|
7
7
|
|
8
|
-
def
|
8
|
+
def create_application
|
9
9
|
dependencies = <<-COFFEE
|
10
10
|
#= require jquery
|
11
11
|
#= require jquery.form
|
@@ -16,6 +16,26 @@ module Joosy
|
|
16
16
|
self.destination_root = ::Rails.root.join('app/assets/javascripts/').join(name || '')
|
17
17
|
run Joosy::Generators.pregenerate('project/base', {name: name, dependencies: dependencies})
|
18
18
|
end
|
19
|
+
|
20
|
+
def create_bindings
|
21
|
+
self.destination_root = ::Rails.root
|
22
|
+
|
23
|
+
if !name
|
24
|
+
index = ::Rails.root.join('app/assets/javascripts/application.js')
|
25
|
+
|
26
|
+
if File.exists?(index)
|
27
|
+
copy_file index, 'app/assets/javascripts/application.bak'
|
28
|
+
remove_file index
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
layout = 'joosy'
|
33
|
+
layout << "/#{name}" if name
|
34
|
+
template File.expand_path('../templates/layout.html.erb', __FILE__), "app/views/layouts/#{layout}.html.erb"
|
35
|
+
|
36
|
+
application = name ? ", application: '#{name}'" : ''
|
37
|
+
route "joosy '/'#{application}"
|
38
|
+
end
|
19
39
|
end
|
20
40
|
end
|
21
41
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title></title>
|
5
|
+
<script type="text/javascript">
|
6
|
+
window.JoosyEnvironment = {
|
7
|
+
router: {
|
8
|
+
base: <%= '<%= raw @base.to_json %'+'>' %>
|
9
|
+
}
|
10
|
+
}
|
11
|
+
</script>
|
12
|
+
|
13
|
+
<%= "<%= stylesheet_link_tag 'application', :media => 'all' %"+'>' %>
|
14
|
+
<%= "<%= javascript_include_tag '#{name}#{'/' if name}application' %"+'>' %>
|
15
|
+
<%= '<%= csrf_meta_tags %'+'>' %>
|
16
|
+
</head>
|
17
|
+
<body>
|
18
|
+
</body>
|
19
|
+
</html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: joosy-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.alpha.
|
4
|
+
version: 1.0.0.alpha.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Boris Staal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: joosy
|
@@ -109,12 +109,14 @@ files:
|
|
109
109
|
- joosy-rails.gemspec
|
110
110
|
- lib/joosy/generators.rb
|
111
111
|
- lib/joosy/rails.rb
|
112
|
+
- lib/joosy/rails/controller.rb
|
112
113
|
- lib/joosy/rails/engine.rb
|
113
114
|
- lib/joosy/rails/version.rb
|
114
115
|
- lib/rails/generators/joosy/application_generator.rb
|
115
116
|
- lib/rails/generators/joosy/base.rb
|
116
117
|
- lib/rails/generators/joosy/layout_generator.rb
|
117
118
|
- lib/rails/generators/joosy/page_generator.rb
|
119
|
+
- lib/rails/generators/joosy/templates/layout.html.erb
|
118
120
|
- lib/rails/generators/joosy/widget_generator.rb
|
119
121
|
homepage: http://github.com/joosy/rails
|
120
122
|
licenses:
|