exhibit 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Exhibit is a simple gem to generate and work with presenters in Rails 3. It is based on the solution Ryan Bates created in [Railscasts Pro episode #287](http://railscasts.com/episodes/287-presenters-from-scratch).
|
4
4
|
|
5
|
-
version 0.1.
|
5
|
+
version 0.1.3
|
6
6
|
Robin Brouwer
|
7
7
|
45north
|
8
8
|
|
data/lib/exhibit/version.rb
CHANGED
@@ -2,23 +2,32 @@ module Exhibit
|
|
2
2
|
class PresenterGenerator < Rails::Generators::Base
|
3
3
|
source_root File.expand_path('../templates', __FILE__)
|
4
4
|
argument :presenter_name, :type => :string
|
5
|
+
class_option :no_namespace, :type => :boolean, :default => false
|
5
6
|
|
6
7
|
def create_presenter
|
7
|
-
template "presenter", "app/presenters/#{file_name}.rb"
|
8
|
+
template "presenter.rb", "app/presenters/#{file_name}.rb"
|
8
9
|
end
|
9
10
|
|
10
11
|
private
|
11
12
|
|
12
13
|
def file_name
|
13
|
-
"#{
|
14
|
+
"#{singular_name}_presenter"
|
15
|
+
end
|
16
|
+
|
17
|
+
def singular_name
|
18
|
+
if options[:no_namespace]
|
19
|
+
presenter_name.underscore.split('/').last
|
20
|
+
else
|
21
|
+
presenter_name.underscore
|
22
|
+
end
|
14
23
|
end
|
15
24
|
|
16
25
|
def class_name
|
17
|
-
|
26
|
+
singular_name.camelize
|
18
27
|
end
|
19
28
|
|
20
|
-
def
|
21
|
-
presenter_name.underscore
|
29
|
+
def exhibit_name
|
30
|
+
presenter_name.underscore.gsub('/', '_')
|
22
31
|
end
|
23
32
|
end
|
24
33
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exhibit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Robin Brouwer
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-
|
18
|
+
date: 2011-10-07 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -49,7 +49,7 @@ files:
|
|
49
49
|
- lib/generators/exhibit/base_generator.rb
|
50
50
|
- lib/generators/exhibit/presenter_generator.rb
|
51
51
|
- lib/generators/exhibit/templates/exhibit_presenter.rb
|
52
|
-
- lib/generators/exhibit/templates/presenter
|
52
|
+
- lib/generators/exhibit/templates/presenter.rb
|
53
53
|
- lib/generators/exhibit/USAGE
|
54
54
|
- lib/tasks/exhibit_tasks.rake
|
55
55
|
- MIT-LICENSE
|