FooBarWidget / paypal

Paypal IPN handling library

This URL has Read+Write access

Hongli Lai (Phusion) (author)
Mon Nov 03 03:13:06 -0800 2008
commit  0ae9cc516d802773a531479acd1553374699d98c
tree    60a90a91af7b85c25377cff4d44c78119519c345
parent  5134570388e0f56c957f2c57749ec0f1885e7c5b
paypal / Rakefile
100644 127 lines (102 sloc) 3.358 kb
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
123
124
125
126
127
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
require 'rake/contrib/rubyforgepublisher'
 
PKG_VERSION = "2.0.0"
PKG_NAME = "paypal"
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
 
PKG_FILES = FileList[
    "lib/**/*",
    "test/*",
    "misc/*",
    "[A-Z]*",
    "MIT-LICENSE",
    "Rakefile"
].exclude(/\bCVS\b|~$/)
 
desc "Default Task"
task :default => [ :test, :test_remote ]
 
desc "Delete tar.gz / zip / rdoc"
task :cleanup => [ :rm_packages, :clobber_rdoc ]
 
# Run the unit tests
Rake::TestTask.new :test do |t|
  t.libs << "test"
  t.pattern = 'test/*_test.rb'
  t.ruby_opts << '-rubygems'
  t.verbose = false
end
 
Rake::TestTask.new :test_remote do |t|
  t.libs << "test"
  t.pattern = 'test/remote/*_test.rb'
  t.ruby_opts << '-rubygems'
  t.verbose = false
end
 
desc "Create a rubygem and install it. Might need root rights"
task :install => [:package] do
  `gem install pkg/#{PKG_FILE_NAME}.gem`
end
 
# Genereate the RDoc documentation
 
Rake::RDocTask.new { |rdoc|
  rdoc.rdoc_dir = 'doc'
  rdoc.title = "Paypal library"
  rdoc.rdoc_files.include('README')
  rdoc.rdoc_files.include('lib/**/*.rb')
}
 
task :lines do
  lines = 0
  codelines = 0
  Dir.foreach("lib") { |file_name|
    next unless file_name =~ /.*rb/
 
    f = File.open("lib/" + file_name)
 
    while line = f.gets
      lines += 1
      next if line =~ /^\s*$/
      next if line =~ /^\s*#/
      codelines += 1
    end
  }
  puts "Lines #{lines}, LOC #{codelines}"
end
 
 
desc "Publish the gem on leetsoft"
task :publish => [:rdoc, :package] do
 Rake::SshFilePublisher.new("leetsoft.com", "dist/pkg", "pkg", "#{PKG_FILE_NAME}.zip").upload
 Rake::SshFilePublisher.new("leetsoft.com", "dist/pkg", "pkg", "#{PKG_FILE_NAME}.tgz").upload
 Rake::SshFilePublisher.new("leetsoft.com", "dist/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
 `ssh tobi@leetsoft.com "mkdir -p dist/api/#{PKG_NAME}"`
 Rake::SshDirPublisher.new("leetsoft.com", "dist/api/#{PKG_NAME}", "doc").upload
 `ssh tobi@leetsoft.com './gemupdate'`
end
 
spec = Gem::Specification.new do |s|
  s.name = PKG_NAME
  s.version = PKG_VERSION
  s.description = s.summary = "Paypal IPN integration library for rails and other web applications"
  s.has_rdoc = true
 
  s.files = %w(init.rb README Rakefile MIT-LICENSE) + Dir['lib/**/*'] + Dir['misc/**/*'] + Dir['test/**/*']
  s.files.reject! { |f| /\/\.\_/ }
  s.require_path = 'lib'
  s.autorequire = 'paypal'
  s.author = "Tobias Luetke"
  s.email = "tobi@leetsoft.com"
  s.homepage = "http://dist.leetsoft.com/api/paypal"
  
  s.add_dependency('money')
end
 
Rake::GemPackageTask.new(spec) do |p|
  p.gem_spec = spec
  p.need_tar = true
  p.need_zip = true
end
 
 
# --- Ruby forge release manager by florian gross -------------------------------------------------
 
RUBY_FORGE_PROJECT = 'paypal'
RUBY_FORGE_USER = 'xal'
RELEASE_NAME = "REL #{PKG_VERSION}"
 
desc "Publish the release files to RubyForge."
task :release => [:publish] do
  `rubyforge login`
  release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.gem"
  puts release_command
  system(release_command)
 
  release_command = "rubyforge add_release #{PKG_NAME} #{PKG_NAME} 'REL #{PKG_VERSION}' pkg/#{PKG_NAME}-#{PKG_VERSION}.zip"
  puts release_command
  system(release_command)
 
end