-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
huge refactoring into separate packages
- Loading branch information
Showing
246 changed files
with
3,422 additions
and
2,629 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/docs/ | ||
/lib/ | ||
/bin/ | ||
lib/ | ||
bin/ | ||
/.shards/ | ||
*.dwarf | ||
node_modules | ||
|
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,11 @@ | ||
require "extensions/libc/clonefile" | ||
|
||
module Backend::CloneFile | ||
def self.install(src_path : String | Path, dest_path : String | Path) : Bool | ||
result = LibC.clonefile(src_path.to_s, dest_path.to_s, 0) | ||
if result == -1 | ||
raise "Error cloning file: #{Errno.value} #{src_path.to_s} -> #{dest_path.to_s}" | ||
end | ||
true | ||
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,13 @@ | ||
require "concurrency/pipeline" | ||
|
||
module Backend::Copy | ||
def self.install(src_path : String | Path, dest_path : String | Path) : Bool | ||
# FileUtils.cp_r(src_path, dest_path) | ||
Pipeline.wrap(force_wait: true) do |pipeline| | ||
Backend.recursively(src_path.to_s, dest_path.to_s, pipeline: pipeline) do |src, dest| | ||
File.copy(src, dest) | ||
end | ||
end | ||
true | ||
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,13 @@ | ||
require "extensions/libc/copyfile" | ||
require "concurrency/pipeline" | ||
|
||
module Backend::CopyFile | ||
def self.install(src_path : String | Path, dest_path : String | Path) : Bool | ||
Pipeline.wrap(force_wait: true) do |pipeline| | ||
Backend.recursively(src_path.to_s, dest_path.to_s, pipeline) do |src, dest| | ||
LibC.copyfile(src.to_s, dest.to_s, nil, LibC::COPYFILE_CLONE_FORCE | LibC::COPYFILE_ALL) | ||
end | ||
end | ||
true | ||
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,12 @@ | ||
require "concurrency/pipeline" | ||
|
||
module Backend::Hardlink | ||
def self.install(src_path : String | Path, dest_path : String | Path) : Bool | ||
Pipeline.wrap(force_wait: true) do |pipeline| | ||
Backend.recursively(src_path.to_s, dest_path.to_s, pipeline: pipeline) do |src, dest| | ||
File.link(src, dest) | ||
end | ||
end | ||
true | ||
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,38 @@ | ||
version: 2.0 | ||
shards: | ||
concurrency: | ||
path: ../concurrency | ||
version: 0.1.0 | ||
|
||
crystar: | ||
git: https://github.com/naqvis/crystar.git | ||
version: 0.4.0 | ||
|
||
data: | ||
path: ../data | ||
version: 0.1.0 | ||
|
||
extensions: | ||
path: ../extensions | ||
version: 0.1.0 | ||
|
||
git: | ||
path: ../git | ||
version: 0.1.0 | ||
|
||
msgpack: | ||
git: https://github.com/crystal-community/msgpack-crystal.git | ||
version: 1.3.4 | ||
|
||
semver: | ||
path: ../semver | ||
version: 0.1.0 | ||
|
||
shared: | ||
path: ../shared | ||
version: 0.1.0 | ||
|
||
utils: | ||
path: ../utils | ||
version: 0.1.0 | ||
|
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,12 @@ | ||
name: backend | ||
version: 0.1.0 | ||
|
||
dependencies: | ||
concurrency: | ||
path: ../concurrency | ||
data: | ||
path: ../data | ||
shared: | ||
path: ../shared | ||
extensions: | ||
path: ../extensions |
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,12 @@ | ||
require "concurrency/pipeline" | ||
|
||
module Backend::Symlink | ||
def self.install(src_path : String | Path, dest_path : String | Path) : Bool | ||
Pipeline.wrap do |pipeline| | ||
Backend.recursively(src_path.to_s, dest_path.to_s, pipeline: pipeline) do |src, dest| | ||
File.symlink(src, dest) | ||
end | ||
end | ||
true | ||
end | ||
end |
Binary file not shown.
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,44 @@ | ||
require "option_parser" | ||
require "core/command_config" | ||
require "core/config" | ||
require "commands/cli" | ||
require "commands/helpers" | ||
|
||
class CLI | ||
@command_config_ref = Core::CommandConfigRef.new | ||
|
||
def initialize( | ||
@commands : Array(Commands::CLI), | ||
@config : Core::Config = Core::Config.new(ENV, "ZAP") | ||
) | ||
end | ||
|
||
def parse | ||
# Parse options and extract configs | ||
parser = OptionParser.new do |parser| | ||
banner_desc = <<-DESCRIPTION | ||
#{"A package manager for the Javascript language.".colorize.bold} | ||
Check out #{"https://github.com/elbywan/zap".colorize.magenta} for more information. | ||
DESCRIPTION | ||
Commands::Helpers.banner(parser, "[command]", banner_desc) | ||
|
||
Commands::Helpers.separator("Commands") | ||
@commands.each &.register(parser, @command_config_ref) | ||
|
||
Commands::Helpers.separator("Options") | ||
Commands::Helpers.common_options(true) | ||
Commands::Helpers.workspace_options(true) | ||
end | ||
|
||
parser.parse | ||
|
||
if @command_config_ref.ref.nil? | ||
puts parser | ||
exit | ||
end | ||
|
||
# Return both configs | ||
{@config, @command_config_ref.ref} | ||
end | ||
end |
Oops, something went wrong.