Skip to content

Commit

Permalink
Refactoring: added Dir.real_entries method
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Schiavini committed Jan 10, 2012
1 parent 73a92b2 commit ef56858
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions build.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
#!/usr/bin/env ruby
#

class Dir
def self.real_entries dir
entries(dir).reject { |e| e == "." || e == ".." }
end
end

def remote_cmd command
system "mvim -f -n --noplugin -U vimrc --servername \"VIMCOLORS\" --remote-send \":#{command} <CR>\""
end

def setup_languages
hash = {}
languages_filenames = Dir.entries(File.join(File.dirname(__FILE__), 'samples')).reject { |e| e == "." || e == ".." } # TODO: extract reject
languages_filenames = Dir.real_entries(File.join(File.dirname(__FILE__), 'samples'))
languages_full_paths = languages_filenames.map { |filename| File.join("samples", filename) }
language_names = languages_filenames.map { |filename| filename.split(".").first }
language_names.each_with_index do |name, index|
Expand All @@ -15,7 +22,7 @@ def setup_languages
hash
end

vim_colorschemes = Dir.entries(File.join(ENV['HOME'], '.vim', 'colors')).map { |c| c.gsub("\.vim", "") }.reject { |e| e == "." || e == ".." }
vim_colorschemes = Dir.real_entries(File.join(ENV['HOME'], '.vim', 'colors')).map { |c| c.gsub("\.vim", "") }

languages = setup_languages()

Expand Down

0 comments on commit ef56858

Please sign in to comment.