padrino-gen 0.16.0.pre4 → 0.16.0
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/Rakefile +1 -1
- data/bin/padrino-gen +4 -4
- data/lib/padrino-gen/command.rb +2 -2
- data/lib/padrino-gen/generators/actions.rb +68 -64
- data/lib/padrino-gen/generators/app/app.rb.tt +6 -6
- data/lib/padrino-gen/generators/app.rb +19 -19
- data/lib/padrino-gen/generators/cli.rb +16 -19
- data/lib/padrino-gen/generators/component.rb +18 -19
- data/lib/padrino-gen/generators/components/actions.rb +42 -42
- data/lib/padrino-gen/generators/components/mocks/mocha.rb +7 -7
- data/lib/padrino-gen/generators/components/mocks/rr.rb +7 -7
- data/lib/padrino-gen/generators/components/orms/activerecord.rb +158 -156
- data/lib/padrino-gen/generators/components/orms/couchrest.rb +33 -33
- data/lib/padrino-gen/generators/components/orms/datamapper.rb +108 -103
- data/lib/padrino-gen/generators/components/orms/dynamoid.rb +40 -40
- data/lib/padrino-gen/generators/components/orms/minirecord.rb +114 -114
- data/lib/padrino-gen/generators/components/orms/mongoid.rb +65 -65
- data/lib/padrino-gen/generators/components/orms/mongomapper.rb +20 -20
- data/lib/padrino-gen/generators/components/orms/mongomatic.rb +63 -59
- data/lib/padrino-gen/generators/components/orms/ohm.rb +49 -47
- data/lib/padrino-gen/generators/components/orms/ripple.rb +45 -45
- data/lib/padrino-gen/generators/components/orms/sequel.rb +51 -46
- data/lib/padrino-gen/generators/components/renderers/erb.rb +1 -1
- data/lib/padrino-gen/generators/components/renderers/liquid.rb +1 -1
- data/lib/padrino-gen/generators/components/scripts/dojo.rb +6 -6
- data/lib/padrino-gen/generators/components/scripts/extcore.rb +6 -6
- data/lib/padrino-gen/generators/components/scripts/jquery.rb +6 -6
- data/lib/padrino-gen/generators/components/scripts/mootools.rb +6 -6
- data/lib/padrino-gen/generators/components/scripts/prototype.rb +8 -8
- data/lib/padrino-gen/generators/components/stylesheets/compass.rb +1 -1
- data/lib/padrino-gen/generators/components/stylesheets/less.rb +4 -4
- data/lib/padrino-gen/generators/components/tests/bacon.rb +66 -66
- data/lib/padrino-gen/generators/components/tests/cucumber.rb +61 -61
- data/lib/padrino-gen/generators/components/tests/minitest.rb +70 -70
- data/lib/padrino-gen/generators/components/tests/rspec.rb +74 -74
- data/lib/padrino-gen/generators/components/tests/shoulda.rb +72 -72
- data/lib/padrino-gen/generators/components/tests/testunit.rb +69 -69
- data/lib/padrino-gen/generators/controller.rb +16 -17
- data/lib/padrino-gen/generators/helper.rb +8 -9
- data/lib/padrino-gen/generators/mailer.rb +8 -9
- data/lib/padrino-gen/generators/migration.rb +6 -6
- data/lib/padrino-gen/generators/model.rb +20 -21
- data/lib/padrino-gen/generators/plugin.rb +9 -9
- data/lib/padrino-gen/generators/project/config/apps.rb.tt +4 -4
- data/lib/padrino-gen/generators/project/config/boot.rb +2 -2
- data/lib/padrino-gen/generators/project/config.ru +1 -1
- data/lib/padrino-gen/generators/project.rb +49 -51
- data/lib/padrino-gen/generators/runner.rb +25 -24
- data/lib/padrino-gen/generators/task.rb +7 -8
- data/lib/padrino-gen/generators/templates/Gemfile.tt +5 -5
- data/lib/padrino-gen/generators/templates/controller.rb.tt +3 -3
- data/lib/padrino-gen/generators/templates/mailer.rb.tt +15 -15
- data/lib/padrino-gen/generators/templates/project_bin.tt +1 -1
- data/lib/padrino-gen/generators/templates/task.rb.tt +1 -1
- data/lib/padrino-gen/padrino-tasks/activerecord.rb +152 -160
- data/lib/padrino-gen/padrino-tasks/database.rb +2 -2
- data/lib/padrino-gen/padrino-tasks/datamapper.rb +31 -31
- data/lib/padrino-gen/padrino-tasks/minirecord.rb +3 -3
- data/lib/padrino-gen/padrino-tasks/mongoid.rb +39 -41
- data/lib/padrino-gen/padrino-tasks/mongomapper.rb +18 -14
- data/lib/padrino-gen/padrino-tasks/sequel.rb +28 -28
- data/lib/padrino-gen/padrino-tasks/sql-helpers.rb +45 -45
- data/lib/padrino-gen.rb +4 -4
- data/padrino-gen.gemspec +19 -19
- data/test/fixtures/admin_template.rb +5 -5
- data/test/fixtures/database_template.rb +19 -22
- data/test/fixtures/example_template.rb +8 -8
- data/test/fixtures/git_template.rb +2 -2
- data/test/fixtures/plugin_template.rb +3 -3
- data/test/fixtures/rake_template.rb +5 -5
- data/test/helper.rb +23 -21
- data/test/test_app_generator.rb +13 -13
- data/test/test_cli.rb +4 -5
- data/test/test_component_generator.rb +17 -17
- data/test/test_controller_generator.rb +62 -63
- data/test/test_generator.rb +6 -6
- data/test/test_helper_generator.rb +23 -24
- data/test/test_mailer_generator.rb +7 -7
- data/test/test_migration_generator.rb +31 -31
- data/test/test_model_generator.rb +80 -80
- data/test/test_plugin_generator.rb +35 -36
- data/test/test_project_generator.rb +171 -169
- data/test/test_sql_helpers.rb +49 -50
- data/test/test_task_generator.rb +13 -13
- metadata +10 -10
|
@@ -1,59 +1,61 @@
|
|
|
1
|
-
OHM =
|
|
2
|
-
# Ohm does not have the concept of namespaces.
|
|
3
|
-
# This means that you will not be able to have
|
|
4
|
-
# a distinct test, development, or production database.
|
|
5
|
-
#
|
|
6
|
-
# You can, however, run multiple redis servers on the same host
|
|
7
|
-
# and point to them based on the environment:
|
|
8
|
-
#
|
|
9
|
-
# case Padrino.env
|
|
10
|
-
# when :development then Ohm.connect(:
|
|
11
|
-
# when :production then Ohm.connect(:
|
|
12
|
-
# when :test then Ohm.connect(:
|
|
13
|
-
# end
|
|
1
|
+
OHM = <<~OHM unless defined?(OHM)
|
|
2
|
+
# Ohm does not have the concept of namespaces.
|
|
3
|
+
# This means that you will not be able to have
|
|
4
|
+
# a distinct test, development, or production database.
|
|
5
|
+
#
|
|
6
|
+
# You can, however, run multiple redis servers on the same host
|
|
7
|
+
# and point to them based on the environment:
|
|
8
|
+
#
|
|
9
|
+
# case Padrino.env
|
|
10
|
+
# when :development then Ohm.connect(port: 6379)
|
|
11
|
+
# when :production then Ohm.connect(port: 6380)
|
|
12
|
+
# when :test then Ohm.connect(port: 6381)
|
|
13
|
+
# end
|
|
14
14
|
|
|
15
|
-
# Alternatively, you can try specifying a difference :db
|
|
16
|
-
# which, outside of confirmation, appears to provide distinct
|
|
17
|
-
# namespaces from testing:
|
|
18
|
-
# case Padrino.env
|
|
19
|
-
# when :development then Ohm.connect(:
|
|
20
|
-
# when :production then Ohm.connect(:
|
|
21
|
-
# when :test then Ohm.connect(:
|
|
22
|
-
# end
|
|
15
|
+
# Alternatively, you can try specifying a difference :db
|
|
16
|
+
# which, outside of confirmation, appears to provide distinct
|
|
17
|
+
# namespaces from testing:
|
|
18
|
+
# case Padrino.env
|
|
19
|
+
# when :development then Ohm.connect(db: 0)
|
|
20
|
+
# when :production then Ohm.connect(db: 1)
|
|
21
|
+
# when :test then Ohm.connect(db: 2)
|
|
22
|
+
# end
|
|
23
23
|
OHM
|
|
24
24
|
|
|
25
25
|
def setup_orm
|
|
26
|
-
require_dependencies 'ohm', :
|
|
27
|
-
create_file(
|
|
26
|
+
require_dependencies 'ohm', version: '~> 1.3.0'
|
|
27
|
+
create_file('config/database.rb', OHM)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
OHM_MODEL =
|
|
31
|
-
class !NAME! < Ohm::Model
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
OHM_MODEL = <<~MODEL unless defined?(OHM_MODEL)
|
|
31
|
+
class !NAME! < Ohm::Model
|
|
32
|
+
# Examples:
|
|
33
|
+
# attribute :name
|
|
34
|
+
# attribute :email
|
|
35
|
+
# reference :venue, Venue
|
|
36
|
+
# set :participants, Person
|
|
37
|
+
# counter :votes
|
|
38
|
+
#
|
|
39
|
+
# index :name
|
|
40
|
+
#
|
|
41
|
+
# def validate
|
|
42
|
+
# assert_present :name
|
|
43
|
+
# end
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
end
|
|
45
|
+
!FIELDS!
|
|
46
|
+
end
|
|
47
47
|
MODEL
|
|
48
48
|
|
|
49
|
-
# options => { :
|
|
50
|
-
def create_model_file(name, options={})
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
# options => { fields: ['title:string', 'body:string'], app: 'app' }
|
|
50
|
+
def create_model_file(name, options = {})
|
|
51
|
+
model_path = destination_root(options[:app], 'models', "#{name.to_s.underscore}.rb")
|
|
52
|
+
column_declarations = options[:fields].map do |value|
|
|
53
|
+
"attribute :#{value.split(':').first}"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
model_contents = OHM_MODEL.gsub(/!NAME!/, name.to_s.underscore.camelize)
|
|
57
|
+
model_contents.gsub!(/!FIELDS!/, column_declarations.join("\n "))
|
|
58
|
+
create_file(model_path, model_contents)
|
|
57
59
|
end
|
|
58
60
|
|
|
59
61
|
def create_model_migration(filename, name, fields)
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
RIPPLE_DB =
|
|
2
|
-
development:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
RIPPLE_DB = <<~RIAK unless defined?(RIPPLE_DB)
|
|
2
|
+
development:
|
|
3
|
+
http_port: 8098
|
|
4
|
+
pb_port: 8087
|
|
5
|
+
host: localhost
|
|
6
6
|
|
|
7
|
-
# The test environment has additional keys for configuring the
|
|
8
|
-
# Riak::TestServer for your test/spec suite:
|
|
9
|
-
#
|
|
10
|
-
# * bin_dir specifies the path to the "riak" script that you use to
|
|
11
|
-
# start Riak (just the directory)
|
|
12
|
-
# * js_source_dir specifies where your custom Javascript functions for
|
|
13
|
-
# MapReduce should be loaded from. Usually app/mapreduce.
|
|
14
|
-
test:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
# The test environment has additional keys for configuring the
|
|
8
|
+
# Riak::TestServer for your test/spec suite:
|
|
9
|
+
#
|
|
10
|
+
# * bin_dir specifies the path to the "riak" script that you use to
|
|
11
|
+
# start Riak (just the directory)
|
|
12
|
+
# * js_source_dir specifies where your custom Javascript functions for
|
|
13
|
+
# MapReduce should be loaded from. Usually app/mapreduce.
|
|
14
|
+
test:
|
|
15
|
+
http_port: 9000
|
|
16
|
+
pb_port: 9002
|
|
17
|
+
host: localhost
|
|
18
|
+
bin_dir: /usr/local/bin # Default for Homebrew.
|
|
19
|
+
js_source_dir: <%%= Padrino.root + 'app/mapreduce' %>
|
|
20
20
|
|
|
21
|
-
production:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
production:
|
|
22
|
+
http_port: 8098
|
|
23
|
+
pb_port: 8087
|
|
24
|
+
host: localhost
|
|
25
25
|
RIAK
|
|
26
|
-
RIPPLE_CFG =
|
|
27
|
-
# encoding: utf-8
|
|
26
|
+
RIPPLE_CFG = <<~RIAK unless defined?(RIPPLE_CFG)
|
|
27
|
+
# encoding: utf-8
|
|
28
28
|
|
|
29
|
-
require 'ripple'
|
|
29
|
+
require 'ripple'
|
|
30
30
|
|
|
31
|
-
if File.exist?(Padrino.root +
|
|
32
|
-
|
|
33
|
-
end
|
|
31
|
+
if File.exist?(Padrino.root + 'config/riak.yml')
|
|
32
|
+
Ripple.load_configuration Padrino.root.join('config', 'riak.yml'), [Padrino.env]
|
|
33
|
+
end
|
|
34
34
|
RIAK
|
|
35
35
|
|
|
36
36
|
def setup_orm
|
|
37
37
|
require_dependencies 'ripple'
|
|
38
|
-
create_file(
|
|
39
|
-
create_file(
|
|
38
|
+
create_file('config/riak.yml', RIPPLE_DB.gsub(/!NAME!/, @project_name.underscore))
|
|
39
|
+
create_file('config/database.rb', RIPPLE_CFG)
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
RIPPLE_MODEL =
|
|
43
|
-
# encoding: utf-8
|
|
42
|
+
RIPPLE_MODEL = <<~MODEL unless defined?(RIPPLE_MODEL)
|
|
43
|
+
# encoding: utf-8
|
|
44
44
|
|
|
45
|
-
class !NAME!
|
|
46
|
-
|
|
45
|
+
class !NAME!
|
|
46
|
+
include Ripple::Document
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
# Standart properties
|
|
49
|
+
# property :name, String
|
|
50
|
+
!FIELDS!
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
end
|
|
52
|
+
# Relations
|
|
53
|
+
# many :addresses
|
|
54
|
+
# many :friends, class_name: 'Person'
|
|
55
|
+
# one :account
|
|
56
|
+
end
|
|
57
57
|
|
|
58
58
|
MODEL
|
|
59
|
-
# options => { :
|
|
60
|
-
def create_model_file(name, options={})
|
|
59
|
+
# options => { fields: ['title:string', 'body:string'], app: 'app' }
|
|
60
|
+
def create_model_file(name, options = {})
|
|
61
61
|
model_path = destination_root(options[:app], 'models', "#{name.to_s.underscore}.rb")
|
|
62
|
-
field_tuples = options[:fields].map { |value| value.split(
|
|
62
|
+
field_tuples = options[:fields].map { |value| value.split(':') }
|
|
63
63
|
column_declarations = field_tuples.map { |field, kind| "property :#{field}, #{kind.underscore.camelize}" }.join("\n ")
|
|
64
64
|
model_contents = RIPPLE_MODEL.gsub(/!NAME!/, name.to_s.underscore.camelize)
|
|
65
65
|
model_contents.gsub!(/!FIELDS!/, column_declarations)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
SEQUEL =
|
|
2
|
-
Sequel::Model.raise_on_save_failure = false # Do not throw exceptions on failure
|
|
3
|
-
Sequel::Model.db = case Padrino.env
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
end
|
|
1
|
+
SEQUEL = <<~SEQUEL unless defined?(SEQUEL)
|
|
2
|
+
Sequel::Model.raise_on_save_failure = false # Do not throw exceptions on failure
|
|
3
|
+
Sequel::Model.db = case Padrino.env
|
|
4
|
+
when :development then Sequel.connect(!DB_DEVELOPMENT!, loggers: [logger])
|
|
5
|
+
when :production then Sequel.connect(!DB_PRODUCTION!, loggers: [logger])
|
|
6
|
+
when :test then Sequel.connect(!DB_TEST!, loggers: [logger])
|
|
7
|
+
end
|
|
8
8
|
SEQUEL
|
|
9
9
|
|
|
10
10
|
def setup_orm
|
|
@@ -17,88 +17,93 @@ def setup_orm
|
|
|
17
17
|
when 'mysql-gem'
|
|
18
18
|
sequel.gsub!(/!DB_DEVELOPMENT!/, "\"mysql://localhost/#{db}_development\"")
|
|
19
19
|
sequel.gsub!(/!DB_PRODUCTION!/, "\"mysql://localhost/#{db}_production\"")
|
|
20
|
-
sequel.gsub!(/!DB_TEST!/,"\"mysql://localhost/#{db}_test\"")
|
|
21
|
-
require_dependencies 'mysql', :
|
|
20
|
+
sequel.gsub!(/!DB_TEST!/, "\"mysql://localhost/#{db}_test\"")
|
|
21
|
+
require_dependencies 'mysql', version: '~> 2.8.1'
|
|
22
22
|
when 'mysql', 'mysql2'
|
|
23
23
|
sequel.gsub!(/!DB_DEVELOPMENT!/, "\"mysql2://localhost/#{db}_development\"")
|
|
24
24
|
sequel.gsub!(/!DB_PRODUCTION!/, "\"mysql2://localhost/#{db}_production\"")
|
|
25
|
-
sequel.gsub!(/!DB_TEST!/,"\"mysql2://localhost/#{db}_test\"")
|
|
25
|
+
sequel.gsub!(/!DB_TEST!/, "\"mysql2://localhost/#{db}_test\"")
|
|
26
26
|
require_dependencies 'mysql2'
|
|
27
27
|
when 'postgres'
|
|
28
28
|
sequel.gsub!(/!DB_DEVELOPMENT!/, "\"postgres://localhost/#{db}_development\"")
|
|
29
29
|
sequel.gsub!(/!DB_PRODUCTION!/, "\"postgres://localhost/#{db}_production\"")
|
|
30
|
-
sequel.gsub!(/!DB_TEST!/,"\"postgres://localhost/#{db}_test\"")
|
|
30
|
+
sequel.gsub!(/!DB_TEST!/, "\"postgres://localhost/#{db}_test\"")
|
|
31
31
|
require_dependencies 'pg'
|
|
32
32
|
when 'sqlite'
|
|
33
|
-
sequel.gsub!(/!DB_DEVELOPMENT!/,"\"sqlite://db/#{db}_development.db\"")
|
|
33
|
+
sequel.gsub!(/!DB_DEVELOPMENT!/, "\"sqlite://db/#{db}_development.db\"")
|
|
34
34
|
sequel.gsub!(/!DB_PRODUCTION!/, "\"sqlite://db/#{db}_production.db\"")
|
|
35
35
|
sequel.gsub!(/!DB_TEST!/, "\"sqlite://db/#{db}_test.db\"")
|
|
36
36
|
require_dependencies 'sqlite3'
|
|
37
37
|
else
|
|
38
38
|
say "Failed to generate `config/database.rb` for ORM adapter `#{options[:adapter]}`", :red
|
|
39
|
-
|
|
39
|
+
raise ArgumentError
|
|
40
40
|
end
|
|
41
41
|
rescue ArgumentError
|
|
42
|
-
adapter = ask(
|
|
42
|
+
adapter = ask('Please, choose a proper adapter:', limited_to: %w[mysql mysql2 mysql-gem postgres sqlite])
|
|
43
43
|
retry
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
create_file(
|
|
46
|
+
create_file('config/database.rb', sequel)
|
|
47
47
|
empty_directory('db/migrate')
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
SQ_MODEL =
|
|
51
|
-
class !NAME! < Sequel::Model
|
|
50
|
+
SQ_MODEL = <<~MODEL unless defined?(SQ_MODEL)
|
|
51
|
+
class !NAME! < Sequel::Model
|
|
52
52
|
|
|
53
|
-
end
|
|
53
|
+
end
|
|
54
54
|
MODEL
|
|
55
55
|
|
|
56
|
-
# options => { :
|
|
57
|
-
def create_model_file(name, options={})
|
|
56
|
+
# options => { fields: ['title:string', 'body:string'], app: 'app' }
|
|
57
|
+
def create_model_file(name, options = {})
|
|
58
58
|
model_path = destination_root(options[:app], 'models', "#{name.to_s.underscore}.rb")
|
|
59
59
|
model_contents = SQ_MODEL.gsub(/!NAME!/, name.to_s.underscore.camelize)
|
|
60
60
|
create_file(model_path, model_contents)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
SQ_MIGRATION =
|
|
64
|
-
Sequel.migration do
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
SQ_MIGRATION = <<~MIGRATION unless defined?(SQ_MIGRATION)
|
|
64
|
+
Sequel.migration do
|
|
65
|
+
up do
|
|
66
|
+
!UP!
|
|
67
|
+
end
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
down do
|
|
70
|
+
!DOWN!
|
|
71
|
+
end
|
|
71
72
|
end
|
|
72
|
-
end
|
|
73
73
|
MIGRATION
|
|
74
74
|
|
|
75
|
-
SQ_MODEL_UP_MG =
|
|
76
|
-
create_table :!TABLE! do
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
end
|
|
75
|
+
SQ_MODEL_UP_MG = <<~MIGRATION.gsub(/^/, ' ') unless defined?(SQ_MODEL_UP_MG)
|
|
76
|
+
create_table :!TABLE! do
|
|
77
|
+
primary_key :id
|
|
78
|
+
!FIELDS!
|
|
79
|
+
end
|
|
80
80
|
MIGRATION
|
|
81
81
|
|
|
82
|
-
SQ_MODEL_DOWN_MG =
|
|
83
|
-
drop_table :!TABLE!
|
|
82
|
+
SQ_MODEL_DOWN_MG = <<~MIGRATION unless defined?(SQ_MODEL_DOWN_MG)
|
|
83
|
+
drop_table :!TABLE!
|
|
84
84
|
MIGRATION
|
|
85
85
|
|
|
86
86
|
def create_model_migration(migration_name, name, columns)
|
|
87
|
-
output_model_migration(
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
output_model_migration(
|
|
88
|
+
migration_name, name, columns,
|
|
89
|
+
column_format: proc { |field, kind| "#{kind.underscore.camelize} :#{field}" },
|
|
90
|
+
base: SQ_MIGRATION,
|
|
91
|
+
up: SQ_MODEL_UP_MG,
|
|
92
|
+
down: SQ_MODEL_DOWN_MG
|
|
93
|
+
)
|
|
90
94
|
end
|
|
91
95
|
|
|
92
|
-
SQ_CHANGE_MG =
|
|
93
|
-
alter_table :!TABLE! do
|
|
94
|
-
|
|
95
|
-
end
|
|
96
|
+
SQ_CHANGE_MG = <<~MIGRATION.gsub(/^/, ' ') unless defined?(SQ_CHANGE_MG)
|
|
97
|
+
alter_table :!TABLE! do
|
|
98
|
+
!COLUMNS!
|
|
99
|
+
end
|
|
96
100
|
MIGRATION
|
|
97
101
|
|
|
98
102
|
def create_migration_file(migration_name, name, columns)
|
|
99
|
-
output_migration_file(
|
|
100
|
-
|
|
101
|
-
:
|
|
102
|
-
:
|
|
103
|
+
output_migration_file(
|
|
104
|
+
migration_name, name, columns,
|
|
105
|
+
base: SQ_MIGRATION, change_format: SQ_CHANGE_MG,
|
|
106
|
+
add: proc { |field, kind| "add_column :#{field}, #{kind.underscore.camelize}" },
|
|
107
|
+
remove: proc { |field, _kind| "drop_column :#{field}" }
|
|
103
108
|
)
|
|
104
109
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
def setup_script
|
|
2
2
|
begin
|
|
3
|
-
get('https://raw.github.com/padrino/padrino-static/master/js/dojo.js', destination_root(
|
|
4
|
-
get('https://raw.github.com/padrino/padrino-static/master/ujs/dojo.js', destination_root(
|
|
5
|
-
rescue
|
|
6
|
-
copy_file('templates/static/js/dojo.js', destination_root(
|
|
7
|
-
copy_file('templates/static/ujs/dojo.js', destination_root(
|
|
3
|
+
get('https://raw.github.com/padrino/padrino-static/master/js/dojo.js', destination_root('/public/javascripts/dojo.js'))
|
|
4
|
+
get('https://raw.github.com/padrino/padrino-static/master/ujs/dojo.js', destination_root('/public/javascripts/dojo-ujs.js'))
|
|
5
|
+
rescue StandardError
|
|
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
8
|
end
|
|
9
|
-
create_file(destination_root('/public/javascripts/application.js'),
|
|
9
|
+
create_file(destination_root('/public/javascripts/application.js'), '// Put your application scripts here')
|
|
10
10
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
def setup_script
|
|
2
2
|
begin
|
|
3
|
-
get('https://raw.github.com/padrino/padrino-static/master/js/ext.js', destination_root(
|
|
4
|
-
get('https://raw.github.com/padrino/padrino-static/master/ujs/ext.js', destination_root(
|
|
5
|
-
rescue
|
|
6
|
-
copy_file('templates/static/js/ext.js', destination_root(
|
|
7
|
-
copy_file('templates/static/ujs/ext.js', destination_root(
|
|
3
|
+
get('https://raw.github.com/padrino/padrino-static/master/js/ext.js', destination_root('/public/javascripts/ext.js'))
|
|
4
|
+
get('https://raw.github.com/padrino/padrino-static/master/ujs/ext.js', destination_root('/public/javascripts/ext-ujs.js'))
|
|
5
|
+
rescue StandardError
|
|
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
8
|
end
|
|
9
|
-
create_file(destination_root('/public/javascripts/application.js'),
|
|
9
|
+
create_file(destination_root('/public/javascripts/application.js'), '// Put your application scripts here')
|
|
10
10
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
def setup_script
|
|
2
2
|
begin
|
|
3
|
-
get('https://raw.github.com/padrino/padrino-static/master/js/jquery.js', destination_root(
|
|
4
|
-
get('https://raw.github.com/padrino/padrino-static/master/ujs/jquery.js', destination_root(
|
|
5
|
-
rescue
|
|
6
|
-
copy_file('templates/static/js/jquery.js', destination_root(
|
|
7
|
-
copy_file('templates/static/ujs/jquery.js', destination_root(
|
|
3
|
+
get('https://raw.github.com/padrino/padrino-static/master/js/jquery.js', destination_root('/public/javascripts/jquery.js'))
|
|
4
|
+
get('https://raw.github.com/padrino/padrino-static/master/ujs/jquery.js', destination_root('/public/javascripts/jquery-ujs.js'))
|
|
5
|
+
rescue StandardError
|
|
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
8
|
end
|
|
9
|
-
create_file(destination_root('/public/javascripts/application.js'),
|
|
9
|
+
create_file(destination_root('/public/javascripts/application.js'), '// Put your application scripts here')
|
|
10
10
|
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
def setup_script
|
|
2
2
|
begin
|
|
3
|
-
get('https://raw.github.com/padrino/padrino-static/master/js/mootools.js', destination_root(
|
|
4
|
-
get('https://raw.github.com/padrino/padrino-static/master/ujs/mootools.js', destination_root(
|
|
5
|
-
rescue
|
|
6
|
-
copy_file('templates/static/js/mootools.js', destination_root(
|
|
7
|
-
copy_file('templates/static/ujs/mootools.js', destination_root(
|
|
3
|
+
get('https://raw.github.com/padrino/padrino-static/master/js/mootools.js', destination_root('/public/javascripts/mootools.js'))
|
|
4
|
+
get('https://raw.github.com/padrino/padrino-static/master/ujs/mootools.js', destination_root('/public/javascripts/mootools-ujs.js'))
|
|
5
|
+
rescue StandardError
|
|
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
8
|
end
|
|
9
|
-
create_file(destination_root('/public/javascripts/application.js'),
|
|
9
|
+
create_file(destination_root('/public/javascripts/application.js'), '// Put your application scripts here')
|
|
10
10
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
def setup_script
|
|
2
2
|
begin
|
|
3
|
-
get('https://raw.github.com/padrino/padrino-static/master/js/protopak.js', destination_root(
|
|
4
|
-
get('https://raw.github.com/padrino/padrino-static/master/js/lowpro.js', destination_root(
|
|
5
|
-
get('https://raw.github.com/padrino/padrino-static/master/ujs/prototype.js', destination_root(
|
|
6
|
-
rescue
|
|
7
|
-
copy_file('templates/static/js/protopak.js', destination_root(
|
|
8
|
-
copy_file('templates/static/js/lowpro.js', destination_root(
|
|
9
|
-
copy_file('templates/static/ujs/prototype.js', destination_root(
|
|
3
|
+
get('https://raw.github.com/padrino/padrino-static/master/js/protopak.js', destination_root('/public/javascripts/protopak.js'))
|
|
4
|
+
get('https://raw.github.com/padrino/padrino-static/master/js/lowpro.js', destination_root('/public/javascripts/lowpro.js'))
|
|
5
|
+
get('https://raw.github.com/padrino/padrino-static/master/ujs/prototype.js', destination_root('/public/javascripts/prototype-ujs.js'))
|
|
6
|
+
rescue StandardError
|
|
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
10
|
end
|
|
11
|
-
create_file(destination_root('/public/javascripts/application.js'),
|
|
11
|
+
create_file(destination_root('/public/javascripts/application.js'), '// Put your application scripts here')
|
|
12
12
|
end
|
|
@@ -24,5 +24,5 @@ COMPASS
|
|
|
24
24
|
def setup_stylesheet
|
|
25
25
|
require_dependencies 'compass-blueprint'
|
|
26
26
|
initializer :compass, COMPASS_INIT.chomp
|
|
27
|
-
directory
|
|
27
|
+
directory 'components/stylesheets/compass/', destination_root('/app/stylesheets')
|
|
28
28
|
end
|
|
@@ -10,10 +10,10 @@ LESS_INIT = <<-LESS unless defined?(LESS_INIT)
|
|
|
10
10
|
# other configs ...
|
|
11
11
|
end
|
|
12
12
|
app.use Rack::Less,
|
|
13
|
-
:
|
|
14
|
-
:
|
|
15
|
-
:
|
|
16
|
-
:
|
|
13
|
+
root: Padrino.root,
|
|
14
|
+
source: 'app/stylesheets',
|
|
15
|
+
public: 'public',
|
|
16
|
+
hosted_at: 'stylesheets'
|
|
17
17
|
LESS
|
|
18
18
|
|
|
19
19
|
def setup_stylesheet
|