stringy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/bin/stringy +3 -0
- data/lib/stringy.rb +5 -0
- data/lib/stringy/cli.rb +116 -0
- data/lib/stringy/version.rb +3 -0
- data/stringy.gemspec +25 -0
- metadata +98 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d244e57d49544f32e39dbf8bb44c021de56ec2b3
|
4
|
+
data.tar.gz: 63bef50a62337f5bd07d0d747153eab76c245ffa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4178b8760042fe03c1cb6534abeb6465eccc3d2f887de16555ecd827e767b2050864a04ddecbee0b72b512ac5d3a2fe9b78c67b54e06946ae0764d908966f7c7
|
7
|
+
data.tar.gz: a0401dafe6ad309ae0c0c209a3edb4bc048791efe81d0ad40b3b122ae7ed29e35b979cc45ba71f587918199806193437ccbebf79becea485adeb8e452d5210fb
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Benjamin Briggs
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Stringy
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'stringy'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install stringy
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/stringy/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/stringy
ADDED
data/lib/stringy.rb
ADDED
data/lib/stringy/cli.rb
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'thread'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'thor'
|
6
|
+
|
7
|
+
Thread.abort_on_exception = true
|
8
|
+
|
9
|
+
module Stringy
|
10
|
+
class CLI < Thor
|
11
|
+
class_option :verbose, :type => :boolean, :aliases => "-v"
|
12
|
+
|
13
|
+
method_option :overwrite, :type => :boolean, :aliases => "-o"
|
14
|
+
desc "update -v -o", "Updates then base stings and optionaly overwrites the tranlations"
|
15
|
+
def update()
|
16
|
+
|
17
|
+
if !Dir.exists?("Base.lproj")
|
18
|
+
puts "Wrong directory please select the directory that contains the Base.lproj folder"
|
19
|
+
return
|
20
|
+
end
|
21
|
+
|
22
|
+
if !options[:verbose] then
|
23
|
+
Thread.new do
|
24
|
+
#set up spinner
|
25
|
+
glyphs = ['|', '/', '-', "\\"]
|
26
|
+
while true
|
27
|
+
glyphs.each do |g|
|
28
|
+
print "\r#{g}"
|
29
|
+
sleep 0.15
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
warningSuppressor = options[:verbose]? "" : " > /dev/null 2>&1"
|
36
|
+
|
37
|
+
# Run Genstrings
|
38
|
+
puts "running genstrings" if options[:verbose]
|
39
|
+
system('find ./ -name "*.m" -o -name "*.mm" -print0 | xargs -0 genstrings -o Base.lproj'+warningSuppressor)
|
40
|
+
|
41
|
+
# Set up some extentions
|
42
|
+
storyboardExt = ".storyboard"
|
43
|
+
stringsExt = ".strings"
|
44
|
+
localeDirExt = ".lproj"
|
45
|
+
|
46
|
+
newStringsExt=".strings.new"
|
47
|
+
|
48
|
+
isNewStringsFile = false
|
49
|
+
|
50
|
+
# Loop the storyboards in base
|
51
|
+
Dir.glob("Base.lproj/*#{storyboardExt}") do |storyboardPath|
|
52
|
+
|
53
|
+
# Create the base path (eg. settings)
|
54
|
+
baseStringsPath = storyboardPath.chomp(File.extname(storyboardPath)) + stringsExt
|
55
|
+
|
56
|
+
puts "" if options[:verbose]
|
57
|
+
puts "Starting " + baseStringsPath if options[:verbose]
|
58
|
+
|
59
|
+
# Check if it exists
|
60
|
+
if File.file?(baseStringsPath)
|
61
|
+
isNewStringsFile = false
|
62
|
+
else
|
63
|
+
# If it we need to create the file.
|
64
|
+
puts baseStringsPath + " file doesn't exist; create" if options[:verbose]
|
65
|
+
puts "Running: ibtool --export-strings-file #{baseStringsPath.chomp} #{storyboardPath.chomp}" if options[:verbose]
|
66
|
+
system("ibtool --export-strings-file #{baseStringsPath.chomp} #{storyboardPath.chomp}"+warningSuppressor)
|
67
|
+
|
68
|
+
puts baseStringsPath + " file created" if options[:verbose]
|
69
|
+
|
70
|
+
isNewStringsFile = true
|
71
|
+
end
|
72
|
+
|
73
|
+
# Create strings file only when storyboard file newer and not just been created
|
74
|
+
if isNewStringsFile || `find #{storyboardPath.chomp} -prune -newer #{baseStringsPath.chomp} -print | grep -q .` then
|
75
|
+
|
76
|
+
puts storyboardPath + " is modified; update " + baseStringsPath if options[:verbose]
|
77
|
+
|
78
|
+
# Get storyboard file name and folder
|
79
|
+
storyboardDir = File.dirname(storyboardPath)
|
80
|
+
|
81
|
+
# Get New Base strings file full path and strings file name
|
82
|
+
newBaseStringsPath = `echo "#{storyboardPath}" | sed "s/#{storyboardExt}/#{newStringsExt}/"`.chomp
|
83
|
+
stringsFile = File.basename(baseStringsPath)
|
84
|
+
|
85
|
+
if isNewStringsFile == false
|
86
|
+
puts "Running: ibtool --export-strings-file #{newBaseStringsPath.chomp} #{storyboardPath.chomp}" if options[:verbose]
|
87
|
+
system("ibtool --export-strings-file #{newBaseStringsPath.chomp} #{storyboardPath.chomp}"+warningSuppressor)
|
88
|
+
|
89
|
+
puts "Running: iconv -f UTF-16 -t UTF-8 #{newBaseStringsPath.chomp} > #{baseStringsPath.chomp}" if options[:verbose]
|
90
|
+
system("iconv -f UTF-16 -t UTF-8 #{newBaseStringsPath.chomp} > #{baseStringsPath.chomp}"+warningSuppressor)
|
91
|
+
end
|
92
|
+
|
93
|
+
FileUtils.rm(newBaseStringsPath) if File.exists?(newBaseStringsPath)
|
94
|
+
|
95
|
+
if options[:overwrite] then
|
96
|
+
# Get all locale strings folder
|
97
|
+
Dir.glob("*#{localeDirExt}") do |localeStringsDir|
|
98
|
+
|
99
|
+
# Skip Base strings folder
|
100
|
+
if localeStringsDir != storyboardDir
|
101
|
+
|
102
|
+
localeStringsPath = localeStringsDir+"/"+stringsFile
|
103
|
+
|
104
|
+
puts "Move strings file in " + localeStringsDir if options[:verbose]
|
105
|
+
FileUtils.mkdir_p(File.dirname(localeStringsPath))
|
106
|
+
FileUtils.cp(baseStringsPath, localeStringsPath)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
puts "" if !options[:verbose]
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
data/stringy.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'stringy/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "stringy"
|
8
|
+
spec.version = Stringy::VERSION
|
9
|
+
spec.authors = ["Benjamin Briggs"]
|
10
|
+
spec.email = ["ben@palringo.com"]
|
11
|
+
spec.summary = "A tool for extracting the strings from a xcode project."
|
12
|
+
spec.description = "This is an in house project to make extracting the .stings files from an xcode project including the storyboards"
|
13
|
+
spec.homepage = "https://github.com/BenjaminBriggs/stringy"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", '~> 1.6'
|
22
|
+
spec.add_development_dependency "rake", '~> 10.3'
|
23
|
+
|
24
|
+
spec.add_dependency "thor", '~> 0.19'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stringy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Benjamin Briggs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.19'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.19'
|
55
|
+
description: This is an in house project to make extracting the .stings files from
|
56
|
+
an xcode project including the storyboards
|
57
|
+
email:
|
58
|
+
- ben@palringo.com
|
59
|
+
executables:
|
60
|
+
- stringy
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- ".gitignore"
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/stringy
|
70
|
+
- lib/stringy.rb
|
71
|
+
- lib/stringy/cli.rb
|
72
|
+
- lib/stringy/version.rb
|
73
|
+
- stringy.gemspec
|
74
|
+
homepage: https://github.com/BenjaminBriggs/stringy
|
75
|
+
licenses:
|
76
|
+
- MIT
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubyforge_project:
|
94
|
+
rubygems_version: 2.2.2
|
95
|
+
signing_key:
|
96
|
+
specification_version: 4
|
97
|
+
summary: A tool for extracting the strings from a xcode project.
|
98
|
+
test_files: []
|