cocoapods-embed-flutter 0.6.0 → 0.6.1

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: 2a64be69df26a945c384cd9c91456396a1dae3542120763103cea1ea95906c62
4
- data.tar.gz: 379fd07871bf85cddaf9f3287d08d92e5ef82a31502a81929f14804de9744db6
3
+ metadata.gz: cff1bb110d17430843c65f81a08a8667932ec8dbbf825d3d6e06265bda88b19b
4
+ data.tar.gz: 3aa62f67bbca421ed63029fb60aa24c41b58bdd2b65cdeb595ac67166453c0c6
5
5
  SHA512:
6
- metadata.gz: 81f87e0aa277b5eedbd585a6db5c026f08a06913f24e11a3037ffe5226a2bdccdac5c96339fa5cfde605896a276708ee8ce0d89ffe47769aa584ed211e0b25d6
7
- data.tar.gz: 29648b77e626389b0a41e8f4548797935d9ce98638ac267dc41594652518ad69e2b22a4a4f353e2a35781b3e25133a16d9b43682d87c355fe1b82b7e140c48b6
6
+ metadata.gz: 4c514345f8b67b9f3cc6acc4859b090dd1546ebb4d5cb13a7f5bc20921862041a49a2e03bf4195633cb2498b9d6769b888734f1639dcdd27f729744b783a0ab4
7
+ data.tar.gz: 4b916e131d5a74ba7aae72eabdeb8e3b740aed7c2320bc102aec8b9180ba6b152aa833326d30023c06268ac5c4b1d7772c5e6c141a9acc19cde8d081f609dd10
data/CHANGELOG.md CHANGED
@@ -1,81 +1,103 @@
1
+ ### [0.6.1](https://github.com/DartBuild/cocoapods-embed-flutter/compare/v0.6.0...v0.6.1) (2022-05-03)
2
+
3
+
4
+ ### 🛠 Dependency
5
+
6
+ * bump cocoapods-downloader from 1.5.1 to 1.6.3 ([#5](https://github.com/DartBuild/cocoapods-embed-flutter/issues/5)) ([8067f06](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8067f062ab268fcc588e60c5cf54c3fe4da1d3e2))
7
+ * bump nokogiri from 1.13.3 to 1.13.4 ([#7](https://github.com/DartBuild/cocoapods-embed-flutter/issues/7)) ([975638e](https://github.com/DartBuild/cocoapods-embed-flutter/commit/975638ecda2fc65f4141d1e0a37f08a775692984))
8
+
9
+
10
+ ### 💡 Continuous Integration
11
+
12
+ * add codeql scanning ([3120c44](https://github.com/DartBuild/cocoapods-embed-flutter/commit/3120c446adf3bce9b80fe07a0d57ca79d7adfe7e))
13
+ * **Deps:** bump @actions/core from 1.6.0 to 1.7.0 in /.github/config ([#8](https://github.com/DartBuild/cocoapods-embed-flutter/issues/8)) ([a3861ad](https://github.com/DartBuild/cocoapods-embed-flutter/commit/a3861ad7223c5d9a2021b15359d158a7c9ea2705))
14
+ * **Deps:** bump semver from 7.3.5 to 7.3.7 in /.github/config ([#9](https://github.com/DartBuild/cocoapods-embed-flutter/issues/9)) ([36f2599](https://github.com/DartBuild/cocoapods-embed-flutter/commit/36f2599074c2a4e13bbd07680cc0cb208fe7ee97))
15
+ * **Deps:** bump subosito/flutter-action from 2.3.0 to 2.4.0 ([#10](https://github.com/DartBuild/cocoapods-embed-flutter/issues/10)) ([2e6c1c1](https://github.com/DartBuild/cocoapods-embed-flutter/commit/2e6c1c108bc4dc44e25844d13fd0bb86639bba2e))
16
+ * **Runners:** added self hosted macos runner ([3371c29](https://github.com/DartBuild/cocoapods-embed-flutter/commit/3371c294ea34f2fa123e4ebb6ae368311e5dfb8b))
17
+
18
+
19
+ ### 🐎 Performance Improvements
20
+
21
+ * allow concurrent `flutter pub get` ([ef5bc8a](https://github.com/DartBuild/cocoapods-embed-flutter/commit/ef5bc8a7daa0eada810210e481f0be708182192c))
22
+
1
23
  ## [0.6.0](https://github.com/DartBuild/cocoapods-embed-flutter/compare/v0.5.3...v0.6.0) (2022-03-27)
2
24
 
3
25
 
4
26
  ### 📚 Documentation
5
27
 
6
- * **README:** add pub.dev limitation ([8f955f3](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8f955f36519b1e5eeac89ffebd660a5f84f9983b))
28
+ * **README:** add pub.dev limitation ([f42de7c](https://github.com/DartBuild/cocoapods-embed-flutter/commit/f42de7c908d65661bb12e8becc6fc6941295d19a))
7
29
 
8
30
 
9
31
  ### 🛠 Dependency
10
32
 
11
- * bump cocoapods from 1.11.2 to 1.11.3 ([#4](https://github.com/DartBuild/cocoapods-embed-flutter/issues/4)) ([152737d](https://github.com/DartBuild/cocoapods-embed-flutter/commit/152737dd77852ef6937b5f458019e6535a426755))
33
+ * bump cocoapods from 1.11.2 to 1.11.3 ([#4](https://github.com/DartBuild/cocoapods-embed-flutter/issues/4)) ([8cec1cb](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8cec1cbe4c18dd20d155d5b1b8824ae7910a11c3))
12
34
 
13
35
 
14
36
  ### 💄 Styles
15
37
 
16
- * add vscode extensions recommendation ([4f021fb](https://github.com/DartBuild/cocoapods-embed-flutter/commit/4f021fbfa75dd58d1257c43ea3d19cb68b8a19e6))
38
+ * add vscode extensions recommendation ([db4bdb5](https://github.com/DartBuild/cocoapods-embed-flutter/commit/db4bdb58765851cabfdf16254678301b149faceb))
17
39
 
18
40
 
19
41
  ### 🚀 Features
20
42
 
21
- * allow specifying different path for remote sources ([bc9c850](https://github.com/DartBuild/cocoapods-embed-flutter/commit/bc9c8509f90ef88248b56361794b6f8f1182a082))
43
+ * allow specifying different path for remote sources ([56178ed](https://github.com/DartBuild/cocoapods-embed-flutter/commit/56178ed645a476e19b77377c246ce90de582b5ef))
22
44
 
23
45
  ### [0.5.3](https://github.com/DartBuild/cocoapods-embed-flutter/compare/v0.5.2...v0.5.3) (2022-03-18)
24
46
 
25
47
 
26
48
  ### 📚 Documentation
27
49
 
28
- * **README:** add limitations ([9133edc](https://github.com/DartBuild/cocoapods-embed-flutter/commit/9133edc006973892b2e55ef13a30f6ae8e8b7ad4))
50
+ * **README:** add limitations ([8830ead](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8830eadfbb46ddbce83a2bf329bc04fa3cfe2583))
29
51
 
30
52
  ### [0.5.2](https://github.com/DartBuild/cocoapods-embed-flutter/compare/v0.5.1...v0.5.2) (2022-03-12)
31
53
 
32
54
 
33
55
  ### 📚 Documentation
34
56
 
35
- * add helpful links and badges ([4ab6983](https://github.com/DartBuild/cocoapods-embed-flutter/commit/4ab69837d5057a0049e1533a00c6209556aec5b0))
57
+ * add helpful links and badges ([8fb5253](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8fb52531d66782525ae10a36bd7c1a5a062c02a4))
36
58
 
37
59
 
38
60
  ### 💡 Continuous Integration
39
61
 
40
- * **Deps:** bump actions/checkout from 2 to 3 ([#2](https://github.com/DartBuild/cocoapods-embed-flutter/issues/2)) ([3d1ca07](https://github.com/DartBuild/cocoapods-embed-flutter/commit/3d1ca0732a87e04561bc68ba1bbfc337173cd783))
41
- * **Deps:** bump actions/setup-node from 2 to 3 ([#3](https://github.com/DartBuild/cocoapods-embed-flutter/issues/3)) ([efd8f1a](https://github.com/DartBuild/cocoapods-embed-flutter/commit/efd8f1a82ce8ca6cd12adc1e5ca943a316a44b03))
62
+ * **Deps:** bump actions/checkout from 2 to 3 ([#2](https://github.com/DartBuild/cocoapods-embed-flutter/issues/2)) ([7fddfd6](https://github.com/DartBuild/cocoapods-embed-flutter/commit/7fddfd663a74e6390cddcee979b211e55daf18bb))
63
+ * **Deps:** bump actions/setup-node from 2 to 3 ([#3](https://github.com/DartBuild/cocoapods-embed-flutter/issues/3)) ([0af3476](https://github.com/DartBuild/cocoapods-embed-flutter/commit/0af34765e384d87fc257a9ddef2015faff393bad))
42
64
 
43
65
  ### [0.5.1](https://github.com/DartBuild/cocoapods-embed-flutter/compare/v0.5.0...v0.5.1) (2022-03-11)
44
66
 
45
67
 
46
68
  ### 📚 Documentation
47
69
 
48
- * add code documentation ([87c06fd](https://github.com/DartBuild/cocoapods-embed-flutter/commit/87c06fd45d3c63a94cda6ce3ae00a200f412bb2a))
70
+ * add code documentation ([dd8d3da](https://github.com/DartBuild/cocoapods-embed-flutter/commit/dd8d3dafc3da6d68fa365d5580e89fc460cf9d94))
49
71
 
50
- ## [0.5.0](https://github.com/DartBuild/cocoapods-embed-flutter/compare/3358c2b251f51154010990b95b7eaa741049d707...v0.5.0) (2022-03-11)
72
+ ## [0.5.0](https://github.com/DartBuild/cocoapods-embed-flutter/compare/1ad9f80188b2fa296933af35e6902ffcd6db001e...v0.5.0) (2022-03-11)
51
73
 
52
74
 
53
75
  ### 🚀 Features
54
76
 
55
- * add all remotes supported by `cocoapods-downloader` ([019d4c5](https://github.com/DartBuild/cocoapods-embed-flutter/commit/019d4c5298eaf52061fbcf6f264102419bc7e51e))
56
- * allow local flutter module to be declared dependency ([3358c2b](https://github.com/DartBuild/cocoapods-embed-flutter/commit/3358c2b251f51154010990b95b7eaa741049d707))
77
+ * add all remotes supported by `cocoapods-downloader` ([e01ea82](https://github.com/DartBuild/cocoapods-embed-flutter/commit/e01ea8212d71b10a78390c187b5e8f351a09114b))
78
+ * allow local flutter module to be declared dependency ([1ad9f80](https://github.com/DartBuild/cocoapods-embed-flutter/commit/1ad9f80188b2fa296933af35e6902ffcd6db001e))
57
79
 
58
80
 
59
81
  ### ✅ Tests
60
82
 
61
- * add app info tests ([2d3f341](https://github.com/DartBuild/cocoapods-embed-flutter/commit/2d3f341299344a16262952bd24306cff479ff74b))
83
+ * add app info tests ([269cb54](https://github.com/DartBuild/cocoapods-embed-flutter/commit/269cb5439c2a6912346187b2612de6b38345b738))
62
84
 
63
85
 
64
86
  ### 💡 Continuous Integration
65
87
 
66
- * add dependabot config ([918b9e6](https://github.com/DartBuild/cocoapods-embed-flutter/commit/918b9e6c1680b91401184289c394f5ba93a80f43))
67
- * add flutter setup task ([2d7ff61](https://github.com/DartBuild/cocoapods-embed-flutter/commit/2d7ff61a1d71b4db4ca10f49a2e03738f9f711aa))
68
- * add publish to cocoapods repo task ([7e620f2](https://github.com/DartBuild/cocoapods-embed-flutter/commit/7e620f24a5b13b126221645b6ec61f5f55b75ea5))
69
- * fix bundle install on older macos ([f5e4843](https://github.com/DartBuild/cocoapods-embed-flutter/commit/f5e484334dfd2d40a132e627524505485a295195))
70
- * fix bundler error on linux ([0e3e4eb](https://github.com/DartBuild/cocoapods-embed-flutter/commit/0e3e4eb505f72564e9b271f0e999ac7af38686a3))
71
- * fix depandabot config spec violation ([aeaab36](https://github.com/DartBuild/cocoapods-embed-flutter/commit/aeaab365f3552848e86b25f2d6b26f79fabe86e0))
72
- * fix pod install ([508d695](https://github.com/DartBuild/cocoapods-embed-flutter/commit/508d6956313ec8f81f36adf9b1c95d5a4eebbbbb))
73
- * setup CI/CD pipeline ([c6fdfca](https://github.com/DartBuild/cocoapods-embed-flutter/commit/c6fdfcac64c7e57a4dc3d4ae2cb517bf745cb6b6))
74
- * setup flutter for ios ([9228bdb](https://github.com/DartBuild/cocoapods-embed-flutter/commit/9228bdbcf673a302d41089d1226d4caf54399265))
88
+ * add dependabot config ([67099bd](https://github.com/DartBuild/cocoapods-embed-flutter/commit/67099bd490fbce0879e4aa6ddd93839847ff7e87))
89
+ * add flutter setup task ([d5aeda3](https://github.com/DartBuild/cocoapods-embed-flutter/commit/d5aeda30817f81ed6ef2f1e9e21f8e2b8f415e20))
90
+ * add publish to cocoapods repo task ([8bbac4d](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8bbac4d24ed5a1e862a2531067aa8a62c5072849))
91
+ * fix bundle install on older macos ([70522ea](https://github.com/DartBuild/cocoapods-embed-flutter/commit/70522eaa46a07c872e727c4f6c774d0444d516cc))
92
+ * fix bundler error on linux ([a18435a](https://github.com/DartBuild/cocoapods-embed-flutter/commit/a18435a4efca56e62c70367b810fe1dc48cce5cf))
93
+ * fix depandabot config spec violation ([7846c67](https://github.com/DartBuild/cocoapods-embed-flutter/commit/7846c67856a1ec7df92275ae887a80ba3413f4d8))
94
+ * fix pod install ([61954c9](https://github.com/DartBuild/cocoapods-embed-flutter/commit/61954c912c6609a375920fccf8bbbf2d6aaa5e0e))
95
+ * setup CI/CD pipeline ([3e20bc9](https://github.com/DartBuild/cocoapods-embed-flutter/commit/3e20bc9d41be80b3a95077e1c7df8e6f0f83d6b7))
96
+ * setup flutter for ios ([d76deb2](https://github.com/DartBuild/cocoapods-embed-flutter/commit/d76deb220e3c0e60303b1b5676bbac24e7dc407f))
75
97
 
76
98
 
77
99
  ### 📚 Documentation
78
100
 
79
- * add code level documentation ([e064192](https://github.com/DartBuild/cocoapods-embed-flutter/commit/e0641922527a814c6635d31b93470367792db084))
80
- * **README:** add usage details ([8935bce](https://github.com/DartBuild/cocoapods-embed-flutter/commit/8935bce01387748e503b0d0f0b64a2573f557bce))
101
+ * add code level documentation ([f3c04ed](https://github.com/DartBuild/cocoapods-embed-flutter/commit/f3c04ed6fddab8901511530014282006beb11e8f))
102
+ * **README:** add usage details ([52852ae](https://github.com/DartBuild/cocoapods-embed-flutter/commit/52852aed76005285a8059bd1adb580a169d7463f))
81
103
 
data/Gemfile CHANGED
@@ -4,13 +4,10 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development do
7
- gem 'cocoapods'
8
- gem 'cocoapods-plugins'
9
- gem 'github_api'
10
-
11
7
  gem 'mocha'
12
8
  gem 'bacon'
13
9
  gem 'mocha-on-bacon'
14
10
  gem 'prettybacon'
15
11
  gem 'solargraph'
12
+ gem 'github_api'
16
13
  end
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cocoapods-embed-flutter (0.6.0)
4
+ cocoapods-embed-flutter (0.6.1)
5
5
  cocoapods
6
+ concurrent-ruby
6
7
  fileutils
7
8
  yaml
8
9
 
@@ -11,7 +12,7 @@ GEM
11
12
  specs:
12
13
  CFPropertyList (3.0.5)
13
14
  rexml
14
- activesupport (6.1.5)
15
+ activesupport (6.1.5.1)
15
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
17
  i18n (>= 1.6, < 2)
17
18
  minitest (>= 5.1)
@@ -57,7 +58,7 @@ GEM
57
58
  public_suffix (~> 4.0)
58
59
  typhoeus (~> 1.0)
59
60
  cocoapods-deintegrate (1.0.5)
60
- cocoapods-downloader (1.5.1)
61
+ cocoapods-downloader (1.6.3)
61
62
  cocoapods-plugins (1.0.0)
62
63
  nap
63
64
  cocoapods-search (1.0.1)
@@ -66,7 +67,7 @@ GEM
66
67
  netrc (~> 0.11)
67
68
  cocoapods-try (1.2.0)
68
69
  colored2 (3.1.2)
69
- concurrent-ruby (1.1.9)
70
+ concurrent-ruby (1.1.10)
70
71
  descendants_tracker (0.0.4)
71
72
  thread_safe (~> 0.3, >= 0.3.1)
72
73
  diff-lcs (1.5.0)
@@ -130,11 +131,11 @@ GEM
130
131
  nanaimo (0.3.0)
131
132
  nap (1.1.0)
132
133
  netrc (0.11.0)
133
- nokogiri (1.13.3-arm64-darwin)
134
+ nokogiri (1.13.4-arm64-darwin)
134
135
  racc (~> 1.4)
135
- nokogiri (1.13.3-x86_64-darwin)
136
+ nokogiri (1.13.4-x86_64-darwin)
136
137
  racc (~> 1.4)
137
- nokogiri (1.13.3-x86_64-linux)
138
+ nokogiri (1.13.4-x86_64-linux)
138
139
  racc (~> 1.4)
139
140
  oauth2 (1.4.9)
140
141
  faraday (>= 0.17.3, < 3.0)
@@ -214,9 +215,7 @@ PLATFORMS
214
215
  DEPENDENCIES
215
216
  bacon
216
217
  bundler
217
- cocoapods
218
218
  cocoapods-embed-flutter!
219
- cocoapods-plugins
220
219
  github_api
221
220
  mocha
222
221
  mocha-on-bacon
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
- # cocoapods-embed-flutter
1
+ # CocoaPods Embed Flutter
2
2
 
3
3
  [![CI/CD](https://github.com/DartBuild/cocoapods-embed-flutter/actions/workflows/main.yml/badge.svg?branch=main&event=push)](https://github.com/DartBuild/cocoapods-embed-flutter/actions/workflows/main.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/cocoapods-embed-flutter.svg)](http://badge.fury.io/rb/cocoapods-embed-flutter)
5
5
  [![Code Climate](https://codeclimate.com/github/DartBuild/cocoapods-embed-flutter.png)](https://codeclimate.com/github/DartBuild/cocoapods-embed-flutter)
6
+ [![CodeQL](https://github.com/DartBuild/cocoapods-embed-flutter/actions/workflows/codeql-analysis.yml/badge.svg?event=push)](https://github.com/DartBuild/cocoapods-embed-flutter/actions/workflows/codeql-analysis.yml)
6
7
 
7
8
  Straight forward way of declaring flutter modules as dependency for targets, just like cocoapods does with pods.
8
9
 
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_runtime_dependency 'yaml'
28
28
  spec.add_runtime_dependency 'fileutils'
29
29
  spec.add_runtime_dependency 'cocoapods'
30
+ spec.add_runtime_dependency 'concurrent-ruby'
30
31
 
31
32
  spec.add_development_dependency 'bundler'
32
33
  spec.add_development_dependency 'rake'
@@ -27,10 +27,10 @@ module Flutter
27
27
  # @param [String, Hash] requirements
28
28
  # the requirements for dependency as declred in `pubspec`
29
29
  #
30
- # @param [Spec] parent_specification
30
+ # @param [Spec] parent_spec
31
31
  # the parent specification where dependency declared
32
32
  #
33
- # @param [Boolean] is_dev_dependency
33
+ # @param [Boolean] dev_dependency
34
34
  # Whether the dependency only required during development
35
35
  #
36
36
  def initialize(name, requirements, parent_spec, dev_dependency = false)
@@ -48,10 +48,10 @@ module Flutter
48
48
  # @param [Hash] hash declared in `dependencies` or `dev_dependencies`
49
49
  # section in `pubspec.yaml` file
50
50
  #
51
- # @param [Spec] parent_specification
51
+ # @param [Spec] parent_spec
52
52
  # the parent specification where dependency declared
53
53
  #
54
- # @param [Boolean] is_dev_dependency
54
+ # @param [Boolean] dev_dependency
55
55
  # Whether the dependency only required during development
56
56
  #
57
57
  # @return [Array<Dependency>] dependencies from hash declared in `dependencies`
@@ -74,14 +74,29 @@ module Flutter
74
74
  Spec.find(name, File.expand_path(path, File.dirname(parent_spec.defined_in_file)))
75
75
  end
76
76
 
77
- # Install this dependency for the parent project.
77
+ # Concurrently install this dependency for the parent project.
78
78
  #
79
- # @return [void]
79
+ # @return [Concurrent::Promises::Future, Nil]
80
+ # {Nil} if not a local dependency, otherwise
81
+ # returns future for {#spec}'s {Spec#pub_get pub_get} task.
80
82
  #
81
83
  def install
82
- spec.setup if local?
84
+ spec.pub_get if local?
83
85
  end
84
86
 
87
+ # Allows accessing top level values in
88
+ # {https://dart.dev/tools/pub/dependencies dependency requirements},
89
+ # if {#requirements} type is {Hash}, i.e. path, git etc.
90
+ #
91
+ # @param [Symbol] m
92
+ # top level key value to access, i.e. path, git etc.
93
+ #
94
+ # @return depending on accessed value type in {#requirements}.
95
+ #
96
+ # @raise [NoMethodError] if no method or custom attribute exists by
97
+ # the attribute name in {#requirements} or {#requirements}
98
+ # is not a {Hash}.
99
+ #
85
100
  def method_missing(m, *args, &block)
86
101
  if requirements.is_a?(Hash) && requirements.include?(m.to_s)
87
102
  return requirements[m.to_s]
@@ -3,6 +3,9 @@ require 'fileutils'
3
3
 
4
4
  module Flutter
5
5
  module Pub
6
+ # The Downloader modules name-spaces all the classes and methods
7
+ # for downloading and caching remote Flutter projects.
8
+ #
6
9
  module Downloader
7
10
  # Downloads a package from the given `request` to the given `target` location.
8
11
  #
@@ -41,7 +41,7 @@ module Flutter
41
41
  if SOURCE_KEYS.keys.any? { |key| options.key?(key) }
42
42
  source = DownloaderSource.new(name, options, Pod::Config.instance.podfile_path)
43
43
  source.fetch(Pod::Config.instance.sandbox)
44
- path = source.normalized_pupspec_path
44
+ path = source.normalized_pubspec_path
45
45
  elsif options.key?(:path)
46
46
  path = options[:path]
47
47
  else
@@ -137,7 +137,7 @@ module Flutter
137
137
  # @note If the declared path is expanded only if the represents a path
138
138
  # relative to the file system.
139
139
  #
140
- def normalized_pupspec_path(declared_path)
140
+ def normalized_pubspec_path(declared_path)
141
141
  Spec.find_file(name, declared_path)
142
142
  end
143
143
 
@@ -147,7 +147,7 @@ module Flutter
147
147
  # @return [String] The uri of the pubspec appending the name of the file
148
148
  # and expanding it if necessary.
149
149
  #
150
- def normalized_pupspec_path
150
+ def normalized_pubspec_path
151
151
  search_path = params[:path].nil? ? target : File.expand_path(params[:path], target)
152
152
  Spec.find_file(name, search_path)
153
153
  end
@@ -1,5 +1,8 @@
1
1
  require 'cocoapods-embed-flutter/flutter'
2
2
  require 'yaml'
3
+ require 'open3'
4
+ require 'concurrent'
5
+ require 'cocoapods'
3
6
 
4
7
  module Flutter
5
8
  module Pub
@@ -43,7 +46,8 @@ module Flutter
43
46
 
44
47
  if File.basename(path) == Pub::SPEC_FILE
45
48
  return path
46
- elsif Dir.exists?(File.expand_path(name, path)) && File.exists?(File.expand_path(Pub::SPEC_FILE, File.expand_path(name, path)))
49
+ elsif Dir.exists?(File.expand_path(name, path)) &&
50
+ File.exists?(File.expand_path(Pub::SPEC_FILE, File.expand_path(name, path)))
47
51
  return File.expand_path(Pub::SPEC_FILE, File.expand_path(name, path))
48
52
  elsif File.exists?(File.expand_path(Pub::SPEC_FILE, path))
49
53
  return File.expand_path(Pub::SPEC_FILE, path)
@@ -88,7 +92,7 @@ module Flutter
88
92
  end
89
93
 
90
94
  # @return [String] the path to the flutter project
91
- # dependencies cache file.
95
+ # dependencies cache file.
92
96
  #
93
97
  def package_cache_path
94
98
  File.join(project_path, Pub::TOOL_DIR, Pub::CACHE_FILE)
@@ -101,7 +105,7 @@ module Flutter
101
105
  end
102
106
 
103
107
  # @return [Array<Dependency>] the list of all the projects this
104
- # specification depends upon and are included in app release.
108
+ # specification depends upon and are included in app release.
105
109
  #
106
110
  def dependencies
107
111
  return [] unless @data.include?('dependencies')
@@ -123,37 +127,66 @@ module Flutter
123
127
  dependencies + dev_dependencies
124
128
  end
125
129
 
126
- # @return [Boolean] If the flutter project for this specification
127
- # has all its dependencies installed.
130
+ # Runs `flutter pub get` on project directory concurrently.
128
131
  #
129
- def setup?
130
- File.exists?(package_cache_path) && (!module? || File.exists?(pod_helper_path))
132
+ # @return [Concurrent::Promises::Future, Nil]
133
+ # {Nil} if `pub get` running/completed, otherwise
134
+ # runs `flutter pub get` task in background
135
+ # and returns its future.
136
+ #
137
+ def pub_get
138
+ future = @@current_pubgets[self]
139
+ return nil if !future.nil?
140
+ future = Concurrent::Promises.future do
141
+ stdout, stderr, status = Open3.capture3('flutter pub get', :chdir => self.project_path)
142
+ :result
143
+ end
144
+ @@current_pubgets[self] = future
145
+ return Concurrent::Promises.zip(future, *all_dependencies.map(&:install).compact)
131
146
  end
132
147
 
133
- # Sets up the project installing all specified dependencies.
148
+ # See if two {Spec} instances refer to the same pubspecs.
134
149
  #
135
- # @return [void]
150
+ # @return [Boolean] whether or not the two {Spec} instances refer to the
151
+ # same projects.
136
152
  #
137
- def setup
138
- return if setup?
139
- pup_get
140
- all_dependencies.each(&:install)
153
+ def ==(other)
154
+ self.class === other &&
155
+ other.defined_in_file == defined_in_file &&
156
+ other.instance_variable_get(:@data) == @data
141
157
  end
142
158
 
143
- # Runs `flutter pub get` on project directory.
144
- #
145
- # @return [void]
159
+ # @return [Fixnum] A hash identical for equals objects.
146
160
  #
147
- def pup_get
148
- Dir.chdir(project_path) { |path| system('flutter pub get', exception: true) }
161
+ def hash
162
+ [defined_in_file, @data].hash
149
163
  end
150
164
 
165
+ alias eql? ==
166
+
167
+ # Allows accessing top level values in `pubspec.yaml`,
168
+ # i.e. name, description, version etc.
169
+ #
170
+ # @param [Symbol] m
171
+ # top level key value to access,
172
+ # i.e. name, description etc.
173
+ #
174
+ # @return depending on accessed value type in `pubspec.yaml`.
175
+ #
176
+ # @raise [NoMethodError] if no method or custom attribute exists by
177
+ # the attribute name in pubspec.
178
+ #
151
179
  def method_missing(m, *args, &block)
152
180
  if @data.include?(m.to_s)
153
181
  return @data[m.to_s]
154
182
  end
155
183
  super.method_missing(m, *args, &block)
156
184
  end
185
+
186
+ private
187
+
188
+ # A hash containing all `pub get` promises.
189
+ @@current_pubgets = {}
157
190
  end
158
191
  end
159
192
  end
@@ -4,5 +4,5 @@
4
4
  module CocoapodsEmbedFlutter
5
5
  # The version of the cocoapods-embed-flutter.
6
6
  #
7
- VERSION = '0.6.0'.freeze
7
+ VERSION = '0.6.1'.freeze
8
8
  end
@@ -112,7 +112,10 @@ module Pod
112
112
  #
113
113
  def pub(name = nil, *requirements)
114
114
  pubspec = Flutter::Pub::ExternalSources.fetchWithNameAndOptions(name, requirements)
115
- pubspec.setup
115
+ Pod::UI.titled_section("Installing flutter dependencies for #{name}...", :verbose_prefix => '-> ') do
116
+ future = pubspec.pub_get
117
+ future.value! if !future.nil?
118
+ end
116
119
  raise StandardError, "Invalid flutter module: '#{name}'." unless File.exists?(pubspec.pod_helper_path)
117
120
  install_flutter_pods_for_pubspec(pubspec)
118
121
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-embed-flutter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soumya Ranjan Mahunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-27 00:00:00.000000000 Z
11
+ date: 2022-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaml
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: concurrent-ruby
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement