prebundler 0.0.2 → 0.0.3

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: 2cb3b9c01592cb314beb744cfe49b05daf72f4e7
4
- data.tar.gz: acb37cc9d4fc50a278758ff20cb17746f17c864d
3
+ metadata.gz: 78dfaf4fa82f9db61579bf0370133a0a5d43a9a2
4
+ data.tar.gz: 0ade8a0aadf781c47972a48bcc810494c16ce4d4
5
5
  SHA512:
6
- metadata.gz: 5aed2eee4563955bf5bc7f568a1b162b117c24d4ef06e62c38f3167901d42a0d2d5e92762866330535c914b737eb7a51aa499f924c516e9d72c2432c50b5e506
7
- data.tar.gz: 9d0a8bd2b1953742cff48b7155f2d5901b80e595fbf33a98ffae8ca52b55e5191c538d6a0d97b6d60cd2ae4418a36c13eed9c6a1028df63ffcb0719787fd4885
6
+ metadata.gz: f27c4a142a4b10191fc0f2f7bc1a1e75b0194ee2aee4e0b71d9e038642d4c3a4941bec42793f6b8acf9964b6a3bf36f53a4ffcb0f816340868e0187812610a0d
7
+ data.tar.gz: fe2a9c1fec8982f841ec96eaf31dc201fc0cd5f906f23bf1945b74a540d24d08468a358d75e4eb6f0e21e739859b46d148f04b6940f399eaddbf409eaea2e6e7
data/bin/prebundle CHANGED
@@ -41,6 +41,12 @@ command :install do |c|
41
41
  c.default_value ENV.fetch('BUNDLE_PATH', Bundler.bundle_path.to_s)
42
42
  c.flag [:b, :'bundle-path']
43
43
 
44
+ c.desc 'A comma-separated list of groups referencing gems to install.'
45
+ c.flag :with
46
+
47
+ c.desc 'A comma-separated list of groups referencing gems to skip during installation.'
48
+ c.flag :without
49
+
44
50
  c.action do |global_options, options, args|
45
51
  raise 'Must specify a non-zero number of jobs' if options[:jobs] < 1
46
52
  Prebundler::Cli::Install.run($out, global_options, options, args)
@@ -17,6 +17,7 @@ module Prebundler
17
17
  def prepare
18
18
  gem_list.each do |_, gem_ref|
19
19
  next if backend_file_list.include?(gem_ref.tar_file)
20
+ next unless member_of_installable_group?(gem_ref)
20
21
  install_gem(gem_ref) if gem_ref.installable?
21
22
  end
22
23
  end
@@ -44,11 +45,17 @@ module Prebundler
44
45
  def install_gem_ref(gem_ref)
45
46
  return unless gem_ref.installable?
46
47
 
47
- unless File.exist?(gem_ref.install_dir)
48
- install_gem(gem_ref)
48
+ unless member_of_installable_group?(gem_ref)
49
+ out.puts "Skipping #{gem_ref.id} because of its group"
50
+ return
49
51
  end
50
52
 
51
- out.puts "Installed #{gem_ref.id}"
53
+ if File.exist?(gem_ref.install_dir)
54
+ out.puts "Skipping #{gem_ref.id} because it's already installed"
55
+ else
56
+ install_gem(gem_ref)
57
+ out.puts "Installed #{gem_ref.id}"
58
+ end
52
59
  end
53
60
 
54
61
  def install_gem(gem_ref)
@@ -100,6 +107,22 @@ module Prebundler
100
107
  def config
101
108
  Prebundler.config
102
109
  end
110
+
111
+ def member_of_installable_group?(gem_ref)
112
+ return true if gem_ref.groups.empty?
113
+ gem_ref.groups.any? { |g| groups.include?(g) }
114
+ end
115
+
116
+ def groups
117
+ @groups ||= begin
118
+ all_groups = gem_list.flat_map { |_, gem_ref| gem_ref.groups }.uniq
119
+ with_groups = (options[:with] || '').split(',').map { |g| g.strip.to_sym }
120
+ without_groups = (options[:without] || '').split(',').map { |g| g.strip.to_sym }
121
+
122
+ groups = with_groups.empty? ? all_groups : with_groups
123
+ groups - without_groups
124
+ end
125
+ end
103
126
  end
104
127
  end
105
128
  end
@@ -1,3 +1,3 @@
1
1
  module Prebundler
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prebundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro