Module: GemfileSorter

Defined in:
lib/gemfile_sorter.rb,
lib/gemfile_sorter/groups.rb,
lib/gemfile_sorter/parser.rb,
lib/gemfile_sorter/sources.rb,
lib/gemfile_sorter/version.rb,
lib/gemfile_sorter/line/gem.rb,
lib/gemfile_sorter/block_map.rb,
lib/gemfile_sorter/line/group.rb,
lib/gemfile_sorter/line/source.rb,
lib/gemfile_sorter/line/comment.rb,
lib/gemfile_sorter/block_of_gems.rb,
lib/gemfile_sorter/comment_group.rb,
lib/gemfile_sorter/gem_extractor.rb,
lib/gemfile_sorter/line/blank_line.rb

Defined Under Namespace

Modules: Line Classes: BlockMap, BlockOfGems, CommentGroup, GemExtractor, Groups, InvalidLineComparisonError, Parser, Sources

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.execute(directory_name = ".") ⇒ Object



15
16
17
18
19
# File 'lib/gemfile_sorter.rb', line 15

def self.execute(directory_name = ".")
  result = Parser.parse("#{directory_name}/Gemfile")
  FileUtils.mv("#{directory_name}/Gemfile", "#{directory_name}/Gemfile.unsorted")
  File.write("#{directory_name}/Gemfile", result)
end

.sort_gemfile(directory_name = ".") ⇒ Object



11
12
13
# File 'lib/gemfile_sorter.rb', line 11

def self.sort_gemfile(directory_name = ".")
  Parser.parse("#{directory_name}/Gemfile")
end