Sha256: 8ec2a2b566450262e6e9bbec19cbe651baac0a5c5472c4814bf0d990cfbc6862

Contents?: true

Size: 521 Bytes

Versions: 7

Compression:

Stored size: 521 Bytes

Contents

namespace :db do

  desc 'create calendar'
  task create_calendar: :environment do

    year = 2023
    d = "#{year}-01-01".to_date
    out = ""
    368.times do
      if d.strftime('%Y').to_i == year+1
        break
      end
      out = "#{out} ('#{d.strftime '%Y-%m-%d'}'),"
      d = d + 1.day
    end
    out = out[0...out.length-1]
    out = "
    INSERT INTO
      dates (date)
    VALUES
      #{out} ;"
    File.write("/opt/tmp/#{year}_calendar.sql", out)
    `mv /opt/tmp/#{year}_calendar.sql doc/`

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
iron_warbler-2.0.7.7 lib/tasks/db_tasks.rake
iron_warbler-2.0.7.6 lib/tasks/db_tasks.rake
iron_warbler-2.0.7.5 lib/tasks/db_tasks.rake
iron_warbler-2.0.7.4 lib/tasks/db_tasks.rake
iron_warbler-2.0.7.3 lib/tasks/db_tasks.rake
iron_warbler-2.0.7.2 lib/tasks/db_tasks.rake
iron_warbler-2.0.7.1 lib/tasks/db_tasks.rake