endpoint 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Neil Cowburn
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Endpoint
2
+
3
+ A simple gem for generating endpoint controllers and views for use with [RABL](https://github.com/nesquena/rabl).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'endpoint'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install endpoint
18
+
19
+ ## Usage
20
+
21
+ rails generate endpoint_controller <controller_name> <actions>
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1,4 @@
1
+ Example:
2
+ rails generate endpoint_controller items create all single
3
+
4
+ Will create a controller called "items" and it will contain the actions create, all, and single.
@@ -0,0 +1,25 @@
1
+ class EndpointControllerGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ argument :actions, :type => :array, :default => [], :banner => "action action"
5
+ check_class_collision :suffix => "Controller"
6
+
7
+ def create_controller_files
8
+ template 'controller.rb', File.join('app/controllers', class_path, "#{file_name}_controller.rb")
9
+ end
10
+
11
+ def add_rabl_template
12
+ actions.reverse.each do |action|
13
+ template 'view.rabl', File.join("app/views/#{file_name}", class_path, "#{action}.rabl")
14
+ end
15
+ end
16
+
17
+ def add_routes
18
+ actions.reverse.each do |action|
19
+ route %{get "#{file_name}/#{action}"}
20
+ end
21
+ end
22
+
23
+ hook_for :test_framework, :in => :rails, :as => :controller
24
+ hook_for :helper, :in => :rails, :as => :controller
25
+ end
@@ -0,0 +1,13 @@
1
+ <% if namespaced? -%>
2
+ require_dependency "<%= namespaced_path %>/application_controller"
3
+
4
+ <% end -%>
5
+ <% module_namespacing do -%>
6
+ class <%= class_name %>Controller < ApplicationController
7
+ <% actions.each do |action| -%>
8
+ def <%= action %>
9
+ end
10
+ <%= "\n" unless action == actions.last -%>
11
+ <% end -%>
12
+ end
13
+ <% end -%>
@@ -0,0 +1 @@
1
+ object false
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: endpoint
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Neil Cowburn
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-31 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: A Rails generator for working with RABL to create endpoint controllers
15
+ email: neilco@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files:
19
+ - LICENSE
20
+ - README.md
21
+ files:
22
+ - lib/generators/endpoint_controller/USAGE
23
+ - lib/generators/endpoint_controller/endpoint_controller_generator.rb
24
+ - lib/generators/endpoint_controller/templates/controller.rb
25
+ - lib/generators/endpoint_controller/templates/view.rabl
26
+ - LICENSE
27
+ - README.md
28
+ homepage: http://github.com/neilco/endpoint
29
+ licenses: []
30
+ post_install_message:
31
+ rdoc_options:
32
+ - --charset=UTF-8
33
+ require_paths:
34
+ - lib
35
+ - lib/generators/**
36
+ required_ruby_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ requirements: []
49
+ rubyforge_project:
50
+ rubygems_version: 1.8.17
51
+ signing_key:
52
+ specification_version: 3
53
+ summary: A Rails 3 generator for RABL
54
+ test_files: []