Skip to content

Commit

Permalink
Merge pull request #16 from netbe/feature/restructure
Browse files Browse the repository at this point in the history
Restructure project
  • Loading branch information
netbe committed Oct 29, 2013
2 parents 6361a06 + e057675 commit 786543f
Show file tree
Hide file tree
Showing 23 changed files with 428 additions and 405 deletions.
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Generated files
*.csv
*.strings
*.lproj
*.gem
*~
*#
*.gem
*.sublime-project
#*#

# Config file
.csvconverter

# SimpleCov
coverage

# ignore Gemfile.lock as http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
Expand All @@ -17,3 +21,7 @@ Gemfile.lock
.ruby-version
.rbenv-version
.rvmrc

# Sublime Text
*.sublime-workspace
*.sublime-project
16 changes: 12 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
language: ruby
rvm:
- 1.9.3
- 1.9.2
- 1.8.7
- 2.0.0
- 1.9.3
- 1.9.2
- 1.8.7
- 2.0.0
deploy:
provider: rubygems
api_key:
secure: Xjq+v+jEU6wK4BtyfnV1elegNcxK6Ah/O99Sn9c2IlkCmJ1wxLBouqzEiSorSJ4IOMa5H2y3gwo5GXOr6Y7d8huyGrPuBeCSGqAmH77wNCIv7G+jnLiYb1sRZbtKcPW2QaN6JF81qDIelwyspMfo6/ug1qN1x323UaxZl7f7nUE=
gem: csv2strings
on:
tags: true
repo: netbe/CSV-to-iOS-Localizable.strings-converter
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ source "http://rubygems.org"
gemspec

group :test do
gem 'coveralls', :require => false
gem 'coveralls', :require => false, :platforms => [:ruby_19, :ruby_20]
end
6 changes: 4 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ require 'rake/testtask'

Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/**/*_test.rb']
t.test_files = FileList['test/csvconverter/**/test_*.rb']
# t.warning = true
t.verbose = true
end

desc "Run tests"
task :default => :test
task :default => :test
4 changes: 2 additions & 2 deletions bin/csv2strings
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
require File.expand_path('../../lib/csv2strings_command', __FILE__)

$: << File.expand_path("../lib/", __FILE__)
require 'csvconverter/commands/csv2strings_command'

CSV2StringsCommand.start
4 changes: 2 additions & 2 deletions bin/strings2csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
require File.expand_path('../../lib/strings2csv_command', __FILE__)

$: << File.expand_path("../lib/", __FILE__)
require 'csvconverter/commands/strings2csv_command'

Strings2CSVCommand.start
6 changes: 4 additions & 2 deletions csv2strings.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ Gem::Specification.new do |s|
if RUBY_VERSION < '1.9'
s.add_dependency "fastercsv"
s.add_dependency "nokogiri", "= 1.5.10"
s.add_dependency "orderedhash"
end
s.add_dependency "orderedhash", "~> 0.0.6"
s.add_dependency "google_drive", '0.3.6'

s.add_dependency "google_drive", '0.3.6'
s.add_development_dependency "rake"

s.add_development_dependency "test-unit"
s.add_development_dependency "simplecov"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Expand Down
133 changes: 0 additions & 133 deletions lib/csv2strings/converter.rb

This file was deleted.

15 changes: 10 additions & 5 deletions lib/csvconverter.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
$: << File.expand_path(File.join(File.dirname(__FILE__)))
require 'rubygems'

CSVGEM = RUBY_VERSION.match(/^[0-1]\.[0-8]\./) ? 'faster_csv' : 'csv'

if RUBY_VERSION.match(/^[0-1]\.[0-8]\./)
require "orderedhash"
ORDERED_HASH_CLASS = OrderedHash
else
ORDERED_HASH_CLASS = Hash
end

begin
require CSVGEM
rescue LoadError
Expand All @@ -12,5 +16,6 @@
end

CSVParserClass = CSVGEM == 'csv' ? CSV : FasterCSV
require "csv2strings/converter"
require "strings2csv/converter"
require "csvconverter/csv2strings"
require "csvconverter/strings2csv"
require "csvconverter/google_doc"
3 changes: 0 additions & 3 deletions lib/command.rb → lib/csvconverter/command.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
$: << File.expand_path(File.join(File.dirname(__FILE__)))
require 'yaml'
require 'thor'
require 'csvconverter'
require 'google_doc'

class Command < Thor
include Thor::Actions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
$: << File.expand_path(File.join(File.dirname(__FILE__)))
require "command"
require "csvconverter/command"
class CSV2StringsCommand < Command
default_task :csv2strings

Expand All @@ -20,7 +19,7 @@ def csv2strings(filename = nil)
help("csv2strings")
exit
end

filename ||= options['filename']
if options['fetch']
say "Downloading file from Google Drive"
Expand All @@ -33,12 +32,12 @@ def csv2strings(filename = nil)
help("csv2strings")
exit
end

args = options.dup
args.delete(:langs)
args.delete(:filename)
converter = CSV2Strings::Converter.new(filename, options[:langs], args)
say converter.csv_to_dotstrings
converter = CSV2Strings.new(filename, options[:langs], args)
say converter.csv_to_dotstrings
end

end
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
$: << File.expand_path(File.join(File.dirname(__FILE__)))
require "command"

require "csvconverter/command"
class Strings2CSVCommand < Command
default_task :strings2csv

Expand All @@ -15,10 +13,10 @@ def strings2csv
unless options.has_key?('filenames')
say "No value provided for required options '--filenames'"
help("strings2csv")
exit
return
end
converter = Strings2CSV::Converter.new(options)
converter = Strings2CSV.new(options)
debug_values = converter.dotstrings_to_csv(!options[:dryrun])
say debug_values.inspect if options[:dryrun]
say debug_values.inspect if options[:dryrun]
end
end
end
Loading

0 comments on commit 786543f

Please sign in to comment.