solara 0.9.0 → 0.10.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06eafb3fee69d6bc3e49d8e61548f54c6da5622613c20803c335ce504f778440
4
- data.tar.gz: 14174d2aedc0c2d7c3477abc47fddba2f814d3be02cabcfc5ba2d035e3258aec
3
+ metadata.gz: 5a5686de4e3afa52cdec8223d3e990d10b3056c4a72d2332a4c376b674966aac
4
+ data.tar.gz: 740cbc01a18278920f9722b94f0987c10c55602ee727badb945db19866ee741a
5
5
  SHA512:
6
- metadata.gz: 4932da60d28a6be98b26b58c21dc5b372ecf83ffbce0e7e229bd95551a993ba4f7f9a01b538406c01e791ce4ece775b208a98e89ee04f6d1e0afb2f97a03b283
7
- data.tar.gz: 39767cea4176efc5850b99f43f8a2e0583927dbb808c31b8329346739a13f02dab7f51e21cc5dea7864b9a3e4e55ad84884ab64a4779ea1201717df2e32c1608
6
+ metadata.gz: 706950176d1fd66f1e10efa9b83d991f444e018bd9cb0282eb74d133a2181fa081a606c91db12f2f9d7e6ce9ae1829e147481949b94acd79d5930263339c9399
7
+ data.tar.gz: '08f25956658174869cc3a71223c842a58323448177dce4c5dbb07f6808f2e76105eaec0d3120e6dfe16865c08f4ada4bf11465c2732dd2351e1eec60c11d8af4'
@@ -53,6 +53,28 @@ project.ext {
53
53
 
54
54
  private
55
55
 
56
+ def write_if_needed(file_path, new_content)
57
+ return unless File.exist?(file_path)
58
+
59
+ current_content = File.read(file_path)
60
+ if normalize_content(new_content) != normalize_content(current_content)
61
+ File.write(file_path, new_content)
62
+ Solara.logger.debug("Updated #{file_path}")
63
+ return true
64
+ end
65
+
66
+ Solara.logger.debug("No changes needed for #{file_path}")
67
+ false
68
+ end
69
+
70
+ def normalize_content(content)
71
+ # Remove empty lines and normalize whitespace
72
+ content.lines
73
+ .map(&:strip)
74
+ .reject(&:empty?)
75
+ .join("\n")
76
+ end
77
+
56
78
  def update_gradle(gradle_file, gradle_content)
57
79
  properties_loader = @is_kotlin_gradle ? KOTLIN_PROPERTIES_LOADER : GROOVY_PROPERTIES_LOADER
58
80
  original_content = gradle_content.dup
@@ -93,23 +115,11 @@ project.ext {
93
115
 
94
116
  gradle_content.sub!(android_block_regex, updated_android_block)
95
117
 
96
- # Compare normalized content
97
- if normalize_content(gradle_content) != normalize_content(original_content)
98
- File.write(gradle_file, gradle_content)
118
+ if write_if_needed(gradle_file, gradle_content)
99
119
  Solara.logger.debug("Updated #{gradle_file} (#{@is_kotlin_gradle ? 'Kotlin' : 'Groovy'}) to use brand.properties")
100
- else
101
- Solara.logger.debug("No changes needed for #{gradle_file}")
102
120
  end
103
121
  end
104
122
 
105
- def normalize_content(content)
106
- # Remove empty lines and normalize whitespace
107
- content.lines
108
- .map(&:strip)
109
- .reject(&:empty?)
110
- .join("\n")
111
- end
112
-
113
123
  def add_source_sets(gradle_file)
114
124
  content = File.read(gradle_file)
115
125
 
@@ -139,8 +149,7 @@ project.ext {
139
149
  end
140
150
  end
141
151
 
142
- File.write(gradle_file, modified_content)
143
- Solara.logger.debug("Source sets configuration updated successfully.")
152
+ write_if_needed(gradle_file, modified_content)
144
153
  end
145
154
 
146
155
  def generate_source_sets(source_sets_string)
@@ -197,12 +206,7 @@ project.ext {
197
206
  modified_content.sub!(/(\s*android\s*\{)/) { "#{$1}\n #{new_config.strip}" }
198
207
  end
199
208
 
200
- if content != modified_content
201
- File.write(gradle_file, modified_content)
202
- Solara.logger.debug("Keystore configuration updated successfully.")
203
- else
204
- Solara.logger.debug("No changes were necessary for keystore configuration.")
205
- end
209
+ write_if_needed(gradle_file, modified_content)
206
210
  end
207
211
 
208
212
  def generate_keystore_config
@@ -1,3 +1,3 @@
1
1
  module Solara
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Malek Kamel