backlog 0.34.1 → 0.34.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +15 -0
- data/Rakefile +7 -19
- data/app/models/work.rb +1 -1
- data/app/views/works/list_excel.rhtml +3 -5
- data/config/warble.rb +84 -0
- data/config/warble.rb~ +84 -0
- metadata +4 -28
- data/uwe@celina +0 -0
- data/vendor/plugins/goldspike/README +0 -13
- data/vendor/plugins/goldspike/Rakefile +0 -22
- data/vendor/plugins/goldspike/generators/goldspike/goldspike_generator.rb +0 -21
- data/vendor/plugins/goldspike/generators/goldspike/templates/war.rb +0 -8
- data/vendor/plugins/goldspike/generators/goldspike/templates/web.xml.erb +0 -57
- data/vendor/plugins/goldspike/init.rb +0 -1
- data/vendor/plugins/goldspike/install.rb +0 -4
- data/vendor/plugins/goldspike/lib/create_war.rb +0 -102
- data/vendor/plugins/goldspike/lib/java_library.rb +0 -131
- data/vendor/plugins/goldspike/lib/packer.rb +0 -215
- data/vendor/plugins/goldspike/lib/run.rb +0 -160
- data/vendor/plugins/goldspike/lib/util.rb +0 -35
- data/vendor/plugins/goldspike/lib/war_config.rb +0 -324
- data/vendor/plugins/goldspike/tasks/war.rake +0 -49
- data/vendor/plugins/goldspike/test/test_create_war.rb +0 -8
- data/vendor/plugins/goldspike/test/test_java_library.rb +0 -130
- data/vendor/plugins/goldspike/test/test_maven_library.rb +0 -132
- data/vendor/plugins/goldspike/test/war_config_test_config.rb +0 -15
@@ -1 +0,0 @@
|
|
1
|
-
# Include hook code here
|
@@ -1,102 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Building a war file
|
3
|
-
#
|
4
|
-
# By Robert Egglestone
|
5
|
-
# Fausto Lelli (*minor* patches for windows platform, plugin dist.)
|
6
|
-
#
|
7
|
-
|
8
|
-
require 'fileutils'
|
9
|
-
require 'java_library'
|
10
|
-
require 'war_config'
|
11
|
-
require 'packer'
|
12
|
-
require 'util'
|
13
|
-
|
14
|
-
module War
|
15
|
-
class Creator
|
16
|
-
|
17
|
-
attr_accessor :config
|
18
|
-
|
19
|
-
def initialize(config = Configuration.instance)
|
20
|
-
@config = config
|
21
|
-
@java_lib_packer = JavaLibPacker.new(@config)
|
22
|
-
@ruby_lib_packer = RubyLibPacker.new(@config)
|
23
|
-
@webapp_packer = WebappPacker.new(@config)
|
24
|
-
@file_packer = FileLibPacker.new(@config)
|
25
|
-
end
|
26
|
-
|
27
|
-
def standalone=(value)
|
28
|
-
@config.standalone = value
|
29
|
-
end
|
30
|
-
|
31
|
-
def create_shared_war
|
32
|
-
@config.standalone = false
|
33
|
-
create_war_file
|
34
|
-
end
|
35
|
-
|
36
|
-
def create_standalone_war
|
37
|
-
@config.standalone = true
|
38
|
-
create_war_file
|
39
|
-
end
|
40
|
-
|
41
|
-
def clean_war
|
42
|
-
FileUtils.remove_file(@config.war_file) if File.exists?(@config.war_file)
|
43
|
-
end
|
44
|
-
|
45
|
-
def create_war_file
|
46
|
-
assemble
|
47
|
-
create_war
|
48
|
-
end
|
49
|
-
|
50
|
-
def assemble
|
51
|
-
WLog.info 'Assembling web application'
|
52
|
-
add_java_libraries
|
53
|
-
if config.standalone
|
54
|
-
add_ruby_libraries
|
55
|
-
end
|
56
|
-
add_configuration_files
|
57
|
-
add_files
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
def create_war
|
63
|
-
WLog.info 'Creating web archive'
|
64
|
-
@webapp_packer.create_war
|
65
|
-
end
|
66
|
-
|
67
|
-
def add_files
|
68
|
-
@file_packer.add_files
|
69
|
-
end
|
70
|
-
|
71
|
-
def add_java_libraries
|
72
|
-
@java_lib_packer.add_java_libraries
|
73
|
-
end
|
74
|
-
|
75
|
-
def add_ruby_libraries
|
76
|
-
@ruby_lib_packer.add_ruby_libraries
|
77
|
-
end
|
78
|
-
|
79
|
-
def add_configuration_files
|
80
|
-
require 'erb'
|
81
|
-
FileUtils.makedirs(File.join(config.staging, 'WEB-INF'))
|
82
|
-
war_file_dir = File.join(config.staging, 'WEB-INF')
|
83
|
-
Dir.foreach(war_file_dir) do |file|
|
84
|
-
output = case file
|
85
|
-
when /\.\Z/ # ignore dotfiles
|
86
|
-
nil
|
87
|
-
when /\.erb\Z/
|
88
|
-
output_file = file.gsub(/\.erb\Z/, '')
|
89
|
-
template = File.read(File.join(war_file_dir, file))
|
90
|
-
erb = ERB.new(template)
|
91
|
-
erb.result(binding)
|
92
|
-
end
|
93
|
-
|
94
|
-
unless output.nil?
|
95
|
-
File.open(File.join(config.staging, 'WEB-INF', output_file), 'w') { |out| out << output}
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
end #class
|
102
|
-
end #module
|
@@ -1,131 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# A library which can hopefully be obtained through one of the following mechanisms:
|
3
|
-
# + A local artifact: lib/java/jruby-0.9.1.jar
|
4
|
-
# + An artifact in a local maven repo: ~/.m2/repository/org/jruby/jruby/0.9.1/jruby-0.9.1/jar
|
5
|
-
# + An artifact in a remote maven repo: http://www.ibiblio.com/maven2/org/jruby/jruby/0.9.1/jruby-0.9.1/jar
|
6
|
-
#
|
7
|
-
require 'util'
|
8
|
-
|
9
|
-
module War
|
10
|
-
class JavaLibrary
|
11
|
-
|
12
|
-
attr_accessor :name, :version, :locations, :config
|
13
|
-
|
14
|
-
def initialize(name, version, config)
|
15
|
-
@config = config
|
16
|
-
@name = name
|
17
|
-
@version = version
|
18
|
-
@locations = local_locations(name, version)
|
19
|
-
end
|
20
|
-
|
21
|
-
def file
|
22
|
-
"#{name}-#{version}.jar"
|
23
|
-
end
|
24
|
-
|
25
|
-
def install(config, target_file)
|
26
|
-
found = false
|
27
|
-
for location in locations
|
28
|
-
if location[0,5] == 'http:' || location[0,6] == 'https:'
|
29
|
-
found = install_remote(config, location, target_file)
|
30
|
-
else
|
31
|
-
found = install_local(config, location, target_file)
|
32
|
-
end
|
33
|
-
break if found
|
34
|
-
end
|
35
|
-
|
36
|
-
unless found
|
37
|
-
# all attempts have failed, inform the user
|
38
|
-
raise <<-ERROR
|
39
|
-
The library #{self} could not be obtained from in any of the following locations:
|
40
|
-
+ #{locations.join("
|
41
|
-
+ ")}
|
42
|
-
ERROR
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def install_local(config, file, target_file)
|
47
|
-
return false unless File.exists?(file)
|
48
|
-
FileUtils.copy(file, target_file)
|
49
|
-
return true
|
50
|
-
end
|
51
|
-
|
52
|
-
def install_remote(config, location, target_file)
|
53
|
-
response = read_url(location)
|
54
|
-
return false unless response
|
55
|
-
File.open(target_file, 'wb') { |out| out << response.body }
|
56
|
-
return true
|
57
|
-
end
|
58
|
-
|
59
|
-
# properly download the required files, taking account of redirects
|
60
|
-
# this code is almost straight from the Net::HTTP docs
|
61
|
-
def read_url(uri_str, limit=10)
|
62
|
-
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
|
63
|
-
require 'net/http'
|
64
|
-
require 'uri'
|
65
|
-
# setup the proxy if available
|
66
|
-
http = Net::HTTP
|
67
|
-
if ENV['http_proxy']
|
68
|
-
proxy = URI.parse(ENV['http_proxy'])
|
69
|
-
http = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user, proxy.password)
|
70
|
-
end
|
71
|
-
# download the file
|
72
|
-
response = http.get_response(URI.parse(uri_str))
|
73
|
-
case response
|
74
|
-
when Net::HTTPSuccess then response
|
75
|
-
when Net::HTTPRedirection then read_url(response['location'], limit - 1)
|
76
|
-
else false
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def to_s
|
81
|
-
"#{name}-#{version}"
|
82
|
-
end
|
83
|
-
|
84
|
-
def local_locations(name, version, type='jar')
|
85
|
-
WLog.debug("locations for " + name + " " + version);
|
86
|
-
paths = []
|
87
|
-
if config.local_java_lib
|
88
|
-
paths << File.join(config.local_java_lib, "#{name}-#{version}.#{type}")
|
89
|
-
paths << File.join(config.local_java_lib, "#{name}.#{type}")
|
90
|
-
end
|
91
|
-
if config.jruby_home
|
92
|
-
paths << File.join(config.jruby_home, 'lib', "#{name}-#{version}.#{type}")
|
93
|
-
paths << File.join(config.jruby_home, 'lib', "#{name}.#{type}")
|
94
|
-
end
|
95
|
-
WLog.debug("paths: " + paths.join("\n"))
|
96
|
-
return paths
|
97
|
-
end
|
98
|
-
|
99
|
-
end #class
|
100
|
-
|
101
|
-
class MavenLibrary < JavaLibrary
|
102
|
-
|
103
|
-
attr_accessor :group, :name, :version, :config
|
104
|
-
|
105
|
-
def initialize (group, name, version, config)
|
106
|
-
@config = config
|
107
|
-
@group = group
|
108
|
-
@name = name
|
109
|
-
@version = version
|
110
|
-
@locations = maven_locations(group, name, version)
|
111
|
-
end
|
112
|
-
|
113
|
-
def maven_locations(group, artifact, version, type='jar')
|
114
|
-
WLog.debug("locations for " + group + " " + artifact + " " + version);
|
115
|
-
paths = []
|
116
|
-
maven_local_repository = config.maven_local_repository
|
117
|
-
maven_remote_repository = config.maven_remote_repository
|
118
|
-
if maven_local_repository
|
119
|
-
paths << File.join(maven_local_repository, group.gsub('.', File::SEPARATOR), artifact, version, "#{artifact}-#{version}.#{type}")
|
120
|
-
end
|
121
|
-
if maven_remote_repository
|
122
|
-
paths << "#{maven_remote_repository}/#{group.gsub('.', '/')}/#{artifact}/#{version}/#{artifact}-#{version}.#{type}"
|
123
|
-
end
|
124
|
-
WLog.debug("paths: " + paths.join("\n"))
|
125
|
-
return paths
|
126
|
-
end
|
127
|
-
|
128
|
-
end
|
129
|
-
|
130
|
-
|
131
|
-
end #module
|
@@ -1,215 +0,0 @@
|
|
1
|
-
require 'util'
|
2
|
-
|
3
|
-
module War
|
4
|
-
|
5
|
-
class Packer
|
6
|
-
|
7
|
-
attr_accessor :config
|
8
|
-
|
9
|
-
def initialize(config = Configuration.instance)
|
10
|
-
@config = config
|
11
|
-
end
|
12
|
-
|
13
|
-
def install(source, dest, mode=0644)
|
14
|
-
# File.install is disabled because of a performance problem under JRuby,
|
15
|
-
# without it the task may fail if the original gem files were not writable by the owner
|
16
|
-
#File.install(source, dest, mode)
|
17
|
-
FileUtils.copy(source, dest)
|
18
|
-
end
|
19
|
-
|
20
|
-
def copy_tree(files, target, strip_prefix='')
|
21
|
-
files.each do |f|
|
22
|
-
relative = f[strip_prefix.length, f.length]
|
23
|
-
target_file = File.join(target, relative)
|
24
|
-
if File.directory?(f)
|
25
|
-
FileUtils.makedirs(target_file)
|
26
|
-
elsif File.file?(f)
|
27
|
-
WLog.debug " Copying #{f} to #{relative}"
|
28
|
-
FileUtils.makedirs(File.dirname(target_file))
|
29
|
-
install(f, target_file)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def compile_tree(dir, config)
|
35
|
-
return unless config.compile_ruby
|
36
|
-
# find the libraries
|
37
|
-
classpath_files = Rake::FileList.new(File.join(config.staging, 'WEB-INF', 'lib', '*.jar'))
|
38
|
-
classpath_files_array = classpath_files.to_a
|
39
|
-
classpath_files_array.collect! {|f| File.expand_path(f) }
|
40
|
-
classpath = classpath_files_array.join(config.os_path_separator)
|
41
|
-
# compile the files
|
42
|
-
os_dir = dir.gsub(File::SEPARATOR, config.os_separator)
|
43
|
-
unless system("cd #{os_dir} && java -cp #{classpath} org.jruby.webapp.ASTSerializerMain")
|
44
|
-
raise "Error: failed to preparse files in #{dir}, returned with error code #{$?}"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def jar(target_file, source_dir, files, compress=true)
|
49
|
-
os_target_file = target_file.gsub(File::SEPARATOR, config.os_separator)
|
50
|
-
os_source_dir = source_dir.gsub(File::SEPARATOR, config.os_separator)
|
51
|
-
flags = '-cf'
|
52
|
-
flags += '0' unless compress
|
53
|
-
files_list = files.join(' ')
|
54
|
-
unless system("jar #{flags} \"#{os_target_file}\" -C \"#{os_source_dir}\" #{files_list}")
|
55
|
-
raise "Error: failed to create archive, error code #{$?}"
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
|
61
|
-
class FileLibPacker < Packer
|
62
|
-
def add_files
|
63
|
-
WLog.info("Packing needed files ...")
|
64
|
-
|
65
|
-
staging = config.staging
|
66
|
-
lib = File.join(staging, 'WEB-INF', 'lib')
|
67
|
-
classes = File.join(staging, 'WEB-INF', 'classes')
|
68
|
-
base = File.join(staging, 'WEB-INF')
|
69
|
-
install(:lib, lib)
|
70
|
-
install(:classes, classes)
|
71
|
-
install(:base, base)
|
72
|
-
end
|
73
|
-
|
74
|
-
def install(dir_sym, dir)
|
75
|
-
WLog.debug("assembling files in " + dir + " directory")
|
76
|
-
FileUtils.makedirs(dir)
|
77
|
-
WLog.debug("need to assemble #{config.files.select{|k,v| v[:directory] == dir_sym }.size} files")
|
78
|
-
for name, file_info in config.files
|
79
|
-
next unless file_info[:directory] == dir_sym
|
80
|
-
WLog.debug("file to add " + name )
|
81
|
-
target = File.join(dir, name)
|
82
|
-
WLog.debug("should install to " + target)
|
83
|
-
file = file_info[:location]
|
84
|
-
if !File.exists?(target) || File.mtime(target) < File.mtime(file_info[:location])
|
85
|
-
WLog.info " adding file #{name}"
|
86
|
-
if File.exists?(file)
|
87
|
-
FileUtils.copy(file, target)
|
88
|
-
else
|
89
|
-
WLog.warn "file '#{file}' does not exist"
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
class JavaLibPacker < Packer
|
97
|
-
|
98
|
-
def initialize(config)
|
99
|
-
super(config)
|
100
|
-
end
|
101
|
-
|
102
|
-
def add_java_libraries
|
103
|
-
WLog.info("Packing needed Java libraries ...")
|
104
|
-
staging = config.staging
|
105
|
-
lib = File.join(staging, 'WEB-INF', 'lib')
|
106
|
-
WLog.debug("assembling files in " + lib + " directory")
|
107
|
-
FileUtils.makedirs(lib)
|
108
|
-
WLog.debug("need to assemble #{config.java_libraries.size} libraries")
|
109
|
-
for library in config.java_libraries.values
|
110
|
-
WLog.debug("library to assemble " + library.name )
|
111
|
-
target = File.join(lib, library.file)
|
112
|
-
WLog.debug("should install to " + target)
|
113
|
-
unless File.exists?(target)
|
114
|
-
WLog.info " adding Java library #{library}"
|
115
|
-
library.install(config, target)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
class RubyLibPacker < Packer
|
122
|
-
|
123
|
-
def initialize (config)
|
124
|
-
super(config)
|
125
|
-
end
|
126
|
-
|
127
|
-
def add_ruby_libraries
|
128
|
-
# add the gems
|
129
|
-
WLog.info("Packing needed Ruby gems ...")
|
130
|
-
gem_home = File.join(config.staging, 'WEB-INF', 'gems')
|
131
|
-
FileUtils.makedirs(gem_home)
|
132
|
-
FileUtils.makedirs(File.join(gem_home, 'gems'))
|
133
|
-
FileUtils.makedirs(File.join(gem_home, 'specifications'))
|
134
|
-
for gem in config.gem_libraries
|
135
|
-
copy_gem(gem[0], gem[1], gem_home)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
def copy_gem(name, match_version, target_gem_home)
|
140
|
-
require 'rubygems'
|
141
|
-
matched = Gem.source_index.search(name, match_version)
|
142
|
-
raise "The #{name} gem is not installed" if matched.empty?
|
143
|
-
gem = matched.last
|
144
|
-
|
145
|
-
gem_target = File.join(target_gem_home, 'gems', gem.full_gem_path.split('/').last)
|
146
|
-
|
147
|
-
unless File.exists?(gem_target)
|
148
|
-
# package up the gem
|
149
|
-
WLog.info " adding Ruby gem #{gem.name} version #{gem.version}"
|
150
|
-
# copy the specification
|
151
|
-
install(gem.loaded_from, File.join(target_gem_home, 'specifications'), 0644)
|
152
|
-
# copy the files
|
153
|
-
FileUtils.makedirs(gem_target)
|
154
|
-
gem_files = Rake::FileList.new(File.join(gem.full_gem_path, '**', '*'))
|
155
|
-
copy_tree(gem_files, gem_target, gem.full_gem_path)
|
156
|
-
# compile the .rb files to .rb.ast.ser
|
157
|
-
compile_tree(File.join(gem_target, 'lib'), config)
|
158
|
-
end
|
159
|
-
|
160
|
-
# handle dependencies
|
161
|
-
if config.add_gem_dependencies
|
162
|
-
for gem_child in gem.dependencies
|
163
|
-
#puts " Gem #{gem.name} requires #{gem_child.name} "
|
164
|
-
copy_gem(gem_child.name, gem_child.requirements_list, target_gem_home)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
end
|
170
|
-
|
171
|
-
class WebappPacker < Packer
|
172
|
-
|
173
|
-
def initialize(config)
|
174
|
-
super(config)
|
175
|
-
end
|
176
|
-
|
177
|
-
def create_war
|
178
|
-
# we can't include a directory, but exclude it's files
|
179
|
-
webapp_files = Rake::FileList.new
|
180
|
-
webapp_files.include('*')
|
181
|
-
webapp_files.exclude('*.war')
|
182
|
-
webapp_files.exclude(/tmp$/)
|
183
|
-
webapp_files.include(File.join('tmp', '*'))
|
184
|
-
webapp_files.exclude(File.join('tmp', 'jetty'))
|
185
|
-
config.excludes.each do |exclude|
|
186
|
-
webapp_files.exclude(exclude)
|
187
|
-
end
|
188
|
-
|
189
|
-
jar(config.war_file, config.staging, webapp_files)
|
190
|
-
end
|
191
|
-
|
192
|
-
def add_webapp
|
193
|
-
staging = config.staging
|
194
|
-
WLog.info 'Packing web application ...'
|
195
|
-
FileUtils.makedirs(staging)
|
196
|
-
webapp_files = Rake::FileList.new(File.join('.', '**', '*'))
|
197
|
-
webapp_files.exclude(staging)
|
198
|
-
webapp_files.exclude('*.war')
|
199
|
-
webapp_files.exclude(config.local_java_lib)
|
200
|
-
webapp_files.exclude(File.join('public', '.ht*'))
|
201
|
-
webapp_files.exclude(File.join('public', 'dispatch*'))
|
202
|
-
webapp_files.exclude(File.join('log', '*.log'))
|
203
|
-
webapp_files.exclude(File.join('tmp', 'cache', '*'))
|
204
|
-
webapp_files.exclude(File.join('tmp', 'sessions', '*'))
|
205
|
-
webapp_files.exclude(File.join('tmp', 'sockets', '*'))
|
206
|
-
webapp_files.exclude(File.join('tmp', 'jetty'))
|
207
|
-
config.excludes.each do |exclude|
|
208
|
-
webapp_files.exclude(exclude)
|
209
|
-
end
|
210
|
-
copy_tree(webapp_files, staging)
|
211
|
-
compile_tree(staging, config)
|
212
|
-
end
|
213
|
-
|
214
|
-
end
|
215
|
-
end
|