Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File move action #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fastlane add_plugin file_manager

## About fastlane-plugin-file_manager

Copy and remove files.
Copy, move and remove files.

## Example

Expand All @@ -23,6 +23,7 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu
```ruby
lane :test do
copy_files(source: "test.rb", destination: "lib")
move_files(source: "test.rb", destination: "lib")
remove_files(path: "test.rb")
end
```
Expand Down
1 change: 1 addition & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
lane :test do
copy_files(source: "test.rb", destination: "lib")
move_files(source: "test.rb", destination: "lib")
remove_files(path: "test.rb")
end
38 changes: 38 additions & 0 deletions lib/fastlane/plugin/file_manager/actions/move_files_action.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require "fastlane/action"

module Fastlane
module Actions
class MoveFilesAction < Action
def self.run(params)
Actions.sh("mv", params[:source], params[:destination])
end

def self.description
"Move files"
end

def self.authors
["Andrey Novikov"]
end

def self.available_options
[
FastlaneCore::ConfigItem.new(key: :source,
short_option: "-s",
description: "Source",
optional: false,
type: String),
FastlaneCore::ConfigItem.new(key: :destination,
short_option: "-d",
description: "Destination",
optional: false,
type: String)
]
end

def self.is_supported?(platform)
true
end
end
end
end
9 changes: 9 additions & 0 deletions spec/move_files_action_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe Fastlane::Actions::MoveFilesAction do
describe "#run" do
it "executes mv command with source and destination" do
expect(Fastlane::Actions).to receive(:sh).with("mv", "test.rb", "lib")

Fastlane::Actions::MoveFilesAction.run(source: "test.rb", destination: "lib")
end
end
end