raykit 0.0.476 → 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: cefdd20ff9e24b12f53cdadbca6378a540815c2aceae1df4a0ccac06cd6cf0a7
4
- data.tar.gz: c98f24c99b5c3a0896523a24222eebf1fd556f2fc804602b10c801fb8b02cb0b
3
+ metadata.gz: 63d856c977869be4ba1f476bfa22266c5f4a40fcd388764d89800032cd62ba44
4
+ data.tar.gz: a094da5ee9b47b1b26c39b5c45cf7d5feef4141d37515bee0b1bbd4c647065da
5
5
  SHA512:
6
- metadata.gz: 80fc5b882a1ba5a80c188e2ed5730734ca3279301099e38810fa0d358cc9c88499cc14a692d1d9a9ece7439e2acd95d0440e428a32da287012f94179a5b25e05
7
- data.tar.gz: a3d6f97ca186c71e0e85804ccad6bcb10803a45ffdfd43a23332b3d706b4c8e197cc8b6b626d640d338e01b2fb3681ba9a6243e9b7615a21883c09f0ad806998
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")
@@ -206,11 +206,11 @@ module Raykit
206
206
  constants.uniq
207
207
  end
208
208
 
209
- def setup
210
- DEFAULT_SUBDIRECTORIES.each do |subdirectory|
211
- FileUtils.mkdir_p(subdirectory)
212
- end
213
- end
209
+ #def setup
210
+ # DEFAULT_SUBDIRECTORIES.each do |subdirectory|
211
+ # FileUtils.mkdir_p(subdirectory)
212
+ # end
213
+ #end
214
214
  end # class Directory
215
215
  end # module Git
216
216
  end # module Raykit
data/lib/raykit.rb CHANGED
@@ -33,10 +33,8 @@ MARKDOWN = Raykit::Markdown.new
33
33
 
34
34
  Raykit::MsBuild::fix_msbuild_path
35
35
 
36
- if RAYKIT_AUTO_SETUP
37
- GIT_DIRECTORY.setup
38
- File.write(".gitignore", DEFAULT_GITIGNORE_CONTENT) unless File.exist?(".gitignore")
39
- end
36
+ Raykit::AutoSetup.run if RAYKIT_AUTO_SETUP
37
+
40
38
  # include Raykit::TopLevel to make run method accessible from the global scope
41
39
  module Raykit
42
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.476
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