rawc 1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5fdc1a461857f455e15f9cd2215504ac70c0a09e
4
+ data.tar.gz: f7ff8d215d5d60a196af886f1150312e7cf5c9ba
5
+ SHA512:
6
+ metadata.gz: 2d163132fce8c1e89cc284408a2a142b8cf31b49e5fb90e565d40e8b5df079bbb3ba06416218934ea8afde74be76d2d6619e1444f78bcfce499ab66f38d55ea4
7
+ data.tar.gz: ab173a329e89e03c30750ce056b36aa2017ec2353d37b2fbc722ca4368e97681447878ef82722f65327125760b5f2a5f86e34e335955e4b8ae6facfd28518d04
@@ -0,0 +1,3 @@
1
+ rakefilepath = File.join( File.dirname(__FILE__), '../lib/rawc/Rakefile.rb' )
2
+ result = system("rake --rakefile " + rakefilepath + " " + ARGV.join(' '))
3
+ exit 1 unless result
@@ -0,0 +1,133 @@
1
+ require_relative './command_shell.rb'
2
+ require 'net/http'
3
+ require 'yaml'
4
+ require_relative './scaffold.rb'
5
+ #require 'jasmine'
6
+ require 'uri'
7
+ require 'rubygems'
8
+ require 'zip'
9
+ require 'colorize'
10
+
11
+
12
+
13
+
14
+ task :rake_dot_net_initialize do
15
+ #throw error if we are not in the root of the folder
16
+ if not File.exist?('dev.yml') then
17
+ puts "You are not in the root folder of a RAW Framework Core project!!".colorize(:red)
18
+ raise "Error!"
19
+ end
20
+
21
+ yml = YAML::load File.open("dev.yml")
22
+ @solution_name = "#{ yml["solution_name"] }.sln"
23
+ @solution_name_sans_extension = "#{ yml["solution_name"] }"
24
+ @mvc_project_directory = yml["mvc_project"]
25
+ @dl_project_directory = yml["dl_project"]
26
+ @database_name = yml["database_name"]
27
+ @project_name = yml["solution_name"]
28
+
29
+ @test_project = yml["test_project"]
30
+ @test_dll = "./#{ yml["test_project"] }/bin/debug/#{ yml["test_project"] }.dll "
31
+
32
+ @sh = CommandShell.new
33
+
34
+ #build?
35
+ end
36
+
37
+ desc "builds and run the website"
38
+ task :default => [:build]
39
+
40
+ desc "creates a new app, unzips the template and initialize the app"
41
+ task :newApp do
42
+ #ask for appName
43
+ puts "Enter app name(case sensitive):".colorize(:cyan)
44
+ appname = STDIN.gets.chomp
45
+ #filename = "#{appname}/#{appname}.zip"
46
+ filename = File.join( File.dirname(__FILE__), 'rawcore.zip' )
47
+ #create the folder
48
+ Dir.mkdir appname
49
+
50
+ puts "Inflating template and replacing tokens......".colorize(:light_green)
51
+ Zip::File.open(filename) do |zip_file|
52
+
53
+ toRepalce = '__NAME__'
54
+ # Handle entries one by one
55
+ zip_file.each do |entry|
56
+ unzipped =entry.name.gsub(toRepalce,appname)
57
+ entry.extract("#{appname}/#{unzipped}")
58
+ #skip dlls, images, fonts, javascript, css, etc
59
+ if !((unzipped.include? ".dll") ||
60
+ (unzipped.include? ".png") ||
61
+ (unzipped.include? ".jpg") ||
62
+ (unzipped.include? ".gif") ||
63
+ (unzipped.end_with? ".css") ||
64
+ (unzipped.end_with? ".js") ||
65
+ (unzipped.end_with? ".map") ||
66
+ (unzipped.include? ".less") ||
67
+ (unzipped.include? ".otf") ||
68
+ (unzipped.include? ".eot") ||
69
+ (unzipped.include? ".svg") ||
70
+ (unzipped.include? ".ttf") ||
71
+ (unzipped.include? ".woff")) &&
72
+ entry.size >0 then
73
+ # load the file as a string
74
+ data = File.read("#{appname}/#{unzipped}")
75
+ # globally substitute "install" for "latest"
76
+ filtered_data = data.gsub(toRepalce,appname)
77
+ # open the file for writing
78
+ File.open("#{appname}/#{unzipped}", "w") do |f|
79
+ f.write(filtered_data)
80
+ end
81
+ end
82
+ end
83
+ end
84
+ #at this point the zip file has been downloaded, uncompress and delete it
85
+ puts "Get app packages......".colorize(:light_green)
86
+ sh "dotnet restore #{appname}/#{appname}.Web/project.json"
87
+ sh "dotnet restore #{appname}/Generator/project.json"
88
+
89
+ puts "Building......".colorize(:light_green)
90
+ sh "dotnet build #{appname}/Generator/project.json -o #{appname}/XmlGenerator -f netcoreapp1.0"
91
+ sh "dotnet build #{appname}/#{appname}.Web/project.json"
92
+ puts "Done!".colorize(:light_blue)
93
+ puts "======================================================================================".colorize(:cyan)
94
+ puts "RAW framework follows Database First approach, expects that a DB schema already exists".colorize(:light_yellow)
95
+ puts "The application is configured to connect to a local SQL server express".colorize(:light_yellow)
96
+ puts "Change the following connection(if necessary) before you start scaffolding".colorize(:light_yellow)
97
+ puts "Data Source=localhost\\SQLEXPRESS;Initial Catalog=#{appname};Trusted_Connection=True;".colorize(:light_green)
98
+ puts "The connection string is in two appsettings.json files under the following folders:".colorize(:light_yellow)
99
+ puts "- #{appname}.Web".colorize(:light_green)
100
+ puts "- Generator".colorize(:light_green)
101
+ puts "======================================================================================".colorize(:cyan)
102
+ puts "Type rawc help for documentation".colorize(:light_yellow)
103
+ puts "Type cd #{appname} to start scaffolding!".colorize(:light_green)
104
+ end
105
+
106
+ desc "builds the solution"
107
+ task :build => :rake_dot_net_initialize do
108
+ #get packages
109
+ sh "dotnet restore #{@project_name}.Web/project.json"
110
+ #run the app
111
+ sh "dotnet build #{@project_name}.Web/project.json"
112
+ end
113
+
114
+ desc "builds the Generator"
115
+ task :buildGen => :rake_dot_net_initialize do
116
+ #get packages
117
+ sh "dotnet restore Generator/project.json"
118
+ #run the app
119
+ sh "dotnet build Generator/project.json -o XmlGenerator -f netcoreapp1.0"
120
+ end
121
+
122
+ desc "run the application"
123
+ task :run => :rake_dot_net_initialize do
124
+ sh "dotnet run --project #{@project_name}.Web/project.json"
125
+ end
126
+
127
+
128
+
129
+ desc "Show help"
130
+ task :help do
131
+ sh "start https://rawframework.github.io/rawfdotnetcore/index.html"
132
+ end
133
+
@@ -0,0 +1,21 @@
1
+ class CommandShell
2
+ def execute cmd
3
+ puts cmd
4
+ str = ""
5
+ status = 0
6
+
7
+ STDOUT.sync = true
8
+ IO.popen(cmd + " 2>&1") do |pipe|
9
+ pipe.sync = true
10
+ while s = pipe.gets
11
+ str += s
12
+ end
13
+ end
14
+
15
+ puts str
16
+
17
+ raise RuntimeError, STDERR if !$?.success?
18
+
19
+ return str
20
+ end
21
+ end
Binary file
@@ -0,0 +1,397 @@
1
+ begin
2
+ require 'nokogiri'
3
+ require 'rake'
4
+ require 'fileutils'
5
+ require 'colorize'
6
+ #Dir[File.dirname(Dir.pwd) + '/templates/*.rb'].each {|file| require file }
7
+ Dir[ './templates/*.rb'].each {|file| require file }
8
+ rescue LoadError
9
+ puts "============ note =============".colorize(:light_yellow)
10
+ puts "Looks like you don't have some gems installed, type ".colorize(:yellow)
11
+ puts "rawc help".colorize(:cyan)
12
+ puts "for pre requisites and get help.".colorize(:yellow)
13
+ puts "================================".colorize(:light_yellow)
14
+ puts ""
15
+ end
16
+
17
+ namespace :new do
18
+ desc "creates models for each table in the data base, example: rake gen:fullDbModels"
19
+ task :full_db_models, [] => :rake_dot_net_initialize do |t, args|
20
+ system("cd XmlGenerator&dotnet Generator.dll Model fulldb ../#{@mvc_project_directory}")
21
+ FileUtils.mv Dir.glob('XmlGenerator/*.xml'), "."
22
+ #delete the sysdiagrams file
23
+ FileUtils.rm 'sysdiagrams.xml', :force=>true
24
+ Dir.glob('*.xml') do |xml_file|
25
+ file_name = File.basename(xml_file, File.extname(xml_file))
26
+ Rake::Task['new:model'].invoke(file_name)
27
+ Rake::Task['new:model'].reenable
28
+ end
29
+
30
+ end
31
+
32
+ desc "creates an xml file from a dll model, example: rake gen:new_xml_file[User]"
33
+ task :create_xml_file, [:model] => :rake_dot_net_initialize do |t, args|
34
+ raise "name parameter required, example: rake gen:api[User]" if args[:model].nil?
35
+ model_name = args[:model]
36
+ file_name = model_name.ext("xml")
37
+
38
+ system("cd XmlGenerator&dotnet Generator.dll Views #{model_name} ../#{@mvc_project_directory}")
39
+ FileUtils.mv Dir.glob('XmlGenerator/*.xml'), "."
40
+ end
41
+
42
+ desc "Adds a new model from an xml, example: rake gen:model[User]"
43
+ task :model, [:model] => [:rake_dot_net_initialize] do |t, args|
44
+ raise "name parameter required, example: rake gen:model[User]" if args[:model].nil?
45
+ model_name = args[:model]
46
+ file_name = model_name.ext("xml")
47
+
48
+ verify_file_name file_name
49
+
50
+ system("cd XmlGenerator&dotnet Generator.dll Model #{model_name} ../#{@mvc_project_directory}")
51
+ FileUtils.mv Dir.glob('XmlGenerator/*.xml'), "."
52
+ xml_file = File.open(file_name)
53
+ nkg_xml_model = Nokogiri::XML(xml_file)
54
+
55
+ nkg_xml_model.xpath("//entity").each do |model|
56
+ create_model_template model
57
+ end
58
+ xml_file.close
59
+ File.delete(file_name)
60
+ end
61
+
62
+ desc "Adds a new api controller, example: rake gen:api[User]"
63
+ task :api, [:model] => [:buildGen, :create_xml_file] do |t, args|
64
+ raise "name parameter required, example: rake gen:api[User]" if args[:model].nil?
65
+ model_name = args[:model]
66
+ file_name = model_name.ext("xml")
67
+
68
+ verify_file_name file_name
69
+
70
+ xml_file = File.open(file_name)
71
+ nkg_xml_model = Nokogiri::XML(xml_file)
72
+
73
+ main_model = nkg_xml_model.xpath("//entity").first
74
+ name = main_model['name']
75
+ primaryKeyType = main_model['primaryKeyType']
76
+ root_namespace = nkg_xml_model.xpath("//model").first['namespace']
77
+ entityNameSpace = main_model['namespace']
78
+ root_namespace = (root_namespace.nil? || root_namespace == entityNameSpace) ? '' : "using #{root_namespace};"
79
+
80
+ create_api_controller_template main_model, primaryKeyType, entityNameSpace, root_namespace
81
+
82
+ xml_file.close
83
+ File.delete(file_name)
84
+ end
85
+
86
+ desc "Adds a new controller, example: rake gen:controller[User]"
87
+ task :controller, [:model] => [:buildGen, :create_xml_file] do |t, args|
88
+ raise "name parameter required, example: rake gen:controller[User]" if args[:model].nil?
89
+ model_name = args[:model]
90
+ file_name = model_name.ext("xml")
91
+
92
+ verify_file_name file_name
93
+
94
+ xml_file = File.open(file_name)
95
+ nkg_xml_model = Nokogiri::XML(xml_file)
96
+
97
+ main_model = nkg_xml_model.xpath("//entity").first
98
+ name = main_model['name']
99
+ primaryKeyType = main_model['primaryKeyType']
100
+ root_namespace = nkg_xml_model.xpath("//model").first['namespace']
101
+ entityNameSpace = main_model['namespace']
102
+ root_namespace = (root_namespace.nil? || root_namespace == entityNameSpace) ? '' : "using #{root_namespace};"
103
+
104
+ create_controller_template main_model, primaryKeyType, entityNameSpace,root_namespace
105
+ #close the xml
106
+ xml_file.close
107
+ #Delete the xml
108
+ File.delete(file_name)
109
+ end
110
+
111
+ desc "Adds a new repository, example: rake gen:repository[User]"
112
+ task :repository, [:model] => [:buildGen, :create_xml_file] do |t, args|
113
+ raise "name parameter required, example: rake gen:repository[User]" if args[:model].nil?
114
+ model_name = args[:model]
115
+ file_name = model_name.ext("xml")
116
+
117
+ verify_file_name file_name
118
+
119
+ xml_file = File.open(file_name)
120
+ nkg_xml_model = Nokogiri::XML(xml_file)
121
+
122
+ main_model = nkg_xml_model.xpath("//entity").first
123
+ name = main_model['name']
124
+ primaryKeyType = main_model['primaryKeyType']
125
+ root_namespace = nkg_xml_model.xpath("//model").first['namespace']
126
+ entityNameSpace = main_model['namespace']
127
+ root_namespace = (root_namespace.nil? || root_namespace == entityNameSpace) ? '' : "using #{root_namespace};"
128
+
129
+ create_repository_template name, primaryKeyType, entityNameSpace
130
+ #close the xml
131
+ xml_file.close
132
+ #Delete the xml
133
+ File.delete(file_name)
134
+ end
135
+
136
+ desc "Adds a new view, you can choose to use bs_grid plug in for index view with a optional third parameter <true>,
137
+ example: rake gen:view[Entity,<Edit, Create, Details, Index>,<true>]. \nTo create partial views set a extra parameter
138
+ partial=true, example: rake gen:view[User,Edit] partial=true"
139
+ task :view, [:model, :type, :use_bs_grid] => [:buildGen, :create_xml_file] do |t, args|
140
+ raise "name and view type parameters are required, example: rake gen:view[Edit,User]" if args[:model].nil? || args[:type].nil?
141
+ @use_partial_views = ENV["partial"] == "true"
142
+
143
+ type = args[:type].downcase
144
+ model_name = args[:model]
145
+ use_bs_grid = args[:use_bs_grid]
146
+ file_name = model_name.ext("xml")
147
+
148
+ verify_file_name file_name
149
+
150
+ xml_file = File.open(file_name)
151
+ nkg_xml_model = Nokogiri::XML(xml_file)
152
+
153
+ model = nkg_xml_model.xpath("//entity").first
154
+ name = model['name']
155
+
156
+ folder "Views/#{name}"
157
+
158
+ case type
159
+ when "create"
160
+ save view_create_template(model), "#{@mvc_project_directory}/Views/#{name}/Create.cshtml"
161
+ add_cshtml_node name, "Create"
162
+ when "edit"
163
+ save view_edit_template(model), "#{@mvc_project_directory}/Views/#{name}/Edit.cshtml"
164
+ add_cshtml_node name, "Edit"
165
+ when "details"
166
+ save view_details_template(model), "#{@mvc_project_directory}/Views/#{name}/Details.cshtml"
167
+ add_cshtml_node name, "Details"
168
+ when "index"
169
+ puts use_bs_grid
170
+ if use_bs_grid
171
+ create_js_bs_grid_template model
172
+ end
173
+
174
+ save view_index_template(model, use_bs_grid), "#{@mvc_project_directory}/Views/#{name}/Index.cshtml"
175
+ add_cshtml_node name, "Index"
176
+ else
177
+ puts "View type is not valid."
178
+ end
179
+ #close the xml
180
+ xml_file.close
181
+ #Delete the xml
182
+ File.delete(file_name)
183
+ end
184
+
185
+
186
+ desc "adds a CRUD scaffold, example: rake gen:crudFor[Entity]. \nTo create partial views set a extra parameter partial=true, example: rake gen:crudFor[Entity] partial=true"
187
+ task :crudFor, [:model] => [:buildGen, :create_xml_file] do |t, args|
188
+ raise "name parameter required, example: rake gen:crudFor[User]" if args[:model].nil?
189
+ @use_partial_views = ENV["partial"] == "true"
190
+
191
+ model_name = args[:model]
192
+ file_name = model_name.ext("xml")
193
+
194
+ verify_file_name file_name
195
+
196
+ xml_file = File.open(file_name)
197
+ nkg_xml_model = Nokogiri::XML(xml_file)
198
+
199
+ @is_view_model = nkg_xml_model.xpath("//entity").first['isViewModel']
200
+
201
+ main_model = nkg_xml_model.xpath("//entity").first
202
+ name = main_model['name']
203
+ primaryKeyType = main_model['primaryKeyType']
204
+ root_namespace = nkg_xml_model.xpath("//model").first['namespace']
205
+ entityNameSpace = main_model['namespace']
206
+ root_namespace = (root_namespace.nil? || root_namespace == entityNameSpace) || root_namespace =='' || root_namespace.nil? ? '' : "using #{root_namespace};"
207
+ #do not create the repository if it's a viewmodel
208
+ if @is_view_model == 'True' || @is_view_model == 'true'
209
+ create_repository_template name, primaryKeyType, entityNameSpace
210
+ end
211
+
212
+ create_controller_template main_model, primaryKeyType, entityNameSpace, root_namespace
213
+
214
+ create_views_templates main_model
215
+
216
+ create_js_templates main_model
217
+
218
+ xml_file.close
219
+ #Delete the xml
220
+ File.delete(file_name)
221
+
222
+ puts "Process completed!!".colorize(:light_green)
223
+
224
+ end
225
+
226
+ desc "adds javascript file to your mvc project, example: rake gen:script[index]"
227
+ task :script, [:name] => :buildGen do |t, args|
228
+ raise "js name required, example: rake gen:script[index]" if args[:name].nil?
229
+
230
+ verify_file_name args[:name]
231
+
232
+ folder "Scripts/app"
233
+
234
+ save js_template(args[:name]), "#{@mvc_project_directory}/Scripts/app/#{args[:name]}.js"
235
+
236
+ add_js_node args[:name]
237
+ end
238
+
239
+ def save content, file_path
240
+ write_file = false
241
+ if !File.exists?(file_path) || @overwrite_files
242
+ write_file = true
243
+ elsif @overwrite_files == nil
244
+ puts ""
245
+ puts "Some files already exists, do you want replace all? (Y/N)".colorize(:light_yellow)
246
+ overWriteFile = STDIN.gets.chomp
247
+ @overwrite_files = (overWriteFile == 'y' || overWriteFile == 'Y')
248
+ write_file = @overwrite_files
249
+ end
250
+
251
+ if write_file
252
+ File.open(file_path, "w+") { |f| f.write(content) }
253
+ puts "#{file_path} added"
254
+ else
255
+ puts "#{file_path} skipped"
256
+ end
257
+ end
258
+
259
+ def folder dir
260
+ FileUtils.mkdir_p "./#{@mvc_project_directory}/#{dir}/"
261
+ end
262
+
263
+ def add_compile_node folder, name, project = nil
264
+ #this is no logner needed for dotnet core projects
265
+ end
266
+
267
+ def add_cshtml_node folder, name
268
+ #this is no logner needed for dotnet core projects
269
+ end
270
+
271
+ def add_js_node name
272
+ #this is no logner needed for dotnet core projects
273
+ end
274
+
275
+ def add_include doc, type, value
276
+ #this is no logner needed for dotnet core projects
277
+ end
278
+
279
+ def proj_file
280
+ "#{@mvc_project_directory}/#{@mvc_project_directory}.csproj"
281
+ end
282
+
283
+ def proj_tests_file
284
+ "#{@test_project}/#{@test_project}.csproj"
285
+ end
286
+
287
+ def webconfig_file
288
+ "#{@mvc_project_directory}/Web.config"
289
+ end
290
+
291
+ def verify_file_name name
292
+ raise "You cant use #{name} as the name. No spaces or fancy characters please." if name =~ /[\x00\/\\:\*\?\"<>\|]/ || name =~ / /
293
+ end
294
+
295
+ def add_db_connection_string
296
+ doc = Nokogiri::XML(open(webconfig_file))
297
+ doc.xpath("//connectionStrings").first << "<add name='Default' providerName='System.Data.SqlClient' connectionString='Data Source=localhost\\SQLEXPRESS;Initial Catalog=#{@database_name};Persist Security Info=true;User ID=user_name;Password=Password1234' />"
298
+ File.open(webconfig_file, "w") { |f| f.write(doc) }
299
+ end
300
+
301
+ def create_repository_template name, keytype, entityNameSpace
302
+ folder "Repositories"
303
+ repository_name = name + "Repository"
304
+ save repository_template(name, keytype,entityNameSpace), "#{@dl_project_directory}/Repositories/#{repository_name}.cs"
305
+ add_compile_node :Repositories, repository_name
306
+ end
307
+
308
+ def create_model_template model
309
+ model_name = model['name']
310
+ save model_template(model), "#{@dl_project_directory}/Models/#{model_name}.cs"
311
+ add_compile_node :Models, model_name
312
+ end
313
+
314
+ def create_controller_template model, keytype, entityNameSpace, root_namespace
315
+ controller_name = model['name'] + "Controller"
316
+ save controller_template(model, keytype, entityNameSpace, root_namespace), "#{@mvc_project_directory}/Controllers/#{controller_name}.cs"
317
+ add_compile_node :Controllers, controller_name
318
+ end
319
+
320
+ def create_api_controller_template model, keytype, entityNameSpace, root_namespace
321
+ api_controller_name = model['name'] + "Controller"
322
+ folder "Controllers/Api"
323
+
324
+ save api_controller_template(model, keytype, entityNameSpace, root_namespace), "#{@mvc_project_directory}/Controllers/Api/#{api_controller_name}.cs"
325
+ add_compile_node "Controllers\\Api", api_controller_name
326
+ end
327
+
328
+ def create_views_templates model
329
+ name = model['name']
330
+ folder "Views/Shared"
331
+ folder "Views/#{name}"
332
+
333
+ save view_index_template(model), "#{@mvc_project_directory}/Views/#{name}/Index.cshtml"
334
+ add_cshtml_node name, "Index"
335
+
336
+ save view_create_template(model), "#{@mvc_project_directory}/Views/#{name}/Create.cshtml"
337
+ add_cshtml_node name, "Create"
338
+
339
+ save view_details_template(model), "#{@mvc_project_directory}/Views/#{name}/Details.cshtml"
340
+ add_cshtml_node name, "Details"
341
+
342
+ save view_edit_template(model), "#{@mvc_project_directory}/Views/#{name}/Edit.cshtml"
343
+ add_cshtml_node name, "Edit"
344
+
345
+ add_navigation_link name, "List #{name}"
346
+ end
347
+
348
+ def create_js_templates model
349
+ name = model['name']
350
+ folder "wwwroot/js/app"
351
+
352
+ save js_binding_template(model), "#{@mvc_project_directory}/wwwroot/js/app/#{name}.binding.js"
353
+ add_js_node "#{name}.binding"
354
+
355
+ save js_model_validate_template(model), "#{@mvc_project_directory}/wwwroot/js/app/#{name}.validate.js"
356
+ add_js_node "#{name}.validate"
357
+
358
+ save js_controller_template(model), "#{@mvc_project_directory}/wwwroot/js/app/#{name}.controller.js"
359
+ add_js_node "#{name}.controller"
360
+ end
361
+
362
+ def create_db_context_templates name
363
+ folder "Context"
364
+
365
+ save context_template(name), "#{@mvc_project_directory}/Context/#{name}Context.cs"
366
+ add_compile_node :Context, "#{name}Context"
367
+ end
368
+
369
+ def create_tests_controller_template model
370
+ #TODO:test project is not implemented yet
371
+ end
372
+
373
+ def create_js_bs_grid_template model
374
+ name = model['name']
375
+ folder "Scripts/app"
376
+
377
+ save js_bs_grid_template(model), "#{@mvc_project_directory}/wwwroot/js/app/#{name}.grid.js"
378
+ add_js_node "#{name}.grid"
379
+ end
380
+
381
+
382
+ def add_navigation_link controller_name, display_name
383
+ source = "#{@mvc_project_directory}/Views/Shared/_Layout.cshtml"
384
+ file = File.open(source, "r")
385
+
386
+ content = file.read.to_s.gsub("<!--toplinks-->",
387
+ "<li @if (ViewBag.page == \"#{controller_name}\"){<text> class=\"active\"</text>;}><a href=\"/#{controller_name}\">#{display_name}</a></li>\n<!--toplinks-->")
388
+
389
+ File.open(source, "w") do |f|
390
+ f.write(content)
391
+ end
392
+
393
+ file.close
394
+ end
395
+
396
+ end
397
+
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rawc
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ platform: ruby
6
+ authors:
7
+ - Pedro Ramirez
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Rawc uses rake
14
+ email: pramirez@sciodev.com
15
+ executables:
16
+ - rawc
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/rawc
21
+ - lib/rawc/Rakefile.rb
22
+ - lib/rawc/command_shell.rb
23
+ - lib/rawc/rawcore.zip
24
+ - lib/rawc/scaffold.rb
25
+ homepage: https://rawframework.github.io/rawfdotnetcore/index.html
26
+ licenses: []
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project: rawc
44
+ rubygems_version: 2.4.8
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: Rawc - rake wrapper for RAW Framework for .Net Core 1
48
+ test_files: []