forked from bjorntrondsen/activerecord-sqlanywhere-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
122 lines (102 loc) · 4.62 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#====================================================
#
# Copyright 2008-2010 iAnywhere Solutions, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
#
# While not a requirement of the license, if you do modify this file, we
# would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
#
#
#====================================================
require 'rake/clean'
require 'rake/rdoctask'
require 'rubygems'
require 'rubygems/builder'
PACKAGE_NAME = "activerecord-sqlanywhere-adapter"
ARCH=Config::CONFIG['arch']
pkg_version = "1.0.0"
spec = Gem::Specification.new do |spec|
spec.authors = ["Eric Farrar"]
spec.email = 'eric.farrar@ianywhere.com'
spec.name = 'activerecord-sqlanywhere-adapter'
spec.summary = 'ActiveRecord driver for SQL Anywhere'
spec.description = <<-EOF
ActiveRecord driver for SQL Anywhere
EOF
spec.version = pkg_version
spec.has_rdoc = true
spec.rubyforge_project = 'sqlanywhere'
spec.homepage = 'http://sqlanywhere.rubyforge.org'
spec.files = Dir['lib/**/*.rb'] + Dir['test/**/*']
spec.required_ruby_version = '>= 1.9.2'
spec.require_paths = ['lib']
spec.add_dependency('sqlanywhere', '>= 0.1.5')
spec.add_dependency('activerecord', '>= 3.0.3')
spec.rdoc_options << '--title' << 'ActiveRecord Driver for SQL Anywhere' <<
'--main' << 'README' <<
'--line-numbers'
spec.extra_rdoc_files = ['README', 'CHANGELOG', 'LICENSE']
end
desc "Build the gem"
task :gem => ["activerecord-sqlanywhere-adapter-#{pkg_version}.gem"] do
end
file "activerecord-sqlanywhere-adapter-#{pkg_version}.gem" => ['lib/active_record/connection_adapters/sqlanywhere_adapter.rb', 'README', 'Rakefile', 'lib/arel/visitors/sqlanywhere.rb'] do
Gem::Builder.new(spec).build
end
desc "Install the gem"
task :install => ["activerecord-sqlanywhere-adapter-#{pkg_version}.gem"] do
sh "gem install activerecord-sqlanywhere-adapter-#{pkg_version}.gem"
end
desc "Build distributables (src zip, src tar.gz, gem)"
task :dist do |t|
puts "Cleaning Build Environment..."
Rake.application['clobber'].invoke
system "rake clobber"
files = Dir.glob('*')
puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version} directory..."
FileUtils.mkdir_p "#{File.join('build', PACKAGE_NAME)}-#{pkg_version}"
puts "Copying files to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}..."
FileUtils.cp_r files, "#{File.join('build', PACKAGE_NAME)}-#{pkg_version}"
if( ARCH =~ /win32/ ) then
system "attrib -R #{File.join('build', PACKAGE_NAME)}-#{pkg_version} /S"
else
system "find #{File.join('build', PACKAGE_NAME)}-#{pkg_version} -type d -exec chmod 755 {} \\;"
system "find #{File.join('build', PACKAGE_NAME)}-#{pkg_version} -type f -exec chmod 644 {} \\;"
end
if( ARCH =~ /win32/ ) then
puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.zip..."
system "cd build && zip -q -r #{PACKAGE_NAME}-#{pkg_version}.zip #{PACKAGE_NAME}-#{pkg_version}"
else
puts "Creating #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar..."
system "tar cf #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar -C build #{PACKAGE_NAME}-#{pkg_version}"
puts "GZipping to create #{File.join('build', PACKAGE_NAME, PACKAGE_NAME)}-#{pkg_version}.tar.gz..."
system "gzip #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.tar"
end
puts "Building GEM distributable..."
Rake.application['gem'].invoke
puts "Copying GEM to #{File.join('build', PACKAGE_NAME)}-#{pkg_version}.gem..."
FileUtils.cp "#{PACKAGE_NAME}-#{pkg_version}.gem", "build"
end
Rake::RDocTask.new do |rd|
rd.title = "ActiveRecord Driver for SQL Anywhere"
rd.main = "README"
rd.rdoc_files.include('README', 'CHANGELOG', 'LICENSE', 'lib/**/*.rb')
end
desc "Publish the RDOCs on RubyForge"
task :publish_rdoc => ["html/index.html"] do
system "pscp -r html/* efarrar@rubyforge.org:/var/www/gforge-projects/sqlanywhere/activerecord-sqlanywhere-adapter"
end
CLOBBER.include("activerecord-sqlanywhere-adapter-#{pkg_version}.gem", "build/**/*", "build")