appium_twine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: aec67b9622ed0458d0fa5c3a50a80eda19027f91
4
+ data.tar.gz: dd931c47b69a6b1f86a97d92e5cf0ea2d3a49a67
5
+ SHA512:
6
+ metadata.gz: 0efe32359a698718c48464344291a485904508bad2aad9f9e8cf5baf87078e30701f628e0870b8c6f6569697918c5d4878ffd7d50e755d68b56d3739b09190ef
7
+ data.tar.gz: 645918b3a23be6e2de913bebd0b76d3fd648b28833db68bcf57684e5e4f070ab75958e3267c7804ca827db40d7f38bf2c67d5463e681cf647d6220948c566a10
@@ -0,0 +1,3 @@
1
+ .DS*
2
+ .id*
3
+ *.lock
data/LICENSE ADDED
@@ -0,0 +1,30 @@
1
+ Software License Agreement (BSD License)
2
+
3
+ Copyright (c) 2012, Mobiata, LLC
4
+ All rights reserved.
5
+
6
+ Redistribution and use of this software in source and binary forms, with or
7
+ without modification, are permitted provided that the following conditions are
8
+ met:
9
+
10
+ * Redistributions of source code must retain the above copyright notice, this
11
+ list of conditions and the following disclaimer.
12
+
13
+ * Redistributions in binary form must reproduce the above copyright notice,
14
+ this list of conditions and the following disclaimer in the documentation
15
+ and/or other materials provided with the distribution.
16
+
17
+ * Neither the name of the organization nor the names of its contributors may be
18
+ used to endorse or promote products derived from this software without
19
+ specific prior written permission.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
25
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
1
+ appium_twine
2
+ ============
3
+
4
+ Appium plugin for twine that enables C# generation for use with Xamarin.Forms
@@ -0,0 +1,5 @@
1
+ require 'appium_thor'
2
+
3
+ Appium::Thor::Config.set do
4
+ gem_name 'appium_twine'
5
+ end
@@ -0,0 +1,22 @@
1
+ require_relative 'lib/appium_twine/version'
2
+
3
+ Gem::Specification.new do |s|
4
+ # 1.8.x is not supported
5
+ s.required_ruby_version = '>= 1.9.3'
6
+
7
+ s.name = 'appium_twine'
8
+ s.version = Appium::Twine::VERSION
9
+ s.date = Appium::Twine::DATE
10
+ s.license = 'https://github.com/appium/appium_twine/blob/master/LICENSE'
11
+ s.description = s.summary = 'Appium plugin for twine that enables C# generation for use with Xamarin.Forms'
12
+ s.description += '.' # avoid identical warning
13
+ s.authors = s.email = ['code@bootstraponline.com']
14
+ s.homepage = 'https://github.com/appium/appium_twine'
15
+ s.require_paths = ['lib']
16
+
17
+ s.add_runtime_dependency 'twine', '~> 0.5.0'
18
+
19
+ s.add_development_dependency 'appium_thor', '~> 0.0', '>= 0.0.7'
20
+
21
+ s.files = `git ls-files`.split("\n")
22
+ end
@@ -0,0 +1 @@
1
+ require_relative 'appium_twine/appium_twine'
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ require 'twine'
3
+
4
+ require_relative 'formatter'
5
+ require_relative 'version'
6
+
7
+ module Appium
8
+ module Twine
9
+ class << self
10
+ # Adds a single formatter to the Twine::Formatters constant.
11
+ #
12
+ # @param formatter [Class] new formatter to append. Example: Formatters::Foobar
13
+ def add_formatter formatter
14
+ target_module = ::Twine::Formatters
15
+ target_constant = :FORMATTERS
16
+
17
+ return unless target_module.const_defined? target_constant
18
+
19
+ old_value = target_module.send :remove_const, target_constant
20
+ new_value = old_value << formatter
21
+
22
+ target_module.send :const_set, target_constant, new_value
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ Appium::Twine.add_formatter Twine::Formatters::Csharp
@@ -0,0 +1,90 @@
1
+ # encoding: utf-8
2
+ require 'cgi'
3
+ require 'rexml/document'
4
+
5
+ # based on Twine's android formatter
6
+ # https://github.com/mobiata/twine/blob/ee6789f62a5d08cac4e1df2a69719470660be144/lib/twine/formatters/android.rb
7
+
8
+ module Twine
9
+ module Formatters
10
+ class Csharp < Abstract
11
+ FORMAT_NAME = 'csharp'
12
+ EXTENSION = '.cs'
13
+ DEFAULT_FILE_NAME = 'strings.cs'
14
+
15
+ def self.can_handle_directory?(path)
16
+ true
17
+ end
18
+
19
+ def default_file_name
20
+ return DEFAULT_FILE_NAME
21
+ end
22
+
23
+ def determine_language_given_path(path)
24
+ raise 'not going to implement'
25
+ end
26
+
27
+ def read_file(path, lang)
28
+ raise 'not going to implement'
29
+ end
30
+
31
+ def write_file(path, lang)
32
+ default_lang = @strings.language_codes[0]
33
+ File.open(path, 'w:UTF-8') do |f|
34
+ # todo: use user specified variable for namespace/class
35
+ # load it from the twine.yml
36
+ f.write (<<S).strip
37
+ namespace ruby_lib
38
+ {
39
+ public static class Twine
40
+ {
41
+ S
42
+ prefix = ' ' * 8
43
+ @strings.sections.each do |section|
44
+ printed_section = false
45
+ section.rows.each do |row|
46
+ if row.matches_tags?(@options[:tags], @options[:untagged])
47
+ if !printed_section
48
+ f.puts ''
49
+ if section.name && section.name.length > 0
50
+ section_name = section.name.gsub('--', '—')
51
+ f.puts prefix + "// SECTION: #{section_name}"
52
+ end
53
+ printed_section = true
54
+ end
55
+
56
+ key = row.key
57
+
58
+ value = row.translated_string_for_lang(lang, default_lang)
59
+ if !value && @options[:include_untranslated]
60
+ value = row.translated_string_for_lang(@strings.language_codes[0])
61
+ end
62
+
63
+ if value # if values is nil, there was no appropriate translation, so let Android handle the defaulting
64
+ value = String.new(value) # use a copy to prevent modifying the original
65
+
66
+ value.gsub!('"', '\\\\"')
67
+
68
+ comment = row.comment
69
+ if comment
70
+ comment = comment.gsub('--', '—')
71
+ end
72
+
73
+ if comment && comment.length > 0
74
+ f.puts prefix + "// #{comment}\n"
75
+ end
76
+ f.puts prefix + "public const string #{key} = \"#{value}\";"
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ f.write (<<S).rstrip
83
+ }
84
+ }
85
+ S
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,6 @@
1
+ module Appium
2
+ module Twine
3
+ VERSION = '0.0.1' unless defined? ::Appium::Twine::VERSION
4
+ DATE = '2014-08-14' unless defined? ::Appium::Twine::DATE
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: appium_twine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - code@bootstraponline.com
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: twine
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.5.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: appium_thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 0.0.7
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '0.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.0.7
47
+ description: Appium plugin for twine that enables C# generation for use with Xamarin.Forms.
48
+ email:
49
+ - code@bootstraponline.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - ".gitignore"
55
+ - LICENSE
56
+ - README.md
57
+ - Thorfile
58
+ - appium_twine.gemspec
59
+ - lib/appium_twine.rb
60
+ - lib/appium_twine/appium_twine.rb
61
+ - lib/appium_twine/formatter.rb
62
+ - lib/appium_twine/version.rb
63
+ homepage: https://github.com/appium/appium_twine
64
+ licenses:
65
+ - https://github.com/appium/appium_twine/blob/master/LICENSE
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.9.3
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.2.2
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Appium plugin for twine that enables C# generation for use with Xamarin.Forms
87
+ test_files: []
88
+ has_rdoc: