Skip to content

Commit

Permalink
Updates for using .ruby and Detroit build tool. [admin]
Browse files Browse the repository at this point in the history
  • Loading branch information
trans committed Oct 14, 2011
1 parent b1726e7 commit 6cf5218
Show file tree
Hide file tree
Showing 7 changed files with 215 additions and 155 deletions.
143 changes: 143 additions & 0 deletions .gemspec
@@ -0,0 +1,143 @@
# encoding: utf-8

require 'yaml'

Gem::Specification.new do |gemspec|

manifest = Dir.glob('manifest{,.txt}', File::FNM_CASEFOLD).first

scm = case
when File.directory?('.git')
:git
end

files = case
when manifest
File.readlines(manifest).
map{ |line| line.strip }.
reject{ |line| line.empty? || line[0,1] == '#' }
when scm == :git
`git ls-files -z`.split("\0")
else
Dir.glob('{**/}{.*,*}') # TODO: be more specific using standard locations ?
end.select{ |path| File.file?(path) }

patterns = {
:bin_files => 'bin/*',
:lib_files => 'lib/{**/}*.rb',
:ext_files => 'ext/{**/}extconf.rb',
:doc_files => '*.{txt,rdoc,md,markdown,tt,textile}',
:test_files => '{test/{**/}*_test.rb,spec/{**/}*_spec.rb}'
}

glob_files = lambda { |pattern|
Dir.glob(pattern).select { |path|
File.file?(path) && files.include?(path)
}
}

#files = glob_files[patterns[:files]]

executables = glob_files[patterns[:bin_files]].map do |path|
File.basename(path)
end

extensions = glob_files[patterns[:ext_files]].map do |path|
File.basename(path)
end

metadata = YAML.load_file('.ruby')

# build-out the gemspec

case metadata['revision']
when 0
gemspec.name = metadata['name']
gemspec.version = metadata['version']
gemspec.summary = metadata['summary']
gemspec.description = metadata['description']

metadata['authors'].each do |author|
gemspec.authors << author['name']

if author.has_key?('email')
if gemspec.email
gemspec.email << author['email']
else
gemspec.email = [author['email']]
end
end
end

gemspec.licenses = metadata['licenses']

metadata['requirements'].each do |req|
name = req['name']
version = req['version']
groups = req['groups'] || []

#development = req['development']
#if development
# # populate development dependencies
# if gemspec.respond_to?(:add_development_dependency)
# gemspec.add_development_dependency(name,*version)
# else
# gemspec.add_dependency(name,*version)
# end
#else
# # populate runtime dependencies
# if gemspec.respond_to?(:add_runtime_dependency)
# gemspec.add_runtime_dependency(name,*version)
# else
# gemspec.add_dependency(name,*version)
# end
#end

if groups.empty? or groups.include?('runtime')
# populate runtime dependencies
if gemspec.respond_to?(:add_runtime_dependency)
gemspec.add_runtime_dependency(name,*version)
else
gemspec.add_dependency(name,*version)
end
else
# populate development dependencies
if gemspec.respond_to?(:add_development_dependency)
gemspec.add_development_dependency(name,*version)
else
gemspec.add_dependency(name,*version)
end
end
end

# convert external dependencies into a requirements
if metadata['external_dependencies']
##gemspec.requirements = [] unless metadata['external_dependencies'].empty?
metadata['external_dependencies'].each do |req|
gemspec.requirements << req.to_s
end
end

# determine homepage from resources
homepage = metadata['resources'].find{ |key, url| key =~ /^home/ }
gemspec.homepage = homepage.last if homepage

gemspec.require_paths = metadata['load_path'] || ['lib']
gemspec.post_install_message = metadata['install_message']

# RubyGems specific metadata
gemspec.files = files
gemspec.extensions = extensions
gemspec.executables = executables

if Gem::VERSION < '1.7.'
gemspec.default_executable = gemspec.executables.first
end

gemspec.test_files = glob_files[patterns[:test_files]]

unless gemspec.files.include?('.document')
gemspec.extra_rdoc_files = glob_files[patterns[:doc_files]]
end
end
end
101 changes: 33 additions & 68 deletions .ruby
@@ -1,72 +1,37 @@
---
name: vanunits
title: VanUnits
contact: Trans <transfire at gmail.com>
requires:
- group:
---
authors:
- name: Peter Vanbroekhoven
- name: Thomas Sawyer
email: transfire@gmail.com
copyrights:
- holder: Peter Vanbroekhoven
year: '2005'
license: MIT
replacements: []
conflicts: []
requirements:
- name: detroit
groups:
- build
name: syckle
version: 0+
resources:
code: http://github.com/rubyworks/vanunits
development: true
dependencies: []
repositories: []
resources:
home: http://rubyworks.github.com/vanunits
pom_verison: 1.0.0
manifest:
- .ruby
- lib/van/units/base.rb
- lib/van/units/constants/cgs.rb
- lib/van/units/constants/math/cgs.rb
- lib/van/units/constants/math/mks.rb
- lib/van/units/constants/math/natural.rb
- lib/van/units/constants/math.rb
- lib/van/units/constants/mks.rb
- lib/van/units/constants.rb
- lib/van/units/currency.rb
- lib/van/units/data/binary/base.rb
- lib/van/units/data/cex.rb
- lib/van/units/data/currency/base.rb
- lib/van/units/data/currency-default.rb
- lib/van/units/data/currency-standard.rb
- lib/van/units/data/iec.rb
- lib/van/units/data/iec_binary/base.rb
- lib/van/units/data/si/base.rb
- lib/van/units/data/si/constants.rb
- lib/van/units/data/si/derived.rb
- lib/van/units/data/si/extra.rb
- lib/van/units/data/si/misc.rb
- lib/van/units/data/si.rb
- lib/van/units/data/uk/base.rb
- lib/van/units/data/uk.rb
- lib/van/units/data/units-default.rb
- lib/van/units/data/units-standard.rb
- lib/van/units/data/us/base.rb
- lib/van/units/data/us.rb
- lib/van/units/data/xmethods/cached.rb
- lib/van/units/data/xmethods/mapping.rb
- lib/van/units/data/xmethods.rb
- lib/van/units/loaders.rb
- lib/van/units/units.rb
- lib/van/units/version.rb
- lib/van/units.rb
- lib/van/units_currency.rb
- qed/conversion.rdoc
- qed/equality.rdoc
- qed/operations.rdoc
- test/test_constants.rb
- test/test_currency.rb
- test/test_units.rb
- HISTORY.rdoc
- LICENSE
- README.rdoc
- VERSION
- HOWITWORKS.rdoc
code: http://github.com/rubyworks/vanunits
load_path:
- lib
extra: {}
revision: 0
name: vanunits
source:
- Profile
alternatives: []
title: VanUnits
version: 1.5.0
copyright: Copyright (c) 2005 Peter Vanbroekhoven
licenses:
- MIT
description: VanUnits is a units system providing both SI units and web-updated currency units, via a very easy to use method-based interface. It also include a large set of real world contants, provided in "m kg s" and "cm kg s" measures.
organization: RubyWorks
summary: Vanbroekhoven's Units System
authors:
- Peter Vanbroekhoven
created: 2005-11-26
created: '2005-11-26'
description: VanUnits is a units system providing both SI units and web-updated currency
units, via a very easy to use method-based interface. It also include a large set
of real world contants, provided in "m kg s" and "cm kg s" measures.
date: '2011-10-14'
27 changes: 27 additions & 0 deletions Assembly
@@ -0,0 +1,27 @@
---
gem:
active: true

github:
active : true

ridoc:
service: RIDoc
include: "lib/"
output : .rdoc

rdoc:
include: ["lib/", "[A-Z]*.*"]
output : site/docs/api

dnote:
labels : ~
exclude : [work]
output : log/NOTES.rdoc

email:
service : Email
file : ~
subject : ~
mailto : ruby-talk@ruby-lang.org

9 changes: 4 additions & 5 deletions Manifest.txt → Manifest
@@ -1,4 +1,4 @@
#!mast -x Syckfile -x PROFILE .ruby bin lib qed test [A-Z]*
#!mast .ruby bin lib qed test [A-Z]*.*
.ruby
lib/van/units/base.rb
lib/van/units/constants/cgs.rb
Expand Down Expand Up @@ -42,8 +42,7 @@ qed/operations.rdoc
test/test_constants.rb
test/test_currency.rb
test/test_units.rb
HISTORY.rdoc
LICENSE
README.rdoc
VERSION
HOWITWORKS.rdoc
HowItWorks.rdoc
History.rdoc
License.txt
14 changes: 8 additions & 6 deletions Profile
@@ -1,9 +1,10 @@
---
name : vanunits
version: 1.5.0

title : VanUnits
summary: Vanbroekhoven's Units System
contact: Trans <transfire at gmail.com>
created: 2005-11-26
license: MIT

description:
VanUnits is a units system providing both SI units and web-updated
Expand All @@ -12,16 +13,17 @@ description:
"m kg s" and "cm kg s" measures.

requires:
- syckle (build)
- detroit (build)

resources:
home: http://rubyworks.github.com/vanunits
code: http://github.com/rubyworks/vanunits

authors:
- Peter Vanbroekhoven
- Thomas Sawyer <transfire@gmail.com>

copyright:
Copyright (c) 2005 Peter Vanbroekhoven
copyrights:
- (c)2005 Peter Vanbroekhoven (MIT)

organization: RubyWorks
source: Profile

0 comments on commit 6cf5218

Please sign in to comment.