joosy-rails 1.0.0.alpha.4 → 1.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d97d285b9b7bd10b7817b37c9891081348603389
4
- data.tar.gz: b58084afe8f93527ef5c278e8585c4147f024a45
3
+ metadata.gz: 28181f873152cd5891d0e04461a8a4236aea9640
4
+ data.tar.gz: 4cc04dbc4be50ff8cf976626078492326f6217fb
5
5
  SHA512:
6
- metadata.gz: 77d1101c8e2c2e51d8618a725ae1bd3fd8ea73e8104a353c675fc4b254376630c6067934dbd0fbd588944fe26ad3bf448066bdb60b2a38ec383b41e8195bd4ad
7
- data.tar.gz: 8f7c0078e7fb50ee4d00a2ff66203fa9403d0d2c58813616cf836ab3d40a73b571a82ba89223b5545639fd952ecd20d8c33151df05b1c058ddf0e9f0671e6f5f
6
+ metadata.gz: a4bcc8ac278cd9993b242c57690d080069da3eb9180c5af362cfd6d718ca4e9e8b11dfce485db78ebd49c8ba9e92392e44f9f1c90cd299ffb0cf95b478d06695
7
+ data.tar.gz: e9ef56f7a1770998970ecc21a04c8bc82c9de72cd653c7f1956091addcace7c556797d327e5f9cc24a44800071d60f91cfb851020153b519a57fc604657bcd43
data/README.md CHANGED
@@ -1,6 +1,18 @@
1
- # Joosy::Rails
1
+ # Joosy::Rails
2
2
 
3
- TODO: Write a gem description
3
+ ![Joosy](http://f.cl.ly/items/2N2J453J2B353F1A0t0I/joocy1.1.png)
4
+
5
+ Rails ties for the [Joosy](http://joosy.ws) Framework
6
+
7
+ [![Gem Version](https://badge.fury.io/rb/joosy-rails.png)](http://badge.fury.io/rb/joosy-rails)
8
+ [![Dependency Status](https://gemnasium.com/joosy/rails.png)](https://gemnasium.com/joosy/rails)
9
+
10
+ On the menu:
11
+
12
+ * Full assets integration
13
+ * Generators
14
+ * Built-in serving controller
15
+ * Routes helpers
4
16
 
5
17
  ## Installation
6
18
 
@@ -12,13 +24,34 @@ And then execute:
12
24
 
13
25
  $ bundle
14
26
 
15
- Or install it yourself as:
27
+ ## Usage
16
28
 
17
- $ gem install joosy-rails
29
+ ### Generators
18
30
 
19
- ## Usage
31
+ * `rails g joosy:application :name` – generates basic application and patches routes to make it loadable straight away.<br>
32
+ **:name** can (and in most cases should) be ommited.<br>
33
+
34
+ * `rails g joosy:layout :name (:application)` – generates new `Joosy.Layout`.<br>
35
+ **:name** can include any namespace (i.e. 'deeply/nested/layout').<br>
36
+ **:application** is a name of an application.<br>
37
+
38
+ * `rails g joosy:page :name (:application)` – generates new `Joosy.Page`.<br>
39
+ **:name** can include any namespace (i.e. 'deeply/nested/page').<br>
40
+ **:application** is a name of an application.<br>
41
+
42
+ * `rails g joosy:widget :name (:application)` – generates new `Joosy.Widget`.<br>
43
+ **:name** can include any namespace (i.e. 'deeply/nested/widget').<br>
44
+ **:application** is a name of an application.
45
+
46
+ ### Serving controller and helpers
47
+
48
+ This gem provides `joosy` routing helper which can be used in the following way:
49
+
50
+ ```ruby
51
+ joosy '/', application: 'dummy'
52
+ ```
20
53
 
21
- TODO: Write usage instructions here
54
+ This will map your `dummy` Joosy application to the root url. Note that `application` option is optional and can be ommited just like `:name` option of the application generator.
22
55
 
23
56
  ## Contributing
24
57
 
@@ -15,12 +15,14 @@ module ActionDispatch::Routing
15
15
  def joosy(route, options={})
16
16
  extender = route.last == '/' ? '(*x)' : '(/*x)'
17
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
18
+ match route,
19
+ controller: options[:controller] || 'joosy/rails/serve',
20
+ action: options[:action] || 'index',
21
+ via: :get,
22
+ as: (options[:application] ? "joosy_#{options[:application]}" : "joosy"),
23
+ defaults: {route: route, application: options[:application]},
24
+ anchor: false,
25
+ format: false
24
26
  end
25
27
  end
26
28
  end
@@ -1,5 +1,5 @@
1
1
  module Joosy
2
2
  module Rails
3
- VERSION = "1.0.0.alpha.4"
3
+ VERSION = "1.0.0.beta.1"
4
4
  end
5
5
  end
@@ -34,7 +34,7 @@ module Joosy
34
34
  template File.expand_path('../templates/layout.html.erb', __FILE__), "app/views/layouts/#{layout}.html.erb"
35
35
 
36
36
  application = name ? ", application: '#{name}'" : ''
37
- route "joosy '/'#{application}"
37
+ route "joosy '/#{name}'#{application}"
38
38
  end
39
39
  end
40
40
  end
@@ -0,0 +1,18 @@
1
+ require_relative './base'
2
+
3
+ module Joosy
4
+ module Generators
5
+ class ControllerGenerator < Base
6
+ argument :name, type: :string
7
+ class_option :copy, :default => false, :type => :boolean, :desc => 'Indicates whether internal controller should be copied'
8
+
9
+ def create_files
10
+ if options["copy"]
11
+ template File.expand_path('../../../../joosy/rails/controller.rb', __FILE__), "app/controller/joosy/rails/serve_controller.rb"
12
+ else
13
+ template File.expand_path('../templates/controller.rb', __FILE__), "app/controllers/#{name.underscore}_controller.rb"
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -4,10 +4,10 @@ module Joosy
4
4
  module Generators
5
5
  class LayoutGenerator < Base
6
6
  argument :name, type: :string
7
- argument :project, type: :string, optional: true
7
+ argument :application, type: :string, optional: true
8
8
 
9
9
  def create_files
10
- self.destination_root = ::Rails.root.join('app/assets/javascripts/').join(project || '')
10
+ self.destination_root = ::Rails.root.join('app/assets/javascripts/').join(application || '')
11
11
  run Joosy::Generators.pregenerate('layout', {name: name})
12
12
  end
13
13
  end
@@ -4,10 +4,10 @@ module Joosy
4
4
  module Generators
5
5
  class PageGenerator < Base
6
6
  argument :name, type: :string
7
- argument :project, type: :string, optional: true
7
+ argument :application, type: :string, optional: true
8
8
 
9
9
  def create_files
10
- self.destination_root = ::Rails.root.join('app/assets/javascripts/').join(project || '')
10
+ self.destination_root = ::Rails.root.join('app/assets/javascripts/').join(application || '')
11
11
  run Joosy::Generators.pregenerate('page', {name: name})
12
12
  end
13
13
  end
@@ -0,0 +1,2 @@
1
+ class <%= name.camelize %>Controller < Joosy::Rails::ServeController
2
+ end
@@ -4,10 +4,10 @@ module Joosy
4
4
  module Generators
5
5
  class WidgetGenerator < Base
6
6
  argument :name, type: :string
7
- argument :project, type: :string, optional: true
7
+ argument :application, type: :string, optional: true
8
8
 
9
9
  def create_files
10
- self.destination_root = ::Rails.root.join('app/assets/javascripts/').join(project || '')
10
+ self.destination_root = ::Rails.root.join('app/assets/javascripts/').join(application || '')
11
11
  run Joosy::Generators.pregenerate('widget', {name: name})
12
12
  end
13
13
  end
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
4
+ version: 1.0.0.beta.1
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-26 00:00:00.000000000 Z
11
+ date: 2013-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: joosy
@@ -114,8 +114,10 @@ files:
114
114
  - lib/joosy/rails/version.rb
115
115
  - lib/rails/generators/joosy/application_generator.rb
116
116
  - lib/rails/generators/joosy/base.rb
117
+ - lib/rails/generators/joosy/controller_generator.rb
117
118
  - lib/rails/generators/joosy/layout_generator.rb
118
119
  - lib/rails/generators/joosy/page_generator.rb
120
+ - lib/rails/generators/joosy/templates/controller.rb
119
121
  - lib/rails/generators/joosy/templates/layout.html.erb
120
122
  - lib/rails/generators/joosy/widget_generator.rb
121
123
  homepage: http://github.com/joosy/rails