midas-g_sectioned_shower 1.0.1

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/History.txt ADDED
@@ -0,0 +1,3 @@
1
+ == 1.0.0 2009-03-12
2
+
3
+ * Initial release (ported from plugin)
data/Manifest.txt ADDED
@@ -0,0 +1,15 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ g_sectioned_shower.gemspec
7
+ lib/g_sectioned_shower.rb
8
+ lib/g_sectioned_shower/view_helpers.rb
9
+ script/console
10
+ script/destroy
11
+ script/generate
12
+ spec/g_sectioned_shower_spec.rb
13
+ spec/spec.opts
14
+ spec/spec_helper.rb
15
+ tasks/rspec.rake
data/PostInstall.txt ADDED
@@ -0,0 +1,7 @@
1
+
2
+ For more information on g_sectioned_shower, see http://g_sectioned_shower.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
data/README.rdoc ADDED
@@ -0,0 +1,77 @@
1
+ = g_sectioned_shower
2
+
3
+ http://github.com/midas/g_sectioned_shower/tree/master
4
+
5
+
6
+ == DESCRIPTION:
7
+
8
+ A Guilded (http://github.com/midas/guilded/tree/master) component that creates adaptaple show (detail) views of a single
9
+ ActiveRecord object.
10
+
11
+
12
+ == FEATURES:
13
+
14
+ * Generates a detail view of an ActiveRecord object using a XHTML data list
15
+ * Can generate a status field (to integrate with AASM, etc)
16
+ * Adaptable title section
17
+ * Generates one main section and zero too many other sections
18
+ * Can generate different sections of the detail (not necessarily divided by domain model)
19
+ * Can pull details from associated has_one or belongs_to record
20
+ * Can generate link to associated has_one or belongs_to record
21
+ * Can pull details from associated has_many records (allows you to specify max and generates an efficient query)
22
+ * Can generate link to associated has_many records and the associations list page
23
+ * Can configure sections to dynamically display based on any conditions
24
+
25
+
26
+ == INSTALL:
27
+
28
+ sudo gem install midas-g_sectioned_shower
29
+
30
+ In Rails environement.rb file:
31
+
32
+ config.gem 'midas-g_sectioned_shower', :version => '1.0.1', :lib => 'g_sectioned_shower', :source => 'http://gems.github.com'
33
+
34
+
35
+ == USAGE:
36
+
37
+ View:
38
+
39
+ <%= g_sectioned_shower @item, :title_attr => :name, :date_format => :us_long, :status => @ticket.status,
40
+ :id => 'item-detail', :sections => [ { :attributes => [:is_active, :created_at, :updated_at },
41
+ { :title => 'Owner', :attributes => [:person], :person_attributes => [:first_name, :last_name, :address => 'Street Address'] } ]
42
+ %>
43
+
44
+ Results in:
45
+
46
+
47
+
48
+ == REQUIREMENTS:
49
+
50
+ * Rails >= 2.2.0
51
+ * Guilded >= 0.0.9 (http://github.com/midas/guilded/tree/master)
52
+
53
+
54
+ == LICENSE:
55
+
56
+ (The MIT License)
57
+
58
+ Copyright (c) 2009 C. Jason Harrelson (midas)
59
+
60
+ Permission is hereby granted, free of charge, to any person obtaining
61
+ a copy of this software and associated documentation files (the
62
+ 'Software'), to deal in the Software without restriction, including
63
+ without limitation the rights to use, copy, modify, merge, publish,
64
+ distribute, sublicense, and/or sell copies of the Software, and to
65
+ permit persons to whom the Software is furnished to do so, subject to
66
+ the following conditions:
67
+
68
+ The above copyright notice and this permission notice shall be
69
+ included in all copies or substantial portions of the Software.
70
+
71
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
72
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
73
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
74
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
75
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
76
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
77
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,30 @@
1
+ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
+ require File.dirname(__FILE__) + '/lib/g_sectioned_shower'
3
+
4
+ # Generate all the Rake tasks
5
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
+ $hoe = Hoe.new('g_sectioned_shower', GSectionedShower::VERSION) do |p|
7
+ p.developer('C. Jason Harrelson (midas)', 'jason@lookforwardenterprises.com')
8
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
+ p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
10
+ p.rubyforge_name = p.name # TODO this is default value
11
+ # p.extra_deps = [
12
+ # ['activesupport','>= 2.0.2'],
13
+ # ]
14
+ p.extra_dev_deps = [
15
+ ['newgem', ">= #{::Newgem::VERSION}"],
16
+ ['rails', ">= 2.2.0"],
17
+ ['midas-guilded', ">=0.0.9"]
18
+ ]
19
+
20
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
21
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
22
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
23
+ p.rsync_args = '-av --delete --ignore-errors'
24
+ end
25
+
26
+ require 'newgem/tasks' # load /tasks/*.rake
27
+ Dir['tasks/**/*.rake'].each { |t| load t }
28
+
29
+ # TODO - want other tests/tasks run by default? Add them to the list
30
+ # task :default => [:spec, :features]
@@ -0,0 +1,44 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{g_sectioned_shower}
5
+ s.version = "1.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["C. Jason Harrelson (midas)"]
9
+ s.date = %q{2009-03-12}
10
+ s.description = %q{A Guilded (http://github.com/midas/guilded/tree/master) component that creates adaptaple show (detail) views of a single ActiveRecord object.}
11
+ s.email = ["jason@lookforwardenterprises.com"]
12
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
13
+ s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "g_sectioned_shower.gemspec", "lib/g_sectioned_shower.rb", "lib/g_sectioned_shower/view_helpers.rb", "script/console", "script/destroy", "script/generate", "spec/g_sectioned_shower_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/midas/g_sectioned_shower/tree/master}
16
+ s.post_install_message = %q{PostInstall.txt}
17
+ s.rdoc_options = ["--main", "README.rdoc"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{g_sectioned_shower}
20
+ s.rubygems_version = %q{1.3.1}
21
+ s.summary = %q{A Guilded (http://github.com/midas/guilded/tree/master) component that creates adaptaple show (detail) views of a single ActiveRecord object.}
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 2
26
+
27
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
+ s.add_development_dependency(%q<newgem>, [">= 1.2.3"])
29
+ s.add_development_dependency(%q<rails>, [">= 2.2.0"])
30
+ s.add_development_dependency(%q<midas-guilded>, [">= 0.0.9"])
31
+ s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
32
+ else
33
+ s.add_dependency(%q<newgem>, [">= 1.2.3"])
34
+ s.add_dependency(%q<rails>, [">= 2.2.0"])
35
+ s.add_dependency(%q<midas-guilded>, [">= 0.0.9"])
36
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
37
+ end
38
+ else
39
+ s.add_dependency(%q<newgem>, [">= 1.2.3"])
40
+ s.add_dependency(%q<rails>, [">= 2.2.0"])
41
+ s.add_dependency(%q<midas-guilded>, [">= 0.0.9"])
42
+ s.add_dependency(%q<hoe>, [">= 1.8.0"])
43
+ end
44
+ end
@@ -0,0 +1,292 @@
1
+ module GSectionedShower
2
+ module ViewHelpers
3
+
4
+ # GUIlded component.
5
+ #
6
+ # *parameters*
7
+ # ar_obj:: The ActiveRecord object containing the information.
8
+ #
9
+ # *options*
10
+ # id:: (required) The id of the element. Must be unique on the page.
11
+ # class::
12
+ # title_attr:: The attribute to use in the title.
13
+ # title_pre:: A string to override the first part of the title. defaults to the name
14
+ # of the active record object's class.
15
+ # date_format:: A symbol representing the date format to use. Defaults to :default.
16
+ # attributes:: A list of attributes to include in the main section.
17
+ # status:: True to include a status section.
18
+ # namespace:: A namespace to append onto all path helpers that are not overridden.
19
+ # sections::
20
+ # title:: The title for this section.
21
+ # attributes:: List of attibutes to include in this section.
22
+ # {associated_attribute_name}_attributes:: List of attributes from associated attribute to include.
23
+ # {associated_attribute_name}_max:: The max number of associated records to show. This will load
24
+ # all and display max unless you define a limited named scope on the respective model, allowing
25
+ # the association to be limited to the max, not returning items that will not be displayed.
26
+ # links:: A list of fields or field => path_helper to generate links to this item in the associated
27
+ # object.
28
+ # list_link:: (Boolean, string, or symbol)
29
+ #
30
+ def g_sectioned_shower( ar_obj, *args )
31
+
32
+ options = args.extract_options!
33
+ raise ArgumentError, "'title_attr' option required" unless options.include?( :title_attr )
34
+ raise ArgumentError, "'sections' option required" unless options.include?( :sections )
35
+ options.merge! :class => "shower" unless options.include?( :class )
36
+ options.merge! :exclude_css => true, :exclude_js => true
37
+ Guilded::Guilder.instance.add( :sectioned_shower, options )
38
+
39
+ html = ""
40
+ html << "<div class=\"status #{options[:status]}\">#{options[:status].to_s.humanize}</div>" if options[:status]
41
+
42
+ title_pre = options[:title_pre] || "#{ar_obj.class.to_s.underscore.humanize} |"
43
+ html << "<h2>#{title_pre} #{ar_obj.send( options[:title_attr].to_sym )}</h2>"
44
+
45
+ # Resolve sections and meta data there-in
46
+ sections = options[:sections]
47
+ reflections = ar_obj.class.inheritable_attributes[:reflections]
48
+
49
+ # Resolve main section
50
+ main_section = sections[0]
51
+ raise ArgumentError, "'attributes' option required within main section configuration" unless main_section.include?( :attributes )
52
+
53
+ methods, titles = Guilded::Rails::Helpers.resolve_field_methods_and_titles( main_section[:attributes], ar_obj )
54
+
55
+ html << "<div class=\"infoItem tableDisplay\"><dl>"
56
+
57
+ methods.each_with_index do |method, i|
58
+
59
+ # Handle associative relationships
60
+ if !reflections.nil? && reflections.has_key?( method.to_sym )
61
+ handle_associated( html, ar_obj, main_section, options, reflections, methods, i )
62
+ else
63
+ # Normal attribute from this model
64
+ html << "<dt>#{titles[i]}</dt>"
65
+ translate_method = "translate_#{method}".to_sym
66
+ val = ar_obj.send( method )
67
+ if respond_to?( translate_method )
68
+ html << "<dd>#{h( send( translate_method, val ) )}</dd>"
69
+ else
70
+ val = val.to_formatted_s( options[:date_format] || :default ) if val.respond_to?( :to_formatted_s )
71
+ html << "<dd>#{h( val )}</dd>"
72
+ end
73
+ end
74
+
75
+ end
76
+
77
+ html << "</dl><div class=\"clear\"></div></div>"
78
+
79
+ # Get rid of the main section as it was already handled
80
+ sections.delete_at( 0 )
81
+
82
+ # Resolve other sections
83
+ sections.each do |section|
84
+
85
+ raise ArgumentError, "'attributes' option required within main section configuration" unless section.include?( :attributes )
86
+ raise ArgumentError, "'title' option required within all section configurations except the main section" unless section.include?( :title )
87
+
88
+ methods, titles = resolve_field_methods_and_titles( section[:attributes], ar_obj )
89
+ html << "<div class=\"infoItem tableDisplay\"><h3>#{section[:title]}</h3><dl>"
90
+
91
+ methods.each_with_index do |method, i|
92
+
93
+ # Handle associative relationships
94
+ if !reflections.nil? && reflections.has_key?( method.to_sym )
95
+ handle_associated( html, ar_obj, section, options, reflections, methods, i )
96
+ else
97
+ # Normal attribute from this model
98
+ html << "<dt>#{titles[i]}</dt>"
99
+ translate_method = "translate_#{method}".to_sym
100
+ val = ar_obj.send( method )
101
+ if respond_to?( translate_method )
102
+ "<dd>#{h( send( translate_method, val ) )}</dd>"
103
+ else
104
+ html << "<dd>#{h( val )}</dd>"
105
+ end
106
+ end
107
+
108
+ end
109
+
110
+ html << "</dl><div class=\"clear\"></div></div>"
111
+
112
+ end
113
+
114
+ html
115
+
116
+ end
117
+
118
+ private
119
+
120
+ def handle_associated( html, ar_obj, section, options, reflections, methods, index )
121
+
122
+ #TODO handle translation helpers if they exist.
123
+
124
+ reflection = reflections[methods[index].to_sym]
125
+
126
+ # Handle many relationships
127
+ if ['has_many', 'has_and_belongs_to_many'].include?( reflection.macro.to_s )
128
+
129
+ reflected_name = reflection.name.to_s
130
+ reflected_singular_name = reflected_name.singularize
131
+ reflected_humanized_name = reflected_name.humanize
132
+ attrs_name = "#{reflected_singular_name}_attributes"
133
+ attrs = section[ attrs_name.to_sym ]
134
+ max_name = "#{reflected_singular_name}_max"
135
+ max = section[ max_name.to_sym ]
136
+ showing_less_than_all = max && max < ar_obj.send( methods[index] ).count
137
+ empty_embedded_ar_obj = reflection.klass.new
138
+ rel_methods, rel_titles = resolve_field_methods_and_titles( attrs, empty_embedded_ar_obj ) unless attrs.nil? || attrs.empty?
139
+
140
+ # Handle creating a link to the associated many objects list
141
+ if section[:list_link]
142
+
143
+ if section[:list_link].is_a?( Symbol )
144
+ assoc_obj_index_path_helper = section[:list_link].to_s
145
+ elsif section[:list_link].is_a?( String )
146
+ assoc_obj_index_path_helper = section[:list_link]
147
+ elsif section[:list_link] == true
148
+ non_namespaced_index_path_helper = "#{ar_obj.class.to_s.tableize.singularize}_#{reflection.name.to_s}_path"
149
+ if options[:namespace]
150
+ assoc_obj_index_path_helper = "#{options[:namespace].to_s}_#{non_namespaced_index_path_helper}"
151
+ else
152
+ assoc_obj_index_path_helper = non_namespaced_index_path_helper
153
+ end
154
+ else
155
+ throw "The 'list_link' parameter must be a String, Symbol or true"
156
+ end
157
+
158
+ if showing_less_than_all
159
+ index_link = link_to( "More #{reflected_humanized_name}...", @controller.send( assoc_obj_index_path_helper, ar_obj ) )
160
+ else
161
+ index_link = link_to( "Jump to #{reflected_humanized_name}", @controller.send( assoc_obj_index_path_helper, ar_obj ) )
162
+ end
163
+
164
+ html << "<dt>#{index_link}</dt><dd></dd>"
165
+
166
+ end
167
+
168
+ # Loop through the collection of embeddeds
169
+ if max && ar_obj.send( methods[index] ).respond_to?( :limited )
170
+ embedded_collection = ar_obj.send( methods[index] ).limited( max )
171
+ else
172
+ embedded_collection = ar_obj.send( methods[index] )
173
+ end
174
+
175
+ embedded_collection.each_with_index do |assoc_ar_obj, i|
176
+
177
+ break if max && i == max # Only display the max number specified (only necessary for when limited is not defined on AR class)
178
+
179
+ assoc_obj_output = ""
180
+
181
+ if section.has_key?( "#{reflected_singular_name}_attributes".to_sym )
182
+ # Handle object output if fields specified explicitly
183
+
184
+ rel_methods.each_with_index do |rel_method, rel_i|
185
+
186
+ method_output = h( assoc_ar_obj.send( rel_method ) )
187
+
188
+ if section.has_key?( :links )
189
+
190
+ links = section[:links]
191
+ throw "The 'links' option must have values in it, or be left out of the options for the section." if links.empty?
192
+ link_entry = find_link_entry( links, rel_method )
193
+
194
+ if link_entry.nil?
195
+ assoc_obj_output << "<dt>#{rel_titles[rel_i]}</dt><dd>#{h( method_output )}</dd>"
196
+ elsif link_entry.is_a?( Symbol ) || link_entry.is_a?( String )
197
+ show_rest_method = "#{assoc_ar_obj.class.to_s.tableize.singularize}_path"
198
+ assoc_obj_link = @controller.send( show_rest_method, assoc_ar_obj )
199
+ assoc_obj_output << "<dt>#{rel_titles[rel_i]}</dt><dd>#{link_to( method_output, assoc_obj_link )}</dd>"
200
+ elsif link_entry.is_a?( Hash )
201
+ show_rest_method = link_entry[rel_method.to_sym]
202
+ assoc_obj_link = @controller.send( show_rest_method, assoc_ar_obj )
203
+ assoc_obj_output << "<dt>#{rel_titles[rel_i]}</dt><dd>#{link_to( method_output, assoc_obj_link )}</dd>"
204
+ else
205
+ assoc_obj_output << "<dt>#{rel_titles[rel_i]}</dt><dd>#{h( method_output )}</dd>"
206
+ end
207
+
208
+ else
209
+ assoc_obj_output << "<dt>#{rel_titles[rel_i]}</dt><dd>#{h( method_output )}</dd>" #TODO can I resolve this repeating from 2 lines above?
210
+ end
211
+
212
+ end
213
+
214
+ else
215
+ # Otherwise just use to_s for the object
216
+ assoc_obj_output << assoc_ar_obj.to_s
217
+ end
218
+
219
+ html << assoc_obj_output
220
+
221
+ end
222
+
223
+ # output '...' if there are embeddeds that are not displayed and we did not render a link to embeddeds index
224
+ if showing_less_than_all && ( section[:list_link].nil? || section[:list_link] == false )
225
+ html << "<dt>...</dt><dd></dd>"
226
+ end
227
+
228
+ elsif ['belongs_to', 'has_one'].include?( reflection.macro.to_s ) # Handle single relationships
229
+
230
+ assoc_obj_output = ""
231
+
232
+ if section.has_key?( "#{reflection.name.to_s.singularize}_attributes".to_sym )
233
+ # Handle object output if fields specified explicitly
234
+
235
+ attrs = section[ "#{reflection.name.to_s.singularize}_attributes".to_sym ]
236
+ rel_methods, rel_titles = resolve_field_methods_and_titles( attrs, ar_obj.send( reflection.name.to_s.to_sym ) )
237
+ assoc_obj = ar_obj.send( methods[index] )
238
+
239
+ rel_methods.each_with_index do |rel_method, rel_i|
240
+
241
+ method_output = h( assoc_obj.send( rel_method ) )
242
+
243
+ if section.has_key?( :links )
244
+
245
+ links = section[:links]
246
+ throw "The 'links' option must have values in it, or be left out of the options for the section." if links.empty?
247
+ link_entry = find_link_entry( links, rel_method )
248
+
249
+ if link_entry.nil?
250
+ assoc_obj_output << "<dt>#{rel_titles[rel_i]}</dt><dd>#{h( method_output )}</dd>"
251
+ elsif link_entry.is_a?( Symbol ) || link_entry.is_a?( String )
252
+ show_rest_method = "#{assoc_obj.class.to_s.tableize.singularize}_path"
253
+ assoc_obj_link = @controller.send( show_rest_method, assoc_obj )
254
+ assoc_obj_output << "<dt>#{rel_titles[rel_i]}</dt><dd>#{link_to( method_output, assoc_obj_link )}</dd>"
255
+ elsif link_entry.is_a?( Hash )
256
+ show_rest_method = link_entry[rel_method.to_sym]
257
+ assoc_obj_link = @controller.send( show_rest_method, assoc_obj )
258
+ assoc_obj_output << "<dt>#{rel_titles[rel_i]}</dt><dd>#{link_to( method_output, assoc_obj_link )}</dd>"
259
+ else
260
+ assoc_obj_output << "<dt>#{rel_titles[rel_i]}</dt><dd>#{h( method_output )}</dd>"
261
+ end
262
+
263
+ else
264
+ assoc_obj_output << "<dt>#{rel_titles[rel_i]}</dt><dd>#{h( method_output )}</dd>"
265
+ end
266
+
267
+ end
268
+
269
+ else
270
+ # Otherwise just use to_s for the object
271
+ assoc_obj_output = ar_obj.send( methods[index] ).to_s
272
+ end
273
+
274
+ html << assoc_obj_output
275
+
276
+ end
277
+
278
+ end
279
+
280
+ def find_link_entry( links, val )
281
+ links.each do |link|
282
+ if link.is_a?( Hash )
283
+ return link if link.has_key?( val.to_sym )
284
+ else
285
+ return link if link == val.to_sym
286
+ end
287
+ end
288
+ return nil
289
+ end
290
+
291
+ end
292
+ end
@@ -0,0 +1,10 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module GSectionedShower
5
+ VERSION = '1.0.1'
6
+ end
7
+
8
+ if defined?( ActionView::Base )
9
+ ActionView::Base.send( :include, GSectionedShower::ViewHelpers ) unless ActionView::Base.include?( GSectionedShower::ViewHelpers )
10
+ end
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/g_sectioned_shower.rb'}"
9
+ puts "Loading g_sectioned_shower gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ # Time to add your specs!
4
+ # http://rspec.info/
5
+ describe "Place your specs here" do
6
+
7
+ it "find this spec in spec directory" do
8
+ violated "Be sure to write your specs"
9
+ end
10
+
11
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'g_sectioned_shower'
data/tasks/rspec.rake ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: midas-g_sectioned_shower
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - C. Jason Harrelson (midas)
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-12 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: newgem
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rails
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 2.2.0
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: midas-guilded
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.0.9
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: hoe
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.8.0
54
+ version:
55
+ description: A Guilded (http://github.com/midas/guilded/tree/master) component that creates adaptaple show (detail) views of a single ActiveRecord object.
56
+ email:
57
+ - jason@lookforwardenterprises.com
58
+ executables: []
59
+
60
+ extensions: []
61
+
62
+ extra_rdoc_files:
63
+ - History.txt
64
+ - Manifest.txt
65
+ - PostInstall.txt
66
+ - README.rdoc
67
+ files:
68
+ - History.txt
69
+ - Manifest.txt
70
+ - PostInstall.txt
71
+ - README.rdoc
72
+ - Rakefile
73
+ - g_sectioned_shower.gemspec
74
+ - lib/g_sectioned_shower.rb
75
+ - lib/g_sectioned_shower/view_helpers.rb
76
+ - script/console
77
+ - script/destroy
78
+ - script/generate
79
+ - spec/g_sectioned_shower_spec.rb
80
+ - spec/spec.opts
81
+ - spec/spec_helper.rb
82
+ - tasks/rspec.rake
83
+ has_rdoc: true
84
+ homepage: http://github.com/midas/g_sectioned_shower/tree/master
85
+ post_install_message: PostInstall.txt
86
+ rdoc_options:
87
+ - --main
88
+ - README.rdoc
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: "0"
96
+ version:
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: "0"
102
+ version:
103
+ requirements: []
104
+
105
+ rubyforge_project: g_sectioned_shower
106
+ rubygems_version: 1.2.0
107
+ signing_key:
108
+ specification_version: 2
109
+ summary: A Guilded (http://github.com/midas/guilded/tree/master) component that creates adaptaple show (detail) views of a single ActiveRecord object.
110
+ test_files: []
111
+