padrino-gen 0.9.28 → 0.9.29

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,26 @@
1
1
  COUCHREST = (<<-COUCHREST) unless defined?(COUCHREST)
2
2
  case Padrino.env
3
- when :development then COUCHDB_NAME = '!NAME!_development'
4
- when :production then COUCHDB_NAME = '!NAME!_production'
5
- when :test then COUCHDB_NAME = '!NAME!_test'
3
+ when :development then db_name = '!NAME!_development'
4
+ when :production then db_name = '!NAME!_production'
5
+ when :test then db_name = '!NAME!_test'
6
+ end
7
+
8
+ CouchRest::Model::Base.configure do |conf|
9
+ conf.model_type_key = 'type' # compatibility with CouchModel 1.1
10
+ conf.database = CouchRest.database!(db_name)
11
+ # Only with CouchModel 1.1
12
+ # conf.environment = Padrino.env
13
+ # conf.connection = {
14
+ # :protocol => 'http',
15
+ # :host => 'localhost',
16
+ # :port => '5984',
17
+ # :prefix => 'padrino',
18
+ # :suffix => nil,
19
+ # :join => '_',
20
+ # :username => nil,
21
+ # :password => nil
22
+ # }
6
23
  end
7
- COUCHDB = CouchRest.database!(COUCHDB_NAME)
8
24
  COUCHREST
9
25
 
10
26
  def setup_orm
@@ -16,8 +32,6 @@ end
16
32
 
17
33
  CR_MODEL = (<<-MODEL) unless defined?(CR_MODEL)
18
34
  class !NAME! < CouchRest::Model::Base
19
- use_database COUCHDB
20
-
21
35
  unique_id :id
22
36
  # property <name>
23
37
  !FIELDS!
@@ -1,7 +1,7 @@
1
1
  SEQUEL = (<<-SEQUEL) unless defined?(SEQUEL)
2
2
  Sequel::Model.plugin(:schema)
3
3
  Sequel::Model.raise_on_save_failure = false # Do not throw exceptions on failure
4
- DB = case Padrino.env
4
+ Sequel::Model.db = case Padrino.env
5
5
  when :development then Sequel.connect(!DB_DEVELOPMENT!, :loggers => [logger])
6
6
  when :production then Sequel.connect(!DB_PRODUCTION!, :loggers => [logger])
7
7
  when :test then Sequel.connect(!DB_TEST!, :loggers => [logger])
@@ -1,14 +1,18 @@
1
1
  # Defines our constants
2
2
  PADRINO_ENV = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||= "development" unless defined?(PADRINO_ENV)
3
- PADRINO_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) unless defined?(PADRINO_ROOT)
4
- # Load Bundler
5
- require 'rubygems'
6
- require 'bundler'
7
- # Only have default and environment gems
8
- Bundler.setup(:default, PADRINO_ENV.to_sym)
9
- # Only require default and environment gems
10
- Bundler.require(:default, PADRINO_ENV.to_sym)
11
- puts "=> Located #{Padrino.bundle} Gemfile for #{Padrino.env}"
3
+ PADRINO_ROOT = File.expand_path('../..', __FILE__) unless defined?(PADRINO_ROOT)
4
+
5
+ # Load our dependencies
6
+ require 'rubygems' unless defined?(Gem)
7
+ require 'bundler/setup'
8
+ Bundler.require(:default, PADRINO_ENV)
9
+
10
+ ##
11
+ # Enable devel logging
12
+ #
13
+ # Padrino::Logger::Config[:development] = { :log_level => :devel, :stream => :stdout }
14
+ # Padrino::Logger.log_static = true
15
+ #
12
16
 
13
17
  ##
14
18
  # Add your before load hooks here
@@ -22,4 +26,4 @@ end
22
26
  Padrino.after_load do
23
27
  end
24
28
 
25
- Padrino.load!
29
+ Padrino.load!
@@ -1,9 +1,11 @@
1
1
  source :rubygems
2
2
 
3
+ # Server requirements
4
+ # gem 'thin' or mongrel
5
+
3
6
  # Project requirements
4
7
  gem 'rake'
5
8
  gem 'rack-flash'
6
- gem 'thin' # or mongrel
7
9
 
8
10
  # Component requirements
9
11
 
@@ -18,4 +20,6 @@ end
18
20
  <%- else -%>
19
21
  # Padrino
20
22
  gem 'padrino', "<%= Padrino.version %>"
21
- <%- end -%>
23
+ <%- end -%>
24
+ # Padrino EDGE
25
+ # gem 'padrino', :git => "git://github.com/padrino/padrino-framework.git"
@@ -9,7 +9,7 @@
9
9
 
10
10
  $("form[data-remote=true]").live('submit', function(e) {
11
11
  e.preventDefault(); e.stopped = true;
12
- var element = $(e.target);
12
+ var element = $(this);
13
13
  var message = element.data('confirm');
14
14
  if (message && !confirm(message)) { return false; }
15
15
  JSAdapter.sendRequest(element, {
@@ -342,7 +342,7 @@ if defined?(ActiveRecord)
342
342
  locale = "#{lang}:" + "\n" +
343
343
  " models:" + "\n" +
344
344
  " #{m}:" + "\n" +
345
- " name: #{klass.human_name}" + "\n" +
345
+ " name: #{klass.model_name.human}" + "\n" +
346
346
  " attributes:" + "\n" +
347
347
  columns.map { |c| " #{c}: #{klass.human_attribute_name(c)}" }.join("\n")
348
348
  print "created a new for #{lang.to_s.upcase} Lang ... "; $stdout.flush
@@ -23,14 +23,14 @@ if defined?(DataMapper)
23
23
  end
24
24
 
25
25
  desc "Migrate up using migrations"
26
- task :up, :version, :needs => :load do |t, args|
26
+ task :up, [:version] => :load do |t, args|
27
27
  version = args[:version] || ENV['VERSION']
28
28
  migrate_up!(version)
29
29
  puts "<= dm:migrate:up #{version} executed"
30
30
  end
31
31
 
32
32
  desc "Migrate down using migrations"
33
- task :down, :version, :needs => :load do |t, args|
33
+ task :down, [:version] => :load do |t, args|
34
34
  version = args[:version] || ENV['VERSION']
35
35
  migrate_down!(version)
36
36
  puts "<= dm:migrate:down #{version} executed"
@@ -5,31 +5,31 @@ if defined?(Sequel)
5
5
  desc "Perform automigration (reset your db data)"
6
6
  task :auto => :environment do
7
7
  ::Sequel.extension :migration
8
- ::Sequel::Migrator.run DB, "db/migrate", :target => 0
9
- ::Sequel::Migrator.run DB, "db/migrate"
8
+ ::Sequel::Migrator.run Sequel::Model.db, "db/migrate", :target => 0
9
+ ::Sequel::Migrator.run Sequel::Model.db, "db/migrate"
10
10
  puts "<= sq:migrate:auto executed"
11
11
  end
12
12
 
13
13
  desc "Perform migration up/down to VERSION"
14
- task :to, :version, :needs => :environment do |t, args|
14
+ task :to, [:version] => :environment do |t, args|
15
15
  version = (args[:version] || ENV['VERSION']).to_s.strip
16
16
  ::Sequel.extension :migration
17
17
  raise "No VERSION was provided" if version.empty?
18
- ::Sequel::Migrator.apply(DB, "db/migrate", version.to_i)
18
+ ::Sequel::Migrator.apply(Sequel::Model.db, "db/migrate", version.to_i)
19
19
  puts "<= sq:migrate:to[#{version}] executed"
20
20
  end
21
21
 
22
22
  desc "Perform migration up to latest migration available"
23
23
  task :up => :environment do
24
24
  ::Sequel.extension :migration
25
- ::Sequel::Migrator.run DB, "db/migrate"
25
+ ::Sequel::Migrator.run Sequel::Model.db, "db/migrate"
26
26
  puts "<= sq:migrate:up executed"
27
27
  end
28
28
 
29
29
  desc "Perform migration down (erase all data)"
30
30
  task :down => :environment do
31
31
  ::Sequel.extension :migration
32
- ::Sequel::Migrator.run DB, "db/migrate", :target => 0
32
+ ::Sequel::Migrator.run Sequel::Model.db, "db/migrate", :target => 0
33
33
  puts "<= sq:migrate:down executed"
34
34
  end
35
35
  end
@@ -123,7 +123,6 @@ class TestModelGenerator < Test::Unit::TestCase
123
123
  silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=couchrest') }
124
124
  silence_logger { generate(:model, 'user', "-r=#{@apptmp}/sample_project") }
125
125
  assert_match_in_file(/class User < CouchRest::Model::Base/m, "#{@apptmp}/sample_project/app/models/user.rb")
126
- assert_match_in_file(/use_database COUCHDB/m, "#{@apptmp}/sample_project/app/models/user.rb")
127
126
  assert_match_in_file(/# property <name>[\s\n]+?end/m, "#{@apptmp}/sample_project/app/models/user.rb")
128
127
  end
129
128
 
@@ -131,7 +130,6 @@ class TestModelGenerator < Test::Unit::TestCase
131
130
  silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=couchrest') }
132
131
  silence_logger { generate(:model, 'person', "name:string", "age", "email:string", "-r=#{@apptmp}/sample_project") }
133
132
  assert_match_in_file(/class Person < CouchRest::Model::Base/m, "#{@apptmp}/sample_project/app/models/person.rb")
134
- assert_match_in_file(/use_database COUCHDB/m, "#{@apptmp}/sample_project/app/models/person.rb")
135
133
  assert_match_in_file(/property :name/m, "#{@apptmp}/sample_project/app/models/person.rb")
136
134
  assert_match_in_file(/property :age/m, "#{@apptmp}/sample_project/app/models/person.rb")
137
135
  assert_match_in_file(/property :email/m, "#{@apptmp}/sample_project/app/models/person.rb")
@@ -132,7 +132,6 @@ class TestProjectGenerator < Test::Unit::TestCase
132
132
  silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none') }
133
133
  assert_match_in_file(/gem 'padrino'/, "#{@apptmp}/sample_project/Gemfile")
134
134
  assert_match_in_file(/gem 'rack-flash'/, "#{@apptmp}/sample_project/Gemfile")
135
- assert_match_in_file(/gem 'thin'/, "#{@apptmp}/sample_project/Gemfile")
136
135
  end
137
136
  end
138
137
 
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-gen
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 9
9
- - 28
10
- version: 0.9.28
5
+ version: 0.9.29
11
6
  platform: ruby
12
7
  authors:
13
8
  - Padrino Team
@@ -18,7 +13,7 @@ autorequire:
18
13
  bindir: bin
19
14
  cert_chain: []
20
15
 
21
- date: 2011-05-11 00:00:00 Z
16
+ date: 2011-05-23 00:00:00 Z
22
17
  dependencies:
23
18
  - !ruby/object:Gem::Dependency
24
19
  name: padrino-core
@@ -28,12 +23,7 @@ dependencies:
28
23
  requirements:
29
24
  - - "="
30
25
  - !ruby/object:Gem::Version
31
- hash: 3
32
- segments:
33
- - 0
34
- - 9
35
- - 28
36
- version: 0.9.28
26
+ version: 0.9.29
37
27
  type: :runtime
38
28
  version_requirements: *id001
39
29
  - !ruby/object:Gem::Dependency
@@ -44,11 +34,6 @@ dependencies:
44
34
  requirements:
45
35
  - - ">="
46
36
  - !ruby/object:Gem::Version
47
- hash: 19
48
- segments:
49
- - 1
50
- - 0
51
- - 2
52
37
  version: 1.0.2
53
38
  type: :runtime
54
39
  version_requirements: *id002
@@ -60,9 +45,6 @@ dependencies:
60
45
  requirements:
61
46
  - - ">="
62
47
  - !ruby/object:Gem::Version
63
- hash: 3
64
- segments:
65
- - 0
66
48
  version: "0"
67
49
  type: :runtime
68
50
  version_requirements: *id003
@@ -186,20 +168,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
168
  requirements:
187
169
  - - ">="
188
170
  - !ruby/object:Gem::Version
189
- hash: 3
190
- segments:
191
- - 0
192
171
  version: "0"
193
172
  required_rubygems_version: !ruby/object:Gem::Requirement
194
173
  none: false
195
174
  requirements:
196
175
  - - ">="
197
176
  - !ruby/object:Gem::Version
198
- hash: 23
199
- segments:
200
- - 1
201
- - 3
202
- - 6
203
177
  version: 1.3.6
204
178
  requirements: []
205
179