Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactoring.

  • Loading branch information...
commit 68a72bf711ccadd30828a3b393751200a5d86d83 1 parent 0db0ae4
@DAddYE DAddYE authored
View
4 .gitignore
@@ -0,0 +1,4 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
View
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in padrino-contrib.gemspec
+gemspec
View
4 README.rdoc
@@ -21,8 +21,8 @@ In your Padrino project edit:
# boot.rb
require 'padrino-contrib/exception_notifier'
- # require 'padrino-contrib/orm/ar/permalink'
- # require 'padrino-contrib/orm/ar/textile'
+ # require 'padrino-contrib/orm/active_record/permalink'
+ # require 'padrino-contrib/orm/active_record/textile'
Padrino.load! # Remember to add contribs before that line!
View
68 Rakefile
@@ -1,62 +1,12 @@
-require 'rubygems/specification' unless defined?(Gem::Specification)
-require 'rake' unless defined?(Rake)
+require 'rubygems' unless defined?(Gem)
+require 'bundler/gem_tasks'
+require 'rspec/core/rake_task'
-# Runs the sh command with sudo if the rake command is run with sudo
-def sudo_sh(command)
- command = `whoami`.strip! != "root" ? "sudo #{command}" : command
- sh command
+desc "Run complete application spec suite"
+RSpec::Core::RakeTask.new("spec") do |t|
+ t.skip_bundler = true
+ t.pattern = './spec/**/*_spec.rb'
+ t.rspec_opts = %w(-fs --color --fail-fast)
end
-# Returns the gem specification object for a gem
-def gemspec
- @gemspec ||= begin
- ::Gem::Specification.load("padrino-contrib.gemspec")
- end
-end
-
-# Most notable functions are:
-# $ rake package # packages the gem into the pkg folder
-# $ rake install # installs the gem into system
-# $ rake release # publishes gem to rubygems
-
-desc "Validates the gemspec"
-task :gemspec do
- gemspec.validate
-end
-
-desc "Displays the current version"
-task :version do
- puts "Current version: #{gemspec.version}"
-end
-
-desc "Installs the gem locally"
-task :install => :package do
- sudo_sh "gem install pkg/#{gemspec.name}-#{gemspec.version}"
-end
-
-desc "Uninstalls the gem locally"
-task :uninstall do
- sudo_sh "gem uninstall padrino-contrib -v #{gemspec.version}"
-end
-
-desc "Release the gem"
-task :release => :package do
- sh "gem push pkg/#{gemspec.name}-#{gemspec.version}.gem"
- sh "rm -rf pkg"
- sh "git add . && git commit -m 'Bump to version #{gemspec.version}' && git push"
-end
-
-# rake package
-begin
- require 'rake/gempackagetask'
-rescue LoadError
- task(:gem) { $stderr.puts '`gem install rake` to package gems' }
-else
- Rake::GemPackageTask.new(gemspec) do |pkg|
- pkg.gem_spec = gemspec
- end
- task :gem => :gemspec
-end
-
-task :package => :gemspec
-task :default => :install
+task :default => :spec
View
11 lib/padrino-contrib.rb
@@ -0,0 +1,11 @@
+module Padrino
+ module Contrib
+ autoload :AutoLocale, 'padrino-contrib/auto_locale.rb'
+ autoload :ExceptionNotifier, 'padrino-contrib/exception_notifier.rb'
+ autoload :FlashSession, 'padrino-contrib/flash_session'
+
+ module Helpers
+ autoload :AssetsCompressor, 'padrino-contrib/assets_compressor.rb'
+ end # Helpers
+ end # Contrib
+end # Padrino
View
5 lib/padrino-contrib/flash_session.rb
@@ -14,6 +14,11 @@ module Contrib
# use Padrino::Contrib::FlashSession, settings.session_id
#
class FlashSession
+
+ def self.registered(app)
+ app.use Padrino::Contrib::FlashSession, app.session_id
+ end
+
def initialize(app, session_key = 'session_id')
@app = app
@session_key = session_key.to_s
View
4 lib/padrino-contrib/orm/ar/permalink.rb → ...no-contrib/orm/active_record/permalink.rb
@@ -1,7 +1,7 @@
module Padrino
module Contrib
module Orm
- module Ar
+ module ActiveRecord
##
# This module extend ActiveRecord.
#
@@ -42,4 +42,4 @@ def generate_permalink
end # Orm
end # Contrib
end # Padrino
-ActiveRecord::Base.extend(Padrino::Contrib::Orm::Ar::Permalink::ClassMethods)
+::ActiveRecord::Base.extend(Padrino::Contrib::Orm::ActiveRecord::Permalink::ClassMethods)
View
4 lib/padrino-contrib/orm/ar/permalink_i18n.rb → ...ntrib/orm/active_record/permalink_i18n.rb
@@ -1,7 +1,7 @@
module Padrino
module Contrib
module Orm
- module Ar
+ module ActiveRecord
##
# This module extend ActiveRecord.
#
@@ -53,4 +53,4 @@ def generate_permalinks
end # Orm
end # Contrib
end # Padrino
-ActiveRecord::Base.extend(Padrino::Contrib::Orm::Ar::PermalinkI18n::ClassMethods)
+::ActiveRecord::Base.extend(Padrino::Contrib::Orm::ActiveRecord::PermalinkI18n::ClassMethods)
View
4 lib/padrino-contrib/orm/ar/textile.rb → ...rino-contrib/orm/active_record/textile.rb
@@ -3,7 +3,7 @@
module Padrino
module Contrib
module Orm
- module Ar
+ module ActiveRecord
##
# This module generate html from textile.
#
@@ -50,4 +50,4 @@ def generate_textile
end # Orm
end # Contrib
end # Padrino
-ActiveRecord::Base.extend(Padrino::Contrib::Orm::Ar::Textile::ClassMethods)
+::ActiveRecord::Base.extend(Padrino::Contrib::Orm::ActiveRecord::Textile::ClassMethods)
View
4 lib/padrino-contrib/orm/ar/translate.rb → ...no-contrib/orm/active_record/translate.rb
@@ -1,7 +1,7 @@
module Padrino
module Contrib
module Orm
- module Ar
+ module ActiveRecord
##
# This is an extension for ActiveRecord where if I had:
#
@@ -40,4 +40,4 @@ def method_missing(method_name, *arguments)
end # Orm
end # Contrib
end # Padrino
-ActiveRecord::Base.extend(Padrino::Contrib::Orm::Ar::Translate::ClassMethods)
+::ActiveRecord::Base.extend(Padrino::Contrib::Orm::ActiveRecord::Translate::ClassMethods)
View
4 lib/padrino-contrib/orm/mm/permalink.rb → ...ino-contrib/orm/mongo_mapper/permalink.rb
@@ -1,7 +1,7 @@
module Padrino
module Contrib
module Orm
- module Mm
+ module MongoMapper
##
# This module extend ActiveRecord.
#
@@ -48,4 +48,4 @@ def generate_permalink
end # Orm
end # Contrib
end # Padrino
-MongoMapper::Document.send(:include, Padrino::Contrib::Orm::Mm::Permalink)
+::MongoMapper::Document.send(:include, Padrino::Contrib::Orm::MongoMapper::Permalink)
View
4 lib/padrino-contrib/orm/mm/search.rb → ...adrino-contrib/orm/mongo_mapper/search.rb
@@ -1,7 +1,7 @@
module Padrino
module Contrib
module Orm
- module Mm
+ module MongoMapper
##
# This module provides full text search in specified fileds with pagination support.
#
@@ -37,4 +37,4 @@ def search(text, options={})
end # Orm
end # Contrib
end # Padrino
-MongoMapper::Document.send(:include, Padrino::Contrib::Orm::Mm::Search)
+::MongoMapper::Document.send(:include, Padrino::Contrib::Orm::MongoMapper::Search)
View
18 lib/padrino-contrib/version.rb
@@ -1,17 +1,5 @@
-##
-# Manages current Padrino Contrib version for use in gem generation.
-#
-# We put this in a separate file so you can get padrino version
-# without include full padrino contrib.
-#
module Padrino
module Contrib
- VERSION = '0.0.6' unless defined?(Padrino::Contrib::VERSION)
- ##
- # Return the current Padrino version
- #
- def self.version
- VERSION
- end
- end # Contrib
-end # Padrino
+ VERSION = "0.0.1"
+ end
+end
View
32 padrino-contrib.gemspec
@@ -1,18 +1,20 @@
-require File.expand_path("../lib/padrino-contrib/version.rb", __FILE__)
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "padrino-contrib/version"
Gem::Specification.new do |s|
- s.name = "padrino-contrib"
- s.rubyforge_project = "padrino-contrib"
- s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
- s.email = "padrinorb@gmail.com"
- s.summary = "Contributed plugins and utilities for Padrino Framework"
- s.homepage = "http://www.padrinorb.com"
+ s.name = "padrino-contrib"
+ s.version = Padrino::Contrib::VERSION
+ s.authors = ["Davide D'Agostino", "Nathan Esquenazi", , "Arthur Chiu"]
+ s.email = "padrinorb@gmail.com"
+ s.summary = "Contributed plugins and utilities for Padrino Framework"
+ s.homepage = "http://www.padrinorb.com"
s.description = "Contributed plugins and utilities for the Padrino Ruby Web Framework"
- s.required_rubygems_version = ">= 1.3.6"
- s.version = Padrino::Contrib.version
- s.date = Time.now.strftime("%Y-%m-%d")
- s.extra_rdoc_files = Dir["*.rdoc"]
- s.files = %w(LICENSE README.rdoc Rakefile padrino-contrib.gemspec) + Dir.glob("{bin,lib,test}/**/*")
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_path = "lib"
-end
+
+ s.rubyforge_project = "padrino-contrib"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+end
View
8 spec/global_spec.rb
@@ -0,0 +1,8 @@
+require 'spec_helper'
+
+describe 'Global' do
+
+ it 'should pass' do
+ true.should be_true
+ end
+end
View
2  spec/spec_helper.rb
@@ -0,0 +1,2 @@
+require 'rubygems' unless defined?(Gem)
+require 'rspec' unless defined?(RSpec)
Please sign in to comment.
Something went wrong with that request. Please try again.