Module: BundleOnly::Messages::Common

Defined in:
lib/bundle-only/messages.rb

Class Method Summary collapse

Class Method Details

.output_post_install_messages(messages) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/bundle-only/messages.rb', line 26

def self.output_post_install_messages(messages)
  return if Bundler.settings['ignore_messages']

  messages.to_a.each do |name, msg|
    print_post_install_message(name, msg) unless Bundler.settings["ignore_messages.#{name}"]
  end
end

.output_without_groups_message(command) ⇒ Object



39
40
41
42
43
# File 'lib/bundle-only/messages.rb', line 39

def self.output_without_groups_message(command)
  return if Bundler.settings[:without].empty?

  Bundler.ui.confirm without_groups_message(command)
end

.print_post_install_message(name, msg) ⇒ Object



34
35
36
37
# File 'lib/bundle-only/messages.rb', line 34

def self.print_post_install_message(name, msg)
  Bundler.ui.confirm "Post-install message from #{name}:"
  Bundler.ui.info msg
end

.without_groups_message(command) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/bundle-only/messages.rb', line 45

def self.without_groups_message(command)
  command_in_past_tense = command == :install ? 'installed' : 'updated'
  groups = Bundler.settings[:without]
  group_list = [groups[0...-1].join(', '), groups[-1..-1]]
               .reject { |s| s.to_s.empty? }.join(' and ')
  group_str = groups.size == 1 ? 'group' : 'groups'
  "Gems in the #{group_str} #{group_list} were not #{command_in_past_tense}."
end