tara 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1784fce5a6faf5e5507684228b65c90d5f2339bb
4
- data.tar.gz: e0c5d1d73c8057cd1bc9de4c22bd365da606356b
3
+ metadata.gz: cf67fd26a216bf00d73d635b4611334cb822d819
4
+ data.tar.gz: 5f17c1b3f28685d7d1e148a641dc8af995b671d4
5
5
  SHA512:
6
- metadata.gz: e3504bc7febfbe67dfefd611ade399514de470b152fae96d675033d537a2b141353635d4e8f96aa1ee470a34a99a12b1d102d5d067b1174cfad66e5cb1363159
7
- data.tar.gz: c78a5c896ab9bb2468d86c2487688938250c71125c07f992d3ca281f42c9f32f4ab4d3c8c9243781ecabb3e76d149b50b87b14f620818f49f4f7313116e8d7eb
6
+ metadata.gz: d366f9c00a4abfad35c071514bb19a43a929712de193e0f90f5ef3837560cd5587543d479e9db67728f6adf226475164898609d7447a1fdc8019a60e7c3682bb
7
+ data.tar.gz: bbbd4a77e5dd631eb11cb07f424737a51f98ca8a8cbb886638f965c598afcdcae9c1f059ee1ddcbc4c758cdcff09dd8cc94df8c57537ef730b06eea7ca8c768a
@@ -0,0 +1,12 @@
1
+ require 'bundler'
2
+ module Bundler
3
+ class Definition
4
+ def add_optional_group(group)
5
+ @optional_groups ||= []
6
+ @optional_groups << group.to_sym
7
+ end
8
+ def has_optional_groups?
9
+ @optional_groups && @optional_groups.is_a?(Array)
10
+ end
11
+ end
12
+ end
@@ -3,7 +3,7 @@
3
3
  require 'bundler'
4
4
  require 'pathname'
5
5
  require 'tmpdir'
6
-
6
+ require 'ext/bundler'
7
7
 
8
8
  module Tara
9
9
  TaraError = Class.new(StandardError)
@@ -35,7 +35,7 @@ module Tara
35
35
 
36
36
  def bundler_command
37
37
  @bundler_command ||= begin
38
- command = 'bundle install --jobs 4 --path . --gemfile lib/vendor/Gemfile'
38
+ command = 'bundle install --jobs 4 --frozen --path . --gemfile lib/vendor/Gemfile'
39
39
  command << %( --without #{@without_groups.join(' ')}) if @without_groups.any?
40
40
  command
41
41
  end
@@ -46,6 +46,7 @@ module Tara
46
46
  copy_gem_files(vendor_path)
47
47
  Dir.chdir(@package_dir) do
48
48
  Bundler.with_clean_env do
49
+ copy_local_gems
49
50
  @shell.exec_with_env(bundler_command, @bundle_env)
50
51
  if @build_command
51
52
  @shell.exec_with_env(@build_command, @bundle_env)
@@ -63,6 +64,41 @@ module Tara
63
64
  end
64
65
  end
65
66
 
67
+ def find_installed_gems
68
+ definition = Bundler::Definition.build('lib/vendor/Gemfile', 'lib/vendor/Gemfile.lock', false)
69
+ return [] unless definition.has_optional_groups?
70
+ @without_groups.each do |group|
71
+ definition.add_optional_group(group)
72
+ end
73
+ definition.specs.each_with_object([]) do |gem_spec, specs|
74
+ if gem_spec.full_gem_path.start_with?(Bundler.bundle_path.to_s) # Local gem
75
+ specs << {
76
+ :full_gem_path => gem_spec.full_gem_path,
77
+ :spec_file => gem_spec.spec_file,
78
+ :relative_path => Pathname.new(gem_spec.full_gem_path).relative_path_from(Bundler.bundle_path).to_s,
79
+ }
80
+ end
81
+ end
82
+ rescue Bundler::GemNotFound => e
83
+ []
84
+ end
85
+
86
+ def copy_local_gems
87
+ local_gems = find_installed_gems
88
+ target_directory = File.join(@package_dir, 'lib/vendor', Bundler.ruby_scope)
89
+
90
+ spec_dir = File.join(target_directory, 'specifications')
91
+ FileUtils.mkdir_p(spec_dir)
92
+ FileUtils.mkdir_p(File.join(target_directory, 'bin'))
93
+ FileUtils.mkdir_p(File.join(target_directory, 'gems'))
94
+ FileUtils.mkdir_p(File.join(target_directory, 'bundler', 'gems'))
95
+
96
+ local_gems.each do |gemspec|
97
+ FileUtils.cp_r(gemspec[:full_gem_path], File.join(target_directory, gemspec[:relative_path]))
98
+ FileUtils.cp(gemspec[:spec_file], spec_dir) if File.exists?(gemspec[:spec_file])
99
+ end
100
+ end
101
+
66
102
  def extract_ruby
67
103
  FileUtils.mkdir_p(ruby_path)
68
104
  FileUtils.mkdir_p(ruby_vendor_path)
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Tara
4
- VERSION = '0.6.1'
4
+ VERSION = '0.7.0'
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.6.1
4
+ version: 0.7.0
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-12-09 00:00:00.000000000 Z
11
+ date: 2016-02-18 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
@@ -20,6 +20,7 @@ extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
22
  - bin/tara
23
+ - lib/ext/bundler.rb
23
24
  - lib/tara.rb
24
25
  - lib/tara/archive.rb
25
26
  - lib/tara/archiver.rb
@@ -49,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
50
  version: '0'
50
51
  requirements: []
51
52
  rubyforge_project:
52
- rubygems_version: 2.4.5
53
+ rubygems_version: 2.4.8
53
54
  signing_key:
54
55
  specification_version: 4
55
56
  summary: Packs your Ruby app as a standalone archive