Class: Prebundler::Cli::Subset

Inherits:
Base
  • Object
show all
Defined in:
lib/prebundler/cli/subset.rb

Instance Attribute Summary

Attributes inherited from Base

#args, #global_options, #options, #out

Instance Method Summary collapse

Methods inherited from Base

#initialize, run

Constructor Details

This class inherits a constructor from Prebundler::Cli::Base

Instance Method Details

#runObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/prebundler/cli/subset.rb', line 4

def run
  subset = Prebundler::GemfileSubset.from(options[:gemfile], bundle_path)

  options[:include].each { |g| subset.include(g) }
  options[:add].each { |a| subset.add_raw(a, group: 'https://rubygems.org') }

  result = subset.to_gemfile(include_dev_deps: options[:development])

  if options[:output].strip == '-'
    out.write(result)
  else
    File.write(options[:output], result)
  end
end