Skip to content

Commit

Permalink
rename tagging_tool to tagging_writer
Browse files Browse the repository at this point in the history
  • Loading branch information
shaiguitar committed Sep 6, 2013
1 parent 2c8b461 commit 8fc5c2e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/haml-i18n-extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
require "haml-i18n-extractor/extraction/exception_finder"
require "haml-i18n-extractor/extraction/haml_parser"
require "haml-i18n-extractor/extraction/haml_reader"
require "haml-i18n-extractor/extraction/tagging_tool"
require "haml-i18n-extractor/extraction/tagging_writer"
require "haml-i18n-extractor/extraction/text_replacer"
require "haml-i18n-extractor/extraction/haml_writer"
require "haml-i18n-extractor/extraction/yaml_writer"
Expand Down
4 changes: 2 additions & 2 deletions lib/haml-i18n-extractor/extraction/extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def initialize(haml_path, opts = {})
validate_haml(@haml_reader.body)
@haml_writer = Haml::I18n::Extractor::HamlWriter.new(haml_path, {:type => @type})
@yaml_writer = Haml::I18n::Extractor::YamlWriter.new(@options[:i18n_scope], @options[:yaml_file])
@tagging_tool ||= Haml::I18n::Extractor::TaggingTool.new
@tagging_writer ||= Haml::I18n::Extractor::TaggingWriter.new
# hold all the processed lines
@body = []
# holds a line_no => {info_about_line_replacemnts_or_not}
Expand Down Expand Up @@ -97,7 +97,7 @@ def process_line(orig_line, line_no)
end

if user_action.tag?
@tagging_tool.write(line_locale_hash[:path], line_no)
@tagging_writer.write(line_locale_hash[:path], line_no)
add_to_body("#{whitespace}#{orig_line}")
elsif user_action.next?
raise AbortFile, "stopping to process the rest of the file"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Haml
module I18n
class Extractor
class TaggingTool
class TaggingWriter

DB = ".tags.haml-i18n-extractor"
def initialize
Expand Down
2 changes: 1 addition & 1 deletion lib/haml-i18n-extractor/flow/prompter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def start_message(file_count, file_names)
def end_message
say("\n\n\n")
say(highlight("Now run a git diff or such and see what changed!"))
say(highlight("Check #{Haml::I18n::Extractor::TaggingTool::DB} if you have tagged any lines."))
say(highlight("Check #{Haml::I18n::Extractor::TaggingWriter::DB} if you have tagged any lines."))
say("PS: If you have any feedback or ideas how this would be better, feel free to open an issue on github. See README for more info.")
end

Expand Down
6 changes: 3 additions & 3 deletions test/extractor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def test_with_a_interactive_option_takes_user_input_into_consideration_for_yaml

def test_with_a_interactive_option_user_can_tag_a_line_for_later_review
TestHelper.hax_shit
if File.exist?(Haml::I18n::Extractor::TaggingTool::DB)
assert_equal File.readlines(Haml::I18n::Extractor::TaggingTool::DB), []
if File.exist?(Haml::I18n::Extractor::TaggingWriter::DB)
assert_equal File.readlines(Haml::I18n::Extractor::TaggingWriter::DB), []
end
h = Haml::I18n::Extractor.new(file_path("ex1.haml"), :interactive => true)
user_input = "D" # dump
Expand All @@ -84,7 +84,7 @@ def test_with_a_interactive_option_user_can_tag_a_line_for_later_review
with_highline(user_input) do
h.run
end
assert (File.readlines(Haml::I18n::Extractor::TaggingTool::DB).size != 0), "tag lines get added to file"
assert (File.readlines(Haml::I18n::Extractor::TaggingWriter::DB).size != 0), "tag lines get added to file"
end


Expand Down
8 changes: 4 additions & 4 deletions test/tagging_tool_test.rb → test/tagging_writer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
require 'fileutils'

module Haml
class TaggingToolTest < MiniTest::Unit::TestCase
class TaggingWriterTest < MiniTest::Unit::TestCase

FILE = Haml::I18n::Extractor::TaggingTool::DB
FILE = Haml::I18n::Extractor::TaggingWriter::DB

def teardown
FileUtils.rm_rf(FILE)
Expand All @@ -13,12 +13,12 @@ def teardown
def test_it_uses_a_file_which_it_uses_to_keep_track_of_user_tagged_lines
TestHelper.hax_shit
assert ! File.exists?(FILE), "no tagging file should exist"
Haml::I18n::Extractor::TaggingTool.new
Haml::I18n::Extractor::TaggingWriter.new
assert File.exists?(FILE), "tagging file should be created on init"
end

def test_it_can_write_in_a_format
tag_tool = Haml::I18n::Extractor::TaggingTool.new
tag_tool = Haml::I18n::Extractor::TaggingWriter.new
tag_tool.write("/foo/bar/baz.txt", 49)
assert File.readlines(FILE).include?("/foo/bar/baz.txt:49\n"), "should write info"
end
Expand Down
4 changes: 2 additions & 2 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def self.mock_full_project_user_interaction!
def self.hax_shit
Dir.glob("*yml").map {|p| FileUtils.rm(p) } # HAX, TODO: handle with yaml files correctly (config/en.yml)
Dir.glob("config/locales/*yml").map {|p| FileUtils.rm(p) } # HAX, TODO: handle with yaml files correctly (config/en.yml)
if File.exists?(Haml::I18n::Extractor::TaggingTool::DB)
FileUtils.rm_rf(Haml::I18n::Extractor::TaggingTool::DB) # HAX, TODO: setup/teardown
if File.exists?(Haml::I18n::Extractor::TaggingWriter::DB)
FileUtils.rm_rf(Haml::I18n::Extractor::TaggingWriter::DB) # HAX, TODO: setup/teardown
end
end

Expand Down

0 comments on commit 8fc5c2e

Please sign in to comment.