This repository has been archived by the owner on May 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set up temporary repository only once
- Loading branch information
1 parent
e9f4d96
commit d86a377
Showing
7 changed files
with
81 additions
and
106 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
--color | ||
--require spec_helper | ||
--tag ~repository |
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 was deleted.
Oops, something went wrong.
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,79 @@ | ||
# frozen_string_literal: true | ||
|
||
# Relative path to the repository | ||
DIRECTORY = "tmp/repository" | ||
|
||
# Committers | ||
john = "John Doe <[email protected]>" | ||
jane = "Jane Doe <[email protected]>" | ||
joey = "Joey Doe <[email protected]>" | ||
|
||
# Cleanup the temporary repository directory | ||
FileUtils.remove_entry(DIRECTORY) | ||
|
||
# Initialize the repository | ||
GIT = Git.init(DIRECTORY) | ||
|
||
# Set up committer configuration | ||
GIT.config("user.name", "John Doe") | ||
GIT.config("user.email", "[email protected]") | ||
|
||
def commit(author, **files_with_content) | ||
# Write the files with content | ||
files_with_content.each do |file, content| | ||
FileUtils.mkdir_p(File.join(DIRECTORY, File.dirname(file))) | ||
File.write(File.join(DIRECTORY, file), content) | ||
end | ||
|
||
# Add and commit the files | ||
GIT.add | ||
GIT.commit("Add #{files_with_content.keys.join(', ')}", author:) | ||
end | ||
|
||
# Setup the repository with initial commit | ||
commit john, | ||
"README.md" => "# Test Repository" | ||
|
||
# Add MOSAIK configuration | ||
commit john, | ||
"mosaik.yml" => File.read(MOSAIK.root.join("config/mosaik.yml")) | ||
|
||
# Add application structure | ||
commit john, | ||
"lib/app.rb" => "class App; end" | ||
|
||
# Add classes | ||
commit john, | ||
"lib/app/foo.rb" => "class App::Foo; end", | ||
"lib/app/bar.rb" => "class App::Bar; end" | ||
|
||
commit jane, | ||
"lib/app/foo.rb" => "class App::Foo; def initialize; end; end", | ||
"lib/app/bat.rb" => "class App::Bat; end" | ||
|
||
commit john, | ||
"lib/app/foo.rb" => "class App::Foo; end", | ||
"lib/app/bak.rb" => "class App::Bak; end" | ||
|
||
commit jane, | ||
"lib/app/bat.rb" => "class App::Bat; def initialize; end; end", | ||
"lib/app/baz.rb" => "class App::Baz; end" | ||
|
||
commit john, | ||
"lib/app/bat.rb" => "class App::Bat; end", | ||
"lib/app/baz.rb" => "class App::Baz; def initialize; end; end" | ||
|
||
commit joey, | ||
"lib/app/bat.rb" => "class App::Bat; def initialize; end; end", | ||
"lib/app/baz.rb" => "class App::Baz; end" | ||
|
||
RSpec.configure do |config| | ||
config.before do | ||
configuration = MOSAIK::Configuration.from(File.join(DIRECTORY, "mosaik.yml")) | ||
|
||
# Mock the configuration | ||
allow(MOSAIK) | ||
.to receive(:configuration) | ||
.and_return configuration | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.