gonative-cli 1.3.8 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 072f9e786f31e758f24a6680f91bcec7303990eb5c78d58fd3fd54acef04d015
4
- data.tar.gz: 4bd8ae73721d0dd614cd161b3a6b86715fe5fc371a3361eb7d871a3e0b40f9e2
3
+ metadata.gz: 16b3c19dee4afcbb644ea40184c8148ea90afba067e35c5497440fedd860d8b3
4
+ data.tar.gz: 46d0665eaa153382c087e1d9201268053e9084c9f725662b1f54ab0774018ee3
5
5
  SHA512:
6
- metadata.gz: 9bdb027fe9bd03782c16012fbf596d14b6090d7ac6e0d0d42088fb29a74beedaccf46cdf041aebd56794f14c8efbfa88adbc73ef3f677f73c461c9157e7ed2d5
7
- data.tar.gz: ba970e1b131a3403231c8b8e79f31c32df160336b1b4a7c0e29afb18cc807f152a4e314c2b75684a6163cb231fdf84983662aea40a35a559929f0f837b2fac23
6
+ metadata.gz: 903ebef8bf1a1aead292f33cfc5abc9145144996eb36053251fc2299089e9bcf0d04c342fd723c316eff7516f78e4fe41dff02960a58a3f5c03ae7e97c8e63e0
7
+ data.tar.gz: 63a0957d99e2b85cae86ddff6463ad84c46ced61d9e9dd1ce20a029dbf561af0bb114a024886acd2c72f58a0ce9d51e33cfbcc2265c83d7d773056a56256f1fe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gonative-cli (1.3.7)
4
+ gonative-cli (1.4.0)
5
5
  activesupport (~> 6.0)
6
6
  cocoapods (~> 1.10)
7
7
  colorize (~> 0.8.0)
@@ -29,10 +29,10 @@ GEM
29
29
  atomos (0.1.3)
30
30
  byebug (11.1.3)
31
31
  claide (1.1.0)
32
- cocoapods (1.14.3)
32
+ cocoapods (1.15.2)
33
33
  addressable (~> 2.8)
34
34
  claide (>= 1.0.2, < 2.0)
35
- cocoapods-core (= 1.14.3)
35
+ cocoapods-core (= 1.15.2)
36
36
  cocoapods-deintegrate (>= 1.0.3, < 2.0)
37
37
  cocoapods-downloader (>= 2.1, < 3.0)
38
38
  cocoapods-plugins (>= 1.0.0, < 2.0)
@@ -47,7 +47,7 @@ GEM
47
47
  nap (~> 1.0)
48
48
  ruby-macho (>= 2.3.0, < 3.0)
49
49
  xcodeproj (>= 1.23.0, < 2.0)
50
- cocoapods-core (1.14.3)
50
+ cocoapods-core (1.15.2)
51
51
  activesupport (>= 5.0, < 8)
52
52
  addressable (~> 2.8)
53
53
  algoliasearch (~> 1.0)
@@ -69,7 +69,7 @@ GEM
69
69
  coderay (1.1.3)
70
70
  colored2 (3.1.2)
71
71
  colorize (0.8.1)
72
- concurrent-ruby (1.2.2)
72
+ concurrent-ruby (1.2.3)
73
73
  diff-lcs (1.4.4)
74
74
  dry-cli (0.7.0)
75
75
  escape (0.0.4)
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Commands
5
+ module Android
6
+ module Helpers
7
+ module GradleVersionReader
8
+ def gradle_file
9
+ @gradle_file ||= `find . -maxdepth 2 -iname build.gradle`.split("\n").first
10
+ end
11
+
12
+ def version
13
+ return @version if @version
14
+
15
+ str = IO.read(gradle_file)
16
+ @version = str.match(/versionName\s+"(?<version>.+)"/)[:version]
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -5,6 +5,7 @@ module GoNative
5
5
  module Android
6
6
  class Publish < Base
7
7
  desc 'Used to update one of the android internal dependencies'
8
+ include Helpers::GradleVersionReader
8
9
 
9
10
  def call
10
11
  assert_build_file_exists!
@@ -12,36 +13,19 @@ module GoNative
12
13
  end
13
14
 
14
15
  def assert_build_file_exists!
15
- return unless gradle_files.empty?
16
+ return unless gradle_file.empty?
16
17
 
17
- raise Error, "No build.gradle file exists"
18
+ raise Error, 'No build.gradle file exists'
18
19
  end
19
20
 
20
21
  private
21
22
 
22
- def gradle_files
23
- @gradle_files ||= `find . -maxdepth 2 -iname build.gradle`.split("\n")
24
- end
25
-
26
- def version
27
- return @version if @version
28
-
29
- gradle_files.each do |gradle_file|
30
- str = IO.read(gradle_file)
31
- @version = str.match(/versionName\s+\"(?<version>.+)\"/)[:version]
32
-
33
- break if @version
34
- end
35
-
36
- @version
37
- end
38
-
39
23
  def create_and_push_tag!
40
- unless system("git tag | grep #{version} > /dev/null")
41
- system "git add -A && git commit -m \"Releases #{version}.\""
42
- system "git tag #{version}"
43
- system "git push && git push --tags"
44
- end
24
+ return if system("git tag | grep #{version} > /dev/null")
25
+
26
+ system "git add -A && git commit -m \"Releases #{version}.\""
27
+ system "git tag #{version}"
28
+ system 'git push && git push --tags'
45
29
  end
46
30
  end
47
31
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Commands
5
+ module Android
6
+ class Version < Base
7
+ desc 'Used to update one of the android internal dependencies'
8
+ include Helpers::GradleVersionReader
9
+
10
+ def call
11
+ Utils::UI.output(version)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Commands
5
+ module IOS
6
+ class AddFiles < Base
7
+ desc 'Add language to the project'
8
+
9
+ argument :path, required: true
10
+ def call(path:, **)
11
+ Plugins::IOS::AddFiles.call(path)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -14,8 +14,10 @@ module GoNative
14
14
  register 'ios rename', IOS::Rename
15
15
  register 'ios version', IOS::Version
16
16
  register 'ios add-language', IOS::AddLanguage
17
+ register 'ios add-files', IOS::AddFiles
17
18
 
18
19
  register 'android create', Android::Create
19
20
  register 'android publish', Android::Publish
21
+ register 'android version', Android::Version
20
22
  end
21
23
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'xcodeproj'
4
+
5
+ module GoNative
6
+ module Plugins
7
+ module IOS
8
+ class AddFiles
9
+ extend DSL::Serviceable
10
+
11
+ attr_reader :file_paths
12
+
13
+ def initialize(path)
14
+ @file_paths = Dir.glob(path)
15
+ end
16
+
17
+ def call
18
+ return if file_paths.empty?
19
+
20
+ project = Xcodeproj::Project.open('MedianIOS.xcodeproj')
21
+ target = project.native_targets.first
22
+
23
+ resources_directory = File.join(FileUtils.pwd, 'Resources')
24
+ FileUtils.mkdir_p(resources_directory)
25
+
26
+ resources_group = project.main_group['Resources'] || project.main_group.new_group('Resources')
27
+
28
+ file_paths.each do |file_path|
29
+ file_name = File.basename(file_path)
30
+ destination_path = File.join(resources_directory, file_name)
31
+ FileUtils.cp(file_path, destination_path)
32
+
33
+ relative_path = File.join('Resources', file_name)
34
+ file_ref = resources_group.new_file(relative_path)
35
+ target.resources_build_phase.add_file_reference(file_ref)
36
+ end
37
+
38
+ project.save
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GoNative
4
- VERSION = '1.3.8'
4
+ VERSION = '1.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gonative-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hunaid Hassan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-26 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-cli
@@ -188,8 +188,11 @@ files:
188
188
  - lib/gonative.rb
189
189
  - lib/gonative/commands.rb
190
190
  - lib/gonative/commands/android/create.rb
191
+ - lib/gonative/commands/android/helpers/gradle_version_reader.rb
191
192
  - lib/gonative/commands/android/publish.rb
193
+ - lib/gonative/commands/android/version.rb
192
194
  - lib/gonative/commands/base.rb
195
+ - lib/gonative/commands/ios/add_files.rb
193
196
  - lib/gonative/commands/ios/add_language.rb
194
197
  - lib/gonative/commands/ios/create.rb
195
198
  - lib/gonative/commands/ios/embed_extensions.rb
@@ -203,6 +206,7 @@ files:
203
206
  - lib/gonative/dsl/error_catchable.rb
204
207
  - lib/gonative/dsl/serviceable.rb
205
208
  - lib/gonative/plugins/android/create.rb
209
+ - lib/gonative/plugins/ios/add_files.rb
206
210
  - lib/gonative/plugins/ios/add_language.rb
207
211
  - lib/gonative/plugins/ios/build_framework.rb
208
212
  - lib/gonative/plugins/ios/create.rb