makit 0.0.35 → 0.0.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/makit/apache.rb +32 -32
- data/lib/makit/cli/clean.rb +14 -14
- data/lib/makit/cli/clone.rb +59 -59
- data/lib/makit/cli/init.rb +38 -38
- data/lib/makit/cli/main.rb +33 -33
- data/lib/makit/cli/make.rb +54 -54
- data/lib/makit/cli/new.rb +37 -37
- data/lib/makit/cli/nuget_cache.rb +38 -38
- data/lib/makit/cli/pull.rb +31 -31
- data/lib/makit/cli/setup.rb +71 -71
- data/lib/makit/cli/work.rb +21 -21
- data/lib/makit/command_runner.rb +391 -353
- data/lib/makit/commands.rb +21 -21
- data/lib/makit/content/default_gitignore.rb +5 -5
- data/lib/makit/content/default_gitignore.txt +222 -222
- data/lib/makit/content/default_rakefile.rb +11 -11
- data/lib/makit/content/gem_rakefile.rb +14 -14
- data/lib/makit/data.rb +50 -50
- data/lib/makit/directories.rb +140 -140
- data/lib/makit/directory.rb +184 -184
- data/lib/makit/dotnet.rb +156 -156
- data/lib/makit/environment.rb +127 -127
- data/lib/makit/fileinfo.rb +16 -16
- data/lib/makit/files.rb +47 -47
- data/lib/makit/git.rb +86 -86
- data/lib/makit/gitlab_runner.rb +60 -60
- data/lib/makit/humanize.rb +112 -112
- data/lib/makit/indexer.rb +56 -0
- data/lib/makit/logging.rb +96 -96
- data/lib/makit/markdown.rb +75 -75
- data/lib/makit/mp/basic_object_mp.rb +16 -16
- data/lib/makit/mp/command_request.mp.rb +16 -16
- data/lib/makit/mp/project_mp.rb +210 -210
- data/lib/makit/mp/string_mp.rb +122 -122
- data/lib/makit/nuget.rb +57 -57
- data/lib/makit/protoc.rb +104 -104
- data/lib/makit/serializer.rb +115 -115
- data/lib/makit/show.rb +76 -77
- data/lib/makit/storage.rb +131 -131
- data/lib/makit/symbols.rb +149 -149
- data/lib/makit/tasks.rb +60 -60
- data/lib/makit/tree.rb +37 -37
- data/lib/makit/v1/makit.v1_pb.rb +4 -3
- data/lib/makit/v1/makit.v1_services_pb.rb +25 -25
- data/lib/makit/version.rb +12 -12
- data/lib/makit/wix.rb +95 -95
- data/lib/makit/zip.rb +17 -17
- data/lib/makit.rb +267 -267
- metadata +4 -5
- data/lib/generated/makit/v1/makit.v1_pb.rb +0 -34
- data/lib/generated/makit/v1/web/link_pb.rb +0 -20
data/lib/makit/cli/pull.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "clamp"
|
4
|
-
#require "git"
|
5
|
-
|
6
|
-
module Makit
|
7
|
-
module Cli
|
8
|
-
# Define the 'pull' subcommand
|
9
|
-
class PullCommand < Clamp::Command
|
10
|
-
parameter "GIT_REPOSITORY", "The git repository url", attribute_name: :git_repository, required: true
|
11
|
-
option "--ignore-errors", :flag, "Ignore errors and present warnings instead of exiting"
|
12
|
-
|
13
|
-
def execute
|
14
|
-
puts "pulling latest changes for repository: #{git_repository}"
|
15
|
-
begin
|
16
|
-
Makit::pull(git_repository)
|
17
|
-
rescue Git::GitExecuteError => e
|
18
|
-
$stderr.puts "failed to pull repository: #{git_repository}"
|
19
|
-
puts "Please check the URL and your network connection."
|
20
|
-
exit 1
|
21
|
-
rescue => e
|
22
|
-
$stderr.puts "failed to pull repository: #{git_repository}"
|
23
|
-
puts e.message
|
24
|
-
exit 1
|
25
|
-
end
|
26
|
-
clone_dir = Directories::get_clone_directory(git_repository)
|
27
|
-
puts "size of clone directory: #{clone_dir} is #{Humanize::get_humanized_size(Directory::get_size(clone_dir))}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "clamp"
|
4
|
+
#require "git"
|
5
|
+
|
6
|
+
module Makit
|
7
|
+
module Cli
|
8
|
+
# Define the 'pull' subcommand
|
9
|
+
class PullCommand < Clamp::Command
|
10
|
+
parameter "GIT_REPOSITORY", "The git repository url", attribute_name: :git_repository, required: true
|
11
|
+
option "--ignore-errors", :flag, "Ignore errors and present warnings instead of exiting"
|
12
|
+
|
13
|
+
def execute
|
14
|
+
puts "pulling latest changes for repository: #{git_repository}"
|
15
|
+
begin
|
16
|
+
Makit::pull(git_repository)
|
17
|
+
rescue Git::GitExecuteError => e
|
18
|
+
$stderr.puts "failed to pull repository: #{git_repository}"
|
19
|
+
puts "Please check the URL and your network connection."
|
20
|
+
exit 1
|
21
|
+
rescue => e
|
22
|
+
$stderr.puts "failed to pull repository: #{git_repository}"
|
23
|
+
puts e.message
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
clone_dir = Directories::get_clone_directory(git_repository)
|
27
|
+
puts "size of clone directory: #{clone_dir} is #{Humanize::get_humanized_size(Directory::get_size(clone_dir))}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/makit/cli/setup.rb
CHANGED
@@ -1,71 +1,71 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "clamp"
|
4
|
-
|
5
|
-
module Makit
|
6
|
-
module Cli
|
7
|
-
# Define the 'new' subcommand
|
8
|
-
class SetupCommand < Clamp::Command
|
9
|
-
PACKAGE_TYPES = %w[gem crate nuget].freeze
|
10
|
-
option "--list", :flag, "List available package types"
|
11
|
-
option ["-t", "--type"], "TYPE", "The package type", default: "gem"
|
12
|
-
option ["-o", "--output"], "OUTPUT", "The output directory", default: "."
|
13
|
-
parameter "TYPE", "Type of the package", attribute_name: :type, required: false
|
14
|
-
parameter "NAME", "Name of the package", attribute_name: :name, required: false
|
15
|
-
|
16
|
-
def execute
|
17
|
-
if list?
|
18
|
-
puts "Available package types:"
|
19
|
-
PACKAGE_TYPES.each { |t| puts " - #{t}" }
|
20
|
-
else
|
21
|
-
if type.nil? || name.nil?
|
22
|
-
puts "Error: TYPE and NAME are required unless using --list"
|
23
|
-
exit(1)
|
24
|
-
end
|
25
|
-
|
26
|
-
unless PACKAGE_TYPES.include?(type)
|
27
|
-
puts "Error: '#{type}' is not a valid type. Use --list to see available types."
|
28
|
-
exit(1)
|
29
|
-
end
|
30
|
-
|
31
|
-
if !Makit::IS_GIT_REPO
|
32
|
-
Makit::LOGGER.error("#{Dir.pwd} does not appear to be a git repository.")
|
33
|
-
exit(1)
|
34
|
-
end
|
35
|
-
if Makit::IS_READ_ONLY
|
36
|
-
Makit::LOGGER.error("The git repository is in a read-only state.")
|
37
|
-
exit(1)
|
38
|
-
end
|
39
|
-
|
40
|
-
# if a Rakefile already exists, then the project has already been setup
|
41
|
-
if File.exist?("Rakefile")
|
42
|
-
Makit::LOGGER.error("Rakefile detected, The project has already been setup.")
|
43
|
-
exit(1)
|
44
|
-
end
|
45
|
-
|
46
|
-
# verify the root directory has a .gitignore file
|
47
|
-
if !File.exist?(".gitignore")
|
48
|
-
Makit::LOGGER.info("added .gitignore file")
|
49
|
-
File.open(".gitignore", "w") do |file|
|
50
|
-
file.puts Makit::Content::GITIGNORE
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# verify the root directory has a Rakefile
|
55
|
-
|
56
|
-
if (type == "gem")
|
57
|
-
if !File.exist?("Gemfile")
|
58
|
-
Makit::RUNNER.run("bundle gem . --coc --mit --exe --no-git --ci=gitlab_ci --test=minitest --changelog --linter=rubocop")
|
59
|
-
|
60
|
-
# overwrite the Rakefile with the one from the gem template
|
61
|
-
File.open("Rakefile", "w") do |file|
|
62
|
-
file.puts Makit::Content::GEM_RAKEFILE.gsub("GEM_NAME", name)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
# Makit::LOGGER.info("bundle gem . --coc --mit --exe --no-git --ci=gitlab_ci --test=minitest --changelog --linter=rubocop --skip=Rakefile,README.md")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "clamp"
|
4
|
+
|
5
|
+
module Makit
|
6
|
+
module Cli
|
7
|
+
# Define the 'new' subcommand
|
8
|
+
class SetupCommand < Clamp::Command
|
9
|
+
PACKAGE_TYPES = %w[gem crate nuget].freeze
|
10
|
+
option "--list", :flag, "List available package types"
|
11
|
+
option ["-t", "--type"], "TYPE", "The package type", default: "gem"
|
12
|
+
option ["-o", "--output"], "OUTPUT", "The output directory", default: "."
|
13
|
+
parameter "TYPE", "Type of the package", attribute_name: :type, required: false
|
14
|
+
parameter "NAME", "Name of the package", attribute_name: :name, required: false
|
15
|
+
|
16
|
+
def execute
|
17
|
+
if list?
|
18
|
+
puts "Available package types:"
|
19
|
+
PACKAGE_TYPES.each { |t| puts " - #{t}" }
|
20
|
+
else
|
21
|
+
if type.nil? || name.nil?
|
22
|
+
puts "Error: TYPE and NAME are required unless using --list"
|
23
|
+
exit(1)
|
24
|
+
end
|
25
|
+
|
26
|
+
unless PACKAGE_TYPES.include?(type)
|
27
|
+
puts "Error: '#{type}' is not a valid type. Use --list to see available types."
|
28
|
+
exit(1)
|
29
|
+
end
|
30
|
+
|
31
|
+
if !Makit::IS_GIT_REPO
|
32
|
+
Makit::LOGGER.error("#{Dir.pwd} does not appear to be a git repository.")
|
33
|
+
exit(1)
|
34
|
+
end
|
35
|
+
if Makit::IS_READ_ONLY
|
36
|
+
Makit::LOGGER.error("The git repository is in a read-only state.")
|
37
|
+
exit(1)
|
38
|
+
end
|
39
|
+
|
40
|
+
# if a Rakefile already exists, then the project has already been setup
|
41
|
+
if File.exist?("Rakefile")
|
42
|
+
Makit::LOGGER.error("Rakefile detected, The project has already been setup.")
|
43
|
+
exit(1)
|
44
|
+
end
|
45
|
+
|
46
|
+
# verify the root directory has a .gitignore file
|
47
|
+
if !File.exist?(".gitignore")
|
48
|
+
Makit::LOGGER.info("added .gitignore file")
|
49
|
+
File.open(".gitignore", "w") do |file|
|
50
|
+
file.puts Makit::Content::GITIGNORE
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# verify the root directory has a Rakefile
|
55
|
+
|
56
|
+
if (type == "gem")
|
57
|
+
if !File.exist?("Gemfile")
|
58
|
+
Makit::RUNNER.run("bundle gem . --coc --mit --exe --no-git --ci=gitlab_ci --test=minitest --changelog --linter=rubocop")
|
59
|
+
|
60
|
+
# overwrite the Rakefile with the one from the gem template
|
61
|
+
File.open("Rakefile", "w") do |file|
|
62
|
+
file.puts Makit::Content::GEM_RAKEFILE.gsub("GEM_NAME", name)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
# Makit::LOGGER.info("bundle gem . --coc --mit --exe --no-git --ci=gitlab_ci --test=minitest --changelog --linter=rubocop --skip=Rakefile,README.md")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/makit/cli/work.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "clamp"
|
4
|
-
|
5
|
-
module Makit
|
6
|
-
module Cli
|
7
|
-
# Define the 'new' subcommand
|
8
|
-
class WorkCommand < Clamp::Command
|
9
|
-
option ["-u", "--url"], "URL", "The git repository url"
|
10
|
-
|
11
|
-
def execute
|
12
|
-
if !url.nil?
|
13
|
-
puts "url: #{url}"
|
14
|
-
puts "relative directoyr: #{Makit::Environment.get_relative_directory(url)}"
|
15
|
-
puts "work directory: #{Makit::Environment.get_work_directory(url)}"
|
16
|
-
end
|
17
|
-
puts "TODO: implement work command"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "clamp"
|
4
|
+
|
5
|
+
module Makit
|
6
|
+
module Cli
|
7
|
+
# Define the 'new' subcommand
|
8
|
+
class WorkCommand < Clamp::Command
|
9
|
+
option ["-u", "--url"], "URL", "The git repository url"
|
10
|
+
|
11
|
+
def execute
|
12
|
+
if !url.nil?
|
13
|
+
puts "url: #{url}"
|
14
|
+
puts "relative directoyr: #{Makit::Environment.get_relative_directory(url)}"
|
15
|
+
puts "work directory: #{Makit::Environment.get_work_directory(url)}"
|
16
|
+
end
|
17
|
+
puts "TODO: implement work command"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|