diff --git a/Rakefile b/Rakefile index dd0c6a1..cf77076 100644 --- a/Rakefile +++ b/Rakefile @@ -2,7 +2,7 @@ require 'rubygems' require 'rake' require 'echoe' -Echoe.new('trivial', '0.0.3') do |p| +Echoe.new('trivial', '0.0.4') do |p| p.summary = "Ultra-lightweight website framework for PHP" p.description = <<-EOT For those who are using PHP to build their sites and want a very simple framework diff --git a/bin/trivialize b/bin/trivialize index b668a67..58db225 100755 --- a/bin/trivialize +++ b/bin/trivialize @@ -19,7 +19,11 @@ end [ [File.dirname(__FILE__), '..', 'content', 'index.html'], [ARGV[0], 'content', 'index.html'] ], [ [File.dirname(__FILE__), '..', 'styles', 'application.css'], [ARGV[0], 'styles', 'application.css'] ] ].each do |src, dest| - FileUtils.cp(File.join(*src), File.join(*dest)) + if !File.exists? File.join(*dest) + FileUtils.cp(File.join(*src), File.join(*dest)) + else + puts "Won't overwrite existing #{File.join(*dest)}!" + end end puts "Done! Make sure you can use .htaccess files in your Webserver setup." diff --git a/dist/htaccess.dist b/dist/htaccess.dist index 646bd2d..126e9df 100644 --- a/dist/htaccess.dist +++ b/dist/htaccess.dist @@ -5,5 +5,4 @@ RewriteRule ^$ lib/trivial.php [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !.*\.inc$ -RewriteRule /(.*) lib/trivial.php [L] - +RewriteRule (.*) lib/trivial.php [L] diff --git a/lib/trivial.php b/lib/trivial.php index e3f0ee9..ba7ecf2 100644 --- a/lib/trivial.php +++ b/lib/trivial.php @@ -38,12 +38,12 @@ $trim = str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', realpath($root_dir) $requested = preg_replace('#/$#', '/index.html', $_SERVER['REDIRECT_URL']); $requested = preg_replace("#${trim}/(.*)\.[^\.]+\$#", '\1', $requested); -function styles($additional = array()) { - return head_component($additional, 'styles/%s.css', ''); +function styles() { + return head_component(func_get_args(), 'styles/%s.css', ''); } -function scripts($additional = array()) { - return head_component($additional, 'scripts/%s.js', ''); +function scripts() { + return head_component(func_get_args(), 'scripts/%s.js', ''); } function head_component($additional, $search, $format) { diff --git a/trivial.gemspec b/trivial.gemspec deleted file mode 100644 index 5c9155a..0000000 --- a/trivial.gemspec +++ /dev/null @@ -1,38 +0,0 @@ -# -*- encoding: utf-8 -*- - -Gem::Specification.new do |s| - s.name = %q{trivial} - s.version = "0.0.3" - - s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version= - s.authors = ["John Bintz"] - s.date = %q{2010-03-21} - s.default_executable = %q{trivialize} - s.description = %q{ For those who are using PHP to build their sites and want a very simple framework - in which to organize their files, trivial is the solution. It's one PHP file - that can include a few other pre-determined PHP and HTML files based on the - request URI. This very simple division of content, actions (controllers), and - views allows for multiple people to easily work on a smaller project without - the overhead of a larger framework. -} - s.email = %q{john@coswelproductions.com} - s.executables = ["trivialize"] - s.extra_rdoc_files = ["bin/trivialize", "lib/trivial.php"] - s.files = ["Manifest", "Rakefile", "bin/trivialize", "content/index.html", "dist/htaccess.dist", "lib/trivial.php", "readme.md", "styles/application.css", "trivial.gemspec", "views/application.inc"] - s.homepage = %q{http://github.com/johnbintz/trivial} - s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Trivial", "--main", "readme.md"] - s.require_paths = ["lib"] - s.rubyforge_project = %q{trivial} - s.rubygems_version = %q{1.3.6} - s.summary = %q{Ultra-lightweight website framework for PHP} - - if s.respond_to? :specification_version then - current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION - s.specification_version = 3 - - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then - else - end - else - end -end