Class: Anticuado::Ruby::Bundler
- Defined in:
- lib/anticuado/ruby/bundler.rb
Instance Attribute Summary
Attributes inherited from Base
#formatted_outdated_libraries, #outdated_libraries, #project_dir
Instance Method Summary collapse
-
#format(outdated = nil) ⇒ Array
Array include outdated data.
- #outdated(option = '') ⇒ Object
- #update_lock(target_names = nil) ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from Anticuado::Base
Instance Method Details
#format(outdated = nil) ⇒ Array
Returns Array include outdated data. If target project have no outdated data, then return blank array such as ‘[]`.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/anticuado/ruby/bundler.rb', line 20 def format(outdated = nil) @outdated_libraries = outdated unless outdated.nil? array = @outdated_libraries.split(/\R/).map(&:strip) index = array.find_index("Outdated gems included in the bundle:") return [] if index.nil? @formatted_outdated_libraries = array[index + 1..array.size].map { |library| versions = library.split(/\s/) # e.g. ["*", "jwt", "(newest", "1.5.6,", "installed", "1.5.5)"] if versions[0] == "*" { library_name: versions[1], current_version: versions[5].delete(")"), available_version: versions[3].delete(","), latest_version: versions[3].delete(",") } end }.compact end |
#outdated(option = '') ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/anticuado/ruby/bundler.rb', line 4 def outdated(option = '') return puts "have no bundle command" if `which bundle`.empty? if @project_dir Dir.chdir(@project_dir) do @outdated_libraries = run_outdated option end else @outdated_libraries = run_outdated option end @outdated_libraries end |
#update_lock(target_names = nil) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/anticuado/ruby/bundler.rb', line 41 def update_lock(target_names = nil) if @project_dir Dir.chdir(@project_dir) do do_update_lock target_names end else do_update_lock target_names end end |