rmvc 2.1.2 → 3.0.1
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.
- checksums.yaml +4 -4
- data/lib/rmvc.rb +21 -21
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d2118910a18dd14b21ae51754610cfdc651a6bb
|
4
|
+
data.tar.gz: a7ace3176411ba4f8d6bd7a8fae094bc89246ee9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7808633b2ba7194f4955d487e5ede3366a9b10c7ebca232228aef3a6b8b42ccab9b4918a6b86cbd2647f551d221ffb30413510b373351a20ab1db6aa396420e
|
7
|
+
data.tar.gz: f76546e066fbd760fbbee382e6b90197eedea144aee5f5202ea4ad051f2612a7947c2f955be5bc594fd49f62a80228a1d3736450248cb77f423b386f0338c531
|
data/lib/rmvc.rb
CHANGED
@@ -74,37 +74,37 @@ module RMVC
|
|
74
74
|
if (args[1] == "model") then
|
75
75
|
puts "Generating model #{args[2]}..."
|
76
76
|
# Create file /app/models/args[2].rb
|
77
|
-
if (File.exists? "app/models/#{args[2]}.rb") then
|
78
|
-
puts "error".red + " File /app/models/#{args[2]}.rb already exists."
|
77
|
+
if (File.exists? "app/models/#{args[2].downcase}.rb") then
|
78
|
+
puts "error".red + " File /app/models/#{args[2].downcase}.rb already exists."
|
79
79
|
exit
|
80
80
|
end
|
81
|
-
File.open("app/models/#{args[2]}.rb", "w") do |f|
|
81
|
+
File.open("app/models/#{args[2].downcase}.rb", "w") do |f|
|
82
82
|
f.write(RMVC::Helpers.createModel(args[2]))
|
83
83
|
end
|
84
|
-
puts "create".green + " File /app/models/#{args[2]}.rb"
|
84
|
+
puts "create".green + " File /app/models/#{args[2].downcase}.rb"
|
85
85
|
elsif (args[1] == "controller")
|
86
86
|
puts "Generating controller #{args[2]}..."
|
87
87
|
# Create file /app/controllers/args[2]_controller.rb
|
88
|
-
if (File.exists? "app/controllers/#{args[2]}_controller.rb") then
|
89
|
-
puts "error".red + " File /app/controller/#{args[2]}_controller.rb already exists."
|
88
|
+
if (File.exists? "app/controllers/#{args[2].downcase}_controller.rb") then
|
89
|
+
puts "error".red + " File /app/controller/#{args[2].downcase}_controller.rb already exists."
|
90
90
|
exit
|
91
91
|
end
|
92
|
-
File.open("app/controllers/#{args[2]}_controller.rb", "w") do |f|
|
92
|
+
File.open("app/controllers/#{args[2].downcase}_controller.rb", "w") do |f|
|
93
93
|
f.write(RMVC::Helpers.createController(args[2]))
|
94
94
|
end
|
95
|
-
puts "create".green + " File /app/controllers/#{args[2]}_controller.rb"
|
96
|
-
puts "notice".yellow + " Remember to add a require statement to the main file of the project, to include app/controllers/#{args[2]}_controller."
|
95
|
+
puts "create".green + " File /app/controllers/#{args[2].downcase}_controller.rb"
|
96
|
+
puts "notice".yellow + " Remember to add a require statement to the main file of the project, to include app/controllers/#{args[2].downcase}_controller."
|
97
97
|
elsif (args[1] == "view")
|
98
98
|
puts "Generating view #{args[2]}..."
|
99
99
|
# Create file /app/controllers/args[2]_controller.rb
|
100
|
-
if (File.exists? "app/views/#{args[2]}.rb") then
|
101
|
-
puts "error".red + " File /app/views/#{args[2]}.rb already exists."
|
100
|
+
if (File.exists? "app/views/#{args[2].downcase}.rb") then
|
101
|
+
puts "error".red + " File /app/views/#{args[2].downcase}.rb already exists."
|
102
102
|
exit
|
103
103
|
end
|
104
|
-
File.open("app/views/#{args[2]}.rb", "w") do |f|
|
104
|
+
File.open("app/views/#{args[2].downcase}.rb", "w") do |f|
|
105
105
|
f.write(RMVC::Helpers.createView(args[2], args[3]))
|
106
106
|
end
|
107
|
-
puts "create".green + " File /app/views/#{args[2]}.rb"
|
107
|
+
puts "create".green + " File /app/views/#{args[2].downcase}.rb"
|
108
108
|
else
|
109
109
|
puts "Wrong argument for generate: #{args[1]}"
|
110
110
|
RMVC::Interface.showHelp
|
@@ -189,9 +189,9 @@ module RMVC
|
|
189
189
|
class Helpers
|
190
190
|
# Helper for creating a controller
|
191
191
|
def self.createController(controllerName)
|
192
|
-
controllerCap = controllerName.capitalize
|
193
|
-
"require './app/models/#{controllerName}'
|
194
|
-
require './app/views/#{controllerName}'
|
192
|
+
controllerCap = controllerName.slice(0,1).capitalize + controllerName.slice(1..-1)
|
193
|
+
"require './app/models/#{controllerName.downcase}'
|
194
|
+
require './app/views/#{controllerName.downcase}'
|
195
195
|
class #{controllerCap}Controller
|
196
196
|
class << self
|
197
197
|
#Add your variables here!
|
@@ -205,8 +205,8 @@ end\n"
|
|
205
205
|
end
|
206
206
|
# Helper for creating a view
|
207
207
|
def self.createView(viewName, controllerName)
|
208
|
-
viewCap = viewName.capitalize
|
209
|
-
"require './app/controllers/#{controllerName}_controller'
|
208
|
+
viewCap = viewName.slice(0,1).capitalize + viewName.slice(1..-1)
|
209
|
+
"require './app/controllers/#{controllerName.downcase}_controller'
|
210
210
|
class #{viewCap}View
|
211
211
|
def self.load
|
212
212
|
puts \"Hello, hello!\"
|
@@ -216,9 +216,9 @@ end\n"
|
|
216
216
|
|
217
217
|
# Helper for creating a model
|
218
218
|
def self.createModel(modelName)
|
219
|
-
"require './app/controllers/#{modelName}_controller'
|
220
|
-
class #{modelName.capitalize}Model
|
219
|
+
"require './app/controllers/#{modelName.downcase}_controller'
|
220
|
+
class #{modelName.slice(0,1).capitalize + modelName.slice(1..-1)}Model
|
221
221
|
end\n"
|
222
222
|
end
|
223
223
|
end
|
224
|
-
end
|
224
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmvc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Catbuntu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
53
|
version: '0'
|
54
54
|
requirements: []
|
55
55
|
rubyforge_project:
|
56
|
-
rubygems_version: 2.0.
|
56
|
+
rubygems_version: 2.0.6
|
57
57
|
signing_key:
|
58
58
|
specification_version: 4
|
59
59
|
summary: Ruby MVC
|