aslon_scaffold 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README +26 -0
- data/Rakefile +2 -0
- data/aslon_scaffold.gemspec +33 -0
- data/config/locales/aslon_scaffold.fr.yml +14 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/app/controllers/articles_controller.rb +7 -0
- data/lib/app/helpers/application_helper.rb +410 -0
- data/lib/app/views/aslon_scaffolds/_search.haml +1 -0
- data/lib/app/views/aslon_scaffolds/index.haml +4 -0
- data/lib/app/views/aslon_scaffolds/new_edit.haml +8 -0
- data/lib/app/views/aslon_scaffolds/show.haml +9 -0
- data/lib/aslon_scaffold.rb +34 -0
- data/lib/aslon_scaffold/aslon_scaffold.rb +237 -0
- data/lib/aslon_scaffold/version.rb +4 -0
- data/lib/generators/haml.rb +11 -0
- data/lib/generators/haml/scaffold/scaffold_generator.rb +25 -0
- data/lib/generators/haml/scaffold/templates/_new_edit.haml.erb +6 -0
- data/lib/generators/haml/scaffold/templates/_search.haml.erb +6 -0
- data/lib/generators/haml/scaffold/templates/edit.haml.erb +5 -0
- data/lib/generators/haml/scaffold/templates/index.haml.erb +10 -0
- data/lib/generators/haml/scaffold/templates/layout.haml.erb +17 -0
- data/lib/generators/haml/scaffold/templates/new.haml.erb +6 -0
- data/lib/generators/haml/scaffold/templates/new_edit.haml.erb +13 -0
- data/lib/generators/haml/scaffold/templates/show.haml.erb +14 -0
- data/lib/generators/nifty.rb +28 -0
- data/lib/generators/nifty/aslon/USAGE +51 -0
- data/lib/generators/nifty/aslon/aslon_generator.rb +320 -0
- data/lib/generators/nifty/aslon/templates/actions/create.rb +8 -0
- data/lib/generators/nifty/aslon/templates/actions/destroy.rb +5 -0
- data/lib/generators/nifty/aslon/templates/actions/edit.rb +3 -0
- data/lib/generators/nifty/aslon/templates/actions/index.rb +3 -0
- data/lib/generators/nifty/aslon/templates/actions/new.rb +3 -0
- data/lib/generators/nifty/aslon/templates/actions/show.rb +3 -0
- data/lib/generators/nifty/aslon/templates/actions/update.rb +8 -0
- data/lib/generators/nifty/aslon/templates/controller.rb +10 -0
- data/lib/generators/nifty/aslon/templates/fixtures.yml +9 -0
- data/lib/generators/nifty/aslon/templates/helper.rb +2 -0
- data/lib/generators/nifty/aslon/templates/migration.rb +16 -0
- data/lib/generators/nifty/aslon/templates/model.rb +4 -0
- data/lib/generators/nifty/aslon/templates/tests/rspec/actions/create.rb +11 -0
- data/lib/generators/nifty/aslon/templates/tests/rspec/actions/destroy.rb +6 -0
- data/lib/generators/nifty/aslon/templates/tests/rspec/actions/edit.rb +4 -0
- data/lib/generators/nifty/aslon/templates/tests/rspec/actions/index.rb +4 -0
- data/lib/generators/nifty/aslon/templates/tests/rspec/actions/new.rb +4 -0
- data/lib/generators/nifty/aslon/templates/tests/rspec/actions/show.rb +4 -0
- data/lib/generators/nifty/aslon/templates/tests/rspec/actions/update.rb +11 -0
- data/lib/generators/nifty/aslon/templates/tests/rspec/controller.rb +8 -0
- data/lib/generators/nifty/aslon/templates/tests/rspec/model.rb +7 -0
- data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/create.rb +13 -0
- data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/destroy.rb +8 -0
- data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/edit.rb +6 -0
- data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/index.rb +6 -0
- data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/new.rb +6 -0
- data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/show.rb +6 -0
- data/lib/generators/nifty/aslon/templates/tests/shoulda/actions/update.rb +13 -0
- data/lib/generators/nifty/aslon/templates/tests/shoulda/controller.rb +5 -0
- data/lib/generators/nifty/aslon/templates/tests/shoulda/model.rb +7 -0
- data/lib/generators/nifty/aslon/templates/tests/testunit/actions/create.rb +11 -0
- data/lib/generators/nifty/aslon/templates/tests/testunit/actions/destroy.rb +6 -0
- data/lib/generators/nifty/aslon/templates/tests/testunit/actions/edit.rb +4 -0
- data/lib/generators/nifty/aslon/templates/tests/testunit/actions/index.rb +4 -0
- data/lib/generators/nifty/aslon/templates/tests/testunit/actions/new.rb +4 -0
- data/lib/generators/nifty/aslon/templates/tests/testunit/actions/show.rb +4 -0
- data/lib/generators/nifty/aslon/templates/tests/testunit/actions/update.rb +11 -0
- data/lib/generators/nifty/aslon/templates/tests/testunit/controller.rb +5 -0
- data/lib/generators/nifty/aslon/templates/tests/testunit/model.rb +7 -0
- data/lib/generators/nifty/aslon/templates/views/haml/_new_edit.html.haml +6 -0
- data/lib/generators/nifty/aslon/templates/views/haml/_search.html.haml +6 -0
- data/lib/generators/nifty/aslon/templates/views/haml/index.html.haml +10 -0
- data/lib/generators/nifty/aslon/templates/views/haml/layout.haml.erb +17 -0
- data/lib/generators/nifty/aslon/templates/views/haml/new_edit.html.haml +13 -0
- data/lib/generators/nifty/aslon/templates/views/haml/show.html.haml +14 -0
- data/lib/generators/nifty/layout/USAGE +25 -0
- data/lib/generators/nifty/layout/layout_generator.rb +42 -0
- data/lib/generators/nifty/layout/templates/_default.html.haml +9 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/add.gif +0 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/delete.gif +0 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/edit.gif +0 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/folder.gif +0 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/grid-blue-hd.gif +0 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/grid-split.gif +0 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/grid3-hrow.gif +0 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/indicator.gif +0 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/magnifier.png +0 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/sort_asc.gif +0 -0
- data/lib/generators/nifty/layout/templates/assets/images/aslon_scaffold/sort_desc.gif +0 -0
- data/lib/generators/nifty/layout/templates/assets/stylesheets/aslon_scaffold/base.css.sass +263 -0
- data/lib/generators/nifty/layout/templates/assets/stylesheets/aslon_scaffold/formtastic.css.sass +176 -0
- data/lib/generators/nifty/layout/templates/assets/stylesheets/aslon_scaffold/formtastic_changes.css.sass +31 -0
- data/lib/generators/nifty/layout/templates/assets/stylesheets/aslon_scaffold/table_coffee_with_milk.css.sass +94 -0
- data/lib/generators/nifty/layout/templates/error_messages_helper.rb +23 -0
- data/lib/generators/nifty/layout/templates/layout.html.haml +13 -0
- data/lib/generators/nifty/layout/templates/layout_helper.rb +22 -0
- data/lib/generators/nifty/layout/templates/locales/aslon_scaffold.fr.yml +14 -0
- data/lib/generators/nifty/scaffold/USAGE +51 -0
- data/lib/generators/nifty/scaffold/scaffold_generator.rb +319 -0
- data/lib/generators/nifty/scaffold/templates/actions/create.rb +8 -0
- data/lib/generators/nifty/scaffold/templates/actions/destroy.rb +5 -0
- data/lib/generators/nifty/scaffold/templates/actions/edit.rb +3 -0
- data/lib/generators/nifty/scaffold/templates/actions/index.rb +3 -0
- data/lib/generators/nifty/scaffold/templates/actions/new.rb +3 -0
- data/lib/generators/nifty/scaffold/templates/actions/show.rb +3 -0
- data/lib/generators/nifty/scaffold/templates/actions/update.rb +8 -0
- data/lib/generators/nifty/scaffold/templates/controller.rb +3 -0
- data/lib/generators/nifty/scaffold/templates/fixtures.yml +9 -0
- data/lib/generators/nifty/scaffold/templates/helper.rb +2 -0
- data/lib/generators/nifty/scaffold/templates/migration.rb +16 -0
- data/lib/generators/nifty/scaffold/templates/model.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/create.rb +11 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/destroy.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/edit.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/index.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/new.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/show.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/actions/update.rb +11 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/controller.rb +8 -0
- data/lib/generators/nifty/scaffold/templates/tests/rspec/model.rb +7 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/create.rb +13 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/destroy.rb +8 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/edit.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/index.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/new.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/show.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/actions/update.rb +13 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/controller.rb +5 -0
- data/lib/generators/nifty/scaffold/templates/tests/shoulda/model.rb +7 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/create.rb +11 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/destroy.rb +6 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/edit.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/index.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/new.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/show.rb +4 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/actions/update.rb +11 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/controller.rb +5 -0
- data/lib/generators/nifty/scaffold/templates/tests/testunit/model.rb +7 -0
- data/lib/generators/nifty/scaffold/templates/views/erb/_form.html.erb +10 -0
- data/lib/generators/nifty/scaffold/templates/views/erb/edit.html.erb +14 -0
- data/lib/generators/nifty/scaffold/templates/views/erb/index.html.erb +29 -0
- data/lib/generators/nifty/scaffold/templates/views/erb/new.html.erb +7 -0
- data/lib/generators/nifty/scaffold/templates/views/erb/show.html.erb +20 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/_new_edit.html.haml +6 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/_search.html.haml +6 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/index.html.haml +10 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/layout.haml.erb +17 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/new_edit.haml.erb +13 -0
- data/lib/generators/nifty/scaffold/templates/views/haml/show.haml.erb +14 -0
- data/lib/generators/templates/rails/scaffold_controller/controller.rb +11 -0
- data/lib/tasks/aslon_scaffold_tasks.rake +91 -0
- data/lib/tasks/task.rake +113 -0
- data/test/articles_controller_test.rb +24 -0
- data/test/database.yml +8 -0
- data/test/schema.rb +6 -0
- data/test/test_helper.rb +39 -0
- data/test/undeletable_plugin.sqlite.db +0 -0
- data/test/undeletable_plugin2.sqlite3.db +0 -0
- data/uninstall.rb +1 -0
- data/vendor/assets/images/aslon_scaffold/add.gif +0 -0
- data/vendor/assets/images/aslon_scaffold/delete.gif +0 -0
- data/vendor/assets/images/aslon_scaffold/edit.gif +0 -0
- data/vendor/assets/images/aslon_scaffold/folder.gif +0 -0
- data/vendor/assets/images/aslon_scaffold/grid-blue-hd.gif +0 -0
- data/vendor/assets/images/aslon_scaffold/grid-split.gif +0 -0
- data/vendor/assets/images/aslon_scaffold/grid3-hrow.gif +0 -0
- data/vendor/assets/images/aslon_scaffold/indicator.gif +0 -0
- data/vendor/assets/images/aslon_scaffold/magnifier.png +0 -0
- data/vendor/assets/images/aslon_scaffold/sort_asc.gif +0 -0
- data/vendor/assets/images/aslon_scaffold/sort_desc.gif +0 -0
- data/vendor/assets/stylesheets/aslon_scaffold_base.css.sass +116 -0
- data/vendor/assets/stylesheets/aslon_scaffold_base.css.sass.old +263 -0
- data/vendor/assets/stylesheets/aslon_scaffold_table.css.sass +94 -0
- data/vendor/assets/stylesheets/formtastic_changes.css.sass +31 -0
- metadata +185 -4
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<title><%= controller_class_name %>: <%%= aslon_controller.action_name %></title>
|
8
|
+
<%%= stylesheet_link_tag 'scaffold' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<p style="color: green"><%%= flash[:notice] %></p>
|
13
|
+
|
14
|
+
<%%= yield %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
-# encoding UTF-8
|
2
|
+
-# autogenerated_by_scaffold
|
3
|
+
|
4
|
+
= titre_action(controller.action_name,"<%= singular_name %>")
|
5
|
+
= error_messages_for :<%= singular_name %>
|
6
|
+
|
7
|
+
- semantic_form_for @<%= singular_name %> do |f|
|
8
|
+
|
9
|
+
- f.inputs :name => "Basic", :id => "basic" do
|
10
|
+
<% for attribute in attributes -%>
|
11
|
+
= f.input :<%= attribute.name%>
|
12
|
+
<% end -%>
|
13
|
+
= f.buttons
|
@@ -0,0 +1,14 @@
|
|
1
|
+
-# encoding UTF-8
|
2
|
+
-# autogenerated_by_scaffold
|
3
|
+
|
4
|
+
=titre_show(@<%= singular_name %>,@<%= singular_name %>.lib)
|
5
|
+
%form.formtastic
|
6
|
+
%fieldset.inputs
|
7
|
+
%legend
|
8
|
+
%span=@as_options[:legend]
|
9
|
+
|
10
|
+
<% for attribute in attributes -%>
|
11
|
+
= show @<%= singular_name %>,:<%= attribute.name %>
|
12
|
+
<%end%>
|
13
|
+
= link_to 'Back', <%= plural_name %>_path
|
14
|
+
|
@@ -0,0 +1,91 @@
|
|
1
|
+
def copyf(name, src, dest, *args)
|
2
|
+
args || args = []
|
3
|
+
args.insert 0, name
|
4
|
+
|
5
|
+
body = proc {
|
6
|
+
FileList[src].each do |f|
|
7
|
+
puts " - copying %s to %s" % [File.basename(f), dest]
|
8
|
+
FileUtils.mkpath(File.dirname(dest)) unless File.directory?(File.dirname(dest))
|
9
|
+
FileUtils.cp f, dest
|
10
|
+
end
|
11
|
+
}
|
12
|
+
Rake::Task.define_task(*args, &body)
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
assets = File.join(File.dirname(__FILE__), '..','app','assets')
|
17
|
+
destination = File.join(Rails.root.to_path,'app', 'assets')
|
18
|
+
|
19
|
+
|
20
|
+
copyf(:copy_images, File.join(assets,"images",'aslon_scaffold',"*.*"), File.join(destination,"images",'aslon_scaffold/') )
|
21
|
+
copyf(:copy_stylesheets, File.join(assets,"stylesheets",'aslon_scaffold',"*.*"), File.join(destination,"stylesheets",'aslon_scaffold/') )
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
namespace :aslon_scaffold do
|
26
|
+
desc "install assets"
|
27
|
+
task :install_assets => [:copy_images,:copy_stylesheets ]
|
28
|
+
|
29
|
+
desc "install"
|
30
|
+
task :install => [
|
31
|
+
'aslon_scaffold:install_images',
|
32
|
+
'aslon_scaffold:install_stylesheets',
|
33
|
+
]
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
desc "Copies images,... to proper application directories"
|
40
|
+
task :install_images do
|
41
|
+
ASSETS = File.join(File.dirname(__FILE__), '..','app','assets')
|
42
|
+
puts ASSETS
|
43
|
+
Dir.glob("#{ASSETS}/*").each do |folder|
|
44
|
+
folder_name = folder.gsub(/\/.+\//, '')
|
45
|
+
destination = File.join(Rails.root.to_path, 'assets','aslon_scaffold',folder_name)
|
46
|
+
FileUtils.mkpath(destination) unless File.directory?(destination)
|
47
|
+
|
48
|
+
Dir[File.join(folder, '/*')].select { |a| File.file?(a) }.each do |asset|
|
49
|
+
puts " - copying %s to %s" % [File.basename(asset), destination.gsub(/Rails.root/, '')]
|
50
|
+
FileUtils.cp asset, destination
|
51
|
+
end
|
52
|
+
end
|
53
|
+
puts " - done.3"
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
desc "Copies stylesheets to proper application directories"
|
58
|
+
task :install_stylesheets do
|
59
|
+
source = File.join(File.dirname(__FILE__), '..','assets','stylesheets','sass')
|
60
|
+
destination = File.join(Rails.public_path, 'stylesheets','sass','aslon_scaffold')
|
61
|
+
|
62
|
+
FileUtils.mkpath(destination) unless File.directory?(destination)
|
63
|
+
|
64
|
+
%w(base.css.sass formtastic.css.sass formtastic_changes.css.sass table_coffee_with_milk.css.sass ).each do |filename|
|
65
|
+
file_source =File.join(source, '/', filename)
|
66
|
+
file_dest = File.join(destination, '/', filename)
|
67
|
+
puts " - copying %s to %s" % [filename, destination.gsub(/Rails.root/, '')]
|
68
|
+
FileUtils.cp file_source, file_dest
|
69
|
+
end
|
70
|
+
puts " - done.2"
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
desc "Copies template for scaffold"
|
75
|
+
task :install_template_scaffold do
|
76
|
+
source = File.join(File.dirname(__FILE__), '..','generators','templates','rails','scaffold_controller')
|
77
|
+
destination = File.join(Rails.root, 'lib','templates','rails','scaffold_controller')
|
78
|
+
|
79
|
+
FileUtils.mkpath(destination) unless File.directory?(destination)
|
80
|
+
|
81
|
+
%w(controller.rb).each do |filename|
|
82
|
+
file_source =File.join(source, '/', filename)
|
83
|
+
file_dest = File.join(destination, '/', filename)
|
84
|
+
puts " - copying %s to %s" % [filename, destination.gsub(/Rails.root/, '')]
|
85
|
+
FileUtils.cp file_source, file_dest
|
86
|
+
end
|
87
|
+
|
88
|
+
puts " - done.1"
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
data/lib/tasks/task.rake
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
namespace :db do
|
4
|
+
desc "Raise an error unless the RAILS_ENV is development"
|
5
|
+
task :development_environment_only do
|
6
|
+
raise "Hey, development only you monkey!" unless RAILS_ENV == 'development'
|
7
|
+
end
|
8
|
+
desc "Drop, create, migrate then seed the development database"
|
9
|
+
task :i => [
|
10
|
+
'environment',
|
11
|
+
'db:development_environment_only',
|
12
|
+
'db:drop',
|
13
|
+
'db:create',
|
14
|
+
'db:migrate',
|
15
|
+
'db:seed',
|
16
|
+
'db:fixtures:load'
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
namespace :db do
|
21
|
+
|
22
|
+
desc "Drop, create, migrate then seed the development database"
|
23
|
+
task :ii => [
|
24
|
+
'environment',
|
25
|
+
'db:drop',
|
26
|
+
'db:create',
|
27
|
+
'db:migrate',
|
28
|
+
'db:seed',
|
29
|
+
'db:fixtures:load'
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
namespace :util do
|
34
|
+
desc "Conversion répertoire de vue html en haml"
|
35
|
+
task(:html2haml) do
|
36
|
+
Dir[ENV['PWD']+"/*.html.erb"].each do |x|
|
37
|
+
system "html2haml "+x+" "+x.gsub(/.erb/, '.haml')
|
38
|
+
puts x.gsub(/.erb/, '.haml')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
namespace :auto do
|
44
|
+
desc "Génération automatique des features cucumber"
|
45
|
+
task(:features) do
|
46
|
+
Dir["#{RAILS_ROOT}/features/*.auto.feature"].each do |x|
|
47
|
+
cmd= open(x).lines.first.split('#').second
|
48
|
+
puts cmd
|
49
|
+
system cmd
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
namespace :auto do
|
56
|
+
desc "Génération automatique des vues et controllers"
|
57
|
+
task(:views,:arg) do |t,a|
|
58
|
+
Dir["#{RAILS_ROOT}/app/views/*/index.auto.html.haml"].each do |x|
|
59
|
+
cmd= open(x).lines.first.split('#').second
|
60
|
+
if cmd=~/ ruby.*/
|
61
|
+
puts cmd
|
62
|
+
system cmd if a.arg==nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
namespace :server do
|
69
|
+
desc "kill ruby script/server"
|
70
|
+
task(:stop) do
|
71
|
+
pidList = `ps -C 'ruby script/server' -o pid`.split[1..-1].map! {|s| s.to_i}
|
72
|
+
pidList.each do |pid|
|
73
|
+
#Process.kill -9, pid
|
74
|
+
sh "kill -9 "+pid.to_s
|
75
|
+
puts 'killed ruby script/server:'+pid.to_s
|
76
|
+
end
|
77
|
+
end
|
78
|
+
desc "kill ruby script/server PRODUCTION"
|
79
|
+
task(:stopp) do
|
80
|
+
pidList = `ps -C 'ruby script/server -e production -p 3001' -o pid`.split[1..-1].map! {|s| s.to_i}
|
81
|
+
pidList.each do |pid|
|
82
|
+
#Process.kill -9, pid
|
83
|
+
sh "kill -9 "+pid.to_s
|
84
|
+
puts 'killed ruby script/server:'+pid.to_s
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
desc "Start ruby script/server"
|
89
|
+
task(:start) do
|
90
|
+
sh "ruby script/server &"
|
91
|
+
end
|
92
|
+
desc "Start ruby script/server PRODUCTION"
|
93
|
+
task(:startp) do
|
94
|
+
sh "ruby script/server -e production -p 3001 &"
|
95
|
+
end
|
96
|
+
|
97
|
+
desc "RE-Start ruby script/server"
|
98
|
+
task(:restart => [:stop, "log:clear", :start]) do
|
99
|
+
puts "restart done!"
|
100
|
+
end
|
101
|
+
|
102
|
+
desc "RE-Start ruby script/server PRODUCTION"
|
103
|
+
task(:restartp => [:stopp, "log:clear", :startp]) do
|
104
|
+
puts "restart done!"
|
105
|
+
end
|
106
|
+
|
107
|
+
desc "Initialise menu"
|
108
|
+
task(:menu) do
|
109
|
+
sh "ruby script/runner Menu.generate"
|
110
|
+
puts "Menus loaded"
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require 'articles_controller'
|
4
|
+
require 'action_controller/test_process'
|
5
|
+
|
6
|
+
class ArticlesController;
|
7
|
+
def rescue_action(e) raise e end;
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
class ArticlesControllerTest < ActionController::TestCase
|
12
|
+
def setup
|
13
|
+
@controller = ArticlesController.new
|
14
|
+
@request = ActionController::TestRequest.new
|
15
|
+
@response = ActionController::TestResponse.new
|
16
|
+
ActionController::Routing::Routes.draw do
|
17
|
+
|map| map.resources :articles end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_index
|
21
|
+
get :index
|
22
|
+
assert_response :success
|
23
|
+
end
|
24
|
+
end
|
data/test/database.yml
ADDED
data/test/schema.rb
ADDED
data/test/test_helper.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_support/test_case'
|
4
|
+
|
5
|
+
|
6
|
+
ENV['RAILS_ENV'] = 'test'
|
7
|
+
ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..'
|
8
|
+
|
9
|
+
require 'test/unit'
|
10
|
+
require File.expand_path(File.join(ENV['RAILS_ROOT'], 'config/environment.rb'))
|
11
|
+
|
12
|
+
def load_schema
|
13
|
+
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
14
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
15
|
+
|
16
|
+
db_adapter = ENV['DB']
|
17
|
+
|
18
|
+
# no db passed, try one of these fine config-free DBs before bombing.
|
19
|
+
db_adapter ||=
|
20
|
+
begin
|
21
|
+
require 'rubygems'
|
22
|
+
require 'sqlite'
|
23
|
+
'sqlite'
|
24
|
+
rescue MissingSourceFile
|
25
|
+
begin
|
26
|
+
require 'sqlite3'
|
27
|
+
'sqlite3'
|
28
|
+
rescue MissingSourceFile
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
if db_adapter.nil?
|
33
|
+
raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
|
34
|
+
end
|
35
|
+
|
36
|
+
ActiveRecord::Base.establish_connection(config[db_adapter])
|
37
|
+
load(File.dirname(__FILE__) + "/schema.rb")
|
38
|
+
require File.dirname(__FILE__) + '/../rails/init.rb'
|
39
|
+
end
|
Binary file
|
Binary file
|
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,116 @@
|
|
1
|
+
|
2
|
+
h1.aslon_scaffold
|
3
|
+
margin: 0px 0px 1px 0px
|
4
|
+
padding: 0px
|
5
|
+
line-height: 28px
|
6
|
+
font:
|
7
|
+
weight: 900
|
8
|
+
size: 14px
|
9
|
+
color: #000066
|
10
|
+
border-bottom: solid 1px #C5DBF7
|
11
|
+
|
12
|
+
h2.aslon_scaffold
|
13
|
+
margin: 0px 0px 1px 0px
|
14
|
+
padding: 0px
|
15
|
+
font:
|
16
|
+
weight: 900
|
17
|
+
size: 14px
|
18
|
+
line-height: 28px
|
19
|
+
color: black
|
20
|
+
border-bottom: solid 1px #C5DBF7
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
.flash
|
25
|
+
ul
|
26
|
+
padding-left: 0pt
|
27
|
+
margin-bottom: 0pt
|
28
|
+
margin-top: 0pt
|
29
|
+
list-style-type: none
|
30
|
+
margin-left: 0pt
|
31
|
+
|
32
|
+
li
|
33
|
+
margin-bottom: 0em
|
34
|
+
padding-left: 1em
|
35
|
+
vertical-align: top
|
36
|
+
text-align: center
|
37
|
+
font-size: 1em
|
38
|
+
|
39
|
+
.container
|
40
|
+
padding-top: 0em
|
41
|
+
padding-left: 2em
|
42
|
+
position: absolute
|
43
|
+
top: 1px
|
44
|
+
left: 200px
|
45
|
+
width: 500px
|
46
|
+
height: 25px
|
47
|
+
|
48
|
+
.containerild
|
49
|
+
padding: 1em
|
50
|
+
padding-left: 5em
|
51
|
+
margin-bottom: 1.5em
|
52
|
+
|
53
|
+
.error
|
54
|
+
color: red
|
55
|
+
|
56
|
+
.errorold
|
57
|
+
background: #fcf6d0 url(../images/icons/flashes/error.gif) 1.5em 1.5em no-repeat
|
58
|
+
border-top: 1px solid #ecd757
|
59
|
+
border-bottom: 1px solid #ecd757
|
60
|
+
border-left: 1px solid #ecd757
|
61
|
+
border-right: 1px solid #ecd757
|
62
|
+
|
63
|
+
.back
|
64
|
+
background: #e9f3dc url(../images/icons/flashes/back.gif) 1.5em 1em no-repeat
|
65
|
+
border-top: 1px solid #bfcbb0
|
66
|
+
border-bottom: 1px solid #bfcbb0
|
67
|
+
|
68
|
+
.confirm
|
69
|
+
background: #e9f3dc url(../images/icons/flashes/confirm.gif) 1.5em 1em no-repeat
|
70
|
+
border-top: 1px solid #bfcbb0
|
71
|
+
border-bottom: 1px solid #bfcbb0
|
72
|
+
|
73
|
+
.info, .notice
|
74
|
+
color: green
|
75
|
+
|
76
|
+
.warn
|
77
|
+
color: orange
|
78
|
+
|
79
|
+
|
80
|
+
.fieldWithErrors
|
81
|
+
padding: 3px
|
82
|
+
background-color: red
|
83
|
+
display: table
|
84
|
+
|
85
|
+
|
86
|
+
input
|
87
|
+
&#login, &#password
|
88
|
+
|
89
|
+
label
|
90
|
+
font-weight: bold
|
91
|
+
|
92
|
+
|
93
|
+
input
|
94
|
+
&:focus
|
95
|
+
border: 1px solid gray
|
96
|
+
background: #ffd
|
97
|
+
|
98
|
+
&.to_dest
|
99
|
+
position: absolute
|
100
|
+
left: 10ex
|
101
|
+
right: 5ex
|
102
|
+
|
103
|
+
|
104
|
+
label.required
|
105
|
+
font-weight: bold
|
106
|
+
|
107
|
+
&:after
|
108
|
+
content: '*'
|
109
|
+
|
110
|
+
|
111
|
+
span.accessKey
|
112
|
+
text-decoration: underline
|
113
|
+
|
114
|
+
@import formtastic
|
115
|
+
@import formtastic_changes
|
116
|
+
@import aslon_scaffold_table
|