From e8bdef1bba1711fd8749bb78c899098a2a91e542 Mon Sep 17 00:00:00 2001 From: Jonas Grimfelt Date: Thu, 31 Dec 2009 18:51:24 +0100 Subject: [PATCH] Using Gemcutter as gem-source now. --- .gitignore | 5 ++- CHANGELOG.textile | 4 ++ README.textile | 87 ++++++++++++++++++++++++++------------------ Rakefile | 34 ++++++++++------- TODO.textile | 6 +-- VERSION.yml | 2 +- dry_scaffold.gemspec | 12 +++--- 7 files changed, 88 insertions(+), 62 deletions(-) diff --git a/.gitignore b/.gitignore index 70811f7..967dfe1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -.tmproj -pkg \ No newline at end of file +.DS_Store +pkg +.*~ \ No newline at end of file diff --git a/CHANGELOG.textile b/CHANGELOG.textile index c0ed909..86520de 100644 --- a/CHANGELOG.textile +++ b/CHANGELOG.textile @@ -1,3 +1,7 @@ +h1. 0.3.6 (2009-12-31) + +* Gemcutter as gem source. + h1. 0.3.4 (2009-09-16) * Fixed bug: Make it possible to require rake tasks (In Rakefile: require 'dry_scaffold/tasks') diff --git a/README.textile b/README.textile index 6ee8d12..006cda5 100644 --- a/README.textile +++ b/README.textile @@ -62,7 +62,8 @@ h4. Standard HAML + ActionView FormHelpers: -
- form_for(@duck) do |f|
+
+- form_for(@duck) do |f|
   = f.error_messages
   %ul
     %li
@@ -72,18 +73,21 @@ HAML + ActionView FormHelpers:
       = f.label :about, 'About'
       = f.text_area :about
   %p.buttons
-    = f.submit 'Create'
+ = f.submit 'Create' +
h4. Formtastic HAML + Formtastic: -
- semantic_form_for(@duck) do |f|
+
+- semantic_form_for(@duck) do |f|
   - f.inputs do
     = f.input :name
     = f.input :about
   - f.buttons do
-    = f.commit_button 'Create'
+ = f.commit_button 'Create' +
Find out more about *formtastic*: "http://github.com/justinfrench/formtastic":http://github.com/justinfrench/formtastic @@ -95,7 +99,8 @@ h4. Standard Using ActionController: -
def new
+
+def new
   @duck = Duck.new
   
   respond_to do |format|
@@ -103,14 +108,17 @@ Using ActionController:
     format.xml  { render :xml => @duck }
     format.json { render :json => @duck }
   end
-end
+end +
h4. Resourceful Using InheritedResources: -
actions :new
-respond_to :html, :xml, :json
+
+actions :new
+respond_to :html, :xml, :json
+
Find out more about *inherited_resources*: "http://github.com/josevalim/inherited_resources":http://github.com/josevalim/inherited_resources @@ -128,7 +136,8 @@ h4. Standard ActionController with pagination: -
before_filter :load_resource, :only => [:show, :edit, :update, :destroy]
+
+before_filter :load_resource, :only => [:show, :edit, :update, :destroy]
 before_filter :load_and_paginate_resources, :only => [:index]
 
 ...
@@ -146,20 +155,23 @@ protected
   def resource
     @resource = @resource = ||= Duck.find(params[:id])
   end
-  alias :load_resource :resource
+ alias :load_resource :resource +
h4. Resourceful InheritedResources with pagination: -
protected
+
+protected
   
   def collection
     paginate_options ||= {}
     paginate_options[:page] ||= (params[:page] || 1)
     paginate_options[:per_page] ||= (params[:per_page] || 20)
     @resources ||= end_of_association_chain.paginate(paginate_options)
-  end
+ end +
h3. View Partials @@ -168,13 +180,6 @@ A very common pattern is to break up views in partials, which is also what DrySc * @new@/@edit@ => @_form@ * @index@ => @_item@ -h3. More To Come... (TODO) - -These are things I have in mind: - -* Handle belongs_to, i.e. specify MODEL --belongs-to PARENT_MODEL, which generates proper routes, proper before-filters if inherited_resources-controller, adding belongs_to-association in model, and correct form_for arguments. -* RSpec-support? - h2. Setup Installing DryScaffold is easy: @@ -185,11 +190,11 @@ Install DryScaffold... h4. Gem (Recommended) -
sudo gem install grimen-dry_scaffold --source http://gems.github.com
+
sudo gem install dry_scaffold
...and in config: @config/environments/development.rb@ -
config.gem 'grimen-dry_scaffold', :lib => false, :source => 'http://gems.github.com'
+
config.gem 'dry_scaffold', :lib => false
h4. Plugin @@ -211,46 +216,58 @@ h4. Manual Get the gems...you want: -
sudo gem install haml
-sudo gem install mislav-will_paginate
-sudo gem install justinfrench-formtastic
-sudo gem install josevalim-inherited_resources
+
+sudo gem install haml
+sudo gem install will_paginate
+sudo gem install formtastic
+sudo gem install inherited_resources
+
...and same for the config config: @config/environments/development.rb@ -
config.gem 'haml'
+
+config.gem 'haml'
 config.gem 'will_paginate'
-config.gem 'justinfrench-formtastic', :lib => 'formtastic', :source => 'http://gems.github.com'
-config.gem 'josevalim-inherited_resources', :lib => 'inherited_resources', :source => 'http://gems.github.com'
+config.gem 'formtastic' +config.gem 'inherited_resources' +
Also configure @config/environments/test.rb@ with the RSpec library if you want to -
config.gem 'rspec'
-config.gem 'rspec-rails'
+
+config.gem 'rspec'
+config.gem 'rspec-rails'
+
And don't forget to initialize it as well: -
./script/generate rspec
+
+./script/generate rspec
+
To access Rake tasks in Rails from the gem version of DryScaffold you need to do this: In your project @Rakefile@:
-  require 'dry_scaffold/tasks'
+require 'dry_scaffold/tasks'
 
Don't ask me why me why this is the only way with gems...Ask the Rails core team, because this is not conventions over configuration. Raur... h2. Usage -
./script/generate dry_scaffold ModelName [attribute:type attribute:type] [_actions:new,create,...] [_formats:html,json,...] [_indexes:attribute,...] [--skip-pagination] [--skip-resourceful] [--skip-formtastic] [--skip-views] [--skip-helpers] [--skip-migration] [--skip-timestamps] [--skip-tests] [--skip-controller-tests] [--layout] [--tunit] [--shoulda] [--rspec] [--fixtures] [--fgirl] [--machinist] [--odaddy]
+
+./script/generate dry_scaffold ModelName [attribute:type attribute:type] [_actions:new,create,...] [_formats:html,json,...] [_indexes:attribute,...] [--skip-pagination] [--skip-resourceful] [--skip-formtastic] [--skip-views] [--skip-helpers] [--skip-migration] [--skip-timestamps] [--skip-tests] [--skip-controller-tests] [--layout] [--tunit] [--shoulda] [--rspec] [--fixtures] [--fgirl] [--machinist] [--odaddy]
+
...or use the alias @dscaffold@ instead of @dry_scaffold@. For generating just a *model*, then use: -
./script/generate dry_model ModelName [attribute:type attribute:type] [_indexes:attribute,...] [--skip-migration] [--skip-timestamps] [--skip-tests] [--tunit] [--shoulda] [--rspec] [--fixtures] [--fgirl] [--machinist] [--odaddy]
+
+./script/generate dry_model ModelName [attribute:type attribute:type] [_indexes:attribute,...] [--skip-migration] [--skip-timestamps] [--skip-tests] [--tunit] [--shoulda] [--rspec] [--fixtures] [--fgirl] [--machinist] [--odaddy]
+
...or use the alias @dmodel@ instead of @dry_model@. @@ -453,4 +470,4 @@ At last, positive feedback is always appreciated! h2. License -Copyright (c) 2009 Jonas Grimfelt, released under the MIT-license. \ No newline at end of file +Copyright (c) 2009 Jonas Grimfelt, released under the MIT-license. diff --git a/Rakefile b/Rakefile index 706f132..5f0f210 100644 --- a/Rakefile +++ b/Rakefile @@ -4,28 +4,34 @@ require 'rake/rdoctask' NAME = "dry_scaffold" SUMMARY = %Q{A DRYer scaffold generator for Rails. Generates dry semantic and standards compliant views, and dry RESTful controllers.} -HOMEPAGE = "http://github.com/grimen/#{NAME}/tree/master" +HOMEPAGE = "http://github.com/grimen/#{NAME}" AUTHOR = "Jonas Grimfelt" EMAIL = "grimen@gmail.com" SUPPORT_FILES = %w(README.textile TODO.textile CHANGELOG.textile) begin require 'jeweler' - Jeweler::Tasks.new do |gem| - gem.name = NAME - gem.summary = SUMMARY - gem.description = SUMMARY - gem.homepage = HOMEPAGE - gem.author = AUTHOR - gem.email = EMAIL + Jeweler::Tasks.new do |gemspec| + gemspec.name = NAME + gemspec.summary = SUMMARY + gemspec.description = SUMMARY + gemspec.homepage = HOMEPAGE + gemspec.author = AUTHOR + gemspec.email = EMAIL - gem.require_paths = %w{lib} - gem.files = %w(MIT-LICENSE Rakefile) + SUPPORT_FILES + Dir.glob(File.join('{bin,config,generators,lib,rails,tasks}', '**', '*')) - gem.executables = %w(dscaffold dry_scaffold dmodel dry_model) - gem.extra_rdoc_files = SUPPORT_FILES + gemspec.require_paths = %w{lib} + gemspec.files = %w(MIT-LICENSE Rakefile) << SUPPORT_FILES << + Dir.glob(File.join('{bin,config,generators,lib,tasks}', '**', '*').to_s) + gemspec.executables = %w(dscaffold dry_scaffold dmodel dry_model) + gemspec.extra_rdoc_files = SUPPORT_FILES + + gemspec.add_dependency 'haml' end + + Jeweler::GemcutterTasks.new rescue LoadError - puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" + puts "Jeweler, or one of its dependencies, is not available. " << + "Install it with: sudo gem install jeweler -s http://gemcutter.org" end desc %Q{Run unit tests for "#{NAME}".} @@ -45,4 +51,4 @@ Rake::RDocTask.new(:rdoc) do |rdoc| rdoc.options << '--line-numbers' << '--inline-source' << '--charset=UTF-8' rdoc.rdoc_files.include(SUPPORT_FILES) rdoc.rdoc_files.include(File.join('lib', '**', '*.rb')) -end \ No newline at end of file +end diff --git a/TODO.textile b/TODO.textile index 20bc2df..fb702cd 100644 --- a/TODO.textile +++ b/TODO.textile @@ -3,16 +3,12 @@ h1. TODO h2. Next * Bug/Issue: InheritedResources functional testing issue. -* Feature: RSpec-templates? -* Optimization: Write even better functional tests for REST-actions. Goal: Killer-tests, i.e. "best practice"-tests. Suggestion: Routing, formats, ... -* Feature: Auto-detection of testing frameworks in working project. +* Feature: Check for overridden templates in: RAILS_ROOT/lib/dry_scaffold/templates/ h2. Maybe -* Feature: Check for overridden templates in: RAILS_ROOT/lib/dry_scaffold/templates/ * Feature: Handle belongs_to, i.e. specify MODEL --belongs-to PARENT_MODEL, which generates proper routes, proper before-filters if inherited_resources-controller, adding belongs_to-association in model, and correct form_for arguments. * Feature: Builder for podcast-feed, similar to RSS/Atom-builders. http://wiki.github.com/radiant/radiant/host-a-podcast -* Tests: Generator tests. =P (Not very straightforward...) h2. Issues diff --git a/VERSION.yml b/VERSION.yml index d611119..50a8918 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,4 @@ --- :minor: 3 -:patch: 5 +:patch: 6 :major: 0 diff --git a/dry_scaffold.gemspec b/dry_scaffold.gemspec index 8e873fe..087bf64 100644 --- a/dry_scaffold.gemspec +++ b/dry_scaffold.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = %q{dry_scaffold} - s.version = "0.3.5" + s.version = "0.3.6" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Jonas Grimfelt"] - s.date = %q{2009-09-16} + s.date = %q{2009-12-31} s.description = %q{A DRYer scaffold generator for Rails. Generates dry semantic and standards compliant views, and dry RESTful controllers.} s.email = %q{grimen@gmail.com} s.executables = ["dscaffold", "dry_scaffold", "dmodel", "dry_model"] @@ -90,13 +90,12 @@ Gem::Specification.new do |s| "lib/dry_generator.rb", "lib/dry_scaffold/tasks.rb", "lib/setup_helper.rb", - "rails/init.rb", "tasks/dry_scaffold.rake" ] - s.homepage = %q{http://github.com/grimen/dry_scaffold/tree/master} + s.homepage = %q{http://github.com/grimen/dry_scaffold} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] - s.rubygems_version = %q{1.3.3} + s.rubygems_version = %q{1.3.5} s.summary = %q{A DRYer scaffold generator for Rails. Generates dry semantic and standards compliant views, and dry RESTful controllers.} if s.respond_to? :specification_version then @@ -104,8 +103,11 @@ Gem::Specification.new do |s| s.specification_version = 3 if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 0"]) else + s.add_dependency(%q, [">= 0"]) end else + s.add_dependency(%q, [">= 0"]) end end