gaku_core 0.2.4 → 0.3.0.pre.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +17 -0
  3. data/app/assets/images/elements/toolbar1.png +0 -0
  4. data/app/assets/images/icon-chair.png +0 -0
  5. data/app/models/application_record.rb +3 -0
  6. data/app/models/concerns/{enrollmentable.rb → enrollable.rb} +2 -2
  7. data/app/models/concerns/gradable.rb +2 -0
  8. data/app/models/gaku/address.rb +3 -3
  9. data/app/models/gaku/attachment.rb +4 -2
  10. data/app/models/gaku/attendance.rb +3 -3
  11. data/app/models/gaku/class_group.rb +1 -1
  12. data/app/models/gaku/contact.rb +2 -2
  13. data/app/models/gaku/course.rb +3 -3
  14. data/app/models/gaku/enrollment.rb +23 -19
  15. data/app/models/gaku/exam.rb +2 -2
  16. data/app/models/gaku/exam_portion.rb +1 -1
  17. data/app/models/gaku/exam_portion_score.rb +6 -2
  18. data/app/models/gaku/exam_session.rb +3 -3
  19. data/app/models/gaku/extracurricular_activity.rb +1 -1
  20. data/app/models/gaku/grading_method_connector.rb +3 -3
  21. data/app/models/gaku/guardian.rb +1 -1
  22. data/app/models/gaku/lesson_plan.rb +1 -1
  23. data/app/models/gaku/note.rb +1 -1
  24. data/app/models/gaku/program_specialty.rb +2 -2
  25. data/app/models/gaku/school_role.rb +1 -1
  26. data/app/models/gaku/semester.rb +1 -1
  27. data/app/models/gaku/semester_connector.rb +2 -2
  28. data/app/models/gaku/specialty.rb +1 -1
  29. data/app/models/gaku/student.rb +10 -12
  30. data/app/models/gaku/student_review.rb +3 -3
  31. data/app/models/gaku/student_specialty.rb +2 -2
  32. data/app/models/gaku/syllabus.rb +1 -1
  33. data/app/models/gaku/teacher.rb +1 -1
  34. data/config/initializers/redis.rb +6 -2
  35. data/db/default/gaku/attendance_types.rb +1 -1
  36. data/db/migrate/20120202111850_presets.rb +3 -4
  37. data/db/migrate/20131014065028_translations.rb +1 -1
  38. data/db/migrate/20131025073352_gaku_core.rb +1 -1
  39. data/db/migrate/20140128141752_change_grading_methods_arguments_field.rb +1 -1
  40. data/db/migrate/20140130182100_change_fields_external_school_record.rb +1 -1
  41. data/db/migrate/20140131113337_create_student_configs.rb +1 -1
  42. data/db/migrate/20140207093618_drop_student_configs.rb +1 -1
  43. data/db/migrate/20140213113405_create_grading_method_connectors_table.rb +1 -1
  44. data/db/migrate/20140304094422_create_gaku_exam_sessions_table.rb +1 -1
  45. data/db/migrate/20140325073941_add_time_format_24_to_presets_table.rb +1 -1
  46. data/db/migrate/20140408111314_remove_semester_join_tables.rb +1 -1
  47. data/db/migrate/20140408111358_create_semester_connectors_table.rb +1 -1
  48. data/db/migrate/20140423093155_create_enrollments_table.rb +1 -1
  49. data/db/migrate/20140423100114_clean_enrollments_join_models.rb +1 -1
  50. data/db/migrate/20140429112725_add_counters_to_enrollmentable.rb +3 -1
  51. data/db/migrate/20140604104210_rename_method_to_grading_method.rb +1 -1
  52. data/db/migrate/20140604113045_add_default_value_to_curved.rb +1 -1
  53. data/db/migrate/20140610091053_add_seat_number_to_enrollments.rb +1 -1
  54. data/db/migrate/20140701104700_change_hstore_to_string_criteria.rb +1 -1
  55. data/db/migrate/20140715135152_create_semester_attendance_table.rb +1 -1
  56. data/db/migrate/20140718105226_create_student_review_categories_table.rb +1 -1
  57. data/db/migrate/20140728121353_create_student_review_table.rb +1 -1
  58. data/db/migrate/20150213095508_improve_countries_and_states.rb +1 -1
  59. data/db/migrate/20160125194100_add_gradable_to_exam_portion_score.rb +5 -0
  60. data/db/migrate/20170509132020_change_enrollmentable_to_enrollable.rb +6 -0
  61. data/gaku_core.gemspec +37 -0
  62. data/lib/gaku/core.rb +1 -1
  63. data/lib/gaku/core/engine.rb +1 -1
  64. data/lib/gaku/grading/collection/base_method.rb +3 -2
  65. data/lib/gaku/grading/collection/calculations.rb +5 -3
  66. data/lib/gaku/grading/collection/interval.rb +2 -2
  67. data/lib/gaku/grading/collection/ordinal.rb +1 -1
  68. data/lib/gaku/grading/collection/percentage.rb +1 -1
  69. data/lib/gaku/grading/collection/score.rb +1 -1
  70. data/lib/gaku/grading/single/base_method.rb +3 -2
  71. data/lib/gaku/grading/single/calculations.rb +5 -4
  72. data/lib/gaku/grading/single/ordinal.rb +2 -3
  73. data/lib/gaku/grading/single/percentage.rb +2 -3
  74. data/lib/gaku/grading/single/score.rb +2 -3
  75. data/lib/gaku/testing/common_rake.rb +47 -6
  76. data/lib/gaku/testing/controller_helpers.rb +6 -4
  77. data/lib/gaku/testing/factories/address_factory.rb +3 -3
  78. data/lib/gaku/testing/factories/campus_factory.rb +1 -1
  79. data/lib/gaku/testing/factories/enrollment_factory.rb +1 -1
  80. data/lib/gaku/testing/factories/guardian_factory.rb +2 -2
  81. data/lib/gaku/testing/factories/program_factory.rb +1 -1
  82. data/lib/gaku/testing/factories/school_factory.rb +1 -1
  83. data/lib/gaku/testing/factories/student_factory.rb +7 -5
  84. data/lib/gaku/testing/factories/syllabus_factory.rb +1 -1
  85. data/lib/gaku/testing/factories/teacher_factory.rb +4 -4
  86. data/lib/gaku/testing/factories/user_factory.rb +2 -2
  87. data/lib/generators/gaku/docker/docker_generator.rb +58 -0
  88. data/lib/generators/gaku/docker/templates/app/assets/javascripts/gaku/admin/all.js +10 -0
  89. data/lib/generators/gaku/docker/templates/app/assets/javascripts/gaku/archive/all.js +10 -0
  90. data/lib/generators/gaku/docker/templates/app/assets/javascripts/gaku/frontend/all.js +10 -0
  91. data/lib/generators/gaku/docker/templates/app/assets/stylesheets/gaku/admin/all.css +9 -0
  92. data/lib/generators/gaku/docker/templates/app/assets/stylesheets/gaku/archive/all.css +9 -0
  93. data/lib/generators/gaku/docker/templates/app/assets/stylesheets/gaku/frontend/all.css +9 -0
  94. data/lib/generators/gaku/docker/templates/bin/check_postgres.sh +16 -0
  95. data/lib/generators/gaku/docker/templates/config/database.yml +2 -0
  96. data/lib/generators/gaku/dummy/dummy_generator.rb +0 -1
  97. data/lib/generators/gaku/dummy/templates/rails/application.rb +0 -1
  98. data/lib/generators/gaku/dummy/templates/rails/database.yml +11 -10
  99. data/lib/generators/gaku/install/install_generator.rb +17 -0
  100. data/lib/generators/gaku/install/templates/Procfile +3 -0
  101. data/lib/generators/gaku/install/templates/lib/grading/README.md +2 -0
  102. data/lib/generators/gaku/install/templates/lib/grading/bin/gaku_grading.coffee +13 -0
  103. data/lib/generators/gaku/install/templates/lib/grading/package.json +19 -0
  104. data/lib/tasks/core.rake +1 -1
  105. data/lib/tasks/grading.rake +10 -0
  106. metadata +69 -53
  107. data/db/migrate/20140304101025_create_gaku_student_exam_session_table.rb +0 -8
  108. data/lib/gaku/testing/factories/student_exam_session_factory.rb +0 -8
@@ -1,11 +1,10 @@
1
1
  class Gaku::Grading::Single::Ordinal < Gaku::Grading::Single::BaseMethod
2
2
 
3
- attr_accessor :criteria
3
+ # attr_accessor :criteria
4
4
 
5
5
  def grade_exam
6
6
  exam = @gradable
7
-
8
- percentage = Gaku::Grading::Single::Percentage.new(exam, @student).grade
7
+ percentage = Gaku::Grading::Single::Percentage.new(exam, @student, gradable_scope).grade
9
8
  @result = { id: @student.id, score: ordinal(percentage['score']) }
10
9
  end
11
10
 
@@ -7,10 +7,9 @@ class Gaku::Grading::Single::Percentage < Gaku::Grading::Single::BaseMethod
7
7
 
8
8
  @scores = []
9
9
  @max_score = exam.max_score
10
-
11
10
  exam.exam_portions.each_with_index do |exam_portion, index|
12
- ep_score = @student.exam_portion_scores.where(exam_portion_id: exam_portion.id).first_or_create!
13
- @scores << ep_score.score if ep_score.score
11
+ ep_score = @student.exam_portion_scores.where(gradable: gradable_scope, exam_portion_id: exam_portion.id).first_or_create
12
+ @scores << ep_score.score if ep_score && ep_score.score
14
13
  end
15
14
 
16
15
  @result = { id: @student.id, score: formated_score }
@@ -3,10 +3,9 @@ class Gaku::Grading::Single::Score < Gaku::Grading::Single::BaseMethod
3
3
  def grade_exam
4
4
  @score = nil
5
5
  exam = @gradable
6
-
7
6
  exam.exam_portions.each_with_index do |exam_portion, index|
8
- ep_score = @student.exam_portion_scores.where(exam_portion_id: exam_portion.id).first_or_create!
9
- @score = @score.to_f + ep_score.score if ep_score.score
7
+ ep_score = @student.exam_portion_scores.where(gradable: gradable_scope, exam_portion_id: exam_portion.id).first_or_create
8
+ @score = @score.to_f + ep_score.score if ep_score && ep_score.score
10
9
  end
11
10
 
12
11
  @result = { id: @student.id, score: @score }
@@ -20,14 +20,55 @@ namespace :common do
20
20
  ]
21
21
 
22
22
  puts 'Setting up dummy database...'
23
- cmd = 'bundle exec rake db:drop db:create db:migrate db:test:prepare RAILS_ENV=test'
24
23
 
25
- if RUBY_PLATFORM =~ /mswin/ # windows
26
- cmd += ' >nul'
24
+ if (!!(`PGPASSWORD=manabu psql postgres --user manabu -c "SELECT current_setting('is_superuser');"` =~ /on/))
25
+ `bundle exec rails app:update:bin db:environment:set db:drop db:create db:migrate db:test:prepare RAILS_ENV=test`
27
26
  else
28
- cmd += ' >/dev/null'
27
+ printf "Database was not accessible. How would you like to proceed?\n" \
28
+ "(1) Try to create user and database automatically (requires sudo)\n" \
29
+ "(2) Attempt to run creation tasks/migrations. This requires the following:\n" \
30
+ "\t * HStore installed\n" \
31
+ "\t * Postgres user \"manabu\" with password \"manabu\"\n" \
32
+ "\t * Database \"gaku_test\" and \"gaku_development\" with full permission granted to \"manabu\"\n" \
33
+ "\t * Database \"gaku_test\" and \"gaku_development\" are *empty*\n" \
34
+ "Please enter 1 or 2. Enter anything else or simply hit enter to cancel: "
35
+ selection = STDIN.getc
36
+ case selection
37
+ when '1' then
38
+ puts 'Creating user and database automatically...'
39
+ _autopilot_setup
40
+ when '2' then
41
+ puts 'Running creation tasks/migrations...'
42
+ `bundle exec rails app:update:bin db:environment:set db:migrate RAILS_ENV=test`
43
+ else
44
+ puts
45
+ end
29
46
  end
30
-
31
- system(cmd)
32
47
  end
33
48
  end
49
+
50
+ def _autopilot_setup
51
+ term_cover = " 1> /dev/null 2> /dev/null"
52
+ puts "Setting up DB User, Database, and Extensions..."
53
+ `sudo -u postgres psql -c "CREATE USER manabu WITH PASSWORD 'manabu';"#{term_cover}`
54
+ `sudo -u postgres psql -c "ALTER USER manabu CREATEDB;"#{term_cover}`
55
+ `sudo -u postgres psql -c "CREATE EXTENSION IF NOT EXISTS hstore;"#{term_cover}`
56
+
57
+ `sudo -u postgres psql -c "DROP DATABASE gaku_test;"#{term_cover}`
58
+ `sudo -u postgres psql -c "CREATE DATABASE gaku_test;"#{term_cover}`
59
+ `sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"gaku_test\" to manabu;"#{term_cover}`
60
+ `sudo -u postgres psql gaku_test -c "CREATE EXTENSION hstore;"#{term_cover}`
61
+ `sudo -u postgres psql -c "ALTER DATABASE gaku_test OWNER TO manabu;"#{term_cover}`
62
+
63
+ `sudo -u postgres psql -c "DROP DATABASE gaku_development;"#{term_cover}`
64
+ `sudo -u postgres psql -c "CREATE DATABASE gaku_development;"#{term_cover}`
65
+ `sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE \"gaku_development\" to manabu;"#{term_cover}`
66
+ `sudo -u postgres psql gaku_development -c "CREATE EXTENSION hstore;"#{term_cover}`
67
+ `sudo -u postgres psql -c "ALTER DATABASE gaku_development OWNER TO manabu;"#{term_cover}`
68
+ puts "Done."
69
+
70
+ puts "Running tasks..."
71
+ `bundle exec rails app:update:bin db:environment:set db:migrate RAILS_ENV=test`
72
+ puts "Done. If the test app does not run normally please follow the setup guide at: "
73
+ puts "https://github.com/GAKUEngine/gaku"
74
+ end
@@ -92,10 +92,12 @@ module Gaku::Testing::ControllerHelpers
92
92
  process(action, method, parameters, session, flash)
93
93
  end
94
94
 
95
- def process_js_gaku_action(action, method = 'GET', parameters = nil, session = nil, flash = nil)
96
- parameters ||= {}
97
- parameters.reverse_merge!(format: :js)
98
- xml_http_request(method, action, parameters, session, flash)
95
+ def process_js_gaku_action(action, method = 'GET', params = nil, session = nil, flash = nil)
96
+ # parameters ||= {}
97
+ # parameters.reverse_merge!(format: :js)
98
+ # xml_http_request(method, action, parameters, session, flash)
99
+ process action, method: method, params: params.reverse_merge!(format: :js), session: session, flash: flash, xhr: true
100
+
99
101
  end
100
102
 
101
103
  end
@@ -1,9 +1,9 @@
1
1
  FactoryGirl.define do
2
2
 
3
3
  factory :address, class: Gaku::Address do
4
- address1 { Faker::Address.street_address }
5
- address2 { Faker::Address.street_address }
6
- city { Faker::Address.city }
4
+ address1 { FFaker::Address.street_address }
5
+ address2 { FFaker::Address.street_address }
6
+ city { FFaker::Address.city }
7
7
 
8
8
  state
9
9
  country
@@ -1,7 +1,7 @@
1
1
  FactoryGirl.define do
2
2
 
3
3
  factory :campus, class: Gaku::Campus do
4
- name { Faker::Education.school_generic_name }
4
+ name { FFaker::Education.school_generic_name }
5
5
  school
6
6
 
7
7
  factory :invalid_campus do
@@ -3,7 +3,7 @@
3
3
 
4
4
  factory "#{resource}_enrollment", class: Gaku::Enrollment do
5
5
  student
6
- association :enrollmentable, factory: resource
6
+ association :enrollable, factory: resource
7
7
  end
8
8
 
9
9
  end
@@ -1,8 +1,8 @@
1
1
  FactoryGirl.define do
2
2
 
3
3
  factory :guardian, class: Gaku::Guardian do
4
- name { Faker::Name.first_name }
5
- surname { Faker::Name.last_name }
4
+ name { FFaker::Name.first_name }
5
+ surname { FFaker::Name.last_name }
6
6
  relationship 'Relationship'
7
7
 
8
8
  factory(:invalid_guardian) { name nil }
@@ -1,7 +1,7 @@
1
1
  FactoryGirl.define do
2
2
 
3
3
  factory :program, class: Gaku::Program do
4
- name { Faker::Education.degree }
4
+ name { FFaker::Education.degree }
5
5
  description 'Superior Ruby Skills'
6
6
  school
7
7
  end
@@ -1,7 +1,7 @@
1
1
  FactoryGirl.define do
2
2
 
3
3
  factory :school, class: Gaku::School do
4
- name { Faker::Education.school_generic_name }
4
+ name { FFaker::Education.school_generic_name }
5
5
  slogan 'Draw the individual potencial'
6
6
  description 'Nagoya University description'
7
7
  founded Date.new(1950, 4, 1)
@@ -1,11 +1,13 @@
1
+ require 'ffaker'
2
+
1
3
  FactoryGirl.define do
2
4
 
3
5
  factory :student, class: Gaku::Student do
4
- name { Faker::Name.first_name }
5
- middle_name { Faker::Name.first_name }
6
- surname { Faker::Name.last_name }
7
- name_reading { Faker::Name.first_name }
8
- surname_reading { Faker::Name.last_name }
6
+ name { FFaker::Name.first_name }
7
+ middle_name { FFaker::Name.first_name }
8
+ surname { FFaker::Name.last_name }
9
+ name_reading { FFaker::Name.first_name }
10
+ surname_reading { FFaker::Name.last_name }
9
11
  gender true
10
12
  birth_date Date.today
11
13
  end
@@ -1,7 +1,7 @@
1
1
  FactoryGirl.define do
2
2
 
3
3
  factory :syllabus, class: Gaku::Syllabus do
4
- name { Faker::Name.name }
4
+ name { FFaker::Name.name }
5
5
  code '12345'
6
6
  description 'Short description'
7
7
  credits 'Huge Credits'
@@ -1,10 +1,10 @@
1
1
  FactoryGirl.define do
2
2
 
3
3
  factory :teacher, class: Gaku::Teacher do
4
- name { Faker::Name.first_name }
5
- surname { Faker::Name.last_name }
6
- name_reading { Faker::Name.first_name }
7
- surname_reading { Faker::Name.last_name }
4
+ name { FFaker::Name.first_name }
5
+ surname { FFaker::Name.last_name }
6
+ name_reading { FFaker::Name.first_name }
7
+ surname_reading { FFaker::Name.last_name }
8
8
  gender true
9
9
 
10
10
  factory :invalid_teacher do
@@ -1,7 +1,7 @@
1
1
  FactoryGirl.define do
2
2
  factory :user, class: Gaku::User do
3
- username { Faker::Internet.user_name }
4
- email { Faker::Internet.email }
3
+ username { FFaker::Internet.user_name }
4
+ email { FFaker::Internet.email }
5
5
  password 'secret'
6
6
  password_confirmation 'secret'
7
7
 
@@ -0,0 +1,58 @@
1
+ require 'rails/generators'
2
+ require 'highline/import'
3
+ require 'bundler'
4
+ require 'bundler/cli'
5
+
6
+ module Gaku
7
+ class DockerGenerator < Rails::Generators::Base
8
+
9
+ class_option :auto_accept, type: :boolean
10
+ class_option :lib_name, type: :string, default: 'gaku'
11
+ class_option :env, type: :string, default: 'development'
12
+
13
+ def self.source_paths
14
+ paths = superclass.source_paths
15
+ paths << File.expand_path('../templates', "../../#{__FILE__}")
16
+ paths << File.expand_path('../templates', "../#{__FILE__}")
17
+ paths << File.expand_path('../templates', __FILE__)
18
+ paths.flatten
19
+ end
20
+
21
+ def copy_database_yml
22
+ copy_file 'config/database.yml', 'config/database.yml'
23
+ end
24
+
25
+ def copy_wait_bin
26
+ copy_file 'bin/check_postgres.sh', 'bin/check_postgres.sh'
27
+ chmod "bin/check_postgres.sh", 0755
28
+ end
29
+
30
+ def add_route
31
+ route "mount Gaku::Core::Engine, at: '/'"
32
+ end
33
+
34
+ def install_migrations
35
+ say_status :copying, 'migrations'
36
+ rake 'gaku:install:migrations'
37
+ end
38
+
39
+ def setup_assets
40
+ @lib_name = 'gaku'
41
+ %w( javascripts stylesheets images ).each do |path|
42
+ empty_directory "app/assets/#{path}/gaku/frontend" if defined? Gaku::Frontend || Rails.env.test?
43
+ empty_directory "app/assets/#{path}/gaku/admin" if defined? Gaku::Admin || Rails.env.test?
44
+ end
45
+
46
+ if defined? Gaku::Frontend || Rails.env.test?
47
+ template 'app/assets/javascripts/gaku/frontend/all.js'
48
+ template 'app/assets/stylesheets/gaku/frontend/all.css'
49
+ end
50
+
51
+ if defined? Gaku::Admin || Rails.env.test?
52
+ template 'app/assets/javascripts/gaku/admin/all.js'
53
+ template 'app/assets/stylesheets/gaku/admin/all.css'
54
+ end
55
+ end
56
+
57
+ end
58
+ end
@@ -0,0 +1,10 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require gaku/admin
10
+ //= require_tree .
@@ -0,0 +1,10 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require gaku/archive
10
+ //= require_tree .
@@ -0,0 +1,10 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require gaku/frontend
10
+ //= require_tree .
@@ -0,0 +1,9 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *
6
+ *= require gaku/admin
7
+ *= require_self
8
+ *= require_tree .
9
+ */
@@ -0,0 +1,9 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *
6
+ *= require gaku/archive
7
+ *= require_self
8
+ *= require_tree .
9
+ */
@@ -0,0 +1,9 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *
6
+ *= require gaku/frontend
7
+ *= require_self
8
+ *= require_tree .
9
+ */
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+
3
+ while ! pg_isready -h postgres -p 5432 > /dev/null 2> /dev/null; do
4
+ echo "Connecting to postgresql failed"
5
+ sleep 1
6
+ done
7
+ rm /app/tmp/pids/server.pid
8
+ bundle check || bundle install
9
+
10
+ psql --host=postgres --port=5432 -U postgres -c "CREATE USER manabu WITH PASSWORD 'manabu';"
11
+ psql --host=postgres --port=5432 -U postgres -c "ALTER USER manabu WITH SUPERUSER;"
12
+ psql --host=postgres --port=5432 -U postgres -c "CREATE EXTENSION IF NOT EXISTS hstore;"
13
+
14
+ bundle exec rake db:create
15
+ bundle exec rake db:migrate
16
+ exec "$@"
@@ -0,0 +1,2 @@
1
+ development:
2
+ url: postgres://manabu:manabu@postgres:5432/gaku_development
@@ -25,7 +25,6 @@ module Gaku
25
25
  opts[:force] = true
26
26
  opts[:skip_bundle] = true
27
27
  opts[:old_style_hash] = true
28
-
29
28
  puts 'Generating dummy Rails application...'
30
29
  invoke Rails::Generators::AppGenerator, [File.expand_path(dummy_path, destination_root)], opts
31
30
  end
@@ -7,4 +7,3 @@ Bundler.require(:default, Rails.env)
7
7
  require '<%= lib_name %>'
8
8
 
9
9
  <%= application_definition %>
10
-
@@ -1,17 +1,18 @@
1
- development:
1
+ default: &default
2
2
  host: localhost
3
3
  adapter: postgresql
4
- database: gaku_development
5
- username: postgres
4
+ username: manabu
5
+ password: manabu
6
6
  min_messages: warning
7
+
8
+ development:
9
+ <<: *default
10
+ database: gaku_development
11
+
7
12
  test:
8
- host: localhost
9
- adapter: postgresql
13
+ <<: *default
10
14
  database: gaku_test
11
- username: postgres
12
- min_messages: warning
15
+
13
16
  production:
14
- adapter: postgresql
17
+ <<: *default
15
18
  database: gaku_production
16
- username: postgres
17
- min_messages: warning