Skip to content

Commit

Permalink
rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
pflouret committed May 2, 2009
1 parent 66ed72c commit 199af72
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 25 deletions.
56 changes: 56 additions & 0 deletions Rakefile
@@ -0,0 +1,56 @@
require 'rubygems'

require 'date'
require 'rake'
require 'rake/clean'
require 'rake/packagetask'

module Ccx2
VERSION = '0.1.1'
end

VERSION_FILE_CONTENTS = %Q{
__version__ = '%s'
}

CLEAN.include("build")

def write_version_file(v)
File.open("src/ccx2/__init__.py", "w") do |f|
f.puts(VERSION_FILE_CONTENTS % v)
end
end

desc "Clean and repackage dev version"
task :default => [ :clean, :versiondev, :repackage ]

desc "Generate version file"
task :version do
write_version_file(Ccx2::VERSION)
end

desc "Generate git aware version file"
task :versiondev do
if File.directory?('.git')
commit = `git log -1 --pretty=format:%h`.chomp
branch = `git branch`.split("\n").grep(/^\*/).first
branch.chomp! if branch
branch = (branch if branch && !branch.empty? && branch != "* master") || nil
additional = "#{'-'+branch if branch}#{'-'+commit if commit}"
additional = "-git-#{Date.today.strftime('%Y%m%d')}#{additional}" if additional
end
write_version_file("#{Ccx2::VERSION}#{additional}")
end

desc "Prepare for release"
task :release => [:clean, :version, :repackage]

Rake::PackageTask.new("ccx2", Ccx2::VERSION) do |pkg|
pkg.package_dir = "build"
pkg.package_files = ["LICENSE", "LICENSE.urwid", "README.mkd", "setup.py"] + \
Dir["scripts/*"] + \
Dir["src/*.py"] + \
Dir["src/**/*.py"]
pkg.need_tar_gz = true
end

8 changes: 7 additions & 1 deletion setup.py
@@ -1,8 +1,14 @@
import sys

from distutils.core import setup
from glob import glob

sys.path.insert(0, './src')

import ccx2

setup(name='ccx2',
version='0.1.1',
version=ccx2.__version__,
description='console client for xmms2',
author='Pablo Flouret',
author_email='quuxbaz@gmail.com',
Expand Down
25 changes: 1 addition & 24 deletions src/ccx2/__init__.py
@@ -1,25 +1,2 @@
# Copyright (c) 2008-2009 Pablo Flouret <quuxbaz@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met: Redistributions of
# source code must retain the above copyright notice, this list of conditions and
# the following disclaimer. Redistributions in binary form must reproduce the
# above copyright notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the distribution.
# Neither the name of the software nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

__version__ = '0.1'
__version__ = '0.1.1'

0 comments on commit 199af72

Please sign in to comment.