fastlane-plugin-sourcery 1.0.0 → 1.1.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: 24b4d1483835497f5a12c090d358f1d0ab7b24ea2ede12d4157eb954339ab6ee
4
- data.tar.gz: 212a8017f4ba90c767b50bbb5a6facd2e8d481c3f864c12ae47204898b8d7b11
3
+ metadata.gz: 534c8a42b0cbaa07dc08aa58889d88d0572fe74e32ca31c96881a3eae0fd683d
4
+ data.tar.gz: 0ad406dee7de93b5ecef1892a6f9bdb7f10db2fe69b73fa2322fed44cc6f0a9d
5
5
  SHA512:
6
- metadata.gz: 75f5348a56629ef791e93ff34db930c7f7bf73ffb8665a633a0dc2987343d8d6c1971fe76bb5ba97dcaae9215ca06cbc261613216f43d8fa63b1c877e3006169
7
- data.tar.gz: faa11a856a3a0a92507a61520708f4d1097cbf693794a962678149295dbaa3c36f55d4ac6251e1ced1add6f04e8a7cb8a711d4abfe760fdfcac2d6e51ecc1e7d
6
+ metadata.gz: f20c4df7793316bb788f33e312835ea02dfe3190b7228400c92939fd7f23de66f3bdbd0502fc53565369d5f5cb0ffdaa65f9f1e2d85ca530edb05e5df8281e24
7
+ data.tar.gz: 26353e1de9fa9a35f6fc431bb5f11bad75c05762c338718a3b5388262e81cf60451b3fc48fa25c2d7062346b6fe09f28c0b5d96732459089b6ece2d1f753b691
@@ -0,0 +1,120 @@
1
+ require 'fastlane'
2
+ require 'fileutils'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class GetSourceryAction < Action
7
+ def self.run(params)
8
+ version = params[:version]
9
+ target_directory = File.expand_path(params[:target_directory])
10
+
11
+ UI.message("Getting Sourcery version #{version}")
12
+
13
+ # Ensure target directory exists
14
+ FileUtils.mkdir_p(target_directory)
15
+
16
+ # Check if Sourcery is already installed
17
+ target_executable = File.join(target_directory, "sourcery")
18
+ if File.exist?(target_executable)
19
+ current_version = `#{target_executable} --version`.strip
20
+ if current_version == version
21
+ UI.message("Sourcery version #{version} is already installed at #{target_executable}")
22
+ ENV['SOURCERY_EXECUTABLE'] = target_executable
23
+ return target_executable
24
+ else
25
+ UI.message("Found Sourcery version #{current_version}, but required version is #{version}. Re-downloading...")
26
+ end
27
+ end
28
+
29
+ # Create temporary directory for download
30
+ temp_dir = File.join(target_directory, "temp_download_#{Time.now.to_i}")
31
+ FileUtils.mkdir_p(temp_dir)
32
+
33
+ zip_path = File.join(temp_dir, "sourcery-#{version}.zip")
34
+
35
+ # Construct download URL
36
+ download_url = "https://github.com/krzysztofzablocki/Sourcery/releases/download/#{version}/sourcery-#{version}.zip"
37
+
38
+ # Download
39
+ UI.message("Downloading Sourcery from #{download_url} to #{zip_path}")
40
+ sh("curl -L -o #{zip_path} #{download_url}")
41
+
42
+ # Unzip
43
+ UI.message("Unzipping Sourcery...")
44
+ sh("unzip -o #{zip_path} -d #{temp_dir}")
45
+
46
+ # Remove zip
47
+ FileUtils.rm(zip_path)
48
+
49
+ # Move executable to target directory
50
+ extracted_executable = File.join(temp_dir, "bin", "sourcery")
51
+ target_executable = File.join(target_directory, "sourcery")
52
+
53
+ # Check if executable exists in bin/sourcery (standard structure)
54
+ unless File.exist?(extracted_executable)
55
+ # Fallback: check directly in temp dir
56
+ extracted_executable = File.join(temp_dir, "sourcery")
57
+ end
58
+
59
+ if File.exist?(extracted_executable)
60
+ UI.message("Moving executable to #{target_executable}...")
61
+ # Ensure target directory is clean for the new executable if it already exists (though we checked version before)
62
+ FileUtils.rm_f(target_executable)
63
+ FileUtils.mv(extracted_executable, target_executable)
64
+ else
65
+ UI.user_error!("Could not find Sourcery executable in downloaded archive")
66
+ end
67
+
68
+ # Cleanup temp directory
69
+ UI.message("Cleaning up temporary files...")
70
+ FileUtils.rm_rf(temp_dir)
71
+
72
+ executable_path = target_executable
73
+
74
+ unless File.exist?(executable_path)
75
+ UI.user_error!("Could not find Sourcery executable at path '#{executable_path}'")
76
+ end
77
+
78
+ # Set environment variable
79
+ UI.message("Setting SOURCERY_EXECUTABLE to #{executable_path}")
80
+ ENV['SOURCERY_EXECUTABLE'] = executable_path
81
+
82
+ return executable_path
83
+ end
84
+
85
+ def self.description
86
+ "Downloads a specific version of Sourcery from GitHub and sets up the environment"
87
+ end
88
+
89
+ def self.authors
90
+ ["Marcin Stepnowski"]
91
+ end
92
+
93
+ def self.return_value
94
+ "The absolute path to the downloaded Sourcery executable"
95
+ end
96
+
97
+ def self.available_options
98
+ [
99
+ FastlaneCore::ConfigItem.new(key: :version,
100
+ description: "The version of Sourcery to download (e.g. '2.1.2')",
101
+ optional: false,
102
+ type: String),
103
+ FastlaneCore::ConfigItem.new(key: :target_directory,
104
+ description: "The directory to download and extract Sourcery to",
105
+ optional: true,
106
+ default_value: "./sourcery_bin",
107
+ type: String)
108
+ ]
109
+ end
110
+
111
+ def self.is_supported?(platform)
112
+ [:ios, :mac].include?(platform)
113
+ end
114
+
115
+ def self.category
116
+ :building
117
+ end
118
+ end
119
+ end
120
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Sourcery
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-sourcery
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Stepnowski
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-04 00:00:00.000000000 Z
11
+ date: 2026-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -164,7 +164,7 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
- description:
167
+ description:
168
168
  email: marcin.stepnowski@gmail.com
169
169
  executables: []
170
170
  extensions: []
@@ -173,13 +173,14 @@ files:
173
173
  - LICENSE
174
174
  - README.md
175
175
  - lib/fastlane/plugin/sourcery.rb
176
+ - lib/fastlane/plugin/sourcery/actions/get_sourcery_action.rb
176
177
  - lib/fastlane/plugin/sourcery/actions/sourcery_action.rb
177
178
  - lib/fastlane/plugin/sourcery/version.rb
178
179
  homepage: https://github.com/WezSieTato/fastlane-plugin-sourcery
179
180
  licenses:
180
181
  - MIT
181
182
  metadata: {}
182
- post_install_message:
183
+ post_install_message:
183
184
  rdoc_options: []
184
185
  require_paths:
185
186
  - lib
@@ -194,8 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
195
  - !ruby/object:Gem::Version
195
196
  version: '0'
196
197
  requirements: []
197
- rubygems_version: 3.0.3.1
198
- signing_key:
198
+ rubygems_version: 3.4.10
199
+ signing_key:
199
200
  specification_version: 4
200
201
  summary: Run sourcery with fastlane! Sourcery is a code generator for Swift language,
201
202
  built on top of Apple's own SwiftSyntax. It extends the language abstractions to