Sha256: 6755c1ae6c8083d30f0d6936f5961ee66472c70d546e8a9f8aad5174d64e8b03

Contents?: true

Size: 1.68 KB

Versions: 1

Compression:

Stored size: 1.68 KB

Contents

require 'echoe'

Echoe.new('flucti-cli', '0.1.16') do |p|
  p.description     = "Command-line interface for managing Flucti VPS's"
  p.url             = "http://doc.flucti.com/cli"
  p.author          = "Roman Le NĂ©grate"
  p.email           = "roman.lenegrate@gmail.com"
  p.ignore_pattern  = "*.gemspec"
  p.dependencies    = ["capistrano ~>2.5", "web-service", "capistrano-fixes"]
  p.development_dependencies = ["mocha"]
  p.rdoc_options    = %w(--main README.mdown --inline-source --line-numbers --charset UTF-8)
end

namespace :check do
  task :namespacing do
    point_out_source_files "Absence of namespacing" do |file|
      case file.to_s.split('.').first
      when /(\b|_)tasks$/, /_pack$/, /\bvendor\b/
        false
      else
        declaration =
          file.read.
          split("\n").
          reject { |line| line.strip.empty? || line =~ /^\s*(?:require\b|\$:)/ }.
          first
        file if declaration !~ /\Amodule Flucti$/
      end
    end
  end
  
  task :constants do
    point_out_source_files "Malformed constant names" do |file|
      malformed = file.read.scan(/\bflucti\b/i).flatten - ["Flucti", "flucti"]
      [file, *malformed] if malformed.any?
    end
  end
  
  def point_out_source_files(checking)
    require 'pathname'
    result =
      Pathname.glob('lib/**/*.rb').
        map { |file| yield file }.
        select { |result| result }.
        map { |file, *rest|
          rest.any? ? "! %-30s %s" % ["#{file}:", rest.join(' ')] : "! #{file}"
        }
    if result.any?
      puts(checking, *result)
    else
      puts "%-30s (none)" % "#{checking}:"
    end
  end
end
task :check => ['check:namespacing', 'check:constants']

task :default => [:check, :test]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Flucti-flucti-cli-0.1.16 Rakefile