Class: Geert::Project
- Inherits:
-
Object
- Object
- Geert::Project
- Defined in:
- lib/geert/project.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #filename ⇒ Object
-
#initialize(path, options = {}) ⇒ Project
constructor
A new instance of Project.
- #migration ⇒ Object
- #output ⇒ Object
Constructor Details
#initialize(path, options = {}) ⇒ Project
Returns a new instance of Project.
7 8 9 |
# File 'lib/geert/project.rb', line 7 def initialize(path, = {}) @path, @options = path, end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/geert/project.rb', line 5 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/geert/project.rb', line 5 def path @path end |
Instance Method Details
#filename ⇒ Object
25 26 27 |
# File 'lib/geert/project.rb', line 25 def filename @filename ||= File.join(path, "db", "migrate", Time.now.strftime("%Y%m%d%H%M%S") + "_" + migration_name + ".rb") end |
#migration ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/geert/project.rb', line 11 def migration <<-MIGRATION.gsub(/^ {6}/,'') class #{migration_name.camelize} < ActiveRecord::Migration def self.up #{cleanup migration_up} end def self.down #{cleanup migration_down} end end MIGRATION end |
#output ⇒ Object
29 30 31 |
# File 'lib/geert/project.rb', line 29 def output models.map(&:output).flatten.compact end |