Permalink
Browse files

Improvements in tasks

  • Loading branch information...
1 parent f0dbb65 commit bb3700f7d1580a47af385aea030bd8b25729bcee Hallison Batista committed with Hallison Batista Nov 14, 2009
Showing with 212 additions and 327 deletions.
  1. +158 −0 CHANGELOG
  2. +0 −139 HISTORY
  3. +13 −163 Rakefile
  4. +13 −0 tasks/changelog.rake
  5. +28 −18 tasks/documentation.rake
  6. +0 −7 tasks/history.rake
View
158 CHANGELOG
@@ -0,0 +1,158 @@
+== v0.9.2 - 2009-10-27 - Small fixes for version 0.9.2
+
+* Fixes for compatibility to Ruby v1.9.x
+* Updates in the documentation.
+
+== v0.9.1 - 2009-10-23 - Enhancements for version 0.9.1
+
+* Deprecation warning message has been included in Postview::Application
+ module. The blog application is Postview::Application::Blog.
+* The source of the main application has been placed into
+ postview/application/blog.
+* The fixtures for test application source have been added.
+* Small fixes in the test sources.
+* Small fixes in tasks
+* All documentation in classes and modules have been updated.
+* The file `lib/postview/version.rb` has been removed. It's unneeded.
+* Fix in task `gem:spec` to open `postview.gemspec` file
+ in writable mode for add new specifications.
+
+== v0.9.0 - 2009-10-14 - New features and enhancements for version 0.9.0
+
+* Features
+ * Support for authentication has been added.
+
+* Enhancements
+ * Added instructions for use Rack::Static to serve static theme files.
+ * Added content in error theme template file.
+ * Added marshalling content in postview.gemspec file.
+ * Added tasks for build Gemspec file.
+ * Tests have been fixed for authorization feature.
+
+* Fixes
+ * Fixes in default theme file for render list of drafts.
+ * The application path has been fixed.
+
+* Improvements
+ * Small improvements in code.
+
+== v0.8.1 - 2009-09-17 - Updates for version 0.8.1
+
+* Added helper method for list all drafted posts.
+* Added fixtures for tests in drafts path.
+* Added new theme files for drafts.
+* All unneeded path variables have been removed.
+
+== v0.8.0 - 2009-09-17 - Enhancements and improvements for version 0.8.0
+
+* Enhancements
+ * Added helper methods for improves all theme views source.
+ * Added core extensions.
+ * Added new instance variables for helpers.
+ * Added fixtures for all tests.
+
+* Improvements
+ * Documentation in sources.
+ * Added a extension for generates test methods from descriptions.
+
+== v0.7.0 - 2009-09-10 - New features and enhancements for version 0.7.0
+
+* Features
+ * Postview is a RubyGems project.
+ * Added executable for creates new Postview blogs.
+ * Added support to themes.
+ * CLI and commands have been added in application libraries.
+
+* Enhancements
+ * Added basic classes and files for version and information about project.
+ * Support to creates default Postview theme have been added.
+ * Default views have been updated to default theme.
+ * Added new images and logos in default theme.
+ * The helper methods have been separated from application.
+ * The method "mapping" has been renamed to "sections".
+ * Added patches for Ruby v1.8.5.
+ * Added creation of Rakefile in new Postview blogs.
+ * Fixes for new features of the Postage API.
+
+* Improvements
+ * Updates in application class to new features of the Sinatra::Mapping.
+ * Updates in CLI commands. Need fix to load the production environment.
+ * Updated method for synchronize.
+ * Removed archive tags path.
+ * Change host attribute name.
+ * Updated methods and constants to path of directories.
+ * Updates all tests to new features.
+ * Improvements in method that creates config.ru file.
+ * Updates in the settings and site classes.
+
+== v0.6.0 - 2009-09-10 - Features and enhancements for version 0.6.0.
+
+* Added task for build settings file.
+* Added task for build rackup file.
+* Default root path has been added in settings.
+* Improvements in synchronize tasks.
+* Fixes in the page keywords.
+* All tasks have been added in the rakefile.
+
+== v0.5.0 - 2009-09-10 - Features and enhancements for version 0.5.0.
+
+* Task for synchronize post files has been added.
+* New instructions in README file.
+* Added instructions in task for new post.
+* Fixes and updates in settings.
+* Default values have been added in settings.
+* All views have been improved.
+* All views for new helper methods have been updated.
+* All tests have been fixed.
+* Mapping class has been removed in favour of Sinatra::Mapping extension.
+* All methods in the application have been updated for new methods of the
+ Sinatra::Mapping extension.
+
+== v0.4.0 - 2009-07-13 - Features and enhancements for version 0.4.0.
+
+* Postage have been used for handle post files.
+* Several features have been updated for use Postage.
+
+== v0.3.2 - 2009-07-13 - Enhancements for version 0.3.2.
+
+* Task for create new post.
+* Task for create release package.
+
+== v0.3.1 - 2009-07-09 - Features for version 0.3.1.
+
+* Added individual tasks.
+* Added default settings to fix errors.
+
+== v0.3.0 - 2009-07-09 - Features for version 0.3.0.
+
+* Added render wrapper method for simplified local variables in views.
+* Support for listing drafts.
+* Added new mapping for list all drafts.
+* Added rescue errors in settings file not found.
+
+== v0.2.0 - 2009-07-07 - Features for version 0.2.0.
+
+* The helper methods were improved.
+* Improvements in routes and settings.
+* Added class for mapping route paths.
+* All tests and views were fixed.
+* Improved methods in settings class.
+* Improved initialize method in site, finder and mapping.
+
+== v0.1.0 - 2009-07-07 - Features for version 0.1.0.
+
+* All posts are loaded from files.
+* All attributes for a post are loaded from a file name.
+* Support for tags, archiving and search.
+* Support for configuration of routes and directories for posts and
+ archive.
+* Lightweight interface.
+
+== v0.0.0 - 2009-07-07 - Added main features for alpha version.
+
+* Added support for settings.
+* Listing posts by tags and search.
+
+== v0.0.0 - 2009-05-29 - First commit.
+
+
View
139 HISTORY
@@ -1,139 +0,0 @@
-[0.9.2 - 2009-10-27 - Fixes]
- Small fixes for compatibility.
-
- * Fixes for compatibility to Ruby v1.9.x.
- * Updates in the documentation.
-
-[0.9.1 - 2009-10-23 - Enhancements]
- New enhancements.
-
- * Deprecation warning message has been included in Postview::Application
- module. The blog application is Postview::Application::Blog.
- * The source of the main application has been placed into
- postview/application/blog.
- * The fixtures for test application source have been added.
- * Small fixes in the test sources.
- * Small fixes in tasks
- * All documentation in classes and modules have been updated.
- * The file `lib/postview/version.rb` has been removed. It's unneeded.
- * Fix in task `gem:spec` to open `postview.gemspec` file
- in writable mode for add new specifications.
-
-[0.9.0 - 2009-10-14 - Features, enhancements and improvements]
- New features, enhancements and small improvements
-
- * Features
- * Support for authentication has been added.
-
- * Enhancements
- * Added instructions for use Rack::Static to serve static theme files.
- * Added content in error theme template file.
- * Added marshalling content in postview.gemspec file.
- * Added tasks for build Gemspec file.
- * Tests have been fixed for authorization feature.
-
- * Fixes
- * Fixes in default theme file for render list of drafts.
- * The application path has been fixed.
-
- * Improvements
- * Small improvements in code.
-
-[0.8.1 - 2009-09-17 - Updates]
- * Added helper method for list all drafted posts.
- * Added fixtures for tests in drafts path.
- * Added new theme files for drafts.
- * All unneeded path variables have been removed.
-
-[0.8.0 - 2009-09-15 - Improvements]
- * Added helper methods for improves all theme views source.
- * Added core extensions.
-
-[0.7.0 - 2009-09-10 - Features, enhancements and improvements]
- New features, enhancements and several improvements.
-
- * Features
- * Postview is a RubyGems project.
- * Added executable for creates new Postview blogs.
- * Added support to themes.
- * CLI and commands have been added in application libraries.
-
- * Enhancements
- * Added basic classes and files for version and information about project.
- * Support to creates default Postview theme have been added.
- * Default views have been updated to default theme.
- * Added new images and logos in default theme.
- * The helper methods have been separated from application.
- * The method "mapping" has been renamed to "sections".
- * Added patches for Ruby v1.8.5.
- * Added creation of Rakefile in new Postview blogs.
- * Fixes for new features of the Postage API.
-
- * Improvements
- * Updates in application class to new features of the Sinatra::Mapping.
- * Updates in CLI commands. Need fix to load the production environment.
- * Updated method for synchronize.
- * Removed archive tags path.
- * Change host attribute name.
- * Updated methods and constants to path of directories.
- * Updates all tests to new features.
- * Improvements in method that creates config.ru file.
- * Updates in the settings and site classes.
-
-[0.6.0 - 2009-07-31 - Features and enhancements]
- * Added task for build settings file.
- * Added task for build rackup file.
- * Default root path has been added in settings.
- * Improvements in synchronize tasks.
- * Fixes in the page keywords.
- * All tasks have been added in the rakefile.
-
-[0.5.0 - 2009-07-21 - Features and enhancements]
- * Task for synchronize post files has been added.
- * New instructions in README file.
- * Added instructions in task for new post.
- * Fixes and updates in settings.
- * Default values have been added in settings.
- * All views have been improved.
- * All views for new helper methods have been updated.
- * All tests have been fixed.
- * Mapping class has been removed in favour of Sinatra::Mapping extension.
- * All methods in the application have been updated for new methods of the
- Sinatra::Mapping extension.
-
-[0.4.0 - 2009-07-13 - Features and enhancements]
- * Postage have been used for handle post files.
- * Several features have been updated for use Postage.
-
-[0.3.2 - 2009-07-09 - Enhancements]
- * Task for create new post.
- * Task for create release package.
-
-[0.3.1 - 2009-07-09 - Features]
- * Added individual tasks.
- * Added default settings to fix errors.
-
-[0.3.0 - 2009-07-07 - Features]
- * Added render wrapper method for simplified local variables in views.
- * Support for listing drafts.
- * Added new mapping for list all drafts.
- * Added rescue errors in settings file not found.
-
-[0.2.0 - 2009-07-02 - Features]
- * The helper methods were improved.
- * Improvements in routes and settings.
- * Added class for mapping route paths.
- * All tests and views were fixed.
- * Improved methods in settings class.
- * Improved initialize method in site, finder and mapping.
-
-[0.1.0 - 2009-06-04 - Main features for alpha version]
- * All posts are loaded from files.
- * All attributes for a post are loaded from a file name.
- * Support for tags, archiving and search.
- * Support for configuration of routes and directories for posts and
- archive.
- * Lightweight interface.
- * Added support for settings.
- * Listing posts by tags and search.
-
View
176 Rakefile
@@ -1,180 +1,30 @@
$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
require 'lib/postview'
-require 'net/ftp'
-require 'rake/testtask'
-require 'rake/packagetask'
+require 'rake/clean'
Rake::application.options.trace = true
-# Show text message in console.
-def banner(message)
- printf "\n%s\n", Postview
- printf "\n%s\n\n", message
-end
-
-# Prompt for values.
-def prompt(label, default = nil)
- while true
- printf((default ? "%s [%s]: " : "%s: "), "#{label}", "#{default}")
- value = $stdin.readline.chomp.strip
- value = default if value.empty?
- return value unless value.nil? || value.to_s.empty?
- end
-end
-
-# Build default settings file and load.
-def settings
- #Postview::Settings.build_default_file
- Postview::Settings.load
-end
-
-# Build and load the resource file for FTP connection.
-def netrc
- begin
- @netrc ||= File.readlines(File.join(ENV['HOME'],".netrc"))
- rescue Errno::ENOENT => message
- puts <<-end_message.gsub(/^[ ]{6}/,'')
- #{message}.
- Please create the .netrc file in your home.
- echo "\
- machine #{settings.site[:domain]}
- login <username>
- password <password>
- " >> #{ENV['HOME']}/.netrc
- end_message
- exit 1
- end
- match ||= @netrc.to_s.match(/machine (.*?)[\n ]login (.*?)[\n ]password (.*?)[\n ].*?/m)
- { :machine => match[1].strip, :login => match[2].strip, :password => match[3].strip }
-end
-
-# Synchronize directory
-def ftp(directory, destination = nil)
- origin = settings.directories[directory]
- destination ||= File.join(settings.site[:directory], settings.directories[directory])
- posts = settings.build_finder_for(directory).all_posts
-
- $stdout.puts ">> Connecting to #{netrc[:machine]} ..."
-
- Net::FTP.open(netrc[:machine]) do |ftp|
- ftp.login netrc[:login], netrc[:password]
-
- $stdout.puts ">> Logged as #{netrc[:login]} ..."
-
- $stdout.puts ">> Accessing #{destination} ..."
-
- ftp.chdir destination
-
- posts.each do |post|
- $stdout.puts ">> Copying #{post} ..."
- ftp.putbinaryfile(File.join(origin, post.file))
- end
-
- $stdout.puts ">> Synchronization for #{directory} is done."
- end
-end
-
-def rsync(directory, destination = nil)
- origin = settings.directories[directory]
- destination ||= File.join(settings.site[:directory], settings.directories[directory])
- posts = settings.build_finder_for(directory).all_posts
-
- $stdout.puts ">> Connecting to #{netrc[:machine]} ..."
-
- Net::FTP.open(netrc[:machine]) do |ftp|
- ftp.login netrc[:login], netrc[:password]
-
- $stdout.puts ">> Logged as #{netrc[:login]} ..."
-
- $stdout.puts ">> Accessing #{destination} ..."
-
- ftp.chdir destination
-
- posts.each do |post|
- $stdout.puts ">> Copying #{post} ..."
- ftp.putbinaryfile(File.join(origin, post.file))
- end
-
- $stdout.puts ">> Synchronization for #{directory} is done."
- end
+FileList["tasks/**.rake"].each do |task_file|
+ load task_file
end
-desc <<-end_desc.gsub(/^[ ]{2}/,'')
- Create new post in #{settings.path_to(:posts)}.
- For edit posts, set environment variable EDITOR or VISUAL. Otherwise,
- pass editor="<your favorite editor command and arguments>".
-
- Example:
-
- $ rake post editor="gvim -f"
+namespace :test do
- Or use directory argument for create a post in other directory.
-
- $ rake post[other/path/for/new/post]
-end_desc
-task :post, [:directory] do |spec, args|
- banner "New post. Type all attributes for new post.\n"
- path = if args.directory
- if settings.directories.has_key? args.directory.to_sym
- settings.directory_for(args.directory.to_sym)
- else
- args.directory
- end
- else
- settings.directory_for(:drafts)
- end
- post = Postage::Post.new :title => prompt("Post title"),
- :publish_date => prompt("Publish date", Date.today),
- :tags => prompt("Tags separated by spaces").split(' '),
- :filter => :markdown,
- :content => <<-end_content.gsub(/^[ ]{29}/,'')
- Tanks for use #{Postview}.
- Input here the content of your post.
- end_content
-
- begin
- post.build_file
- post.create_into(path)
- rescue Errno::ENOENT => message
- $stderr.puts message
- $stderr.puts "Try create path #{args.directory}."
- exit 1
+ task :command do
+ @testcmd = (Gem.available? "turn") ? "turn" : "testrb -v"
end
- printf "%s\n", "The post '#{post.title}' was created in '#{path}/#{post.file}'."
-
- editor = ENV['editor'] || ENV['EDITOR'] || ENV['VISUAL'] || 'none'
- if prompt("Edit post using '#{editor}'?", "y") =~ /y/i
- if editor
- sh "#{editor} #{path}/#{post.file}"
- else
- printf "%s", "Editor not specified."
- end
+ desc "Run all tests"
+ task :all => :command do
+ sh "#{@testcmd} test/*_test.rb"
end
- $stdout.puts ">> Post done."
-end
-
-namespace :sync do
- settings.directories.keys.each do |dirname|
- desc "Synchronize #{dirname}."
- task dirname, [:destination] do |spec,args|
- banner "Synchronize #{dirname} directory."
- ftp(dirname, args.destination)
- end
+ desc "Run only test found by pattern"
+ task :only, [:pattern] => :command do |spec|
+ sh "#{@testcmd} test/#{pattern}*_test.rb"
end
- desc "Synchronize all directories."
- task :all => settings.directories.keys
-end
-
-Rake::TestTask.new do |spec|
- spec.test_files = FileList["test/*_test.rb"]
-end
-
-Dir["tasks/**.rake"].each do |task_file|
- load task_file
end
-task :default => :test
+task :default => "test:all"
View
13 tasks/changelog.rake
@@ -0,0 +1,13 @@
+desc "Creates/updates history file."
+task :changelog do |spec|
+ history = `git log master --date=short --format='%d;%cd;%s;%b;'`
+ File.open("#{spec.name.upcase}", "w+") do |changelog|
+ history.scan(/(.*?);(.*?);(.*?);(.*?);/m) do |tag, date, subject, content|
+ tag.gsub! /[\n\( ].*?:[\) ]|,.*,.*[\)\n ]|[\)\n ]/m, ""
+ tag = tag.empty? ? "v0.0.0" : "v#{tag}"
+ changelog << "== #{tag} - #{date} - #{subject}\n"
+ changelog << "\n#{content}\n"
+ end
+ end
+end
+
View
46 tasks/documentation.rake
@@ -1,21 +1,31 @@
-begin
- require 'hanna/rdoctask'
-rescue LoadError
- require 'rdoc'
- require 'rake/rdoctask'
-end
+namespace :rdoc do
+
+ CLOBBER << FileList["doc/*"]
+
+ task :command do
+ @rdoccmd = if Gem.available? "hanna"
+ "hanna --fmt html --accessor option_accessor=RW"
+ else
+ "rdoc"
+ end
+ end
+
+ file "doc/api/index.html" => FileList["lib/**/*.rb", "README.*", "CHANGELOG"] do |file_spec|
+ rm_rf 'doc'
+ sh <<-end_sh.gsub(/[\s\n]+/, ' ').strip
+ #{@rdoccmd} --op doc/api
+ --promiscuous
+ --charset utf8
+ --inline-source
+ --line-numbers
+ --main Postview
+ --title 'Postview API Documentation'
+ #{file_spec.prerequisites.join(' ')}
+ end_sh
+ end
+
+ desc "Build API documentation (doc/api)"
+ task :api => [ :command, "doc/api/index.html" ]
-desc "Generate RDoc API documentation."
-Rake::RDocTask.new("doc:api") do |rdoc|
- rdoc.title = Postview.name
- rdoc.main = %q{README.rdoc}
- rdoc.options = %w{--line-numbers --show-hash}
- rdoc.rdoc_dir = %q{doc/api}
- rdoc.rdoc_files.include %w{
- HISTORY
- LICENSE
- README.rdoc
- lib/**/*.rb
- }
end
View
7 tasks/history.rake
@@ -1,7 +0,0 @@
-desc "Creates/updates history file."
-task :history, [:branch] do |spec, args|
- File.open("#{spec.name.upcase}.new", "w+") do |history|
- history << `git log #{args[:branch] || :master} --date=short --format="== %ci%n%n=== %s%n%n%b"`
- end
-end
-

0 comments on commit bb3700f

Please sign in to comment.