padrino-gen 0.5.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.rdoc +1 -1
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/bin/padrino-gen +1 -2
- data/lib/padrino-gen.rb +7 -23
- data/lib/padrino-gen/generators.rb +22 -0
- data/lib/padrino-gen/generators/actions.rb +1 -1
- data/lib/padrino-gen/generators/app.rb +7 -1
- data/lib/padrino-gen/generators/base.rb +0 -1
- data/lib/padrino-gen/generators/components/orms/activerecord_gen.rb +3 -3
- data/lib/padrino-gen/generators/components/orms/datamapper_gen.rb +3 -3
- data/lib/padrino-gen/generators/components/orms/sequel_gen.rb +3 -3
- data/lib/padrino-gen/generators/controller.rb +7 -2
- data/lib/padrino-gen/generators/mailer.rb +6 -1
- data/lib/padrino-gen/generators/migration.rb +6 -1
- data/lib/padrino-gen/generators/model.rb +6 -1
- data/lib/padrino-gen/generators/templates/controller.rb.tt +2 -5
- data/lib/padrino-gen/generators/templates/scripts/jquery.js +1 -1
- data/lib/padrino-gen/padrino-tasks/datamapper.rb +15 -0
- data/padrino-gen.gemspec +7 -7
- data/test/helper.rb +0 -2
- data/test/test_app_generator.rb +0 -1
- data/test/test_controller_generator.rb +5 -5
- metadata +6 -6
- data/lib/padrino-gen/generators/app/config/urls.rb.tt +0 -44
- data/lib/padrino-gen/generators/app/lib/.empty_directory +0 -0
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
|
4
|
+
GEM_VERSION = File.read(File.dirname(__FILE__) + '/VERSION')
|
5
|
+
|
4
6
|
begin
|
5
7
|
require 'jeweler'
|
6
8
|
Jeweler::Tasks.new do |gem|
|
@@ -12,7 +14,7 @@ begin
|
|
12
14
|
gem.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
13
15
|
gem.executables = ["padrino-gen"]
|
14
16
|
gem.add_runtime_dependency "sinatra", ">= 0.9.2"
|
15
|
-
gem.add_runtime_dependency "padrino-core", "
|
17
|
+
gem.add_runtime_dependency "padrino-core", "= #{GEM_VERSION}"
|
16
18
|
gem.add_runtime_dependency "thor", ">= 0.11.8"
|
17
19
|
gem.add_runtime_dependency "bundler", ">= 0.5.0"
|
18
20
|
gem.add_development_dependency "haml", ">= 2.2.1"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.1
|
data/bin/padrino-gen
CHANGED
@@ -7,10 +7,9 @@ Padrino::Generators.lockup!
|
|
7
7
|
|
8
8
|
generator_kind = ARGV.delete_at(0).to_s.downcase.to_sym if ARGV[0].present?
|
9
9
|
generator_class = Padrino::Generators.mappings[generator_kind]
|
10
|
-
arguments = ARGV.any? ? ARGV : ['-h']
|
11
10
|
|
12
11
|
if generator_class
|
13
|
-
generator_class.start(
|
12
|
+
generator_class.start(ARGV)
|
14
13
|
else
|
15
14
|
puts "Please specify generator to use (#{Padrino::Generators.mappings.keys.join(", ")})"
|
16
15
|
end
|
data/lib/padrino-gen.rb
CHANGED
@@ -1,27 +1,11 @@
|
|
1
1
|
require 'padrino-core/support_lite'
|
2
|
-
Dir[File.dirname(__FILE__) + '/padrino-gen/generators/{components}/**/*.rb'].each { |lib| require lib }
|
3
|
-
require File.dirname(__FILE__) + '/padrino-gen/generators/actions.rb'
|
4
|
-
require File.dirname(__FILE__) + '/padrino-gen/generators/base.rb'
|
5
|
-
|
6
|
-
module Padrino
|
7
|
-
module Generators
|
8
2
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def mappings
|
15
|
-
@mappings ||= SupportLite::OrderedHash.new
|
16
|
-
end
|
3
|
+
Dir[File.dirname(__FILE__) + '/padrino-gen/generators/{components}/**/*.rb'].each { |lib| require lib }
|
4
|
+
require File.dirname(__FILE__) + '/padrino-gen/generators/actions'
|
5
|
+
require File.dirname(__FILE__) + '/padrino-gen/generators/base'
|
6
|
+
require File.dirname(__FILE__) + '/padrino-gen/generators'
|
17
7
|
|
18
|
-
def add_generator(name, klass)
|
19
|
-
mappings[name] = klass
|
20
|
-
end
|
21
8
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
9
|
+
# Add our rakes when padrino core require this file.
|
10
|
+
require 'padrino-core/tasks'
|
11
|
+
Padrino::Tasks.files << Dir[File.dirname(__FILE__) + "/padrino-gen/padrino-tasks/**/*.rb"]
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Padrino
|
2
|
+
module Generators
|
3
|
+
|
4
|
+
class << self
|
5
|
+
def load_paths
|
6
|
+
@load_paths ||= Dir[File.dirname(__FILE__) + '/generators/{app,mailer,controller,model,migration}.rb']
|
7
|
+
end
|
8
|
+
|
9
|
+
def mappings
|
10
|
+
@mappings ||= SupportLite::OrderedHash.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def add_generator(name, klass)
|
14
|
+
mappings[name] = klass
|
15
|
+
end
|
16
|
+
|
17
|
+
def lockup!
|
18
|
+
load_paths.each { |lib| require lib }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -84,7 +84,7 @@ module Padrino
|
|
84
84
|
end
|
85
85
|
|
86
86
|
# Constructs a path from the specified app root
|
87
|
-
#
|
87
|
+
# app_root_path("app/mailers", "#{@mailer_basename}.rb")
|
88
88
|
def app_root_path(*paths)
|
89
89
|
settings = paths.extract_options!
|
90
90
|
File.join(settings[:root] || options[:root] || '.', *paths)
|
@@ -19,7 +19,7 @@ module Padrino
|
|
19
19
|
desc "Description:\n\n\tpadrino-gen project generates a new Padrino project"
|
20
20
|
|
21
21
|
argument :name, :desc => "The name of your padrino project"
|
22
|
-
argument :path, :desc => "The path to create your padrino project"
|
22
|
+
argument :path, :desc => "The path to create your padrino project", :default => "."
|
23
23
|
class_option :run_bundler, :aliases => '-b', :default => false, :type => :boolean
|
24
24
|
|
25
25
|
# Definitions for the available customizable components
|
@@ -29,6 +29,12 @@ module Padrino
|
|
29
29
|
component_option :script, "javascript library", :aliases => '-s', :choices => [:jquery, :prototype, :rightjs]
|
30
30
|
component_option :renderer, "template engine", :aliases => '-r', :choices => [:erb, :haml]
|
31
31
|
|
32
|
+
# Show help if no argv given
|
33
|
+
def self.start(given_args=ARGV, config={})
|
34
|
+
given_args = ["-h"] if given_args.empty?
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
32
38
|
# Copies over the Padrino base application App
|
33
39
|
def setup_app
|
34
40
|
self.destination_root = File.join(path, name)
|
@@ -11,7 +11,6 @@ module Padrino
|
|
11
11
|
|
12
12
|
class_option :root, :aliases => '-r', :default => nil, :type => :string
|
13
13
|
|
14
|
-
# Copies over the base sinatra starting project
|
15
14
|
def load_boot
|
16
15
|
if in_app_root?(options[:root])
|
17
16
|
require(options[:root] ? File.join(options[:root], 'config/boot.rb') : 'config/boot.rb')
|
@@ -12,21 +12,21 @@ module Padrino
|
|
12
12
|
app.configure :development do
|
13
13
|
ActiveRecord::Base.establish_connection(
|
14
14
|
:adapter => 'sqlite3',
|
15
|
-
:database => "
|
15
|
+
:database => Padrino.root('db', "development.db")
|
16
16
|
)
|
17
17
|
end
|
18
18
|
|
19
19
|
app.configure :production do
|
20
20
|
ActiveRecord::Base.establish_connection(
|
21
21
|
:adapter => 'sqlite3',
|
22
|
-
:database => "
|
22
|
+
:database => Padrino.root('db', "production.db")
|
23
23
|
)
|
24
24
|
end
|
25
25
|
|
26
26
|
app.configure :test do
|
27
27
|
ActiveRecord::Base.establish_connection(
|
28
28
|
:adapter => 'sqlite3',
|
29
|
-
:database => "
|
29
|
+
:database => Padrino.root('db', "test.db")
|
30
30
|
)
|
31
31
|
end
|
32
32
|
end
|
@@ -8,9 +8,9 @@ module Padrino
|
|
8
8
|
module DatabaseSetup
|
9
9
|
def self.registered(app)
|
10
10
|
app.configure { DataMapper.logger = logger }
|
11
|
-
app.configure(:development) { DataMapper.setup(:default, "sqlite3://
|
12
|
-
app.configure(:production) { DataMapper.setup(:default, "sqlite3://
|
13
|
-
app.configure(:test) { DataMapper.setup(:default, "sqlite3://
|
11
|
+
app.configure(:development) { DataMapper.setup(:default, "sqlite3://" + Padrino.root('db', "development.db")) }
|
12
|
+
app.configure(:production) { DataMapper.setup(:default, "sqlite3://" + Padrino.root('db', "production.db")) }
|
13
|
+
app.configure(:test) { DataMapper.setup(:default, "sqlite3://" + Padrino.root('db', "test.db")) }
|
14
14
|
rescue ArgumentError => e
|
15
15
|
logger.error "Database options need to be configured within 'config/database.rb'!" if app.logging?
|
16
16
|
end
|
@@ -9,9 +9,9 @@ module Padrino
|
|
9
9
|
module DatabaseSetup
|
10
10
|
def self.registered(app)
|
11
11
|
Sequel::Model.plugin(:schema)
|
12
|
-
app.configure(:development) { Sequel.connect("
|
13
|
-
app.configure(:production) { Sequel.connect("
|
14
|
-
app.configure(:test) { Sequel.connect("
|
12
|
+
app.configure(:development) { Sequel.connect("sqlite3://" + Padrino.root('db', "development.db"), :loggers => [logger]) }
|
13
|
+
app.configure(:production) { Sequel.connect("sqlite3://" + Padrino.root('db', "production.db"), :loggers => [logger]) }
|
14
|
+
app.configure(:test) { Sequel.connect("sqlite3://" + Padrino.root('db', "test.db"), :loggers => [logger]) }
|
15
15
|
end
|
16
16
|
end
|
17
17
|
SEQUEL
|
@@ -24,13 +24,18 @@ module Padrino
|
|
24
24
|
class_option :root, :aliases => '-r', :default => nil, :type => :string
|
25
25
|
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
26
26
|
|
27
|
-
#
|
27
|
+
# Show help if no argv given
|
28
|
+
def self.start(given_args=ARGV, config={})
|
29
|
+
given_args = ["-h"] if given_args.empty?
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
28
33
|
def create_controller
|
29
34
|
if in_app_root?(options[:root])
|
30
35
|
@app_name = fetch_app_name(options[:root])
|
31
36
|
@actions = controller_actions(fields)
|
32
37
|
self.behavior = :revoke if options[:destroy]
|
33
|
-
inject_into_file app_root_path("config/urls.rb"), controller_routes(name,fields), :after => "urls do\n"
|
38
|
+
# inject_into_file app_root_path("config/urls.rb"), controller_routes(name,fields), :after => "urls do\n"
|
34
39
|
template "templates/controller.rb.tt", app_root_path("app/controllers", "#{name}.rb")
|
35
40
|
template "templates/helper.rb.tt", app_root_path("app/helpers", "#{name}_helper.rb")
|
36
41
|
empty_directory app_root_path("app/views/#{name}")
|
@@ -23,7 +23,12 @@ module Padrino
|
|
23
23
|
class_option :root, :aliases => '-r', :default => nil, :type => :string
|
24
24
|
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
25
25
|
|
26
|
-
#
|
26
|
+
# Show help if no argv given
|
27
|
+
def self.start(given_args=ARGV, config={})
|
28
|
+
given_args = ["-h"] if given_args.empty?
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
27
32
|
def create_mailer
|
28
33
|
if in_app_root?(options[:root])
|
29
34
|
self.behavior = :revoke if options[:destroy]
|
@@ -24,7 +24,12 @@ module Padrino
|
|
24
24
|
class_option :root, :aliases => '-r', :default => nil, :type => :string
|
25
25
|
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
26
26
|
|
27
|
-
#
|
27
|
+
# Show help if no argv given
|
28
|
+
def self.start(given_args=ARGV, config={})
|
29
|
+
given_args = ["-h"] if given_args.empty?
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
28
33
|
def create_model
|
29
34
|
if in_app_root?(options[:root])
|
30
35
|
remove_migration(name) if options[:destroy]
|
@@ -24,7 +24,12 @@ module Padrino
|
|
24
24
|
class_option :root, :aliases => '-r', :default => nil, :type => :string
|
25
25
|
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
26
26
|
|
27
|
-
#
|
27
|
+
# Show help if no argv given
|
28
|
+
def self.start(given_args=ARGV, config={})
|
29
|
+
given_args = ["-h"] if given_args.empty?
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
28
33
|
def create_model
|
29
34
|
if in_app_root?(options[:root])
|
30
35
|
remove_model_migration(name) if options[:destroy]
|
@@ -1,10 +1,7 @@
|
|
1
|
-
# Define your named routes inside config/urls.rb or define them inline
|
2
|
-
# You can also use unnamed routes by defining them directly
|
3
|
-
|
4
1
|
<%= @app_name %>.controllers do
|
5
|
-
# get :index do
|
2
|
+
# get :index, :map => "/foo/bar" do
|
6
3
|
# session[:foo] = "bar"
|
7
|
-
#
|
4
|
+
# render 'index'
|
8
5
|
# end
|
9
6
|
|
10
7
|
# get :sample, :map => "/sample/url" do
|
@@ -0,0 +1,15 @@
|
|
1
|
+
if defined?(DataMapper)
|
2
|
+
namespace :dm do
|
3
|
+
desc "DataMapper: perform migration (reset your db data)"
|
4
|
+
task :migrate => :environment do
|
5
|
+
DataMapper.auto_migrate!
|
6
|
+
puts "=> db:migrate executed"
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "DataMapper: perform upgrade (with a no-destructive way)"
|
10
|
+
task :upgrade => :environment do
|
11
|
+
DataMapper.auto_upgrade!
|
12
|
+
puts "=> db:upgrade executed"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/padrino-gen.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{padrino-gen}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.6.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-14}
|
13
13
|
s.default_executable = %q{padrino-gen}
|
14
14
|
s.description = %q{Generators for easily creating and building padrino applications from the console}
|
15
15
|
s.email = %q{nesquena@gmail.com}
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
"VERSION",
|
27
27
|
"bin/padrino-gen",
|
28
28
|
"lib/padrino-gen.rb",
|
29
|
+
"lib/padrino-gen/generators.rb",
|
29
30
|
"lib/padrino-gen/generators/actions.rb",
|
30
31
|
"lib/padrino-gen/generators/app.rb",
|
31
32
|
"lib/padrino-gen/generators/app/.gitignore",
|
@@ -43,8 +44,6 @@ Gem::Specification.new do |s|
|
|
43
44
|
"lib/padrino-gen/generators/app/config/boot.rb",
|
44
45
|
"lib/padrino-gen/generators/app/config/initializers/.empty_directory",
|
45
46
|
"lib/padrino-gen/generators/app/config/initializers/example.rb",
|
46
|
-
"lib/padrino-gen/generators/app/config/urls.rb.tt",
|
47
|
-
"lib/padrino-gen/generators/app/lib/.empty_directory",
|
48
47
|
"lib/padrino-gen/generators/app/tmp/.empty_directory",
|
49
48
|
"lib/padrino-gen/generators/base.rb",
|
50
49
|
"lib/padrino-gen/generators/components/actions.rb",
|
@@ -77,6 +76,7 @@ Gem::Specification.new do |s|
|
|
77
76
|
"lib/padrino-gen/generators/templates/scripts/lowpro.js",
|
78
77
|
"lib/padrino-gen/generators/templates/scripts/protopak.js",
|
79
78
|
"lib/padrino-gen/generators/templates/scripts/right.js",
|
79
|
+
"lib/padrino-gen/padrino-tasks/datamapper.rb",
|
80
80
|
"padrino-gen.gemspec",
|
81
81
|
"test/helper.rb",
|
82
82
|
"test/test_app_generator.rb",
|
@@ -98,7 +98,7 @@ Gem::Specification.new do |s|
|
|
98
98
|
|
99
99
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
100
100
|
s.add_runtime_dependency(%q<sinatra>, [">= 0.9.2"])
|
101
|
-
s.add_runtime_dependency(%q<padrino-core>, ["
|
101
|
+
s.add_runtime_dependency(%q<padrino-core>, ["= 0.6.1"])
|
102
102
|
s.add_runtime_dependency(%q<thor>, [">= 0.11.8"])
|
103
103
|
s.add_runtime_dependency(%q<bundler>, [">= 0.5.0"])
|
104
104
|
s.add_development_dependency(%q<haml>, [">= 2.2.1"])
|
@@ -109,7 +109,7 @@ Gem::Specification.new do |s|
|
|
109
109
|
s.add_development_dependency(%q<fakeweb>, [">= 1.2.3"])
|
110
110
|
else
|
111
111
|
s.add_dependency(%q<sinatra>, [">= 0.9.2"])
|
112
|
-
s.add_dependency(%q<padrino-core>, ["
|
112
|
+
s.add_dependency(%q<padrino-core>, ["= 0.6.1"])
|
113
113
|
s.add_dependency(%q<thor>, [">= 0.11.8"])
|
114
114
|
s.add_dependency(%q<bundler>, [">= 0.5.0"])
|
115
115
|
s.add_dependency(%q<haml>, [">= 2.2.1"])
|
@@ -121,7 +121,7 @@ Gem::Specification.new do |s|
|
|
121
121
|
end
|
122
122
|
else
|
123
123
|
s.add_dependency(%q<sinatra>, [">= 0.9.2"])
|
124
|
-
s.add_dependency(%q<padrino-core>, ["
|
124
|
+
s.add_dependency(%q<padrino-core>, ["= 0.6.1"])
|
125
125
|
s.add_dependency(%q<thor>, [">= 0.11.8"])
|
126
126
|
s.add_dependency(%q<bundler>, [">= 0.5.0"])
|
127
127
|
s.add_dependency(%q<haml>, [">= 2.2.1"])
|
data/test/helper.rb
CHANGED
data/test/test_app_generator.rb
CHANGED
@@ -34,7 +34,6 @@ class TestAppGenerator < Test::Unit::TestCase
|
|
34
34
|
silence_logger { @app.start(['sample_app', '/tmp', '--script=none']) }
|
35
35
|
assert_match_in_file(/class SampleApp < Padrino::Application/m, '/tmp/sample_app/app/app.rb')
|
36
36
|
assert_match_in_file(/Padrino.mount_core\("SampleApp"\)/m, '/tmp/sample_app/config/apps.rb')
|
37
|
-
assert_match_in_file(/SampleApp.urls do/m, '/tmp/sample_app/config/urls.rb')
|
38
37
|
end
|
39
38
|
|
40
39
|
should "create components file containing options chosen with defaults" do
|
@@ -8,7 +8,7 @@ class TestControllerGenerator < Test::Unit::TestCase
|
|
8
8
|
@contgen = Padrino::Generators::Controller.dup
|
9
9
|
@controller_path = '/tmp/sample_app/app/controllers/demo_items.rb'
|
10
10
|
@controller_test_path = '/tmp/sample_app/test/controllers/demo_items_controller_test.rb'
|
11
|
-
@route_path = '/tmp/sample_app/config/urls.rb'
|
11
|
+
# @route_path = '/tmp/sample_app/config/urls.rb'
|
12
12
|
`rm -rf /tmp/sample_app`
|
13
13
|
end
|
14
14
|
|
@@ -70,8 +70,8 @@ class TestControllerGenerator < Test::Unit::TestCase
|
|
70
70
|
should "generate url routes for get:yoda post:yada" do
|
71
71
|
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=shoulda'])}
|
72
72
|
silence_logger { @contgen.start(['demo_items', "get:yoda","post:yada",'-r=/tmp/sample_app']) }
|
73
|
-
assert_match_in_file(/map\(\:yoda\).to\(\"\/demo_items\/yoda\"\)/m,@route_path)
|
74
|
-
assert_match_in_file(/map\(\:yada\).to\(\"\/demo_items\/yada\"\)/m,@route_path)
|
73
|
+
# assert_match_in_file(/map\(\:yoda\).to\(\"\/demo_items\/yoda\"\)/m,@route_path)
|
74
|
+
# assert_match_in_file(/map\(\:yada\).to\(\"\/demo_items\/yada\"\)/m,@route_path)
|
75
75
|
end
|
76
76
|
|
77
77
|
end
|
@@ -100,8 +100,8 @@ class TestControllerGenerator < Test::Unit::TestCase
|
|
100
100
|
silence_logger { @app.start(['sample_app', '/tmp', '--script=none', '-t=bacon'])}
|
101
101
|
silence_logger { @contgen.start(['demo_items', "get:yoda","post:yada",'-r=/tmp/sample_app']) }
|
102
102
|
silence_logger { @contgen.start(['demo_items','-r=/tmp/sample_app','-d'])}
|
103
|
-
assert_no_match_in_file(/map\(\:yoda\).to\(\"\/demo_items\/yoda\"\)/m,@route_path)
|
104
|
-
assert_no_match_in_file(/map\(\:yada\).to\(\"\/demo_items\/yada\"\)/m,@route_path)
|
103
|
+
# assert_no_match_in_file(/map\(\:yoda\).to\(\"\/demo_items\/yoda\"\)/m,@route_path)
|
104
|
+
# assert_no_match_in_file(/map\(\:yada\).to\(\"\/demo_items\/yada\"\)/m,@route_path)
|
105
105
|
end
|
106
106
|
|
107
107
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date: 2010-01-
|
15
|
+
date: 2010-01-14 00:00:00 +01:00
|
16
16
|
default_executable: padrino-gen
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -31,9 +31,9 @@ dependencies:
|
|
31
31
|
version_requirement:
|
32
32
|
version_requirements: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
|
-
- - "
|
34
|
+
- - "="
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 0.
|
36
|
+
version: 0.6.1
|
37
37
|
version:
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: thor
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- VERSION
|
133
133
|
- bin/padrino-gen
|
134
134
|
- lib/padrino-gen.rb
|
135
|
+
- lib/padrino-gen/generators.rb
|
135
136
|
- lib/padrino-gen/generators/actions.rb
|
136
137
|
- lib/padrino-gen/generators/app.rb
|
137
138
|
- lib/padrino-gen/generators/app/.gitignore
|
@@ -149,8 +150,6 @@ files:
|
|
149
150
|
- lib/padrino-gen/generators/app/config/boot.rb
|
150
151
|
- lib/padrino-gen/generators/app/config/initializers/.empty_directory
|
151
152
|
- lib/padrino-gen/generators/app/config/initializers/example.rb
|
152
|
-
- lib/padrino-gen/generators/app/config/urls.rb.tt
|
153
|
-
- lib/padrino-gen/generators/app/lib/.empty_directory
|
154
153
|
- lib/padrino-gen/generators/app/tmp/.empty_directory
|
155
154
|
- lib/padrino-gen/generators/base.rb
|
156
155
|
- lib/padrino-gen/generators/components/actions.rb
|
@@ -183,6 +182,7 @@ files:
|
|
183
182
|
- lib/padrino-gen/generators/templates/scripts/lowpro.js
|
184
183
|
- lib/padrino-gen/generators/templates/scripts/protopak.js
|
185
184
|
- lib/padrino-gen/generators/templates/scripts/right.js
|
185
|
+
- lib/padrino-gen/padrino-tasks/datamapper.rb
|
186
186
|
- padrino-gen.gemspec
|
187
187
|
- test/helper.rb
|
188
188
|
- test/test_app_generator.rb
|
@@ -1,44 +0,0 @@
|
|
1
|
-
<%= @class_name %>.urls do
|
2
|
-
# map(:index).to("/")
|
3
|
-
# map(:test).to("/test")
|
4
|
-
end
|
5
|
-
|
6
|
-
=begin
|
7
|
-
|
8
|
-
This file contains named routes to be used in the Padrino application.
|
9
|
-
To create named routes simply add them to the urls block below.
|
10
|
-
|
11
|
-
You can specify simple routes as:
|
12
|
-
|
13
|
-
map(:index).to("/")
|
14
|
-
map(:test).to("/test")
|
15
|
-
|
16
|
-
Routes can also contain query parameters:
|
17
|
-
|
18
|
-
map(:account).to("/the/accounts/:name/and/:id")
|
19
|
-
|
20
|
-
Routes can also be grouped by a namespaced:
|
21
|
-
|
22
|
-
map :admin do |namespace|
|
23
|
-
namespace.map(:show).to("/admin/:id/show")
|
24
|
-
namespace.map(:destroy).to("/admin/:id/destroy")
|
25
|
-
end
|
26
|
-
|
27
|
-
Routes can then be accessed in controllers and views:
|
28
|
-
|
29
|
-
url_for(:account, :id => 1, :name => 'first')
|
30
|
-
url_for(:admin, :show, :id => 25)
|
31
|
-
|
32
|
-
To define the controller actions for a named route simply refer to the alias symbol:
|
33
|
-
|
34
|
-
# Configure the routes using the named alias
|
35
|
-
get(:account) { "name: params[:name] - id: params[:id]" }
|
36
|
-
get(:accounts) { "I am the body for the url /the/accounts/index" }
|
37
|
-
# and for namespaced routes
|
38
|
-
namespace :admin do
|
39
|
-
get :show do
|
40
|
-
"admin show for #{params[:id]}"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
=end
|
File without changes
|