sztupy-shaml 0.1.1 → 0.1.5
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.
- data/lib/shaml.rb +36 -17
- data/lib/templates/shaml_base_template.zip +0 -0
- metadata +11 -1
data/lib/shaml.rb
CHANGED
@@ -1,15 +1,23 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'zip/zip'
|
3
3
|
|
4
|
-
SHAML_VERSION="0.1"
|
4
|
+
SHAML_VERSION="0.1.5"
|
5
5
|
|
6
6
|
TEMPLATEDIR = File.join(File.dirname(__FILE__),"templates")
|
7
7
|
|
8
|
+
def getappname
|
9
|
+
appname = Dir.glob("*.sln").first
|
10
|
+
if appname.nil?
|
11
|
+
puts 'S#aml ERROR: solution file not found. Change directory to a s#aml-architecture project'
|
12
|
+
exit
|
13
|
+
end
|
14
|
+
appname.gsub(".sln","")
|
15
|
+
end
|
16
|
+
|
8
17
|
def camelcase(phrase)
|
9
18
|
phrase.gsub(/^[a-z]|[ _]+[a-z]/) { |a| a.upcase }.gsub(/[ _]/, '')
|
10
19
|
end
|
11
20
|
|
12
|
-
|
13
21
|
def unzip_file(file, destination)
|
14
22
|
Zip::ZipFile.open(file) { |zip_file|
|
15
23
|
zip_file.each { |f|
|
@@ -74,9 +82,14 @@ if ARGV.count == 0 then
|
|
74
82
|
puts " controller Controller : Create a standalone controller"
|
75
83
|
puts " model Model [desc] : Create a standalone model"
|
76
84
|
puts
|
85
|
+
puts " compile : Compiles the solution under mono"
|
86
|
+
puts
|
87
|
+
puts " server : Runs xsp2"
|
88
|
+
puts
|
77
89
|
puts "Examples: "
|
78
90
|
puts " shaml generate app Blog"
|
79
91
|
puts " shaml generate resource Post"
|
92
|
+
puts " shaml compile"
|
80
93
|
puts
|
81
94
|
puts "The optional [desc] parameter describes the base schema"
|
82
95
|
puts "of the model. Here is an example how it looks like:"
|
@@ -107,11 +120,7 @@ else
|
|
107
120
|
FileUtils.rm_rf ".shaml_extract_temp"
|
108
121
|
when "resource"
|
109
122
|
desc = ARGV.shift || nil
|
110
|
-
appname =
|
111
|
-
if appname.nil?
|
112
|
-
puts 'S#aml ERROR: solution file not found'
|
113
|
-
exit
|
114
|
-
end
|
123
|
+
appname = getappname
|
115
124
|
copy_file(File.join(TEMPLATEDIR,"WebSample.cs"),File.join(appname,"App","Models","WebSample.cs"),appname,name,desc)
|
116
125
|
copy_file(File.join(TEMPLATEDIR,"WebSamplesController.cs"),File.join(appname,"App","Controllers","WebSamplesController.cs"),appname,name,desc)
|
117
126
|
copy_file(File.join(TEMPLATEDIR,"_WebSampleForm.haml"),File.join(appname,"App","Views","WebSample","_WebSampleForm.haml"),appname,name,desc)
|
@@ -124,20 +133,12 @@ else
|
|
124
133
|
copy_file(File.join(TEMPLATEDIR,"WebSamplesControllerTests.cs"),File.join(appname+".Tests","Tests","Web","Controllers","WebSamplesControllerTests.cs"),appname,name,desc)
|
125
134
|
when "model"
|
126
135
|
desc = ARGV.shift || nil
|
127
|
-
appname =
|
128
|
-
if appname.nil?
|
129
|
-
puts 'S#aml ERROR: solution file not found'
|
130
|
-
exit
|
131
|
-
end
|
136
|
+
appname = getappname
|
132
137
|
copy_file(File.join(TEMPLATEDIR,"WebSample.cs"),File.join(appname,"App","Models","WebSample.cs"),appname,name,desc)
|
133
138
|
copy_file(File.join(TEMPLATEDIR,"WebSampleTests.cs"),File.join(appname+".Tests","Tests","Core","WebSampleTests.cs"),appname,name,desc)
|
134
139
|
when "controller"
|
135
140
|
desc = ARGV.shift || nil
|
136
|
-
appname =
|
137
|
-
if appname.nil?
|
138
|
-
puts 'S#aml ERROR: solution file not found'
|
139
|
-
exit
|
140
|
-
end
|
141
|
+
appname = getappname
|
141
142
|
copy_file(File.join(TEMPLATEDIR,"WebSamplesController.cs"),File.join(appname,"App","Controllers","WebSamplesController.cs"),appname,name,desc)
|
142
143
|
copy_file(File.join(TEMPLATEDIR,"_WebSampleForm.haml"),File.join(appname,"App","Views","WebSample","_WebSampleForm.haml"),appname,name,desc)
|
143
144
|
copy_file(File.join(TEMPLATEDIR,"Create.haml"),File.join(appname,"App","Views","WebSample","Create.haml"),appname,name,desc)
|
@@ -152,6 +153,24 @@ else
|
|
152
153
|
else
|
153
154
|
puts 'S#aml ERROR: no name specified'
|
154
155
|
end
|
156
|
+
when "compile"
|
157
|
+
puts "Compiling using gmcs"
|
158
|
+
appname = getappname
|
159
|
+
FileUtils.mkdir_p(File.join(appname,"bin"))
|
160
|
+
FileUtils.mkdir_p(File.join(appname+".Tests","bin"))
|
161
|
+
system("gmcs -recurse:#{File.join(appname,"*.cs")} `ls libraries/*.dll | sed \"s/../-r:../\"` -r:System.Web.Routing -r:System.Web -t:library -out:#{File.join(appname,"bin",appname+".dll")}")
|
162
|
+
system("gmcs -recurse:#{File.join(appname+".Tests","*.cs")} `ls libraries/*.dll | sed \"s/../-r:../\"` -r:System.Web.Routing -r:System.Web -t:library -out:#{File.join(appname+".Tests","bin",appname+".dll")}")
|
163
|
+
when "server"
|
164
|
+
puts "Starting xsp2"
|
165
|
+
appname = getappname
|
166
|
+
Dir.chdir(appname) do
|
167
|
+
puts "Changed directory to #{Dir.pwd}"
|
168
|
+
ENV["MONO_PATH"] = File.join(Dir.pwd,"bin")
|
169
|
+
puts "Set MONO_PATH to #{ENV["MONO_PATH"]}"
|
170
|
+
puts "Starting xsp2"
|
171
|
+
system("xsp2")
|
172
|
+
puts "Done..."
|
173
|
+
end
|
155
174
|
else
|
156
175
|
puts 'S#aml ERROR: unknown command'
|
157
176
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sztupy-shaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zsolt Sz. Sztupak
|
@@ -12,6 +12,16 @@ cert_chain: []
|
|
12
12
|
date: 2009-06-18 00:00:00 -07:00
|
13
13
|
default_executable: shaml
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: febeling-rubyzip
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.9.1
|
24
|
+
version:
|
15
25
|
- !ruby/object:Gem::Dependency
|
16
26
|
name: chriseppstein-compass
|
17
27
|
type: :runtime
|