railsbuilder 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/railsbuilder.rb +19 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a3d4230fc6b0c21d1f52713b437c026b1341909
|
4
|
+
data.tar.gz: 7441ed3b3b1a4dba56709765cf70d750b680b91b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec7c6d5db236e66c2d068e0a22a89350a1d6bd02c42547689cbe162ef58c92d206c7454f10244b769d1b4c959128347180f869a9953fad71fecb328f6b174d1c
|
7
|
+
data.tar.gz: 42742008fe6040b01c221b735c32c5576484391662edc7bdc87e66830677b0b578267cb5394ef546201e434e89863613c737f8e9bce193dd43ed490bed9efdf3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/railsbuilder.rb
CHANGED
@@ -34,8 +34,11 @@ class RailsBuilder
|
|
34
34
|
def build()
|
35
35
|
|
36
36
|
@app = @h[:app][0][1][':app']
|
37
|
+
app_path = @h[:app][0][1][':app_path']
|
38
|
+
Dir.chdir app_path if app_path
|
37
39
|
|
38
40
|
unless File.exists? @app then
|
41
|
+
|
39
42
|
command = 'rails new ' + @app
|
40
43
|
puts ":: preparing to execute shell command: `#{command}`"
|
41
44
|
puts 'Are you sure you want to build a new app? (Y/n)'
|
@@ -46,6 +49,21 @@ class RailsBuilder
|
|
46
49
|
Dir.chdir @app
|
47
50
|
|
48
51
|
# select the :resource records
|
52
|
+
root = @h[:root][0][1][":root"]
|
53
|
+
|
54
|
+
if root then
|
55
|
+
|
56
|
+
# check if the config/routes.rb file needs updated
|
57
|
+
routes = File.join('config','routes.rb')
|
58
|
+
buffer = File.read routes
|
59
|
+
|
60
|
+
regex = / #( root 'welcome#index')/
|
61
|
+
|
62
|
+
if buffer[regex] then
|
63
|
+
puts ':: updating ' + routes
|
64
|
+
File.write routes, buffer.sub(regex, ' \1').sub('welcome#index',root)
|
65
|
+
end
|
66
|
+
end
|
49
67
|
|
50
68
|
@h[:resource].each do |raw_resource|
|
51
69
|
|
@@ -104,6 +122,7 @@ app: #{dir}
|
|
104
122
|
# resources: posts
|
105
123
|
EOF
|
106
124
|
end
|
125
|
+
|
107
126
|
@config = s
|
108
127
|
a = LineParser.new(patterns).parse s
|
109
128
|
a.group_by(&:first)
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|