omt-cli 1.6.3 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +8 -0
  3. data/.gitignore +24 -0
  4. data/.travis.yml +31 -0
  5. data/CHANGELOG +188 -0
  6. data/Gemfile +11 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +35 -0
  9. data/Rakefile +10 -0
  10. data/bin/console +11 -0
  11. data/bin/fir +14 -0
  12. data/bin/setup +7 -0
  13. data/doc/build_apk.md +42 -0
  14. data/doc/build_ipa.md +66 -0
  15. data/doc/help.md +34 -0
  16. data/doc/info.md +44 -0
  17. data/doc/install.md +65 -0
  18. data/doc/login.md +19 -0
  19. data/doc/mapping.md +22 -0
  20. data/doc/publish.md +35 -0
  21. data/doc/upgrade.md +7 -0
  22. data/lib/fir.rb +28 -0
  23. data/lib/fir/api.yml +13 -0
  24. data/lib/fir/api.yml.bak +13 -0
  25. data/lib/fir/cli.rb +195 -0
  26. data/lib/fir/patches.rb +10 -0
  27. data/lib/fir/patches/blank.rb +131 -0
  28. data/lib/fir/patches/concern.rb +146 -0
  29. data/lib/fir/patches/default_headers.rb +9 -0
  30. data/lib/fir/patches/hash.rb +79 -0
  31. data/lib/fir/patches/instance_variables.rb +30 -0
  32. data/lib/fir/patches/native_patch.rb +28 -0
  33. data/lib/fir/patches/os_patch.rb +28 -0
  34. data/lib/fir/patches/try.rb +102 -0
  35. data/lib/fir/util.rb +87 -0
  36. data/lib/fir/util/build_apk.rb +76 -0
  37. data/lib/fir/util/build_common.rb +93 -0
  38. data/lib/fir/util/build_ipa.rb +240 -0
  39. data/lib/fir/util/config.rb +42 -0
  40. data/lib/fir/util/http.rb +30 -0
  41. data/lib/fir/util/info.rb +39 -0
  42. data/lib/fir/util/login.rb +18 -0
  43. data/lib/fir/util/mapping.rb +98 -0
  44. data/lib/fir/util/me.rb +19 -0
  45. data/lib/fir/util/parser/apk.rb +43 -0
  46. data/lib/fir/util/parser/bin/pngcrush +0 -0
  47. data/lib/fir/util/parser/common.rb +24 -0
  48. data/lib/fir/util/parser/ipa.rb +188 -0
  49. data/lib/fir/util/parser/pngcrush.rb +23 -0
  50. data/lib/fir/util/publish.rb +106 -0
  51. data/lib/fir/util/publish.rb.bak +185 -0
  52. data/lib/fir/version.rb +5 -0
  53. data/lib/fir/xcode_wrapper.sh +29 -0
  54. data/lib/omt-cli.rb +3 -0
  55. data/lib/omt_cli.rb +3 -0
  56. data/omt-cli.gemspec +48 -0
  57. data/test/build_ipa_test.rb +17 -0
  58. data/test/cases/test_apk.apk +0 -0
  59. data/test/cases/test_apk_txt +1 -0
  60. data/test/cases/test_ipa.ipa +0 -0
  61. data/test/cases/test_ipa_dsym +0 -0
  62. data/test/info_test.rb +36 -0
  63. data/test/login_test.rb +12 -0
  64. data/test/mapping_test.rb +18 -0
  65. data/test/me_test.rb +17 -0
  66. data/test/publish_test.rb +44 -0
  67. data/test/test_helper.rb +98 -0
  68. metadata +84 -4
@@ -0,0 +1,10 @@
1
+ # encoding: utf-8
2
+
3
+ require_relative './patches/blank'
4
+ require_relative './patches/concern'
5
+ require_relative './patches/hash'
6
+ require_relative './patches/instance_variables'
7
+ require_relative './patches/native_patch'
8
+ require_relative './patches/os_patch'
9
+ require_relative './patches/try'
10
+ require_relative './patches/default_headers'
@@ -0,0 +1,131 @@
1
+ # encoding: utf-8
2
+
3
+ class Object
4
+ # An object is blank if it's false, empty, or a whitespace string.
5
+ # For example, '', ' ', +nil+, [], and {} are all blank.
6
+ #
7
+ # This simplifies
8
+ #
9
+ # address.nil? || address.empty?
10
+ #
11
+ # to
12
+ #
13
+ # address.blank?
14
+ #
15
+ # @return [true, false]
16
+ def blank?
17
+ respond_to?(:empty?) ? !!empty? : !self
18
+ end
19
+
20
+ # An object is present if it's not blank.
21
+ #
22
+ # @return [true, false]
23
+ def present?
24
+ !blank?
25
+ end
26
+
27
+ # Returns the receiver if it's present otherwise returns +nil+.
28
+ # <tt>object.presence</tt> is equivalent to
29
+ #
30
+ # object.present? ? object : nil
31
+ #
32
+ # For example, something like
33
+ #
34
+ # state = params[:state] if params[:state].present?
35
+ # country = params[:country] if params[:country].present?
36
+ # region = state || country || 'US'
37
+ #
38
+ # becomes
39
+ #
40
+ # region = params[:state].presence || params[:country].presence || 'US'
41
+ #
42
+ # @return [Object]
43
+ def presence
44
+ self if present?
45
+ end
46
+ end
47
+
48
+ class NilClass
49
+ # +nil+ is blank:
50
+ #
51
+ # nil.blank? # => true
52
+ #
53
+ # @return [true]
54
+ def blank?
55
+ true
56
+ end
57
+ end
58
+
59
+ class FalseClass
60
+ # +false+ is blank:
61
+ #
62
+ # false.blank? # => true
63
+ #
64
+ # @return [true]
65
+ def blank?
66
+ true
67
+ end
68
+ end
69
+
70
+ class TrueClass
71
+ # +true+ is not blank:
72
+ #
73
+ # true.blank? # => false
74
+ #
75
+ # @return [false]
76
+ def blank?
77
+ false
78
+ end
79
+ end
80
+
81
+ class Array
82
+ # An array is blank if it's empty:
83
+ #
84
+ # [].blank? # => true
85
+ # [1,2,3].blank? # => false
86
+ #
87
+ # @return [true, false]
88
+ alias_method :blank?, :empty?
89
+ end
90
+
91
+ class Hash
92
+ # A hash is blank if it's empty:
93
+ #
94
+ # {}.blank? # => true
95
+ # { key: 'value' }.blank? # => false
96
+ #
97
+ # @return [true, false]
98
+ alias_method :blank?, :empty?
99
+ end
100
+
101
+ class String
102
+ BLANK_RE = /\A[[:space:]]*\z/
103
+
104
+ # A string is blank if it's empty or contains whitespaces only:
105
+ #
106
+ # ''.blank? # => true
107
+ # ' '.blank? # => true
108
+ # "\t\n\r".blank? # => true
109
+ # ' blah '.blank? # => false
110
+ #
111
+ # Unicode whitespace is supported:
112
+ #
113
+ # "\u00a0".blank? # => true
114
+ #
115
+ # @return [true, false]
116
+ def blank?
117
+ BLANK_RE === self
118
+ end
119
+ end
120
+
121
+ class Numeric #:nodoc:
122
+ # No number is blank:
123
+ #
124
+ # 1.blank? # => false
125
+ # 0.blank? # => false
126
+ #
127
+ # @return [false]
128
+ def blank?
129
+ false
130
+ end
131
+ end
@@ -0,0 +1,146 @@
1
+ # encoding: utf-8
2
+
3
+ module ActiveSupport
4
+ # A typical module looks like this:
5
+ #
6
+ # module M
7
+ # def self.included(base)
8
+ # base.extend ClassMethods
9
+ # base.class_eval do
10
+ # scope :disabled, -> { where(disabled: true) }
11
+ # end
12
+ # end
13
+ #
14
+ # module ClassMethods
15
+ # ...
16
+ # end
17
+ # end
18
+ #
19
+ # By using <tt>ActiveSupport::Concern</tt> the above module could instead be
20
+ # written as:
21
+ #
22
+ # require 'active_support/concern'
23
+ #
24
+ # module M
25
+ # extend ActiveSupport::Concern
26
+ #
27
+ # included do
28
+ # scope :disabled, -> { where(disabled: true) }
29
+ # end
30
+ #
31
+ # class_methods do
32
+ # ...
33
+ # end
34
+ # end
35
+ #
36
+ # Moreover, it gracefully handles module dependencies. Given a +Foo+ module
37
+ # and a +Bar+ module which depends on the former, we would typically write the
38
+ # following:
39
+ #
40
+ # module Foo
41
+ # def self.included(base)
42
+ # base.class_eval do
43
+ # def self.method_injected_by_foo
44
+ # ...
45
+ # end
46
+ # end
47
+ # end
48
+ # end
49
+ #
50
+ # module Bar
51
+ # def self.included(base)
52
+ # base.method_injected_by_foo
53
+ # end
54
+ # end
55
+ #
56
+ # class Host
57
+ # include Foo # We need to include this dependency for Bar
58
+ # include Bar # Bar is the module that Host really needs
59
+ # end
60
+ #
61
+ # But why should +Host+ care about +Bar+'s dependencies, namely +Foo+? We
62
+ # could try to hide these from +Host+ directly including +Foo+ in +Bar+:
63
+ #
64
+ # module Bar
65
+ # include Foo
66
+ # def self.included(base)
67
+ # base.method_injected_by_foo
68
+ # end
69
+ # end
70
+ #
71
+ # class Host
72
+ # include Bar
73
+ # end
74
+ #
75
+ # Unfortunately this won't work, since when +Foo+ is included, its <tt>base</tt>
76
+ # is the +Bar+ module, not the +Host+ class. With <tt>ActiveSupport::Concern</tt>,
77
+ # module dependencies are properly resolved:
78
+ #
79
+ # require 'active_support/concern'
80
+ #
81
+ # module Foo
82
+ # extend ActiveSupport::Concern
83
+ # included do
84
+ # def self.method_injected_by_foo
85
+ # ...
86
+ # end
87
+ # end
88
+ # end
89
+ #
90
+ # module Bar
91
+ # extend ActiveSupport::Concern
92
+ # include Foo
93
+ #
94
+ # included do
95
+ # self.method_injected_by_foo
96
+ # end
97
+ # end
98
+ #
99
+ # class Host
100
+ # include Bar # It works, now Bar takes care of its dependencies
101
+ # end
102
+ module Concern
103
+ class MultipleIncludedBlocks < StandardError #:nodoc:
104
+ def initialize
105
+ super "Cannot define multiple 'included' blocks for a Concern"
106
+ end
107
+ end
108
+
109
+ def self.extended(base) #:nodoc:
110
+ base.instance_variable_set(:@_dependencies, [])
111
+ end
112
+
113
+ def append_features(base)
114
+ if base.instance_variable_defined?(:@_dependencies)
115
+ base.instance_variable_get(:@_dependencies) << self
116
+ return false
117
+ else
118
+ return false if base < self
119
+ @_dependencies.each { |dep| base.send(:include, dep) }
120
+ super
121
+ base.extend const_get(:ClassMethods) if const_defined?(:ClassMethods)
122
+ base.class_eval(&@_included_block) if instance_variable_defined?(:@_included_block)
123
+ end
124
+ end
125
+
126
+ def included(base = nil, &block)
127
+ if base.nil?
128
+ fail MultipleIncludedBlocks if instance_variable_defined?(:@_included_block)
129
+
130
+ @_included_block = block
131
+ else
132
+ super
133
+ end
134
+ end
135
+
136
+ def class_methods(&class_methods_module_definition)
137
+ if const_defined?(:ClassMethods, false)
138
+ mod = const_get(:ClassMethods)
139
+ else
140
+ mod = const_set(:ClassMethods, Module.new)
141
+ end
142
+
143
+ mod.module_eval(&class_methods_module_definition)
144
+ end
145
+ end
146
+ end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ module RestClient
4
+ class Request
5
+ def default_headers
6
+ { content_type: :json, source: 'fir-cli', version: FIR::VERSION }
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,79 @@
1
+ # encoding: utf-8
2
+
3
+ class Hash
4
+ # Returns a copy of self with all blank keys removed.
5
+ #
6
+ # hash = { name: 'Rob', age: '', title: nil }
7
+ #
8
+ # hash.compact
9
+ # # => { name: 'Rob' }
10
+ def compact
11
+ delete_if { |_, v| v.is_a?(FalseClass) ? false : v.blank? }
12
+ end
13
+
14
+ # Returns a new hash with all keys converted using the block operation.
15
+ #
16
+ # hash = { name: 'Rob', age: '28' }
17
+ #
18
+ # hash.transform_keys{ |key| key.to_s.upcase }
19
+ # # => {"NAME"=>"Rob", "AGE"=>"28"}
20
+ def transform_keys
21
+ return enum_for(:transform_keys) unless block_given?
22
+ result = self.class.new
23
+ each_key do |key|
24
+ result[yield(key)] = self[key]
25
+ end
26
+ result
27
+ end
28
+
29
+ # Returns a new hash with all keys converted to symbols, as long as
30
+ # they respond to +to_sym+.
31
+ #
32
+ # hash = { 'name' => 'Rob', 'age' => '28' }
33
+ #
34
+ # hash.symbolize_keys
35
+ # # => {:name=>"Rob", :age=>"28"}
36
+ def symbolize_keys
37
+ transform_keys { |key| key.to_sym rescue key }
38
+ end
39
+
40
+ # Returns a new hash with all keys converted by the block operation.
41
+ # This includes the keys from the root hash and from all
42
+ # nested hashes and arrays.
43
+ #
44
+ # hash = { person: { name: 'Rob', age: '28' } }
45
+ #
46
+ # hash.deep_transform_keys{ |key| key.to_s.upcase }
47
+ # # => {"PERSON"=>{"NAME"=>"Rob", "AGE"=>"28"}}
48
+ def deep_transform_keys(&block)
49
+ _deep_transform_keys_in_object(self, &block)
50
+ end
51
+
52
+ # Returns a new hash with all keys converted to symbols, as long as
53
+ # they respond to +to_sym+. This includes the keys from the root hash
54
+ # and from all nested hashes and arrays.
55
+ #
56
+ # hash = { 'person' => { 'name' => 'Rob', 'age' => '28' } }
57
+ #
58
+ # hash.deep_symbolize_keys
59
+ # # => {:person=>{:name=>"Rob", :age=>"28"}}
60
+ def deep_symbolize_keys
61
+ deep_transform_keys { |key| key.to_sym rescue key }
62
+ end
63
+
64
+ private
65
+
66
+ # support methods for deep transforming nested hashes and arrays
67
+ def _deep_transform_keys_in_object(object, &block)
68
+ case object
69
+ when Hash
70
+ object.each_with_object({}) do |(key, value), result|
71
+ result[yield(key)] = _deep_transform_keys_in_object(value, &block)
72
+ end
73
+ when Array
74
+ object.map { |e| _deep_transform_keys_in_object(e, &block) }
75
+ else
76
+ object
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+
3
+ class Object
4
+ # Returns a hash with string keys that maps instance variable names without "@" to their
5
+ # corresponding values.
6
+ #
7
+ # class C
8
+ # def initialize(x, y)
9
+ # @x, @y = x, y
10
+ # end
11
+ # end
12
+ #
13
+ # C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
14
+ def instance_values
15
+ Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] }]
16
+ end
17
+
18
+ # Returns an array of instance variable names as strings including "@".
19
+ #
20
+ # class C
21
+ # def initialize(x, y)
22
+ # @x, @y = x, y
23
+ # end
24
+ # end
25
+ #
26
+ # C.new(0, 1).instance_variable_names # => ["@y", "@x"]
27
+ def instance_variable_names
28
+ instance_variables.map { |var| var.to_s }
29
+ end
30
+ end
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ class File
4
+ class << self
5
+ # A binary file is Mach-O dSYM
6
+ #
7
+ # @return [true, false]
8
+ def dsym?(file_path)
9
+ !(`file -b #{file_path}` =~ /dSYM/).nil?
10
+ end
11
+
12
+ # A file is ASCII text
13
+ #
14
+ # @return [true, false]
15
+ def text?(file_path)
16
+ !(`file -b #{file_path}` =~ /text/).nil?
17
+ end
18
+ end
19
+ end
20
+
21
+ class String
22
+ # Convert String encoding to UTF-8
23
+ #
24
+ # @return string
25
+ def to_utf8
26
+ encode(Encoding.find('UTF-8'), invalid: :replace, undef: :replace, replace: '')
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ module OS
4
+ class << self
5
+
6
+ def windows?
7
+ !(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM).nil?
8
+ end
9
+
10
+ def mac?
11
+ !(/darwin/ =~ RUBY_PLATFORM).nil?
12
+ end
13
+
14
+ def unix?
15
+ !OS.windows?
16
+ end
17
+
18
+ def linux?
19
+ OS.unix? && !OS.mac?
20
+ end
21
+
22
+ def set_locale
23
+ system 'export LC_ALL=en_US.UTF-8'
24
+ system 'export LC_CTYPE=en_US.UTF-8'
25
+ system 'export LANG=en_US.UTF-8'
26
+ end
27
+ end
28
+ end