Class: TurkeeGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/turkee/turkee_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object

Implement the required interface for Rails::Generators::Migration. taken from github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb



9
10
11
# File 'lib/generators/turkee/turkee_generator.rb', line 9

def self.next_migration_number(dirname)
  Time.now.utc.strftime("%Y%m%d%H%M%S")
end

Instance Method Details

#create_initializerObject



47
48
49
# File 'lib/generators/turkee/turkee_generator.rb', line 47

def create_initializer
  template "turkee.rb", "config/initializers/turkee.rb"
end

#create_migrationsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/generators/turkee/turkee_generator.rb', line 17

def create_migrations
  migration_template "turkee_migration.rb.erb", "db/migrate/create_turkee_tasks.rb"

  # Need this sleep so that we don't get the same migration timestamp for both migrations
  sleep 1
  
  migration_template "turkee_imported_assignments.rb.erb", "db/migrate/create_turkee_imported_assignments.rb"

  sleep 1

  migration_template "add_completed_tasks.rb.erb", "db/migrate/add_completed_tasks.rb"
  
  sleep 1

  migration_template "add_imported_assignment_details.rb.erb", "db/migrate/add_imported_assignment_details.rb"

  sleep 1

  migration_template "add_hit_duration.rb.erb", "db/migrate/add_hit_duration.rb"

  sleep 1

  migration_template "add_expired.rb.erb", "db/migrate/add_expired.rb"

  sleep 1

  migration_template "create_turkee_study.rb.erb", "db/migrate/create_turkee_study.rb"

end