Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add --exports_to_clipboard option to spaceauth. * Add documentation for exports_to_clipboard option. * Add FastlaneCore::Clipboard utility. * Fix clipboard action platform availability. * Make clipboard be more resilient on unsupported OS. * Document exports_to_clipboard OS limitations. * Add missing require. * Export only the session itself. * Add #session_string method to SpaceauthRunner. * Fix "Application-specific passwords" external link. * Redirect official docs instead of duplicating it. * Rename option from exports_to_clipboard to copy_to_clipboard. * Code style. * Allow non-interactive script in interactive session. * Update docs to point to new docs page introduced in fastlane/docs#1052
- Loading branch information
Showing
8 changed files
with
131 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'fastlane_core' | ||
require 'open3' | ||
|
||
module FastlaneCore | ||
class Clipboard | ||
def self.copy(content: nil) | ||
return UI.crash!("'pbcopy' or 'pbpaste' command not found.") unless is_supported? | ||
Open3.popen3('pbcopy') { |input, _, _| input << content } | ||
end | ||
|
||
def self.paste | ||
return UI.crash!("'pbcopy' or 'pbpaste' command not found.") unless is_supported? | ||
return `pbpaste` | ||
end | ||
|
||
def self.is_supported? | ||
return `which pbcopy`.length > 0 && `which pbpaste`.length > 0 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
describe FastlaneCore do | ||
describe FastlaneCore::Clipboard do | ||
describe '#copy and paste' do | ||
before(:each) do | ||
@test_message = "_fastlane_ is awesome" | ||
end | ||
|
||
it 'should work on supported environments', if: FastlaneCore::Clipboard.is_supported? do | ||
# Save clipboard | ||
clipboard = FastlaneCore::Clipboard.paste | ||
|
||
# Test copy and paste | ||
FastlaneCore::Clipboard.copy(content: @test_message) | ||
expect(FastlaneCore::Clipboard.paste).to eq(@test_message) | ||
|
||
# Restore clipboard | ||
FastlaneCore::Clipboard.copy(content: clipboard) | ||
expect(FastlaneCore::Clipboard.paste).to eq(clipboard) | ||
end | ||
|
||
it 'should throw on non-supported environment', if: !FastlaneCore::Clipboard.is_supported? do | ||
expect { FastlaneCore::Clipboard.copy(content: @test_message) }.to raise_error("'pbcopy' or 'pbpaste' command not found.") | ||
expect { FastlaneCore::Clipboard.paste }.to raise_error("'pbcopy' or 'pbpaste' command not found.") | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters