exhibit 0.1.4 → 0.1.5
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.5
|
6
6
|
Robin Brouwer
|
7
7
|
45north
|
8
8
|
|
data/lib/exhibit/version.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
Available generators:
|
2
2
|
exhibit:presenter
|
3
|
+
Options:
|
4
|
+
--rspec
|
5
|
+
--testunit
|
6
|
+
--no_namespace
|
7
|
+
|
3
8
|
exhibit:base
|
4
9
|
|
5
10
|
Examples:
|
@@ -7,6 +12,7 @@ Examples:
|
|
7
12
|
This will create:
|
8
13
|
app/presenters
|
9
14
|
app/presenters/user_presenter.rb
|
15
|
+
spec/presenters/user_presenter_spec.rb
|
10
16
|
|
11
17
|
rails g exhibit:base
|
12
18
|
This will create:
|
@@ -3,11 +3,21 @@ module Exhibit
|
|
3
3
|
source_root File.expand_path('../templates', __FILE__)
|
4
4
|
argument :presenter_name, :type => :string
|
5
5
|
class_option :no_namespace, :type => :boolean, :default => false
|
6
|
+
class_option :testunit, :type => :boolean, :default => false
|
7
|
+
class_option :rspec, :type => :boolean, :default => true
|
6
8
|
|
7
9
|
def create_presenter
|
8
10
|
template "presenter.rb", "app/presenters/#{file_name}.rb"
|
9
11
|
end
|
10
12
|
|
13
|
+
def create_tests
|
14
|
+
if test_framework == :rspec
|
15
|
+
template "presenter_spec.rb", "spec/presenters/#{file_name}_spec.rb"
|
16
|
+
else
|
17
|
+
template "presenter_test.rb", "test/unit/presenters/#{file_name}_test.rb"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
11
21
|
private
|
12
22
|
|
13
23
|
def file_name
|
@@ -33,5 +43,24 @@ module Exhibit
|
|
33
43
|
presenter_name.underscore.gsub('/', '_')
|
34
44
|
end
|
35
45
|
end
|
46
|
+
|
47
|
+
def test_framework
|
48
|
+
return @test_framework if defined?(@test_framework)
|
49
|
+
if options.testunit?
|
50
|
+
return @test_framework = :testunit
|
51
|
+
elsif options.rspec?
|
52
|
+
return @test_framework = :rspec
|
53
|
+
else
|
54
|
+
return @test_framework = default_test_framework
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def default_test_framework
|
59
|
+
File.exist?(destination_path("spec")) ? :rspec : :testunit
|
60
|
+
end
|
61
|
+
|
62
|
+
def destination_path(path)
|
63
|
+
File.join(destination_root, path)
|
64
|
+
end
|
36
65
|
end
|
37
66
|
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: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
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-08 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -50,6 +50,8 @@ files:
|
|
50
50
|
- lib/generators/exhibit/presenter_generator.rb
|
51
51
|
- lib/generators/exhibit/templates/exhibit_presenter.rb
|
52
52
|
- lib/generators/exhibit/templates/presenter.rb
|
53
|
+
- lib/generators/exhibit/templates/presenter_spec.rb
|
54
|
+
- lib/generators/exhibit/templates/presenter_test.rb
|
53
55
|
- lib/generators/exhibit/USAGE
|
54
56
|
- lib/tasks/exhibit_tasks.rake
|
55
57
|
- MIT-LICENSE
|