raykit 0.0.477 → 0.0.478

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: 88c4f9cfb61c1f0424f9f3a8f8909650ad00db858ef81c116a70b2c9b77d4d0a
4
- data.tar.gz: dd6ed119c54f5116963d1d0b53c822163f449add8732930bb7817de3c0b8033f
3
+ metadata.gz: 63d856c977869be4ba1f476bfa22266c5f4a40fcd388764d89800032cd62ba44
4
+ data.tar.gz: a094da5ee9b47b1b26c39b5c45cf7d5feef4141d37515bee0b1bbd4c647065da
5
5
  SHA512:
6
- metadata.gz: 7b4548764c6ea9262d37019c57e48e3a8eea8435fa5b5e53c3badac869be044ae6a1181be9e962c765e87151ef2173ac0cf0604ab875988638bddcc03231eac2
7
- data.tar.gz: 6a751a342dd588e1c02fcc8c170d4a9ca1fb636157e18331700f9b71d9ce5acef3ec7eafa4624ab996b9a0b33e6debae12829b10e77daa0a74430b266e1b1fb1
6
+ metadata.gz: 54ce3619da8f3c1a3fe38690a731dc3846d32ce46e6679b463eac49077bde703d48dfcb97fe28e5cbbc418580d053a0727cf3047682f7e7ef573df1d9e0a1b73
7
+ data.tar.gz: e7e20d8ce19a89f459c313959c111e80f1073300e9f79f2aeda35cb4c2f550084ae06c6f0b3f6c49328322f7fb5beb60f9ae0d6973ec8b49b0e7b44e5a119a80
@@ -0,0 +1,36 @@
1
+ module Raykit
2
+ class AutoSetup
3
+ def self.run
4
+ # Default subdirectories
5
+ DEFAULT_SUBDIRECTORIES.each do |subdirectory|
6
+ puts " RAYKIT_AUTO_SETUP: creating #{subdirectory}" unless Dir.exist?(subdirectory)
7
+ FileUtils.mkdir_p(subdirectory) unless Dir.exist?(subdirectory)
8
+ end
9
+ puts " RAYKIT_AUTO_SETUP: creating .gitignore" unless File.exist?(".gitignore")
10
+
11
+ # Default .gitignore
12
+ File.write(".gitignore", DEFAULT_GITIGNORE_CONTENT) unless File.exist?(".gitignore")
13
+
14
+ # C# class libs
15
+ if (defined?(RAYKIT_CSHARPCLASSLIBS))
16
+ RAYKIT_CSHARPCLASSLIBS.each do |csharpclasslib|
17
+ Raykit::DotNet::initialize_csharp_razorclasslib csharpclasslib
18
+ end
19
+ end
20
+
21
+ # Razor class libs
22
+ if (defined?(RAYKIT_RAZORCLASSLIBS))
23
+ RAYKIT_RAZORCLASSLIBS.each do |razorclasslib|
24
+ Raykit::DotNet::initialize_csharp_razorclasslib razorclasslib
25
+ end
26
+ end
27
+
28
+ # Blazor server apps
29
+ if (defined?(RAYKIT_BLAZORSERVERAPPS))
30
+ RAYKIT_BLAZORSERVERAPPS.each do |razorclasslib|
31
+ Raykit::DotNet::initialize_csharp_blazorserverapp razorclasslib
32
+ end
33
+ end
34
+ end
35
+ end # class AutoSetup
36
+ end # module Raykit
data/lib/raykit/dotnet.rb CHANGED
@@ -11,27 +11,6 @@ module Raykit
11
11
  end
12
12
  end
13
13
 
14
- # initialize a C# library
15
- def self.initialize_csharp_lib(name)
16
- puts `dotnet new sln --name #{name}` unless File.exist?("#{name}.sln")
17
- unless Dir.exist?(name)
18
- FileUtils.mkdir(name)
19
- Dir.chdir(name) do
20
- puts `dotnet new classlib -lang C#`
21
- end
22
- # puts `dotnet new sln`
23
- puts `dotnet sln #{name}.sln add #{name}/#{name}.csproj`
24
-
25
- FileUtils.mkdir("#{name}.Test") unless Dir.exist?("#{name}.Test")
26
- Dir.chdir("#{name}.Test") do
27
- puts `dotnet new nunit -lang C#`
28
- puts `dotnet add reference ../#{name}/#{name}.csproj`
29
- end
30
-
31
- puts `dotnet sln #{name}.sln add #{name}.Test/#{name}.Test.csproj`
32
- end
33
- end
34
-
35
14
  # initialize an F# library
36
15
  def self.initialize_fsharp_lib(name)
37
16
  puts `dotnet new sln --name #{name}` unless File.exist?("#{name}.sln")
@@ -100,6 +79,74 @@ module Raykit
100
79
  end
101
80
  end
102
81
 
82
+ # initialize a C# library
83
+ def self.initialize_csharp_lib(name)
84
+ # create the solution
85
+ puts " creating #{name}.sln" unless File.exist?("#{name}.sln")
86
+ PROJECT.run("dotnet new sln --name #{name}") unless File.exist?("#{name}.sln")
87
+ # create the library
88
+ puts " creating src/#{name}/#{name}.csproj" unless File.exist?("src/#{name}/#{name}.csproj")
89
+ PROJECT.run("dotnet new classlib -lang C# --name #{name} --output src/#{name}") unless File.exist?("src/#{name}/#{name}.csproj")
90
+ PROJECT.run("dotnet sln #{name}.sln add src/#{name}/#{name}.csproj") unless File.exist?("src/#{name}/#{name}.csproj")
91
+ # create the test
92
+ puts " creating test/#{name}.Test/#{name}.Test.csproj" unless File.exist?("test/#{name}.Test/#{name}.Test.csproj")
93
+ PROJECT.run("dotnet new nunit -lang C# --name #{name}.Test --output test/#{name}.Test") unless File.exist?("test/#{name}.Test/#{name}.Test.csproj")
94
+ PROJECT.run("dotnet sln #{name}.sln add test/#{name}.Test/#{name}.Test.csproj") unless File.exist?("test/#{name}.Test/#{name}.Test.csproj")
95
+ PROJECT.run("dotnet add test/#{name}.Test/#{name}.Test.csproj reference src/#{name}/#{name}.csproj") unless File.exist?("test/#{name}.Test/#{name}.Test.csproj")
96
+ # create a blazor server example
97
+ PROJECT.run("dotnet new blazorserver -lang C# --name #{name}.BlazorServer --output examples/#{name}.BlazorServer") unless File.exist?("examples/#{name}.BlazorServer/#{name}.BlazorServer.csproj")
98
+ PROJECT.run("dotnet sln #{name}.sln add examples/#{name}.BlazorServer/#{name}.BlazorServer.csproj") unless File.exist?("examples/#{name}.BlazorServer/#{name}.BlazorServer.csproj")
99
+ PROJECT.run("dotnet add examples/#{name}.BlazorServer/#{name}.BlazorServer.csproj reference src/#{name}/#{name}.csproj") unless File.exist?("examples/#{name}.BlazorServer/#{name}.BlazorServer.csproj")
100
+ # generate project folders
101
+ ["Interfaces", "Extensions", "Models"].each do |folder|
102
+ FileUtils.mkdir_p("src/#{name}/#{folder}") unless Dir.exist?("src/#{name}/#{folder}")
103
+ FileUtils.mkdir_p("test/#{name}.Test/#{folder}") unless Dir.exist?("test/#{name}.Test/#{folder}")
104
+ FileUtils.mkdir_p("examples/#{name}.BlazorServer/#{folder}") unless Dir.exist?("examples/#{name}.BlazorServer/#{folder}")
105
+ end
106
+ end
107
+
108
+ # initialize a C# razor class library
109
+ def self.initialize_csharp_razorclasslib(name)
110
+ # create the solution
111
+ puts " creating #{name}.sln" unless File.exist?("#{name}.sln")
112
+ PROJECT.run("dotnet new sln --name #{name}") unless File.exist?("#{name}.sln")
113
+ # create the library
114
+ puts " creating src/#{name}/#{name}.csproj" unless File.exist?("src/#{name}/#{name}.csproj")
115
+ PROJECT.run("dotnet new razorclasslib -lang C# --name #{name} --output src/#{name}") unless File.exist?("src/#{name}/#{name}.csproj")
116
+ PROJECT.run("dotnet sln #{name}.sln add src/#{name}/#{name}.csproj") unless File.exist?("src/#{name}/#{name}.csproj")
117
+ # create the test
118
+ puts " creating test/#{name}.Test/#{name}.Test.csproj" unless File.exist?("test/#{name}.Test/#{name}.Test.csproj")
119
+ PROJECT.run("dotnet new nunit -lang C# --name #{name}.Test --output test/#{name}.Test") unless File.exist?("test/#{name}.Test/#{name}.Test.csproj")
120
+ PROJECT.run("dotnet sln #{name}.sln add test/#{name}.Test/#{name}.Test.csproj") unless File.exist?("test/#{name}.Test/#{name}.Test.csproj")
121
+ PROJECT.run("dotnet add test/#{name}.Test/#{name}.Test.csproj reference src/#{name}/#{name}.csproj") unless File.exist?("test/#{name}.Test/#{name}.Test.csproj")
122
+ # create a blazor server example
123
+ PROJECT.run("dotnet new blazorserver -lang C# --name #{name}.BlazorServer --output examples/#{name}.BlazorServer") unless File.exist?("examples/#{name}.BlazorServer/#{name}.BlazorServer.csproj")
124
+ PROJECT.run("dotnet sln #{name}.sln add examples/#{name}.BlazorServer/#{name}.BlazorServer.csproj") unless File.exist?("examples/#{name}.BlazorServer/#{name}.BlazorServer.csproj")
125
+ PROJECT.run("dotnet add examples/#{name}.BlazorServer/#{name}.BlazorServer.csproj reference src/#{name}/#{name}.csproj") unless File.exist?("examples/#{name}.BlazorServer/#{name}.BlazorServer.csproj")
126
+ # generate project folders
127
+ ["Interfaces", "Extensions", "Models", "Components", "Controllers"].each do |folder|
128
+ FileUtils.mkdir_p("src/#{name}/#{folder}") unless Dir.exist?("src/#{name}/#{folder}")
129
+ FileUtils.mkdir_p("test/#{name}.Test/#{folder}") unless Dir.exist?("test/#{name}.Test/#{folder}")
130
+ FileUtils.mkdir_p("examples/#{name}.BlazorServer/#{folder}") unless Dir.exist?("examples/#{name}.BlazorServer/#{folder}")
131
+ end
132
+ end
133
+
134
+ # initialize a C# blazor server application
135
+ def self.initialize_csharp_blazorserver(name)
136
+ # create the solution
137
+ puts " creating #{name}.sln" unless File.exist?("#{name}.sln")
138
+ # create the blazor server application
139
+ puts " creating src/#{name}/#{name}.csproj" unless File.exist?("src/#{name}/#{name}.csproj")
140
+ PROJECT.run("dotnet new blazorserver -lang C# --name #{name} --output src/#{name}") unless File.exist?("src/#{name}/#{name}.csproj")
141
+ PROJECT.run("dotnet sln #{name}.sln add src/#{name}/#{name}.csproj") unless File.exist?("src/#{name}/#{name}.csproj")
142
+ # generate project folders
143
+ ["Interfaces", "Extensions", "Models", "Components", "Controllers"].each do |folder|
144
+ FileUtils.mkdir_p("src/#{name}/#{folder}") unless Dir.exist?("src/#{name}/#{folder}")
145
+ FileUtils.mkdir_p("test/#{name}.Test/#{folder}") unless Dir.exist?("test/#{name}.Test/#{folder}")
146
+ FileUtils.mkdir_p("examples/#{name}.BlazorServer/#{folder}") unless Dir.exist?("examples/#{name}.BlazorServer/#{folder}")
147
+ end
148
+ end
149
+
103
150
  def self.get_package_names(filename)
104
151
  package_names = []
105
152
  if File.exist?(filename) && filename.include?(".csproj")
data/lib/raykit.rb CHANGED
@@ -33,14 +33,8 @@ MARKDOWN = Raykit::Markdown.new
33
33
 
34
34
  Raykit::MsBuild::fix_msbuild_path
35
35
 
36
- if RAYKIT_AUTO_SETUP
37
- DEFAULT_SUBDIRECTORIES.each do |subdirectory|
38
- puts " RAYKIT_AUTO_SETUP: creating #{subdirectory}" unless Dir.exist?(subdirectory)
39
- FileUtils.mkdir_p(subdirectory) unless Dir.exist?(subdirectory)
40
- end
41
- puts " RAYKIT_AUTO_SETUP: creating .gitignore" unless File.exist?(".gitignore")
42
- File.write(".gitignore", DEFAULT_GITIGNORE_CONTENT) unless File.exist?(".gitignore")
43
- end
36
+ Raykit::AutoSetup.run if RAYKIT_AUTO_SETUP
37
+
44
38
  # include Raykit::TopLevel to make run method accessible from the global scope
45
39
  module Raykit
46
40
  module TopLevel
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.477
4
+ version: 0.0.478
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow
@@ -91,6 +91,7 @@ files:
91
91
  - README.md
92
92
  - bin/raykit
93
93
  - lib/raykit.rb
94
+ - lib/raykit/auto_setup.rb
94
95
  - lib/raykit/command.rb
95
96
  - lib/raykit/conan/buildinfo.rb
96
97
  - lib/raykit/conanpackage.rb