cable 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/views/layouts/_breadcrumb.html.erb +1 -1
- data/config/routes.rb +3 -1
- data/lib/cable/engine.rb +1 -1
- data/lib/generators/cable/install_generator.rb +5 -3
- data/lib/generators/cable/menu/menu_generator.rb +8 -5
- data/lib/generators/cable/resource/resource_generator.rb +7 -6
- metadata +13 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.4
|
@@ -1 +1 @@
|
|
1
|
-
<div id="breadcrumb"><%= render_navigation :renderer => :breadcrumbs, :join_with => " » " %></div>
|
1
|
+
<div id="breadcrumb"><%= render_navigation :renderer => :breadcrumbs, :join_with => " » " , :context => :admin %></div>
|
data/config/routes.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
# Cable::Engine.routes.draw do
|
4
4
|
# match '/admin(/:action(/:id))' => 'admin'
|
5
5
|
# end
|
6
|
-
Rails.application.routes.draw do
|
6
|
+
Rails.application.routes.draw do
|
7
|
+
match '/admin' => 'admin#index'
|
7
8
|
match '/admin(/:action(/:id))' => 'admin'
|
9
|
+
match '*url' => 'main#find_by_url'
|
8
10
|
end
|
data/lib/cable/engine.rb
CHANGED
@@ -4,7 +4,7 @@ require 'cable'
|
|
4
4
|
module Cable
|
5
5
|
class Engine < Rails::Engine
|
6
6
|
initializer "static assets" do |app|
|
7
|
-
app.middleware.use ::ActionDispatch::Static, "#{root}/public"
|
7
|
+
# app.middleware.use ::ActionDispatch::Static, "#{root}/public"
|
8
8
|
app.middleware.insert_after ::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public"
|
9
9
|
end
|
10
10
|
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'rails/generators/migration'
|
2
|
+
require 'active_record'
|
3
|
+
require 'rainbow'
|
2
4
|
|
3
5
|
module Cable
|
4
6
|
module Generators
|
@@ -40,7 +42,7 @@ module Cable
|
|
40
42
|
|
41
43
|
def copy_simple_nav
|
42
44
|
if options.simple_nav?
|
43
|
-
if yes?("Would you like to install simple navigation?")
|
45
|
+
if yes?("Would you like to install simple navigation?".color(:yellow) )
|
44
46
|
generate("navigation_config")
|
45
47
|
copy_file 'config/admin_navigation.rb', 'config/admin_navigation.rb'
|
46
48
|
# copy_file 'config/navigation.rb', 'config/navigation.rb'
|
@@ -49,7 +51,7 @@ module Cable
|
|
49
51
|
end
|
50
52
|
|
51
53
|
def install_jquery
|
52
|
-
if yes?("Would you like to install jquery?")
|
54
|
+
if yes?("Would you like to install jquery?".color(:yellow))
|
53
55
|
generate("jquery:install --ui")
|
54
56
|
end
|
55
57
|
end
|
@@ -68,7 +70,7 @@ module Cable
|
|
68
70
|
|
69
71
|
def print_setup_instructions
|
70
72
|
puts ""
|
71
|
-
puts "Run rake db:migrate to complete setup."
|
73
|
+
puts "Run rake db:migrate to complete setup.".color(:yellow)
|
72
74
|
puts ""
|
73
75
|
puts "To begin using Cable Menu and Pages use:"
|
74
76
|
puts "rails generate cable:menu MENU_NAME"
|
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'rails/generators'
|
2
2
|
require 'rails/generators/migration'
|
3
3
|
require 'rails/generators/active_model'
|
4
|
+
require 'active_record'
|
5
|
+
require 'rainbow'
|
6
|
+
|
4
7
|
module Cable
|
5
8
|
module Generators
|
6
9
|
class MenuGenerator < Rails::Generators::NamedBase
|
@@ -18,25 +21,25 @@ module Cable
|
|
18
21
|
|
19
22
|
def create_migration_file
|
20
23
|
if options.migration?
|
21
|
-
migration_template 'migration.rb', "db/migrate/create_#{model_name.pluralize}.rb" if yes?("Would you like to generate a migration?")
|
24
|
+
migration_template 'migration.rb', "db/migrate/create_#{model_name.pluralize}.rb" if yes?("Would you like to generate a migration?".color(:yellow))
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
25
28
|
def create_model_file
|
26
29
|
if options.model?
|
27
|
-
template 'model.rb' , "app/models/#{model_name}.rb" if yes?("Would you like to generate a model?")
|
30
|
+
template 'model.rb' , "app/models/#{model_name}.rb" if yes?("Would you like to generate a model?".color(:yellow))
|
28
31
|
end
|
29
32
|
end
|
30
33
|
|
31
34
|
def create_controller_file
|
32
35
|
if options.controller?
|
33
|
-
template 'controller.rb', "app/controllers/admin/#{model_name.pluralize}_controller.rb" if yes?("Would you like to generate a controller?")
|
36
|
+
template 'controller.rb', "app/controllers/admin/#{model_name.pluralize}_controller.rb" if yes?("Would you like to generate a controller?".color(:yellow))
|
34
37
|
end
|
35
38
|
end
|
36
39
|
|
37
40
|
def create_views
|
38
41
|
if options.views?
|
39
|
-
if yes?( "Would you like Cable to generate menu views?")
|
42
|
+
if yes?( "Would you like Cable to generate menu views?".color(:yellow))
|
40
43
|
Dir.glob(File.expand_path("../templates", __FILE__) + '/erb/menus/*.erb') do |rb_file|
|
41
44
|
template rb_file, "app/views/admin/#{plural_table_name}/#{File.basename(rb_file)}"
|
42
45
|
end
|
@@ -54,7 +57,7 @@ cable_to :#{plural_table_name} do |menu|
|
|
54
57
|
end
|
55
58
|
end
|
56
59
|
EOF
|
57
|
-
route( route_string ) if yes?("Would you like to generate routes?")
|
60
|
+
route( route_string ) if yes?("Would you like to generate routes?".color(:yellow))
|
58
61
|
|
59
62
|
end
|
60
63
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'rails/generators'
|
2
2
|
require 'rails/generators/migration'
|
3
3
|
require 'rails/generators/resource_helpers'
|
4
|
-
|
4
|
+
require 'active_record'
|
5
|
+
require 'rainbow'
|
5
6
|
# require 'rails/generators/controller_generator'
|
6
7
|
module Cable
|
7
8
|
module Generators
|
@@ -22,22 +23,22 @@ module Cable
|
|
22
23
|
class_option :orm, :type => :string, :default => "active_record"
|
23
24
|
|
24
25
|
def create_migration_file
|
25
|
-
migration_template 'migration.rb', "db/migrate/create_#{table_name}.rb" if options.migration? and yes?("Would you like to generate a migration?")
|
26
|
+
migration_template 'migration.rb', "db/migrate/create_#{table_name}.rb" if options.migration? and yes?("Would you like to generate a migration?".color(:yellow))
|
26
27
|
end
|
27
28
|
|
28
29
|
def create_model_file
|
29
|
-
template 'model.rb' , "app/models/#{model_name}.rb" if options.model? and yes?("Would you like to generate a model?")
|
30
|
+
template 'model.rb' , "app/models/#{model_name}.rb" if options.model? and yes?("Would you like to generate a model?".color(:yellow))
|
30
31
|
end
|
31
32
|
|
32
33
|
def create_controller_file
|
33
34
|
if options.controller?
|
34
|
-
template 'controller.rb' , "app/controllers/admin/#{file_name.pluralize}_controller.rb" if yes?("Would you like to generate a controller?")
|
35
|
+
template 'controller.rb' , "app/controllers/admin/#{file_name.pluralize}_controller.rb" if yes?("Would you like to generate a controller?".color(:yellow))
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
39
|
def create_scaffold
|
39
40
|
if options.views?
|
40
|
-
if yes?("Would you like Cable to generate views for #{model_name.capitalize}?")
|
41
|
+
if yes?("Would you like Cable to generate views for #{model_name.capitalize}?".color(:yellow))
|
41
42
|
template 'erb/scaffold/_form.html.erb', "app/views/admin/#{plural_table_name}/_#{singular_table_name}.html.erb"
|
42
43
|
template 'erb/scaffold/index.html.erb', "app/views/admin/#{plural_table_name}/index.html.erb"
|
43
44
|
template 'erb/scaffold/edit.html.erb', "app/views/admin/#{plural_table_name}/edit.html.erb"
|
@@ -48,7 +49,7 @@ module Cable
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def install_route
|
51
|
-
route("cable_to :#{plural_table_name}") if options.routes? and yes?("Would you like to generate routes for #{model_name.capitalize}?")
|
52
|
+
route("cable_to :#{plural_table_name}") if options.routes? and yes?("Would you like to generate routes for #{model_name.capitalize}?".color(:yellow))
|
52
53
|
end
|
53
54
|
|
54
55
|
def self.next_migration_number(dirname)
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Spencer Markowski
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2011-03-
|
15
|
+
date: 2011-03-21 00:00:00 -04:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -81,6 +81,17 @@ dependencies:
|
|
81
81
|
type: :runtime
|
82
82
|
prerelease: false
|
83
83
|
version_requirements: *id006
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rainbow
|
86
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
type: :runtime
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: *id007
|
84
95
|
description:
|
85
96
|
email:
|
86
97
|
executables: []
|