-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
129 lines (108 loc) · 3.83 KB
/
Copy pathRakefile
File metadata and controls
129 lines (108 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
require 'rake/clean'
require_relative 'scripts/get_version'
# Get version from centralized VERSION file
VERSION = get_version
VERSION_PARTS = parse_version(VERSION)
# Updated for AI Image Tagger - Lightroom Classic 2024
LUAC = "/usr/local/bin/luac" # Use installed Lua 5.4.8
ZIP = "zip"
BUILD_DIR = "build"
PLUGIN_DIR = File.join(BUILD_DIR, "ai-lr-tagimg.lrplugin")
DIST_DIR = "dist"
SOURCE_FILES = FileList[ File.join("src", "*.lua") ]
RESOURCE_FILES = FileList[ File.join("src", "*.png") ]
TRANSLATION_FILES = FileList[ File.join("src", "TranslatedStrings_*.txt") ]
README_FILES = FileList[ "README.md", "LICENSE" ]
TARGET_FILES = SOURCE_FILES.pathmap(File.join(PLUGIN_DIR, "%f")) + README_FILES.pathmap(File.join(PLUGIN_DIR, "%f"))
PACKAGE_FILE = File.join(DIST_DIR, "ai-lr-tagimg-v#{VERSION}.zip")
task :default => [ :compile, :package ]
desc "Show version information"
task :version do
puts "AI Image Tagger v#{VERSION} - Updated for Lightroom Classic 2024"
puts "SDK Version: 13.0 (minimum 10.0)"
puts "Multi-provider AI: Gemini and Ollama support with preset prompts"
end
desc "Update all files with current version from VERSION file"
task :update_version do
puts "Updating all files to version #{VERSION}..."
sh "ruby scripts/update_info_version.rb"
sh "ruby scripts/update_website_version.rb"
puts "All version references updated to #{VERSION}"
end
desc "Build plugin using source files (no compilation)"
task :build_source => [ PLUGIN_DIR ] do
puts "Building plugin with source files (no compilation)..."
# Copy source files directly
SOURCE_FILES.each do |src|
tgt = src.pathmap(File.join(PLUGIN_DIR, "%f"))
cp src, tgt
puts "Copied: #{src} -> #{tgt}"
end
# Copy resource, translation, and readme files
(RESOURCE_FILES + TRANSLATION_FILES + README_FILES).each do |src|
tgt = src.pathmap(File.join(PLUGIN_DIR, "%f"))
cp src, tgt
puts "Copied: #{src} -> #{tgt}"
end
puts "Plugin built successfully in #{PLUGIN_DIR}"
puts "You can now install this folder as a Lightroom plugin."
end
desc "Package plugin using source files"
task :package_source => [ :build_source, DIST_DIR ] do
puts "Creating distribution package..."
sh "cd #{BUILD_DIR} && #{ZIP} --recurse-paths #{File.absolute_path(PACKAGE_FILE)} #{PLUGIN_DIR.pathmap("%f")}"
puts "Package created: #{PACKAGE_FILE}"
puts "Adding package to git..."
sh "git add #{PACKAGE_FILE}"
puts "Package added to git staging area"
end
directory BUILD_DIR
CLEAN << BUILD_DIR
directory PLUGIN_DIR
CLEAN << PLUGIN_DIR
directory DIST_DIR
CLOBBER << DIST_DIR
desc "Compile source files"
task :compile => [ :test, PLUGIN_DIR ]
task :test do
puts "Testing Lua compiler..."
begin
sh "#{LUAC} -v"
puts "Lua compiler confirmed - ready for compilation"
rescue
puts "ERROR: Lua compiler not found at #{LUAC}!"
puts "Please install Lua:"
puts " brew install lua"
puts ""
puts "Or if you prefer to work with source files directly,"
puts "you can skip compilation and use the .lua files as-is."
exit 1
end
end
SOURCE_FILES.each do |src|
tgt = src.pathmap(File.join(PLUGIN_DIR, "%f"))
file tgt => src do
sh "#{LUAC} -o #{tgt} #{src}"
end
CLEAN << tgt
task :compile => tgt
task PACKAGE_FILE => tgt
end
(RESOURCE_FILES + TRANSLATION_FILES + README_FILES).each do |src|
tgt = src.pathmap(File.join(PLUGIN_DIR, "%f"))
file tgt => src do
cp src, tgt
end
CLEAN << tgt
task PACKAGE_FILE => tgt
end
desc "Create distribution package file"
task :package => [ :compile, PACKAGE_FILE ]
task PACKAGE_FILE => DIST_DIR do
sh "cd #{BUILD_DIR} && #{ZIP} --recurse-paths #{File.absolute_path(PACKAGE_FILE)} #{PLUGIN_DIR.pathmap("%f")}"
puts "Package created: #{PACKAGE_FILE}"
puts "Adding package to git..."
sh "git add #{PACKAGE_FILE}"
puts "Package added to git staging area"
puts "Note: Update docs/index.html manually if needed for GitHub Pages"
end