Skip to content

Commit

Permalink
feat: Added Assets Manager (XcodebuildAssetsManager) (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-kulik authored Nov 25, 2024
1 parent c90243d commit 9bdcb75
Show file tree
Hide file tree
Showing 11 changed files with 448 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ It provides all essential actions for development including building, debugging,
- [x] Support for Swift Packages (building & testing).
- [x] Project-based configuration.
- [x] Project Manager to deal with project files without using Xcode.
- [x] Assets Manager to manage images, colors, and data assets.
- [x] Test Explorer to visually present a tree with all tests and results.
- [x] Built using official command line tools like `xcodebuild` and `xcrun simctl`.
- [x] Actions to build, run, debug, and test apps on simulators and physical devices.
Expand Down
65 changes: 64 additions & 1 deletion doc/xcodebuild.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Project Configuration ·····························
App Data ·········································· |xcodebuild.project.appdata|
Project Builder ··································· |xcodebuild.project.builder|
Project Manager ··································· |xcodebuild.project.manager|
Project Assets Manager ····························· |xcodebuild.project.assets|
Device ············································ |xcodebuild.platform.device|
Device Proxy ································ |xcodebuild.platform.device_proxy|
macOS Platform Integration ························· |xcodebuild.platform.macos|
Expand Down Expand Up @@ -228,6 +229,7 @@ Features *xcodebuild.features*
- Support for Swift Packages (building & testing).
- Project-based configuration.
- Project Manager to deal with project files without using Xcode.
- Assets Manager to manage images, colors, and data assets.
- Test Explorer to visually present a tree with all tests and results.
- Built using official command line tools like `xcodebuild` and `xcrun simctl`.
- Actions to build, run, debug, and test apps on simulators and
Expand Down Expand Up @@ -449,6 +451,7 @@ Project Manager
| Command | Description |
| ---------------------------------- | ---------------------------------------------------------- |
| `XcodebuildProjectManager` | Show picker with all Project Manager actions |
| `XcodebuildAssetsManager` | Show picker with all Assets Manager actions |
| `XcodebuildCreateNewFile` | Create a new file and add it to target(s) |
| `XcodebuildAddCurrentFile` | Add the active file to target(s) |
| `XcodebuildRenameCurrentFile` | Rename the current file |
Expand Down Expand Up @@ -863,6 +866,10 @@ M.test_explorer_rerun_tests()
Runs last executed tests or all if nothing was executed.


M.show_assets_manager() *xcodebuild.actions.show_assets_manager*
Show the Assets Manager.


M.get_project_targets() *xcodebuild.actions.get_project_targets*
Returns project targets.

Expand Down Expand Up @@ -2233,6 +2240,62 @@ M.show_action_picker()
Shows the action picker with all available actions.


==============================================================================
Project Assets Manager *xcodebuild.project.assets*

This module contains the functionality to manage Xcode project assets.

It allows to add, delete, and browse assets in the project.
Supported asset types are: images, colors, and data.

*xcodebuild.project.assets.create_image*
M.create_image({filename}, {path}, {template})
Creates a new image set.

Parameters: ~
{filename} (string)
{path} (string)
{template} (boolean) renderings as template


M.create_data({filename}, {path}) *xcodebuild.project.assets.create_data*
Creates a new data set.

Parameters: ~
{filename} (string)
{path} (string)


M.create_color({name}, {color}, {path}) *xcodebuild.project.assets.create_color*
Creates a new color set.

Parameters: ~
{name} (string) color name
{color} (string) color in hex format, e.g. #FF0000
{path} (string)


*xcodebuild.project.assets.create_new_asset_picker*
M.create_new_asset_picker()
Shows a wizard to create a new asset.


*xcodebuild.project.assets.show_asset_picker*
M.show_asset_picker()
Shows a picker with all the assets in the project.
Opens the asset in Finder or Quick Look.


*xcodebuild.project.assets.delete_asset_picker*
M.delete_asset_picker()
Shows a picker to delete an asset.


*xcodebuild.project.assets.show_assets_manager*
M.show_assets_manager()
Shows the Assets Manager with all available actions.


==============================================================================
Device *xcodebuild.platform.device*

Expand Down Expand Up @@ -4417,7 +4480,7 @@ M.shell({cmd}) *xcodebuild.util.shell*


M.shellAsync({cmd}, {callback}) *xcodebuild.util.shellAsync*
Runs a shell command and asynchronously.
Runs a shell command asynchronously.

Parameters: ~
{cmd} (string|string[])
Expand Down
8 changes: 8 additions & 0 deletions lua/xcodebuild/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ local testRunner = require("xcodebuild.tests.runner")
local projectBuilder = require("xcodebuild.project.builder")
local projectConfig = require("xcodebuild.project.config")
local projectManager = require("xcodebuild.project.manager")
local assetsManager = require("xcodebuild.project.assets")
local appdata = require("xcodebuild.project.appdata")
local lsp = require("xcodebuild.integrations.lsp")

Expand Down Expand Up @@ -310,6 +311,13 @@ function M.test_explorer_rerun_tests()
testExplorer.repeat_last_run()
end

-- Assets Management

---Show the Assets Manager.
function M.show_assets_manager()
assetsManager.show_assets_manager()
end

-- Project Management

---Returns project targets.
Expand Down
1 change: 1 addition & 0 deletions lua/xcodebuild/docs/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
--- | Command | Description |
--- | ---------------------------------- | ---------------------------------------------------------- |
--- | `XcodebuildProjectManager` | Show picker with all Project Manager actions |
--- | `XcodebuildAssetsManager` | Show picker with all Assets Manager actions |
--- | `XcodebuildCreateNewFile` | Create a new file and add it to target(s) |
--- | `XcodebuildAddCurrentFile` | Add the active file to target(s) |
--- | `XcodebuildRenameCurrentFile` | Rename the current file |
Expand Down
1 change: 1 addition & 0 deletions lua/xcodebuild/docs/features.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
--- - Support for Swift Packages (building & testing).
--- - Project-based configuration.
--- - Project Manager to deal with project files without using Xcode.
--- - Assets Manager to manage images, colors, and data assets.
--- - Test Explorer to visually present a tree with all tests and results.
--- - Built using official command line tools like `xcodebuild` and `xcrun simctl`.
--- - Actions to build, run, debug, and test apps on simulators and
Expand Down
2 changes: 1 addition & 1 deletion lua/xcodebuild/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ local optional_dependencies = {
{
binary = "fd",
url = "https://github.com/sharkdp/fd",
message = "Improves performance when searching for files.",
message = "Improves performance when searching for files. Required for Assets Manager.",
},
}

Expand Down
3 changes: 3 additions & 0 deletions lua/xcodebuild/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ function M.setup(options)
vim.api.nvim_create_user_command("XcodebuildUpdateCurrentFileTargets", call(actions.update_current_file_targets), { nargs = 0 })
vim.api.nvim_create_user_command("XcodebuildShowCurrentFileTargets", call(actions.show_current_file_targets), { nargs = 0 })

-- Assets Manager
vim.api.nvim_create_user_command("XcodebuildAssetsManager", call(actions.show_assets_manager), { nargs = 0 })

-- Other
vim.api.nvim_create_user_command("XcodebuildEditEnvVars", call(actions.edit_env_vars), { nargs = 0 })
vim.api.nvim_create_user_command("XcodebuildEditRunArgs", call(actions.edit_run_args), { nargs = 0 })
Expand Down
Loading

0 comments on commit 9bdcb75

Please sign in to comment.