tara 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tara/archive.rb +1 -2
- data/lib/tara/installer.rb +30 -33
- data/lib/tara/shell.rb +6 -0
- data/lib/tara/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1784fce5a6faf5e5507684228b65c90d5f2339bb
|
4
|
+
data.tar.gz: e0c5d1d73c8057cd1bc9de4c22bd365da606356b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3504bc7febfbe67dfefd611ade399514de470b152fae96d675033d537a2b141353635d4e8f96aa1ee470a34a99a12b1d102d5d067b1174cfad66e5cb1363159
|
7
|
+
data.tar.gz: c78a5c896ab9bb2468d86c2487688938250c71125c07f992d3ca281f42c9f32f4ab4d3c8c9243781ecabb3e76d149b50b87b14f620818f49f4f7313116e8d7eb
|
data/lib/tara/archive.rb
CHANGED
@@ -88,10 +88,10 @@ module Tara
|
|
88
88
|
project_dir = Pathname.new(@config[:app_dir])
|
89
89
|
package_dir = Pathname.new(tmp_dir)
|
90
90
|
build_dir = Pathname.new(@config[:build_dir])
|
91
|
-
install_dependencies(package_dir, fetcher)
|
92
91
|
copy_source(project_dir, package_dir)
|
93
92
|
copy_executables(project_dir, package_dir)
|
94
93
|
create_gem_shims(package_dir)
|
94
|
+
install_dependencies(package_dir, fetcher)
|
95
95
|
Dir.chdir(tmp_dir) do
|
96
96
|
create_archive(build_dir)
|
97
97
|
end
|
@@ -150,7 +150,6 @@ module Tara
|
|
150
150
|
unless (dirname = relative_file.dirname) == DOT_PATH
|
151
151
|
FileUtils.mkdir_p(package_dir.join(dirname))
|
152
152
|
end
|
153
|
-
FileUtils.cp_r(file, package_dir.join(relative_file))
|
154
153
|
else
|
155
154
|
unless (dirname = relative_file.dirname) == DOT_PATH
|
156
155
|
FileUtils.mkdir_p(package_dir.join(dirname))
|
data/lib/tara/installer.rb
CHANGED
@@ -8,8 +8,9 @@ module Tara
|
|
8
8
|
@fetcher = fetcher
|
9
9
|
@without_groups = options[:without_groups]
|
10
10
|
@app_dir = Pathname.new(options[:app_dir])
|
11
|
-
@bundle_env =
|
11
|
+
@bundle_env = bundle_env(options[:bundle_ignore_config])
|
12
12
|
@shell = options[:shell] || Shell
|
13
|
+
@build_command = options[:build_command]
|
13
14
|
end
|
14
15
|
|
15
16
|
def execute
|
@@ -21,37 +22,43 @@ module Tara
|
|
21
22
|
strip_leftovers
|
22
23
|
strip_java_files
|
23
24
|
strip_git_files
|
24
|
-
|
25
|
+
strip_empty_directories
|
25
26
|
end
|
26
27
|
|
27
28
|
private
|
28
29
|
|
30
|
+
def bundle_env(ignore_config)
|
31
|
+
env = {'BUNDLE_GEMFILE' => 'lib/vendor/Gemfile'}
|
32
|
+
env['BUNDLE_IGNORE_CONFIG'] = '1' if ignore_config
|
33
|
+
env
|
34
|
+
end
|
35
|
+
|
29
36
|
def bundler_command
|
30
37
|
@bundler_command ||= begin
|
31
|
-
command =
|
38
|
+
command = 'bundle install --jobs 4 --path . --gemfile lib/vendor/Gemfile'
|
32
39
|
command << %( --without #{@without_groups.join(' ')}) if @without_groups.any?
|
33
40
|
command
|
34
41
|
end
|
35
42
|
end
|
36
43
|
|
37
44
|
def bundle_gems
|
38
|
-
FileUtils.mkdir_p(
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
Dir['vendor/*/*/cache/*'].each do |cached_file|
|
46
|
-
FileUtils.rm_rf(cached_file)
|
47
|
-
end
|
48
|
-
Dir['vendor/ruby/*/extensions/*'].each do |ext_file|
|
49
|
-
FileUtils.rm_rf(ext_file)
|
50
|
-
end
|
51
|
-
%w[o so bundle].each do |ext|
|
52
|
-
find_and_remove_files('vendor/ruby/*/gems', %(*.#{ext}))
|
45
|
+
FileUtils.mkdir_p(vendor_path)
|
46
|
+
copy_gem_files(vendor_path)
|
47
|
+
Dir.chdir(@package_dir) do
|
48
|
+
Bundler.with_clean_env do
|
49
|
+
@shell.exec_with_env(bundler_command, @bundle_env)
|
50
|
+
if @build_command
|
51
|
+
@shell.exec_with_env(@build_command, @bundle_env)
|
53
52
|
end
|
54
|
-
|
53
|
+
end
|
54
|
+
Dir['lib/vendor/*/*/cache/*'].each do |cache_file|
|
55
|
+
FileUtils.rm_rf(cache_file)
|
56
|
+
end
|
57
|
+
Dir['lib/vendor/ruby/*/extensions/*'].each do |ext_file|
|
58
|
+
FileUtils.rm_rf(ext_file)
|
59
|
+
end
|
60
|
+
%w[o so bundle].each do |ext|
|
61
|
+
find_and_remove_files('lib/vendor/ruby/*/gems', %(*.#{ext}))
|
55
62
|
end
|
56
63
|
end
|
57
64
|
end
|
@@ -88,16 +95,6 @@ module Tara
|
|
88
95
|
end
|
89
96
|
end
|
90
97
|
|
91
|
-
def create_bundler_config
|
92
|
-
copy_gem_files(vendor_path)
|
93
|
-
FileUtils.mkdir_p(bundle_path)
|
94
|
-
File.open(bundle_path.join('config'), 'w+') do |f|
|
95
|
-
f.puts(%(BUNDLE_PATH: .))
|
96
|
-
f.puts(%(BUNDLE_WITHOUT: #{@without_groups.join(':')})) if @without_groups.any?
|
97
|
-
f.puts(%(BUNDLE_DISABLE_SHARED_GEMS: '1'))
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
98
|
def strip_tests
|
102
99
|
strip_from_gems(%w[tests test spec])
|
103
100
|
end
|
@@ -131,6 +128,10 @@ module Tara
|
|
131
128
|
end
|
132
129
|
end
|
133
130
|
|
131
|
+
def strip_empty_directories
|
132
|
+
@shell.exec(%(find #{@package_dir} -type d -empty -delete 2> /dev/null || true))
|
133
|
+
end
|
134
|
+
|
134
135
|
def find_and_remove_files(dir, glob)
|
135
136
|
@shell.exec(%(find #{dir} -name "#{glob}" -type f -exec rm -f "{}" \\; 2> /dev/null || true))
|
136
137
|
end
|
@@ -151,10 +152,6 @@ module Tara
|
|
151
152
|
@ruby_vendor_path ||= vendor_path.join('ruby')
|
152
153
|
end
|
153
154
|
|
154
|
-
def bundle_path
|
155
|
-
@bundle_path ||= vendor_path.join('.bundle')
|
156
|
-
end
|
157
|
-
|
158
155
|
def ruby_path
|
159
156
|
@ruby_path ||= lib_path.join('ruby')
|
160
157
|
end
|
data/lib/tara/shell.rb
CHANGED
@@ -10,6 +10,12 @@ module Tara
|
|
10
10
|
raise ExecError, %(Command `#{command}` failed with output: #{output})
|
11
11
|
end
|
12
12
|
output
|
13
|
+
rescue Errno::ENOENT => e
|
14
|
+
raise ExecError, %(Command `#{command}` failed with output: #{e.message})
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.exec_with_env(command, env)
|
18
|
+
self.exec(env.map { |k, v| [k, v].join('=') }.join(' ') << ' ' << command)
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
data/lib/tara/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Söderberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Tara packs your Ruby app into a standalone archive with gems and a Ruby
|
14
14
|
runtime
|