makit 0.0.31 → 0.0.32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd32600c16b343af0aca4d27302ce500be167858bc54f1b57006cffbf7cdcf06
4
- data.tar.gz: 70564e6b73998614ec7a9e86fd9ca06e3d9226014fce028af9476bd57c844311
3
+ metadata.gz: 7171c87f0672a845fabff8aafe834c249c5afc049b8b19b1617195db5d8f525d
4
+ data.tar.gz: 18f8bced0cf82178693dd01b0cc91c38091fcec8f3dea8daf710a2ddff1eefa6
5
5
  SHA512:
6
- metadata.gz: af741663354f9ba23a1aae56572bb101c2947c2936bb51891e9e3c913162fda4d17da954c29941a34db94841f10b0b21b68cc4c646e3bec1f96c734f0b0e8cf5
7
- data.tar.gz: 358dd573c9f5f149297ca7acbdcda8257f1732e7d122ff37246206cd5622d24cd48dffe8c27b84d1d923829b8937699157360b7ca6953658c38a8c62a0bec66e
6
+ metadata.gz: caa6f2dc113c62bacba9634674b05a2b8161e914db135064acc150445bc27a2cd3715f58ceb1fa238e94096e557c99f29bd3555375e68fbd46391018bc3dc1ac
7
+ data.tar.gz: a533113bac07e6ab8b0ce4834a7d2ec702d2a1b4312265103336d35849b6b26b2067139816a88eba5bae113dba4d25633747d31de5d623f0babb509953d44ffe
data/lib/makit/dotnet.rb CHANGED
@@ -16,8 +16,32 @@ module Makit
16
16
  "dotnet new #{template} --name #{name} --output #{output}".run
17
17
  end
18
18
  end
19
+
20
+ def find_project(project_hint)
21
+ matches = []
22
+ Dir.glob("**/*.csproj").each do |project_path|
23
+ project_name = File.basename(project_path, ".csproj")
24
+ if project_name.include?(project_hint)
25
+ matches << project_path
26
+ end
27
+ end
28
+ if matches.length == 1
29
+ return matches.first
30
+ elsif matches.length > 1
31
+ raise "Multiple projects found matching #{project_hint}".colorize(:red)
32
+ end
33
+ raise "No project found matching #{project_hint}".colorize(:red)
34
+ end
19
35
 
20
36
  def self.add_package(project_path, package_name)
37
+ if(!File.exist?(project_path))
38
+ actual_project_path = find_project(project_path)
39
+ if(!File.exist?(actual_project_path))
40
+ raise "Project #{project_path} does not exist".colorize(:red)
41
+ else
42
+ project_path = actual_project_path
43
+ end
44
+ end
21
45
  project_content = File.read(project_path)
22
46
  if (!project_content.include?("\"#{package_name}\""))
23
47
  "dotnet add #{project_path} package #{package_name}".run
@@ -26,6 +50,12 @@ module Makit
26
50
  end
27
51
  end
28
52
 
53
+ def self.add_packages(project_path, packages)
54
+ packages.each do |package|
55
+ add_package(project_path, package)
56
+ end
57
+ end
58
+
29
59
  def self.add_reference(project_path, reference_path)
30
60
  project_content = File.read(project_path)
31
61
  if (project_content.include?("<PackageReference Include=\"#{package}\""))
data/lib/makit/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Makit
4
- VERSION = "0.0.31"
4
+ VERSION = "0.0.32"
5
5
 
6
6
  class Version
7
7
  # given an array of version strings, return the highest version
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.31
4
+ version: 0.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow