bootscaf 0.1.10 → 0.1.11
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/bootscaf/cli.rb +75 -75
- data/lib/bootscaf/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2d964d2ad1e86185edeebc5ab6ba7b3962dd343
|
4
|
+
data.tar.gz: 5f183d8f1366c4aa8d4d47635aac3808c41f449f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66db58858b610da71aeb304aca6b309f3d0268e908d9f3537baff2e87a21cdb5fd0b9dacf206dcd04b14f8ba797e8e10dcf97d1b286b6e6e2cb8105b393a1dc9
|
7
|
+
data.tar.gz: 319a03b1cf61f01619629f615cc78269527231e63294df6ebcb63f2cad55e0cb54cb3af835b20f33d02252e98f12abed497e947569496bd12813ed5cef2b575c
|
data/lib/bootscaf/cli.rb
CHANGED
@@ -21,7 +21,7 @@ module Bootscaf
|
|
21
21
|
def nest(nestpath)
|
22
22
|
|
23
23
|
is_mac = (RbConfig::CONFIG['host_os'] =~ /^darwin/) >= 0
|
24
|
-
|
24
|
+
icmd = is_mac ? "-i ''" : '--in-place'
|
25
25
|
|
26
26
|
fullpath = nestpath.split('>').map { |a| a.downcase }
|
27
27
|
ancestors_only = fullpath.first(fullpath.size-1)
|
@@ -29,50 +29,50 @@ module Bootscaf
|
|
29
29
|
modelname = fullpath.last
|
30
30
|
singular_modelname = Bootscaf::Utils.singularize(modelname)
|
31
31
|
|
32
|
-
|
32
|
+
print "Running on #{modelname} scaffolds with nesting path `#{singularized_ancestors.join(' > ')}`."
|
33
33
|
|
34
34
|
print "Updating app/controllers/#{modelname}_controller.rb."
|
35
35
|
singularized_ancestors.each do |sa|
|
36
|
-
print `sed #{
|
37
|
-
print `sed #{
|
38
|
-
print `sed #{
|
36
|
+
print `sed #{icmd} -e 's/Controller < ApplicationController/Controller < ApplicationController\\\nbefore_action :set_#{sa}/' app/controllers/#{modelname}_controller.rb`
|
37
|
+
print `sed #{icmd} -e 's/private/private\\\ndef set_#{sa}\\\n@#{sa} = #{sa.capitalize}.find_by_id(params[:#{sa}_id])\\\nraise ActiveRecord::RecordNotFound unless @#{sa}\\\nend/' app/controllers/#{modelname}_controller.rb`
|
38
|
+
print `sed #{icmd} -e 's/.permit(\\(.*\\):#{sa}_id,\\(.*\\))/.permit(\\1\\2)/' app/controllers/#{modelname}_controller.rb`
|
39
39
|
end
|
40
|
-
print `sed #{
|
41
|
-
print `sed #{
|
42
|
-
print `sed #{
|
43
|
-
print `sed #{
|
44
|
-
print `sed #{
|
45
|
-
print `sed #{
|
40
|
+
print `sed #{icmd} -e 's/#{singular_modelname.capitalize}.all/@#{singularized_ancestors.last}.#{modelname}.all/' app/controllers/#{modelname}_controller.rb`
|
41
|
+
print `sed #{icmd} -e 's/#{singular_modelname.capitalize}.new/@#{singularized_ancestors.last}.#{modelname}.build/' app/controllers/#{modelname}_controller.rb`
|
42
|
+
print `sed #{icmd} -e 's/redirect_to @#{singular_modelname},/redirect_to [@#{singularized_ancestors.join(', @')}#{singular_modelname}],/' app/controllers/#{modelname}_controller.rb`
|
43
|
+
print `sed #{icmd} -e 's/, location: @#{singular_modelname}/, location: [@#{singularized_ancestors.join(', @')}#{singular_modelname}]/' app/controllers/#{modelname}_controller.rb`
|
44
|
+
print `sed #{icmd} -e 's/redirect_to #{modelname}_url/redirect_to [#{singularized_ancestors.map{|sa| "@#{sa}"}.join(', ')}:#{modelname}]/' app/controllers/#{modelname}_controller.rb`
|
45
|
+
print `sed #{icmd} -e 's/#{singular_modelname.capitalize}.find(params[:id])/@#{singularized_ancestors.last}.#{modelname}.find(params[:id])/' app/controllers/#{modelname}_controller.rb`
|
46
46
|
|
47
47
|
print "Updating app/views/#{modelname}/_form.html.erb."
|
48
|
-
print `sed #{
|
48
|
+
print `sed #{icmd} -e 's/form_for(@#{singular_modelname})/form_for([@#{singularized_ancestors.join(', @')}#{singular_modelname}])/' app/views/#{modelname}/_form.html.erb`
|
49
49
|
|
50
50
|
print "Updating app/views/#{modelname}/edit.html.erb."
|
51
|
-
print `sed #{
|
52
|
-
print `sed #{
|
53
|
-
print `sed #{
|
51
|
+
print `sed #{icmd} -e 's/Edit \\(.*\\) - $/Edit \\1 - #{singularized_ancestors.last.capitalize} <%= @#{singularized_ancestors.last}.id %>/' app/views/#{modelname}/edit.html.erb`
|
52
|
+
print `sed #{icmd} -e 's/<h1>Editing \\(.*\\)<\\/h1>/<h1>Editing \\1 <small>#{singularized_ancestors.last.capitalize} <%= @#{singularized_ancestors.last}.id %><\\/small><\\/h1>/' app/views/#{modelname}/edit.html.erb`
|
53
|
+
print `sed #{icmd} -e 's/.html_safe, @#{singular_modelname}, /.html_safe, [@#{singularized_ancestors.join(', @')}#{singular_modelname}], /' app/views/#{modelname}/edit.html.erb`
|
54
54
|
|
55
55
|
print "Updating app/views/#{modelname}/index.html.erb."
|
56
|
-
print `sed #{
|
57
|
-
print `sed #{
|
58
|
-
print `sed #{
|
59
|
-
print `sed #{
|
60
|
-
print `sed #{
|
61
|
-
print `sed #{
|
56
|
+
print `sed #{icmd} -e 's/#{modelname.capitalize} -$/#{modelname.capitalize} - #{singularized_ancestors.last.capitalize} <%= @#{singularized_ancestors.last}.id %>/' app/views/#{modelname}/index.html.erb`
|
57
|
+
print `sed #{icmd} -e 's/.html_safe, "\\/", /.html_safe, [#{singularized_ancestors.map{|sa| "@#{sa}"}.join(', ')}], /' app/views/#{modelname}/index.html.erb`
|
58
|
+
print `sed #{icmd} -e 's/.html_safe, [:new, :#{singular_modelname}], /.html_safe, [:new, #{singularized_ancestors.map{|sa| "@#{sa}"}.join(', ')}:#{singular_modelname}], /' app/views/#{modelname}/index.html.erb`
|
59
|
+
print `sed #{icmd} -e 's/Listing #{modelname.capitalize}$/Listing #{modelname.capitalize}\\\n <small>#{singularized_ancestors.last.capitalize} <%= @#{singularized_ancestors.last}.id %><\\/small>/' app/views/#{modelname}/index.html.erb`
|
60
|
+
print `sed #{icmd} -e 's/data-href="<%= #{singular_modelname}_path(#{singular_modelname}) %>"/data-href="<%= polymorphic_path([#{singularized_ancestors.map{|sa| "@#{sa}"}.join(', ')}, #{singular_modelname}]) %>"/' app/views/#{modelname}/index.html.erb`
|
61
|
+
print `sed #{icmd} -e 's/, #{singular_modelname} %><\\/td>/, [#{singularized_ancestors.map{|sa| "@#{sa}"}.join(', ')}, #{singular_modelname}] %><\\/td>/' app/views/#{modelname}/index.html.erb`
|
62
62
|
|
63
63
|
print "Updating app/views/#{modelname}/index.json.jbuilder."
|
64
|
-
print `sed #{
|
64
|
+
print `sed #{icmd} -e 's/#{singular_modelname}_url(#{singular_modelname}, format: :json)/polymorphic_url([#{singularized_ancestors.map{|sa| "@#{sa}"}.join(', ')}, #{singular_modelname}], format: :json)/' app/views/#{modelname}/index.json.jbuilder`
|
65
65
|
|
66
66
|
print "Updating app/views/#{modelname}/new.html.erb."
|
67
|
-
print `sed #{
|
68
|
-
print `sed #{
|
69
|
-
print `sed #{
|
67
|
+
print `sed #{icmd} -e 's/Create #{singular_modelname.capitalize} - $/Create #{singular_modelname.capitalize} - #{singularized_ancestors.last.capitalize} <%= @#{singularized_ancestors.last}.id %>/' app/views/#{modelname}/new.html.erb`
|
68
|
+
print `sed #{icmd} -e 's/New #{singular_modelname.capitalize}$/New #{singular_modelname.capitalize} <small>#{singularized_ancestors.last.capitalize} <%= @#{singularized_ancestors.last}.id %><\\/small>/' app/views/#{modelname}/new.html.erb`
|
69
|
+
print `sed #{icmd} -e 's/, giveaways_path, /, polymorphic_path([#{singularized_ancestors.map{|sa| "@#{sa}"}.join(', ')}, :#{modelname}]), /' app/views/#{modelname}/new.html.erb`
|
70
70
|
|
71
71
|
print "Updating app/views/#{modelname}/show.html.erb."
|
72
|
-
print `sed #{
|
73
|
-
print `sed #{
|
74
|
-
print `sed #{
|
75
|
-
print `sed #{
|
72
|
+
print `sed #{icmd} -e 's/#{singular_modelname.capitalize} Details - $/#{singular_modelname.capitalize} Details - #{singularized_ancestors.last.capitalize} <%= @#{singularized_ancestors.last}.id %>/' app/views/#{modelname}/show.html.erb`
|
73
|
+
print `sed #{icmd} -e 's/ #{modelname}_path,/ polymorphic_path([#{singularized_ancestors.map{|sa| "@#{sa}"}.join(', ')}, :#{modelname}]),/' app/views/#{modelname}/show.html.erb`
|
74
|
+
print `sed #{icmd} -e 's/edit_#{singular_modelname}_path(@#{singular_modelname})/polymorphic_path([:edit, #{singularized_ancestors.map{|sa| "@#{sa}"}.join(', ')}, :#{modelname}])/' app/views/#{modelname}/show.html.erb`
|
75
|
+
print `sed #{icmd} -e 's/#{singular_modelname.capitalize} Details$/#{singular_modelname.capitalize} Details <small>#{singularized_ancestors.last.capitalize} <%= @#{singularized_ancestors.last}.id %><\\/small>/' app/views/#{modelname}/show.html.erb`
|
76
76
|
|
77
77
|
end
|
78
78
|
|
@@ -87,7 +87,7 @@ module Bootscaf
|
|
87
87
|
end
|
88
88
|
|
89
89
|
is_mac = (RbConfig::CONFIG['host_os'] =~ /^darwin/) >= 0
|
90
|
-
|
90
|
+
icmd = is_mac ? "-i ''" : '--in-place'
|
91
91
|
|
92
92
|
print "Would you like to update app/views/layouts/application.html.erb [y/n(default)]? "
|
93
93
|
update_apphtml = $stdin.gets.strip
|
@@ -118,16 +118,16 @@ module Bootscaf
|
|
118
118
|
latest_jquery_ui_version ||= LAST_KNOWN_JQUERY_UI_VERSION
|
119
119
|
|
120
120
|
print "Updating app/views/layouts/application.html.erb. "
|
121
|
-
print `sed #{
|
122
|
-
print `sed #{
|
123
|
-
print `sed #{
|
124
|
-
print `sed #{
|
125
|
-
print `sed #{
|
126
|
-
print `sed #{
|
121
|
+
print `sed #{icmd} -e 's/<title>/<title><%= yield :page_title %>/' app/views/layouts/application.html.erb`
|
122
|
+
print `sed #{icmd} -e "s/<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>/<link href=\\"\\/\\/maxcdn.bootstrapcdn.com\\/bootstrap\\/#{latest_boostrap_version.gsub(/\//,'\\/')}css\\/bootstrap.min.css\\" rel=\\"stylesheet\\">\\\n<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>/" app/views/layouts/application.html.erb`
|
123
|
+
print `sed #{icmd} -e "s/<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>/\\\n/" app/views/layouts/application.html.erb`
|
124
|
+
print `sed #{icmd} -e 's/<\\/head>/ <%= yield :after_css %>\\\n<\\/head>/' app/views/layouts/application.html.erb`
|
125
|
+
print `sed #{icmd} -e 's/<body>/<body class="controller-<%= controller.controller_name.dasherize %> action-<%= controller.action_name.dasherize %>"> <nav class="navbar navbar-default navbar-inverse" role="navigation">\\\n <div class="container">\\\n <div class="navbar-header">\\\n <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">\\\n <span class="sr-only">Toggle navigation<\\/span>\\\n <span class="icon-bar"><\\/span>\\\n <span class="icon-bar"><\\/span>\\\n <span class="icon-bar"><\\/span>\\\n <\\/button>\\\n <a class="navbar-brand" href="\\/">Foo<\\/a>\\\n <\\/div>\\\n <div id="navbar" class="navbar-collapse collapse">\\\n <ul class="nav navbar-nav">\\\n <li<%= request.path == "\\/" ? " class=\\\\"active\\\\"".html_safe : "" %>><a href="\\/">Home<\\/a><\\/li>\\\n <\\/ul> \\\n <ul class="nav navbar-nav navbar-right">\\\n <li class="bar"><a href="\\/">Bar<\\/a><\\/li>\\\n <\\/ul>\\\n <\\/div>\\\n <\\/div>\\\n <\\/nav>\\\n <% unless notice.blank? %>\\\n <div id="notice" class="alert alert-success" role="alert">\\\n <div class="container">\\\n <%= notice %>\\\n <\\/div>\\\n <\\/div>\\\n <% end %>/' app/views/layouts/application.html.erb`
|
126
|
+
print `sed #{icmd} -e 's/<%= yield %>/<%= yield %>\\\n <footer id="content-footer" role="contentinfo">\\\n <div class="container">\\\n <p class="align-center">\\\n Copyright \\© <%= Time.now.year %> Foo · all rights reserved.\\\n <\\/p>\\\n <\\/div>\\\n <\\/footer>\\\n\\\n <%= yield :before_js %>\\\n <% unless ENV["GOOGLE_ANALYTICS_ID"].blank? %>\\\n <script>\\\n (function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){\\\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\\\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\\\n })(window,document,"script","\\/\\/www.google-analytics.com\\/analytics.js","ga");\\\n ga("create", "<%= ENV["GOOGLE_ANALYTICS_ID"] %>", "auto");\\\n ga("send", "pageview");\\\n <\\/script>\\\n <% end %>\\\n <script src="\\/\\/code.jquery.com\\/jquery-#{latest_jquery_version}.min.js"><\\/script>\\\n <script src="\\/\\/code.jquery.com\\/ui\\/#{latest_jquery_ui_version}\\/jquery-ui.min.js"><\\/script>\\\n <script src="\\/\\/maxcdn.bootstrapcdn.com\\/bootstrap\\/#{latest_boostrap_version.gsub(/\//,'\\/')}js\\/bootstrap.min.js"><\\/script>\\\n <%= javascript_include_tag "application", "data-turbolinks-track" => true %>\\\n<%= yield :after_js %>\\\n/' app/views/layouts/application.html.erb`
|
127
127
|
print "\n"
|
128
128
|
|
129
129
|
print "Removing '//= require jquery' from app/assets/javascripts/application.js "
|
130
|
-
print `sed #{
|
130
|
+
print `sed #{icmd} -e 's/\\/\\/= require jquery$//' app/assets/javascripts/application.js`
|
131
131
|
print "\n"
|
132
132
|
end
|
133
133
|
|
@@ -188,56 +188,56 @@ module Bootscaf
|
|
188
188
|
print "\n\nWorking on model:#{modelname}\n\n"
|
189
189
|
|
190
190
|
print "Updating app/views/#{modelname}/_form.html.erb. "
|
191
|
-
print `sed #{
|
192
|
-
print `sed #{
|
193
|
-
print `sed #{
|
194
|
-
print `sed #{
|
195
|
-
print `sed #{
|
196
|
-
print `sed #{
|
197
|
-
print `sed #{
|
198
|
-
print `sed #{
|
199
|
-
print `sed #{
|
200
|
-
print `sed #{
|
201
|
-
print `sed #{
|
191
|
+
print `sed #{icmd} -e 's/<div id="error_explanation">/<div id="error_explanation" class="alert alert-danger" role="alert">/' app/views/#{modelname}/_form.html.erb`
|
192
|
+
print `sed #{icmd} -e 's/<h2>/<strong>/' app/views/#{modelname}/_form.html.erb`
|
193
|
+
print `sed #{icmd} -e 's/<\\/h2>/<\\/strong>/' app/views/#{modelname}/_form.html.erb`
|
194
|
+
print `sed #{icmd} -e 's/<div class="field">/<div class="row">/g' app/views/#{modelname}/_form.html.erb`
|
195
|
+
print `sed #{icmd} -e 's/<%= f.label :\\(.*\\) %><br>/<div class="form-group<%= f.object.errors[:\\1].empty? ? "" : " has-error has-feedback" %>">\\\n<%= f.label :\\1, { class: "control-label col-sm-2" } %>\\\n<div class="col-sm-10">/g' app/views/#{modelname}/_form.html.erb`
|
196
|
+
print `sed #{icmd} -e 's/<%= f.\\(.*\\)_field :\\(.*\\) %>/<%= f.\\1_field :\\2, { class: "form-control" } %>\\\n<\\/div>\\\n<\\/div>/g' app/views/#{modelname}/_form.html.erb`
|
197
|
+
print `sed #{icmd} -e 's/<%= f.\\(.*\\)_area :\\(.*\\) %>/<%= f.\\1_area :\\2, { class: "form-control" } %>\\\n<\\/div>\\\n<\\/div>/g' app/views/#{modelname}/_form.html.erb`
|
198
|
+
print `sed #{icmd} -e 's/<%= f.\\(.*\\)_box :\\(.*\\) %>/<%= f.\\1_box :\\2, { class: "form-control" } %>\\\n<\\/div>\\\n<\\/div>/g' app/views/#{modelname}/_form.html.erb`
|
199
|
+
print `sed #{icmd} -e 's/<%= f.\\(.*\\)_select :\\(.*\\) %>/<%= f.\\1_select :\\2, { class: "form-control" } %>\\\n<\\/div>\\\n<\\/div>/g' app/views/#{modelname}/_form.html.erb`
|
200
|
+
print `sed #{icmd} -e 's/<div class="actions">/<div class="actions text-center">/' app/views/#{modelname}/_form.html.erb`
|
201
|
+
print `sed #{icmd} -e 's/<%= f.submit %>/<%= f.submit class: "btn btn-success" %>/' app/views/#{modelname}/_form.html.erb`
|
202
202
|
print "\n"
|
203
203
|
|
204
204
|
print "Updating app/views/#{modelname}/edit.html.erb. "
|
205
|
-
print `sed #{
|
206
|
-
print `sed #{
|
207
|
-
print `sed #{
|
205
|
+
print `sed #{icmd} -e 's/<h1>Editing \\(.*\\)<\\/h1>/<% content_for :page_title do %>\\\nEdit \\1 - \\\n<% end %>\\\n<div class="container">\\\n<div class="page-header">\\\n<h1>Editing \\1<\\/h1>\\\n<\\/div>/' app/views/#{modelname}/edit.html.erb`
|
206
|
+
print `sed #{icmd} -e 's/<%= link_to '\\''Show'\\'', @\\(.*\\) %> \\|/<div class="clearfix"><\\/div>\\\n<div class="pull-left">\\\n<%= link_to "<span class=\\\\"glyphicon glyphicon-ban-circle\\\\" aria-hidden=\\\\"true\\\\"><\\/span> Cancel".html_safe, @\\1, class: "btn btn-default" %>\\\n<\\/div>/' app/views/#{modelname}/edit.html.erb`
|
207
|
+
print `sed #{icmd} -e 's/<%= link_to '\\''Back'\\'', \\(.*\\)s_path %>/<div class="pull-right">\\\n<%= link_to "<span class=\\\\"glyphicon glyphicon-trash\\\\" aria-hidden=\\\\"true\\\\"><\\/span> Delete \\1...".html_safe, @\\1, method: :delete, data: { confirm: "Are you sure you want to delete this \\1?" }, class: "btn btn-danger" %>\\\n<\\/div>\\\n<\\/div>/' app/views/#{modelname}/edit.html.erb`
|
208
208
|
print "\n"
|
209
209
|
|
210
210
|
print "Updating app/views/#{modelname}/index.html.erb. "
|
211
|
-
print `sed #{
|
212
|
-
print `sed #{
|
213
|
-
print `sed #{
|
214
|
-
print `sed #{
|
215
|
-
print `sed #{
|
216
|
-
print `sed #{
|
217
|
-
print `sed #{
|
218
|
-
print `sed #{
|
219
|
-
print `sed #{
|
220
|
-
print `sed #{
|
221
|
-
print `sed #{
|
222
|
-
print `sed #{
|
223
|
-
print `sed #{
|
224
|
-
print `sed #{
|
225
|
-
print `sed #{
|
211
|
+
print `sed #{icmd} -e 's/<p id="notice"><%= notice %><\\/p>//' app/views/#{modelname}/index.html.erb`
|
212
|
+
print `sed #{icmd} -e 's/<h1>Listing \\(.*\\)s<\\/h1>/<% content_for :page_title do %>\\\n\\1s - \\\n<% end %>\\\n<div class="container">\\\n<div class="page-header">\\\n<h1>\\\n<div class="pull-left">\\\n<%= link_to "<span class=\\\\"glyphicon glyphicon-step-backward\\\\" aria-hidden=\\\\"true\\\\"><\\/span>".html_safe, "\\/", class: "btn btn-default", title: "Back" %>\\\n\\ \\\n<\\/div>\\\n\\\n<div class="pull-right">\\\n<%= link_to "<span class=\\\\"glyphicon glyphicon-plus-sign\\\\" aria-hidden=\\\\"true\\\\"><\\/span> New \\1".html_safe, [:new, :#{Bootscaf::Utils.singularize(modelname)}], class: "btn btn-success" %>\\\n<\\/div>\\\nListing \\1s\\\n<\\/h1>\\\n<\\/div>\\\n\\\n<table class="table table-striped table-hover tablesorter" id="\\1s-table">/' app/views/#{modelname}/index.html.erb`
|
213
|
+
print `sed #{icmd} -e 's/<th>\\(.*\\)<\\/th>/<th><span>\\1<\\/span><\\/th>/g' app/views/#{modelname}/index.html.erb`
|
214
|
+
print `sed #{icmd} -e 's/<table>//' app/views/#{modelname}/index.html.erb`
|
215
|
+
print `sed #{icmd} -e 's/<\\/table>/<\\/table>\\\n<\\/div>/' app/views/#{modelname}/index.html.erb`
|
216
|
+
print `sed #{icmd} -e 's/<th colspan="3"><\\/th>//' app/views/#{modelname}/index.html.erb`
|
217
|
+
print `sed #{icmd} -e 's/<td><%= link_to '\\''Show'\\'', \\(.*\\) %><\\/td>//' app/views/#{modelname}/index.html.erb`
|
218
|
+
print `sed #{icmd} -e 's/<td><%= link_to '\\''Edit'\\'', edit_\\(.*\\)_path(\\(.*\\)) %><\\/td>//' app/views/#{modelname}/index.html.erb`
|
219
|
+
print `sed #{icmd} -e 's/<td><%= link_to '\\''Destroy'\\'', \\(.*\\), method: :delete, data: { confirm: '\\''Are you sure?'\\'' } %><\\/td>//' app/views/#{modelname}/index.html.erb`
|
220
|
+
print `sed #{icmd} -e 's/<% @\\(.*\\)s.each do \\|\\(.*\\)\\| %>/<% unless @\\1s.any? %>\\\n<tr id="empty-table">\\\n<td class="bg-warning" colspan="2">No \\1s created yet.<\\/td>\\\n<\\/tr>\\\n<% end %>\\\n<% @\\1s.each do \\|\\1\\| %>\\\n<tr class="linked-row" data-href="<%= \\1_path(\\1) %>">/' app/views/#{modelname}/index.html.erb`
|
221
|
+
print `sed #{icmd} -e 's/<tr>//' app/views/#{modelname}/index.html.erb`
|
222
|
+
print `sed #{icmd} -e 's/<thead>/<thead>\\\n<tr>/' app/views/#{modelname}/index.html.erb`
|
223
|
+
print `sed #{icmd} -e 's/<td><%= \\(.*\\)\\.\\(.*\\) %><\\/td>/<td><%= link_to \\1.\\2, \\1 %><\\/td>/' app/views/#{modelname}/index.html.erb`
|
224
|
+
print `sed #{icmd} -e 's/<br>//' app/views/#{modelname}/index.html.erb`
|
225
|
+
print `sed #{icmd} -e 's/<%= link_to '\\''New \\(.*\\)'\\'', new_\\(.*\\)_path %>//' app/views/#{modelname}/index.html.erb`
|
226
226
|
print "\n"
|
227
227
|
|
228
228
|
print "Updating app/views/#{modelname}/new.html.erb. "
|
229
|
-
print `sed #{
|
230
|
-
print `sed #{
|
229
|
+
print `sed #{icmd} -e 's/<h1>New \\(.*\\)<\\/h1>/<% content_for :page_title do %>\\\nCreate \\1 - \\\n<% end %>\\\n<div class="container">\\\n<div class="page-header">\\\n<h1>\\\nNew \\1\\\n<\\/h1>\\\n<\\/div>/' app/views/#{modelname}/new.html.erb`
|
230
|
+
print `sed #{icmd} -e 's/<%= link_to '\\''Back'\\'', \\(.*\\)s_path %>/<div class="clearfix"><\\/div>\\\n<%= link_to "<span class=\\\\"glyphicon glyphicon-ban-circle\\\\" aria-hidden=\\\\"true\\\\"><\\/span> Cancel".html_safe, \\1s_path, class: "btn btn-default" %>\\\n<\\/div>/' app/views/#{modelname}/new.html.erb`
|
231
231
|
print "\n"
|
232
232
|
|
233
233
|
print "Updating app/views/#{modelname}/show.html.erb. "
|
234
|
-
print `sed #{
|
235
|
-
print `sed #{
|
236
|
-
print `sed #{
|
237
|
-
print `sed #{
|
238
|
-
print `sed #{
|
239
|
-
print `sed #{
|
240
|
-
print `sed #{
|
234
|
+
print `sed #{icmd} -e 's/<p id="notice"><%= notice %><\\/p>/<% content_for :page_title do %>\\\n#{Bootscaf::Utils.singularize(modelname).capitalize} Details - \\\n<% end %>\\\n<div class="container">\\\n<div class="page-header">\\\n<h1>\\\n<div class="pull-left">\\\n<%= link_to "<span class=\\\\"glyphicon glyphicon-step-backward\\\\" aria-hidden=\\\\"true\\\\"><\\/span>".html_safe, #{modelname}_path, class: "btn btn-default", title: "Back to #{modelname}" %>\\\n\\ \\\n<\\/div>\\\n<div class="pull-right">\\\n<%= link_to "<span class=\\\\"glyphicon glyphicon-pencil\\\\" aria-hidden=\\\\"true\\\\"><\\/span> Edit".html_safe, edit_#{Bootscaf::Utils.singularize(modelname)}_path(@#{Bootscaf::Utils.singularize(modelname)}), class: "btn btn-warning" %>\\\n<\\/div>\\\n#{Bootscaf::Utils.singularize(modelname).capitalize} Details\\\n<\\/h1>\\\n<\\/div>/' app/views/#{modelname}/show.html.erb`
|
235
|
+
print `sed #{icmd} -e 's/<p>/<div class="row">/' app/views/#{modelname}/show.html.erb`
|
236
|
+
print `sed #{icmd} -e 's/<\\/p>/<\\/div>/' app/views/#{modelname}/show.html.erb`
|
237
|
+
print `sed #{icmd} -e 's/<strong>\\(.*\\):<\\/strong>/<label class="col-sm-3 text-right text-muted">\\1<\\/label>/g' app/views/#{modelname}/show.html.erb`
|
238
|
+
print `sed #{icmd} -e 's/<%= @\\(.*\\)\\.\\(.*\\) %>/<div class="col-sm-9"><%= @\\1.\\2 %><\\/div>/g' app/views/#{modelname}/show.html.erb`
|
239
|
+
print `sed #{icmd} -e 's/<%= link_to '\\''Edit'\\'', edit_\\(.*\\)_path(@\\(.*\\)) %> \\|/<\\/div>/' app/views/#{modelname}/show.html.erb`
|
240
|
+
print `sed #{icmd} -e 's/<%= link_to '\\''Back'\\'', \\(.*\\)s_path %>//' app/views/#{modelname}/show.html.erb`
|
241
241
|
print "\n"
|
242
242
|
end
|
243
243
|
end
|
data/lib/bootscaf/version.rb
CHANGED