Permalink
Browse files

[ALL] Adapted test to new changes.

[ALL] Test now don't need a gem we look if padrino is vendorized
  • Loading branch information...
1 parent f0e7ab0 commit 730159050a6a8c6baf6fdf2b8a69f34ecafd2ec5 Davide D'Agostino committed Jan 14, 2010
View
Oops, something went wrong.
View
@@ -15,7 +15,6 @@ VERSIONER = Versioner.new(GEM_VERSION, Dir[File.dirname(__FILE__) + '/**/VERSI
padrino_gems = [
"padrino-core",
- "padrino-cache",
"padrino-gen",
"padrino-helpers",
"padrino-mailer",
@@ -96,6 +95,17 @@ namespace :version do
end
end
+desc "Create main README.rdoc"
+task :readme do
+ copyright = "== Copyright\n\nCopyright (c) 2010 Padrino. See LICENSE for details."
+ readme = %w(core gen helpers admin mailer cache).collect do |gem|
+ File.read("padrino-#{gem}/README.rdoc").gsub(copyright,"").strip
+ end
+ readme << copyright
+ File.open("README.rdoc", "w"){ |f| f.puts readme.join("\n\n") }
+ puts "Created correctly README.rdoc"
+end
+
desc "Release all padrino gems"
task :publish do
puts "Pushing to GitHub..."
@@ -1,4 +1,6 @@
-= padrino-admin
+= Admin Dashboard and Authentication (padrino-admin)
+
+=== Overview
Padrino has a beautiful Ajax Admin, with these fatures:
@@ -28,7 +30,10 @@ Your admin now is "complete", you can start your server with <tt>padrino start</
For create a new "scaffold" you need to provide only a Model for them like:
+ fun-test$ padrino-gen model post --skip-migration // edit your post.rb model and add some fields
+ fun-test$ padrino-gen rake dm:auto:migrate
fun-test$ padrino-gen admin_page Post
+ fun-test$ padrino start // and go to yourserver.local/admin
That's all!!
View
@@ -52,7 +52,7 @@ rescue LoadError
end
end
-task :test => :check_dependencies
+# task :test => :check_dependencies
task :default => :test
@@ -1,7 +1,7 @@
require 'tilt'
require 'thor'
require 'padrino-core'
-require 'padrino-gen' unless defined?(Padrino::Generators)
+require 'padrino-gen'
Dir[File.dirname(__FILE__) + '/padrino-admin/*.rb'].each {|file| require file }
Dir[File.dirname(__FILE__) + '/padrino-admin/{helpers,adapters,ext_js,generators,utils}/*.rb'].each {|file| require file }
@@ -1,7 +1,5 @@
columns:
- - method: name.upcase
- header: Name Upcase
- dataIndex: name
+ - method: name
- method: surname
- method: email
header: E-mail
@@ -6,6 +6,14 @@
require 'rack/test'
require 'rack'
require 'shoulda'
+
+# We try to load the vendored padrino-core if exist
+%w(core gen).each do |gem|
+ if File.exist?(File.dirname(__FILE__) + "/../../padrino-#{gem}/lib")
+ $LOAD_PATH.unshift File.dirname(__FILE__) + "/../../padrino-#{gem}/lib"
+ end
+end
+
require 'padrino-admin'
module Kernel
@@ -27,13 +27,13 @@ def setup
end
should 'have correct store fields' do
- result = "[{\"mapping\":\"account_name\",\"name\":\"accounts.name\"},{\"mapping\":\"account_surname\",\"name\":\"accounts.surname\"},{\"mapping\":\"category_name\",\"name\":\"category.name\"},{\"mapping\":\"account_email\",\"name\":\"accounts.email\"},{\"mapping\":\"account_role\",\"name\":\"accounts.role\"}]"
+ result = "[{\"name\":\"accounts.name\",\"mapping\":\"account_name\"},{\"name\":\"accounts.surname\",\"mapping\":\"account_surname\"},{\"name\":\"category.name\",\"mapping\":\"category_name\"},{\"name\":\"accounts.email\",\"mapping\":\"account_email\"},{\"name\":\"accounts.role\",\"mapping\":\"account_role\"}]"
assert_equal result, @column_store.store_fields
assert_equal result, @column_store_direct.store_fields
end
should 'store data' do
- result = "{\"count\":2,\"results\":[{\"account_surname\":\"Not found\",\"account_email\":\"d.dagostino@lipsiasoft.com\",\"category_name\":\"Not found\",\"id\":1,\"account_role\":\"Admin\",\"account_name\":\"DADDYE\"},{\"account_surname\":\"Not found\",\"account_email\":\"editor@lipsiasoft.com\",\"category_name\":\"Not found\",\"id\":2,\"account_role\":\"Editor\",\"account_name\":\"DEXTER\"}]}"
+ result = "{\"results\":[{\"account_surname\":\"Not found\",\"account_email\":\"d.dagostino@lipsiasoft.com\",\"category_name\":\"Not found\",\"id\":1,\"account_role\":\"Admin\",\"account_name\":\"DADDYE\"},{\"account_surname\":\"Not found\",\"account_email\":\"editor@lipsiasoft.com\",\"category_name\":\"Not found\",\"id\":2,\"account_role\":\"Editor\",\"account_name\":\"DEXTER\"}],\"count\":2}"
assert_equal result, @column_store.store_data(:fields => "name,role", :query => "d", :sort => :name, :dir => :asc, :limit => 2, :offset => 0)
assert_equal result, @column_store_direct.store_data(:fields => "name,role", :query => "d", :sort => :name, :dir => :asc, :limit => 2, :offset => 0)
end
View
@@ -1,22 +1,7 @@
-= padrino-cache
-
-== Installation
-
-To install the 'full-stack' padrino framework, simply grab the latest version from gemcutter:
-
- $ sudo gem install padrino --source http://gemcutter.org
-
-This will install the necessary padrino gems to get you started.
-Now you are ready to use this gem to enhance your existing Sinatra projects or build new Padrino applications.
-
-You can also install only the padrino-cache gem for more fine-grained use:
-
- $ sudo gem install padrino-cache --source http://gemcutter.org
-
-== Usage
+= Painless Page and Fragment Caching (padrino-cache)
Not implemented yet.
== Copyright
-Copyright (c) 2010 Padrino. See LICENSE for details.
+Copyright (c) 2010 Padrino. See LICENSE for details.
View
@@ -46,7 +46,7 @@ rescue LoadError
end
end
-task :test => :check_dependencies
+# task :test => :check_dependencies
task :default => :test
View
@@ -1,4 +1,4 @@
-= padrino-core
+= Padrino (padrino-core)
Padrino is the godfather of Sinatra.
@@ -417,4 +417,4 @@ Using these commands can simplify common tasks making development that much smoo
== Copyright
-Copyright (c) 2010 Padrino. See LICENSE for details.
+Copyright (c) 2010 Padrino. See LICENSE for details.
@@ -1,8 +1,6 @@
require 'usher'
require 'sinatra/base'
-Dir[File.dirname(__FILE__) + '/padrino-core/*.rb'].each {|file| require file unless file =~ /support_lite/ }
-
# Defines our PADRINO_ENV
PADRINO_ENV = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||= "development" unless defined?(PADRINO_ENV)
@@ -30,11 +28,27 @@ def self.application
self.mounted_apps.each { |app| app.map_onto(builder) }
builder
end
+
+ # Method used for require dependencies and correct support_lite
+ def self.require_dependencies!
+ require root('vendor', 'gems', 'environment')
+ Bundler.require_env(Padrino.env)
+ Dir[File.dirname(__FILE__) + '/padrino-core/*.rb'].each {|file| require file }
+ puts "=> Loaded bundled gems for #{Padrino.env} with #{Padrino.support.to_s.humanize}"
+ rescue LoadError
+ require 'bundler'
+ if File.exist?(root("Gemfile"))
+ Bundler::Bundle.load(root("Gemfile")).environment.require_env(Padrino.env)
+ Dir[File.dirname(__FILE__) + '/padrino-core/*.rb'].each {|file| require file }
+ puts "=> Located Gemfile for #{Padrino.env} with #{Padrino.support.to_s.humanize}"
+ else
+ Dir[File.dirname(__FILE__) + '/padrino-core/*.rb'].each {|file| require file }
+ end
+ end
end
# When we require this file is necessary check if we have a gemfile o bundled gems,
# this because we load ExtLib or ActiveSupport if some of our dependencies
# just require them. This prevent for example to load ActiveSupport
# when we require only 'dm-core'.
-Padrino.load_required_gems!
-
+Padrino.require_dependencies!
@@ -11,23 +11,6 @@ def load!
Thread.current[:padrino_loaded] = true
end
- # Method used for load dependencies and correct support_lite
- def load_required_gems!
- require root('vendor', 'gems', 'environment')
- Bundler.require_env(Padrino.env)
- require 'padrino-core/support_lite'
- puts "=> Loaded bundled gems for #{Padrino.env} with #{Padrino.support.to_s.humanize}" if Padrino.env != :test
- rescue LoadError
- require 'bundler'
- if File.exist?(root("Gemfile"))
- Bundler::Bundle.load(root("Gemfile")).environment.require_env(Padrino.env)
- require 'padrino-core/support_lite'
- puts "=> Located Gemfile for #{Padrino.env} with #{Padrino.support.to_s.humanize}" if Padrino.env != :test
- else
- puts "=> Gemfile for #{Padrino.env} not found!" if Padrino.env != :test
- end
- end
-
# Method for reloading required applications and their files
def reload!
return unless Stat.changed?
@@ -30,7 +30,7 @@ def changed?
# A safe Kernel::load, issuing the hooks depending on the results
def safe_load(file, mtime)
- Padrino.say! "=> Reloading #{file}"
+ logger.debug "Reloading #{file}"
load(file)
file
rescue LoadError, SyntaxError => ex
@@ -19,6 +19,7 @@
=end
require 'i18n'
+
# Load our locales
I18n.load_path += Dir["#{File.dirname(__FILE__)}/locale/*.yml"]
@@ -21,7 +21,7 @@ class Complex2Demo < Padrino::Application
end
Complex2Demo.controllers do
- get("(/)"){ "The magick number is: 53!" } # Change only the number!!!
+ get("(/)"){ "The magick number is: 78!" } # Change only the number!!!
end
Padrino.load!
@@ -11,7 +11,7 @@ class SimpleDemo < Padrino::Application
SimpleDemo.controllers do
get "/" do
- 'The magick number is: 43!' # Change only the number!!!
+ 'The magick number is: 45!' # Change only the number!!!
end
end
View
@@ -1,15 +1,6 @@
-= padrino-gen
+= Agnostic Application Generators (padrino-gen)
-== Installation
-
-To install the 'full-stack' padrino framework, simply grab the latest version from gemcutter:
-
- $ sudo gem install padrino --source http://gemcutter.org
-
-This will install the necessary padrino gems to get you started.
-Now you are ready to use this gem to enhance your existing Sinatra projects or build new Padrino applications.
-
-== Overview
+=== Overview
Padrino comes preloaded with flexible code generators powered in part by the excellent Thor gem
(incidentally also used in the Rails 3 generators). These generators are intended to allow for easy code generation
@@ -18,7 +9,7 @@ as possible, supporting a myriad of test frameworks, js libraries, mocking libra
See the wiki article for additional information: <...WIKI...>
-=== Application Generator ===
+=== Application Generator
Padrino provides generator support for quickly creating new Padrino applications. This provides many benefits
such as constructing the recommended Padrino application structure, auto-generating a Gemfile listing
@@ -78,7 +69,7 @@ This would be achieved through forking our project and reading through the code
the setup instructions inside the relevant files within <tt>lib/generators/components/</tt>. We are happy to accept pull requests
for additional component types not originally included (although helping us maintain them would also be appreciated).
-=== Model Generator ===
+=== Model Generator
Padrino provides generator support for quickly creating new models within your Padrino application. Note that
the models (and migrations) generated are specifically tailored towards the ORM component and testing framework
@@ -111,7 +102,7 @@ You can destroy models that you created via the destroy option and setting it to
This remove all created model files.
-=== Migration Generator ===
+=== Migration Generator
Padrino provides generator for quickly generating new migrations to change or manipulate the database schema.
These migrations generated will be tailored towards the ORM chosen when generating the application.
@@ -139,7 +130,7 @@ You can destroy migrations that you created via the destroy option and setting i
This removes the migration file.
-=== Controller Generator ===
+=== Controller Generator
Padrino provides generator support for quickly creating new controllers within your Padrino application. Note that
the controller tests are generated specifically tailored towards the testing framework chosen
@@ -170,7 +161,7 @@ You can destroy controllers that you created via the destroy option and setting
This removes all created controller files.
-=== Mailer Generator ===
+=== Mailer Generator
Padrino provides generator support for quickly creating new mailers within your Padrino application.
Very important to note that mailer generators are intended primarily to work within applications
View
@@ -50,7 +50,7 @@ rescue LoadError
end
end
-task :test => :check_dependencies
+# task :test => :check_dependencies
task :default => :test
@@ -1,3 +1,4 @@
+require 'padrino-core/support_lite'
require 'padrino-gen/generators'
# Add our rakes when padrino core require this file.
require 'padrino-core/tasks'
@@ -45,7 +45,6 @@ Gem::Specification.new do |s|
"lib/padrino-gen/generators/app/config/initializers/.empty_directory",
"lib/padrino-gen/generators/app/config/initializers/example.rb",
"lib/padrino-gen/generators/app/tmp/.empty_directory",
- "lib/padrino-gen/generators/base.rb",
"lib/padrino-gen/generators/components/actions.rb",
"lib/padrino-gen/generators/components/mocks/mocha_gen.rb",
"lib/padrino-gen/generators/components/mocks/rr_gen.rb",
@@ -76,6 +75,7 @@ Gem::Specification.new do |s|
"lib/padrino-gen/generators/templates/scripts/lowpro.js",
"lib/padrino-gen/generators/templates/scripts/protopak.js",
"lib/padrino-gen/generators/templates/scripts/right.js",
+ "lib/padrino-gen/padrino-tasks/activerecord.rb",
"lib/padrino-gen/padrino-tasks/datamapper.rb",
"padrino-gen.gemspec",
"test/helper.rb",
View
@@ -4,9 +4,19 @@
require 'mocha'
require 'rack/test'
require 'webrat'
+require 'thor'
+
+# We try to load the vendored padrino-core if exist
+%w(core).each do |gem|
+ if File.exist?(File.dirname(__FILE__) + "/../../padrino-#{gem}/lib")
+ $LOAD_PATH.unshift File.dirname(__FILE__) + "/../../padrino-#{gem}/lib"
+ end
+end
require 'padrino-gen'
+Padrino::Generators::Cli.start
+
class Test::Unit::TestCase
include Rack::Test::Methods
include Webrat::Methods
@@ -1,23 +1,11 @@
-= padrino-helpers
+= Application Extensions and Helpers (padrino-helpers)
+
+=== Overview
This component provides a great deal of view helpers related to html markup generation.
There are helpers for generating tags, forms, links, images, and more. Most of the basic
methods should be very familiar to anyone who has used rails view helpers.
-== Installation
-
-To install the 'full-stack' padrino framework, simply grab the latest version from gemcutter:
-
- $ sudo gem install padrino --source http://gemcutter.org
-
-This will install the necessary padrino gems to get you started.
-Now you are ready to use this gem to enhance your existing Sinatra projects or build new Padrino applications.
-
-You can also install only the padrino-helpers gem for more fine-grained use:
-
- $ sudo gem install padrino-helpers --source http://gemcutter.org
-
-== Usage
=== Output Helpers
@@ -485,4 +473,4 @@ See the wiki article for additional information: <...WIKI...>
== Copyright
-Copyright (c) 2010 Padrino. See LICENSE for details.
+Copyright (c) 2010 Padrino. See LICENSE for details.
Oops, something went wrong.

0 comments on commit 7301590

Please sign in to comment.