padrino-gen 0.9.24 → 0.9.25
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/padrino-gen/generators/actions.rb +10 -2
- data/lib/padrino-gen/generators/app.rb +4 -4
- data/lib/padrino-gen/generators/app/app.rb.tt +26 -2
- data/lib/padrino-gen/generators/components/actions.rb +9 -9
- data/lib/padrino-gen/generators/components/orms/couchrest.rb +2 -2
- data/lib/padrino-gen/generators/components/orms/datamapper.rb +3 -3
- data/lib/padrino-gen/generators/components/orms/mongoid.rb +5 -5
- data/lib/padrino-gen/generators/components/orms/mongomapper.rb +4 -3
- data/lib/padrino-gen/generators/components/orms/mongomatic.rb +6 -6
- data/lib/padrino-gen/generators/components/orms/ohm.rb +2 -2
- data/lib/padrino-gen/generators/components/renderers/erb.rb +1 -1
- data/lib/padrino-gen/generators/components/renderers/slim.rb +1 -1
- data/lib/padrino-gen/generators/components/scripts/dojo.rb +7 -1
- data/lib/padrino-gen/generators/components/scripts/extcore.rb +7 -1
- data/lib/padrino-gen/generators/components/scripts/jquery.rb +7 -1
- data/lib/padrino-gen/generators/components/scripts/mootools.rb +7 -1
- data/lib/padrino-gen/generators/components/scripts/prototype.rb +9 -2
- data/lib/padrino-gen/generators/components/scripts/rightjs.rb +8 -2
- data/lib/padrino-gen/generators/components/stylesheets/sass.rb +3 -3
- data/lib/padrino-gen/generators/components/stylesheets/scss.rb +2 -2
- data/lib/padrino-gen/generators/components/tests/cucumber.rb +1 -1
- data/lib/padrino-gen/generators/components/tests/riot.rb +3 -1
- data/lib/padrino-gen/generators/components/tests/rspec.rb +1 -1
- data/lib/padrino-gen/generators/project.rb +5 -6
- data/lib/padrino-gen/generators/project/config/apps.rb.tt +2 -2
- data/lib/padrino-gen/generators/project/config/boot.rb +3 -3
- data/lib/padrino-gen/generators/runner.rb +4 -4
- data/lib/padrino-gen/generators/templates/Gemfile.tt +1 -1
- data/lib/padrino-gen/padrino-tasks/activerecord.rb +3 -3
- data/lib/padrino-gen/padrino-tasks/mongoid.rb +5 -5
- data/lib/padrino-gen/padrino-tasks/mongomapper.rb +3 -3
- data/padrino-gen.gemspec +2 -2
- data/test/helper.rb +9 -11
- data/test/test_app_generator.rb +4 -3
- data/test/test_project_generator.rb +17 -7
- metadata +8 -15
- data/lib/padrino-gen/generators/templates/scripts/dojo.js +0 -16
- data/lib/padrino-gen/generators/templates/scripts/ext-core.js +0 -8
- data/lib/padrino-gen/generators/templates/scripts/jquery.js +0 -154
- data/lib/padrino-gen/generators/templates/scripts/lowpro.js +0 -370
- data/lib/padrino-gen/generators/templates/scripts/mootools-core.js +0 -476
- data/lib/padrino-gen/generators/templates/scripts/protopak.js +0 -1
- data/lib/padrino-gen/generators/templates/scripts/right.js +0 -1
@@ -44,6 +44,15 @@ module Padrino
|
|
44
44
|
retrieve_component_config(destination_root('.components'))[component]
|
45
45
|
end
|
46
46
|
|
47
|
+
# Set the component choice and store it in the .component file of the application
|
48
|
+
# store_component_choice(:renderer, :haml)
|
49
|
+
def store_component_choice(key, value)
|
50
|
+
path = destination_root('.components')
|
51
|
+
config = retrieve_component_config(path)
|
52
|
+
config[key] = value
|
53
|
+
create_file(path, :force => true) { config.to_yaml }
|
54
|
+
end
|
55
|
+
|
47
56
|
# Loads the component config back into a hash
|
48
57
|
# i.e retrieve_component_config(...) => { :mock => 'rr', :test => 'riot', ... }
|
49
58
|
def retrieve_component_config(target)
|
@@ -109,7 +118,6 @@ module Padrino
|
|
109
118
|
options = gem_names.extract_options!
|
110
119
|
gem_names.reverse.each { |lib| insert_into_gemfile(lib, options) }
|
111
120
|
end
|
112
|
-
alias :require_dependency :require_dependencies
|
113
121
|
|
114
122
|
# Inserts a required gem into the Gemfile to add the bundler dependency
|
115
123
|
# insert_into_gemfile(name)
|
@@ -213,7 +221,7 @@ module Padrino
|
|
213
221
|
raise ::NameError, "Project name #{name} cannot start with numbers"
|
214
222
|
elsif name =~ /^\W/
|
215
223
|
raise ::NameError, "Project name #{name} cannot start with non-word character"
|
216
|
-
end
|
224
|
+
end
|
217
225
|
end
|
218
226
|
|
219
227
|
module ClassMethods
|
@@ -31,16 +31,16 @@ module Padrino
|
|
31
31
|
@app_name = name.gsub(/\W/, "_").underscore.camelize
|
32
32
|
if in_app_root?
|
33
33
|
self.behavior = :revoke if options[:destroy]
|
34
|
-
app_skeleton(
|
35
|
-
empty_directory destination_root("public/#{
|
36
|
-
append_file destination_root("config/apps.rb"), "\nPadrino.mount(\"#{@app_name}\").to(\"/#{
|
34
|
+
app_skeleton(@app_name.downcase, options[:tiny])
|
35
|
+
empty_directory destination_root("public/#{@app_name.downcase}")
|
36
|
+
append_file destination_root("config/apps.rb"), "\nPadrino.mount(\"#{@app_name}\").to(\"/#{@app_name.downcase}\")"
|
37
37
|
|
38
38
|
return if self.behavior == :revoke
|
39
39
|
say (<<-TEXT).gsub(/ {10}/,'')
|
40
40
|
|
41
41
|
=================================================================
|
42
42
|
Your #{@app_name} application has been installed.
|
43
|
-
This application has been mounted to /#{
|
43
|
+
This application has been mounted to /#{@app_name.downcase}
|
44
44
|
You can configure a different path by editing 'config/apps.rb'
|
45
45
|
=================================================================
|
46
46
|
|
@@ -2,16 +2,36 @@ class <%= @app_name %> < Padrino::Application
|
|
2
2
|
register Padrino::Mailer
|
3
3
|
register Padrino::Helpers
|
4
4
|
|
5
|
+
set :session_secret, "<%= '%x' % rand(2**255) %>"
|
6
|
+
set :sessions, true
|
7
|
+
|
8
|
+
##
|
9
|
+
# Caching support
|
10
|
+
#
|
11
|
+
# register Padrino::Cache
|
12
|
+
# enable :caching
|
13
|
+
#
|
14
|
+
# You can customize caching store engines:
|
15
|
+
#
|
16
|
+
# set :cache, Padrino::Cache::Store::Memcache.new(::Memcached.new('127.0.0.1:11211', :exception_retry_limit => 1))
|
17
|
+
# set :cache, Padrino::Cache::Store::Memcache.new(::Dalli::Client.new('127.0.0.1:11211', :exception_retry_limit => 1))
|
18
|
+
# set :cache, Padrino::Cache::Store::Redis.new(::Redis.new(:host => '127.0.0.1', :port => 6379, :db => 0))
|
19
|
+
# set :cache, Padrino::Cache::Store::Memory.new(50)
|
20
|
+
# set :cache, Padrino::Cache::Store::File.new(Padrino.root('tmp', app_name.to_s, 'cache')) # default choice
|
21
|
+
#
|
22
|
+
|
5
23
|
##
|
6
24
|
# Application configuration options
|
7
25
|
#
|
8
|
-
# set :raise_errors, true #
|
26
|
+
# set :raise_errors, true # Raise exceptions (will stop application) (default true for development)
|
27
|
+
# set :show_exceptions, true # Show a stack trace in browser (default is true)
|
9
28
|
# set :public, "foo/bar" # Location for static assets (default root/public)
|
10
29
|
# set :reload, false # Reload application files (default in development)
|
11
30
|
# set :default_builder, "foo" # Set a custom form builder (default 'StandardFormBuilder')
|
12
31
|
# set :locale_path, "bar" # Set path for I18n translations (defaults to app/locale/)
|
13
|
-
# enable
|
32
|
+
# enable :sessions # Disabled by default
|
14
33
|
# disable :flash # Disables rack-flash (enabled by default if sessions)
|
34
|
+
# disable :padrino_logging # Disables Padrino logging (enabled by default)
|
15
35
|
# layout :my_layout # Layout can be in views/layouts/foo.ext or views/foo.ext (default :application)
|
16
36
|
#
|
17
37
|
|
@@ -31,4 +51,8 @@ class <%= @app_name %> < Padrino::Application
|
|
31
51
|
# render 'errors/404'
|
32
52
|
# end
|
33
53
|
#
|
54
|
+
# error 505 do
|
55
|
+
# render 'errors/505'
|
56
|
+
# end
|
57
|
+
#
|
34
58
|
end
|
@@ -12,9 +12,9 @@ module Padrino
|
|
12
12
|
else
|
13
13
|
return if migration_exist?(filename)
|
14
14
|
model_name = name.to_s.pluralize
|
15
|
-
field_tuples = fields.
|
16
|
-
field_tuples.
|
17
|
-
column_declarations = field_tuples.
|
15
|
+
field_tuples = fields.map { |value| value.split(":") }
|
16
|
+
field_tuples.map! { |field, kind| kind =~ /datetime/i ? [field, 'DateTime'] : [field, kind] } # fix datetime
|
17
|
+
column_declarations = field_tuples.map(&options[:column_format]).join("\n ")
|
18
18
|
contents = options[:base].dup.gsub(/\s{4}!UP!\n/m, options[:up]).gsub(/!DOWN!\n/m, options[:down])
|
19
19
|
contents = contents.gsub(/!NAME!/, model_name.camelize).gsub(/!TABLE!/, model_name.underscore)
|
20
20
|
contents = contents.gsub(/!FILENAME!/, filename.underscore).gsub(/!FILECLASS!/, filename.camelize)
|
@@ -38,10 +38,10 @@ module Padrino
|
|
38
38
|
change_format = options[:change_format]
|
39
39
|
migration_scan = filename.camelize.scan(/(Add|Remove)(?:.*?)(?:To|From)(.*?)$/).flatten
|
40
40
|
direction, table_name = migration_scan[0].downcase, migration_scan[1].downcase.pluralize if migration_scan.any?
|
41
|
-
tuples = direction ? columns.
|
42
|
-
tuples.
|
43
|
-
add_columns = tuples.
|
44
|
-
remove_columns = tuples.
|
41
|
+
tuples = direction ? columns.map { |value| value.split(":") } : []
|
42
|
+
tuples.map! { |field, kind| kind =~ /datetime/i ? [field, 'DateTime'] : [field, kind] } # fix datetime
|
43
|
+
add_columns = tuples.map(&options[:add]).join("\n ")
|
44
|
+
remove_columns = tuples.map(&options[:remove]).join("\n ")
|
45
45
|
forward_text = change_format.gsub(/!TABLE!/, table_name).gsub(/!COLUMNS!/, add_columns) if tuples.any?
|
46
46
|
back_text = change_format.gsub(/!TABLE!/, table_name).gsub(/!COLUMNS!/, remove_columns) if tuples.any?
|
47
47
|
contents = options[:base].dup.gsub(/\s{4}!UP!\n/m, (direction == 'add' ? forward_text.to_s : back_text.to_s))
|
@@ -108,8 +108,8 @@ module Padrino
|
|
108
108
|
# For Controller action generation
|
109
109
|
# Takes in fields for routes in the form of get:index post:test delete:yada and such
|
110
110
|
def controller_actions(fields)
|
111
|
-
field_tuples = fields.
|
112
|
-
action_declarations = field_tuples.
|
111
|
+
field_tuples = fields.map { |value| value.split(":") }
|
112
|
+
action_declarations = field_tuples.map do |request, name|
|
113
113
|
"#{request} :#{name} do\n end\n"
|
114
114
|
end
|
115
115
|
action_declarations.join("\n ")
|
@@ -30,8 +30,8 @@ MODEL
|
|
30
30
|
# options => { :fields => ["title:string", "body:string"], :app => 'app' }
|
31
31
|
def create_model_file(name, options={})
|
32
32
|
model_path = destination_root(options[:app], 'models', "#{name.to_s.underscore}.rb")
|
33
|
-
field_tuples = options[:fields].
|
34
|
-
column_declarations = field_tuples.
|
33
|
+
field_tuples = options[:fields].map { |value| value.split(":") }
|
34
|
+
column_declarations = field_tuples.map { |field, kind| "property :#{field}" }.join("\n ")
|
35
35
|
model_contents = CR_MODEL.gsub(/!NAME!/, name.to_s.camelize)
|
36
36
|
model_contents.gsub!(/!FIELDS!/, column_declarations)
|
37
37
|
create_file(model_path, model_contents)
|
@@ -61,9 +61,9 @@ MODEL
|
|
61
61
|
def create_model_file(name, options={})
|
62
62
|
model_path = destination_root(options[:app], 'models', "#{name.to_s.underscore}.rb")
|
63
63
|
model_contents = DM_MODEL.gsub(/!NAME!/, name.to_s.camelize)
|
64
|
-
field_tuples = options[:fields].
|
65
|
-
field_tuples.
|
66
|
-
column_declarations = field_tuples.
|
64
|
+
field_tuples = options[:fields].map { |value| value.split(":") }
|
65
|
+
field_tuples.map! { |field, kind| kind =~ /datetime/i ? [field, 'DateTime'] : [field, kind] } # fix datetime
|
66
|
+
column_declarations = field_tuples.map { |field, kind|"property :#{field}, #{kind.camelize}" }.join("\n ")
|
67
67
|
model_contents.gsub!(/!FIELDS!/, column_declarations)
|
68
68
|
create_file(model_path, model_contents)
|
69
69
|
end
|
@@ -28,7 +28,8 @@ MONGO
|
|
28
28
|
|
29
29
|
def setup_orm
|
30
30
|
require_dependencies 'bson_ext', :require => 'mongo'
|
31
|
-
require_dependencies 'mongoid', :version => '2.0.0
|
31
|
+
require_dependencies 'mongoid', :version => '2.0.0'
|
32
|
+
require_dependencies 'SystemTimer', :require => 'system_timer'
|
32
33
|
create_file("config/database.rb", MONGOID.gsub(/!NAME!/, @app_name.underscore))
|
33
34
|
empty_directory('app/models')
|
34
35
|
end
|
@@ -46,15 +47,14 @@ class !NAME!
|
|
46
47
|
|
47
48
|
# You can create a composite key in mongoid to replace the default id using the key macro:
|
48
49
|
# key :field <, :another_field, :one_more ....>
|
49
|
-
|
50
50
|
end
|
51
51
|
MODEL
|
52
52
|
|
53
53
|
# options => { :fields => ["title:string", "body:string"], :app => 'app' }
|
54
54
|
def create_model_file(name, options={})
|
55
55
|
model_path = destination_root(options[:app], 'models', "#{name.to_s.underscore}.rb")
|
56
|
-
field_tuples = options[:fields].
|
57
|
-
column_declarations = field_tuples.
|
56
|
+
field_tuples = options[:fields].map { |value| value.split(":") }
|
57
|
+
column_declarations = field_tuples.map { |field, kind| "field :#{field}, :type => #{kind.camelize}" }.join("\n ")
|
58
58
|
model_contents = MONGOID_MODEL.gsub(/!NAME!/, name.to_s.camelize)
|
59
59
|
model_contents.gsub!(/!FIELDS!/, column_declarations)
|
60
60
|
create_file(model_path, model_contents)
|
@@ -66,4 +66,4 @@ end
|
|
66
66
|
|
67
67
|
def create_migration_file(migration_name, name, columns)
|
68
68
|
# NO MIGRATION NEEDED
|
69
|
-
end
|
69
|
+
end
|
@@ -10,7 +10,8 @@ MONGO
|
|
10
10
|
|
11
11
|
def setup_orm
|
12
12
|
require_dependencies 'bson_ext', :require => 'mongo'
|
13
|
-
require_dependencies 'mongo_mapper'
|
13
|
+
require_dependencies 'mongo_mapper'
|
14
|
+
require_dependencies 'SystemTimer', :require => "system_timer"
|
14
15
|
create_file("config/database.rb", MONGO.gsub(/!NAME!/, @app_name.underscore))
|
15
16
|
empty_directory('app/models')
|
16
17
|
end
|
@@ -28,8 +29,8 @@ MODEL
|
|
28
29
|
# options => { :fields => ["title:string", "body:string"], :app => 'app' }
|
29
30
|
def create_model_file(name, options={})
|
30
31
|
model_path = destination_root(options[:app], 'models', "#{name.to_s.underscore}.rb")
|
31
|
-
field_tuples = options[:fields].
|
32
|
-
column_declarations = field_tuples.
|
32
|
+
field_tuples = options[:fields].map { |value| value.split(":") }
|
33
|
+
column_declarations = field_tuples.map { |field, kind| "key :#{field}, #{kind.camelize}" }.join("\n ")
|
33
34
|
model_contents = MM_MODEL.gsub(/!NAME!/, name.to_s.camelize)
|
34
35
|
model_contents.gsub!(/!FIELDS!/, column_declarations)
|
35
36
|
create_file(model_path, model_contents)
|
@@ -49,9 +49,9 @@ class !NAME! < Mongomatic::Base
|
|
49
49
|
# end
|
50
50
|
|
51
51
|
# def create_indexes
|
52
|
-
# self.
|
53
|
-
# self.
|
54
|
-
# self.
|
52
|
+
# self.mapion.create_index('name', :unique => true)
|
53
|
+
# self.mapion.create_index('email', :unique => true)
|
54
|
+
# self.mapion.create_index('age')
|
55
55
|
# end
|
56
56
|
def validate
|
57
57
|
expectations do
|
@@ -66,10 +66,10 @@ MODEL
|
|
66
66
|
# options => { :fields => ["title:string", "body:string"], :app => 'app' }
|
67
67
|
def create_model_file(name, options={})
|
68
68
|
model_path = destination_root(options[:app], 'models', "#{name.to_s.underscore}.rb")
|
69
|
-
field_tuples = options[:fields].
|
70
|
-
column_declarations = field_tuples.
|
69
|
+
field_tuples = options[:fields].map { |value| value.split(":") }
|
70
|
+
column_declarations = field_tuples.map { |field, kind| "be_present self['#{field}'], '#{field} cannot be blank'" }.join("\n ")
|
71
71
|
# Really ugly oneliner
|
72
|
-
integers = field_tuples.select { |col, type| type =~ /[Ii]nteger/ }.
|
72
|
+
integers = field_tuples.select { |col, type| type =~ /[Ii]nteger/ }.map { |field, kind| "be_a_number self['#{field}'], '#{field} must be a number'" }.join("\n ")
|
73
73
|
model_contents = MONGOMATIC_MODEL.gsub(/!NAME!/, name.to_s.camelize)
|
74
74
|
model_contents.gsub!(/!FIELDS!/, column_declarations)
|
75
75
|
model_contents.gsub!(/!INTEGERS!/, integers)
|
@@ -56,8 +56,8 @@ MODEL
|
|
56
56
|
# options => { :fields => ["title:string", "body:string"], :app => 'app' }
|
57
57
|
def create_model_file(name, options={})
|
58
58
|
model_path = destination_root(options[:app], 'models', "#{name.to_s.underscore}.rb")
|
59
|
-
field_tuples = options[:fields].
|
60
|
-
column_declarations = field_tuples.
|
59
|
+
field_tuples = options[:fields].map { |value| value.split(":") }
|
60
|
+
column_declarations = field_tuples.map { |field, kind| "attribute :#{field}, #{kind.camelize}" }.join("\n ")
|
61
61
|
model_contents = OHM_MODEL.gsub(/!NAME!/, name.to_s.camelize)
|
62
62
|
model_contents.gsub!(/!FIELDS!/, column_declarations)
|
63
63
|
create_file(model_path, model_contents)
|
@@ -1,4 +1,10 @@
|
|
1
1
|
def setup_script
|
2
|
-
|
2
|
+
begin
|
3
|
+
get('https://github.com/padrino/padrino-static/raw/master/js/dojo.js', destination_root("/public/javascripts/dojo.js"))
|
4
|
+
get('https://github.com/padrino/padrino-static/raw/master/ujs/dojo.js', destination_root("/public/javascripts/dojo-ujs.js"))
|
5
|
+
rescue
|
6
|
+
copy_file('templates/static/js/dojo.js', destination_root("/public/javascripts/dojo.js"))
|
7
|
+
copy_file('templates/static/ujs/dojo.js', destination_root("/public/javascripts/dojo-ujs.js"))
|
8
|
+
end
|
3
9
|
create_file(destination_root('/public/javascripts/application.js'), "// Put your application scripts here")
|
4
10
|
end
|
@@ -1,4 +1,10 @@
|
|
1
1
|
def setup_script
|
2
|
-
|
2
|
+
begin
|
3
|
+
get('https://github.com/padrino/padrino-static/raw/master/js/ext.js', destination_root("/public/javascripts/ext.js"))
|
4
|
+
get('https://github.com/padrino/padrino-static/raw/master/ujs/ext.js', destination_root("/public/javascripts/ext-ujs.js"))
|
5
|
+
rescue
|
6
|
+
copy_file('templates/static/js/ext.js', destination_root("/public/javascripts/ext.js"))
|
7
|
+
copy_file('templates/static/ujs/ext.js', destination_root("/public/javascripts/ext-ujs.js"))
|
8
|
+
end
|
3
9
|
create_file(destination_root('/public/javascripts/application.js'), "// Put your application scripts here")
|
4
10
|
end
|
@@ -1,4 +1,10 @@
|
|
1
1
|
def setup_script
|
2
|
-
|
2
|
+
begin
|
3
|
+
get('https://github.com/padrino/padrino-static/raw/master/js/jquery.js', destination_root("/public/javascripts/jquery.js"))
|
4
|
+
get('https://github.com/padrino/padrino-static/raw/master/ujs/jquery.js', destination_root("/public/javascripts/jquery-ujs.js"))
|
5
|
+
rescue
|
6
|
+
copy_file('templates/static/js/jquery.js', destination_root("/public/javascripts/jquery.js"))
|
7
|
+
copy_file('templates/static/ujs/jquery.js', destination_root("/public/javascripts/jquery-ujs.js"))
|
8
|
+
end
|
3
9
|
create_file(destination_root('/public/javascripts/application.js'), "// Put your application scripts here")
|
4
10
|
end
|
@@ -1,4 +1,10 @@
|
|
1
1
|
def setup_script
|
2
|
-
|
2
|
+
begin
|
3
|
+
get('https://github.com/padrino/padrino-static/raw/master/js/mootools.js', destination_root("/public/javascripts/mootools.js"))
|
4
|
+
get('https://github.com/padrino/padrino-static/raw/master/ujs/mootools.js', destination_root("/public/javascripts/mootools-ujs.js"))
|
5
|
+
rescue
|
6
|
+
copy_file('templates/static/js/mootools.js', destination_root("/public/javascripts/mootools.js"))
|
7
|
+
copy_file('templates/static/ujs/mootools.js', destination_root("/public/javascripts/mootools-ujs.js"))
|
8
|
+
end
|
3
9
|
create_file(destination_root('/public/javascripts/application.js'), "// Put your application scripts here")
|
4
10
|
end
|
@@ -1,5 +1,12 @@
|
|
1
1
|
def setup_script
|
2
|
-
|
3
|
-
|
2
|
+
begin
|
3
|
+
get('https://github.com/padrino/padrino-static/raw/master/js/protopak.js', destination_root("/public/javascripts/protopak.js"))
|
4
|
+
get('https://github.com/padrino/padrino-static/raw/master/js/lowpro.js', destination_root("/public/javascripts/lowpro.js"))
|
5
|
+
get('https://github.com/padrino/padrino-static/raw/master/ujs/prototype.js', destination_root("/public/javascripts/prototype-ujs.js"))
|
6
|
+
rescue
|
7
|
+
copy_file('templates/static/js/protopak.js', destination_root("/public/javascripts/protopak.js"))
|
8
|
+
copy_file('templates/static/js/lowpro.js', destination_root("/public/javascripts/lowpro.js"))
|
9
|
+
copy_file('templates/static/ujs/prototype.js', destination_root("/public/javascripts/prototype-ujs.js"))
|
10
|
+
end
|
4
11
|
create_file(destination_root('/public/javascripts/application.js'), "// Put your application scripts here")
|
5
12
|
end
|
@@ -1,4 +1,10 @@
|
|
1
1
|
def setup_script
|
2
|
-
|
2
|
+
begin
|
3
|
+
get('https://github.com/padrino/padrino-static/raw/master/js/right.js', destination_root("/public/javascripts/right.js"))
|
4
|
+
get('https://github.com/padrino/padrino-static/raw/master/ujs/right.js', destination_root("/public/javascripts/right-ujs.js"))
|
5
|
+
rescue
|
6
|
+
copy_file('templates/static/js/right.js', destination_root("/public/javascripts/right.js"))
|
7
|
+
copy_file('templates/static/ujs/right.js', destination_root("/public/javascripts/right-ujs.js"))
|
8
|
+
end
|
3
9
|
create_file(destination_root('/public/javascripts/application.js'), "// Put your application scripts here")
|
4
|
-
end
|
10
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
SASS_INIT = (<<-SASS).gsub(
|
1
|
+
SASS_INIT = (<<-SASS).gsub(/^/, ' ')
|
2
2
|
# Enables support for SASS template reloading in rack applications.
|
3
3
|
# See http://nex-3.com/posts/88-sass-supports-rack for more details.
|
4
4
|
# Store SASS files (by default) within 'app/stylesheets'
|
@@ -9,7 +9,7 @@ app.use Sass::Plugin::Rack
|
|
9
9
|
SASS
|
10
10
|
|
11
11
|
def setup_stylesheet
|
12
|
-
require_dependencies '
|
13
|
-
initializer :sass, SASS_INIT
|
12
|
+
require_dependencies 'sass'
|
13
|
+
initializer :sass, SASS_INIT.chomp
|
14
14
|
empty_directory destination_root('/app/stylesheets')
|
15
15
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
SCSS_INIT = (<<-SCSS).gsub(
|
1
|
+
SCSS_INIT = (<<-SCSS).gsub(/^/, ' ')
|
2
2
|
# Enables support for SCSS template reloading in rack applications.
|
3
3
|
# See http://nex-3.com/posts/88-sass-supports-rack for more details.
|
4
4
|
# Store SCSS files (by default) within 'app/stylesheets'
|
@@ -11,6 +11,6 @@ SCSS
|
|
11
11
|
|
12
12
|
def setup_stylesheet
|
13
13
|
require_dependencies 'haml'
|
14
|
-
initializer :scss, SCSS_INIT
|
14
|
+
initializer :scss, SCSS_INIT.chomp
|
15
15
|
empty_directory destination_root('/app/stylesheets')
|
16
16
|
end
|
@@ -5,7 +5,7 @@ PADRINO_ENV = 'test' unless defined?(PADRINO_ENV)
|
|
5
5
|
require File.expand_path(File.dirname(__FILE__) + "/../../config/boot")
|
6
6
|
|
7
7
|
require 'capybara/cucumber'
|
8
|
-
require '
|
8
|
+
require 'rspec/expectations'
|
9
9
|
|
10
10
|
##
|
11
11
|
# You can handle all padrino applications using instead:
|
@@ -12,9 +12,11 @@ class Riot::Situation
|
|
12
12
|
##
|
13
13
|
# You can handle all padrino applications using instead:
|
14
14
|
# Padrino.application
|
15
|
+
# Or just the Application itself like:
|
16
|
+
# CLASS_NAME.tap { |app| }
|
15
17
|
|
16
18
|
def app
|
17
|
-
|
19
|
+
@app || Padrino.application
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -49,10 +49,10 @@ module Padrino
|
|
49
49
|
execute_runner(:template, options[:template])
|
50
50
|
else # generate project without template
|
51
51
|
directory("project/", destination_root)
|
52
|
-
empty_directory destination_root
|
53
|
-
empty_directory destination_root
|
54
|
-
empty_directory destination_root
|
55
|
-
empty_directory destination_root
|
52
|
+
empty_directory destination_root("public/images")
|
53
|
+
empty_directory destination_root("public/javascripts")
|
54
|
+
empty_directory destination_root("public/stylesheets")
|
55
|
+
empty_directory destination_root("tmp")
|
56
56
|
app_skeleton('app', options[:tiny])
|
57
57
|
store_component_config('.components')
|
58
58
|
template "templates/Gemfile.tt", destination_root("Gemfile")
|
@@ -103,7 +103,6 @@ module Padrino
|
|
103
103
|
end
|
104
104
|
say(text)
|
105
105
|
end
|
106
|
-
|
107
106
|
end # Project
|
108
107
|
end # Generators
|
109
|
-
end # Padrino
|
108
|
+
end # Padrino
|