tara 0.3.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8bd43a87f95c54251fd0a27ad9fb00ae8a6f2c0
4
- data.tar.gz: 37127da9f2b062b6594529db98094110e76ff7cd
3
+ metadata.gz: 8becc22fc23dec6323164fa640d18e062cd7b7f3
4
+ data.tar.gz: ddd7ae48b1cfab03a864384e8e617889cba48671
5
5
  SHA512:
6
- metadata.gz: b7d7ca8dbe189bf6f19b8b0a09d83912bc72ef33512c8b3f679942f16b53b4d17bcc8e1c1ea1b14b877d8b47e1cfb3fd4d277ff7b394a0b160896f97cf6dff57
7
- data.tar.gz: 5c74f6978741b779b43586a0bddd8208a5560c4d82d66c4ac2ed4893bb85cd3befb5bc4ee33b634d93a7756ed2f5ad4f8f5aad0d75faa18aba84657a9e2805bb
6
+ metadata.gz: 5e86a0fddd03a6afa670d3eddeebcffcda3f52149020c81890f641c14261e7bc0371c94b5a290d5691801ab41df7335f98d93f3d1c126948a679a219173744b4
7
+ data.tar.gz: 6492aa2bf1fe0bbb33fb14566db8c7d0bf1aff66aa943acfcd6a3c48f7b2664849fa09d4fba77b60a0e14120df54081703c428260b84de845144ee7ad55f9bbb
data/lib/tara.rb CHANGED
@@ -16,7 +16,7 @@ end
16
16
  require 'tara/archive'
17
17
  require 'tara/archiver'
18
18
  require 'tara/cli'
19
- require 'tara/executable'
20
19
  require 'tara/fetcher'
21
20
  require 'tara/installer'
22
21
  require 'tara/shell'
22
+ require 'tara/shim'
data/lib/tara/archive.rb CHANGED
@@ -112,7 +112,7 @@ module Tara
112
112
  copy_file(project_dir, package_dir, executable)
113
113
  FileUtils.chmod(0755, package_dir.join(executable))
114
114
  relative_executable = executable.relative_path_from(project_dir)
115
- create_exec_wrapper(package_dir, relative_executable)
115
+ create_shim(package_dir, relative_executable)
116
116
  end
117
117
  end
118
118
  end
@@ -144,11 +144,11 @@ module Tara
144
144
  end
145
145
  end
146
146
 
147
- def create_exec_wrapper(package_dir, executable)
148
- wrapper_path = package_dir.join(executable.basename)
149
- ex = Executable.new(*executable.split)
150
- File.open(wrapper_path, 'w') { |f| ex.write(f) }
151
- FileUtils.chmod(0755, wrapper_path)
147
+ def create_shim(package_dir, executable)
148
+ shim_path = package_dir.join(executable.basename)
149
+ shim = Shim.new(*executable.split)
150
+ File.open(shim_path, 'w') { |f| shim.write(f) }
151
+ FileUtils.chmod(0755, shim_path)
152
152
  end
153
153
  end
154
154
  end
@@ -47,9 +47,9 @@ module Tara
47
47
  Dir['vendor/ruby/*/extensions/*'].each do |ext_file|
48
48
  FileUtils.rm_rf(ext_file)
49
49
  end
50
- @shell.exec('find vendor/ruby/*/gems -name "*.o" -exec rm {} \; 2> /dev/null || true')
51
- @shell.exec('find vendor/ruby/*/gems -name "*.so" -exec rm {} \; 2> /dev/null || true')
52
- @shell.exec('find vendor/ruby/*/gems -name "*.bundle" -exec rm {} \; 2> /dev/null || true')
50
+ %w[o so bundle].each do |ext|
51
+ find_and_remove_files('vendor/ruby/*/gems', %(*.#{ext}))
52
+ end
53
53
  FileUtils.cp_r('vendor', lib_path, preserve: true)
54
54
  end
55
55
  end
@@ -107,20 +107,20 @@ module Tara
107
107
 
108
108
  def strip_leftovers
109
109
  %w[c cpp h rl].each do |ext|
110
- @shell.exec(%(find #{ruby_vendor_path} -name "*.#{ext}" -exec rm {} \\; 2> /dev/null))
110
+ find_and_remove_files(ruby_vendor_path, %(*.#{ext}))
111
111
  end
112
- @shell.exec(%(find #{ruby_vendor_path} -name "extconf.rb" -exec rm {} \\; 2> /dev/null))
113
- @shell.exec(%(find #{vendor_gems_glob.join('*', 'ext')} -name "Makefile" -exec rm {} \\; 2> /dev/null))
114
- @shell.exec(%(find #{vendor_gems_glob.join('*', 'ext')} -name "tmp" -type d 2> /dev/null | xargs rm -rf))
112
+ find_and_remove_files(ruby_vendor_path, 'extconf.rb')
113
+ find_and_remove_files(vendor_gems_glob.join('*', 'ext'), 'Makefile')
114
+ find_and_remove_directories(vendor_gems_glob.join('*', 'ext'), 'tmp')
115
115
  end
116
116
 
117
117
  def strip_java_files
118
- @shell.exec(%(find #{vendor_gems_glob} -name "*.java" -exec rm {} \\; 2> /dev/null))
118
+ find_and_remove_files(vendor_gems_glob, '*.java')
119
119
  end
120
120
 
121
121
  def strip_git_files
122
- @shell.exec(%(find #{vendor_gems_glob} -name ".git" -type d 2> /dev/null | xargs rm -rf))
123
- @shell.exec(%(find #{bundler_gems_glob} -name ".git" -type d 2> /dev/null | xargs rm -rf))
122
+ find_and_remove_directories(vendor_gems_glob, '.git')
123
+ find_and_remove_directories(bundler_gems_glob, '.git')
124
124
  end
125
125
 
126
126
  def strip_from_gems(things)
@@ -130,6 +130,14 @@ module Tara
130
130
  end
131
131
  end
132
132
 
133
+ def find_and_remove_files(dir, glob)
134
+ @shell.exec(%(find #{dir} -name "#{glob}" -type f -exec rm -f "{}" \\; 2> /dev/null || true))
135
+ end
136
+
137
+ def find_and_remove_directories(dir, glob)
138
+ @shell.exec(%(find #{dir} -name "#{glob}" -type d -exec rm -rf "{}" \\; 2> /dev/null || true))
139
+ end
140
+
133
141
  def lib_path
134
142
  @lib_path ||= Pathname.new(@package_dir).join('lib')
135
143
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Tara
4
4
  # @private
5
- class Executable
5
+ class Shim
6
6
  def initialize(dirpath, name)
7
7
  @dirpath = dirpath
8
8
  @name = name
data/lib/tara/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Tara
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.1'
5
5
  end
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.3.0
4
+ version: 0.3.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-04-25 00:00:00.000000000 Z
11
+ date: 2015-07-25 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
@@ -24,10 +24,10 @@ files:
24
24
  - lib/tara/archive.rb
25
25
  - lib/tara/archiver.rb
26
26
  - lib/tara/cli.rb
27
- - lib/tara/executable.rb
28
27
  - lib/tara/fetcher.rb
29
28
  - lib/tara/installer.rb
30
29
  - lib/tara/shell.rb
30
+ - lib/tara/shim.rb
31
31
  - lib/tara/version.rb
32
32
  homepage: http://github.com/mthssdrbrg/tara
33
33
  licenses: