Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/api/projects/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
json.(@project, :identifier, :project_type)
json.(@project, :identifier, :project_type, :name)

json.components @project.components, :id, :name, :extension, :content
87 changes: 87 additions & 0 deletions lib/tasks/projects.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
namespace :projects do
desc "Import starter projects"
task create_starter: :environment do

Project.find_by(identifier: "python-hello-starter")&.destroy
project = Project.new(identifier: "python-hello-starter", name: "Hello World!")
project.components << Component.new(name: "main", extension: "py", content: main_content)
project.components << Component.new(name: "emoji", extension: "py", content: emoji_content)
project.components << Component.new(name: "noemoji", extension: "py", content: no_emoji_content)
project.save
end
end

def main_content
main_content = <<-END
#!/bin/python3

from emoji import *
from datetime import *
from random import randint

# Put function definitions under here

# Useful characters :',()*_/.#

# Put code to run under here

print('Hello ', world)
END
end

def emoji_content
emoji_content = <<-END
# Emoji variables to use in your project

world = '🌍🌎🌏'
python = '🐍⌨️'
sums = '✖️➗➖➕'
calendar = '📅'
clock = '🕒'
projects = '🎨🎮🔬'
fun = '🎉🕶️'
dice = '🎲'
unicorn = '🦄'
space = '🚀'
happy = '😃'
silly = '😜'
heart = '❤️'
games = '🎮'
books = '📚'
sports = '⚽🎾👟'
green = '♻️'
nature = '🌳'
fire = '🔥'
sparkles = '✨'
plead = '🥺'
hundred = '💯'
star = '⭐'
yellow_heart = '💛'
rainbow = '🌈'
END
end

def no_emoji_content
no_emoji_content = <<-END
# Add ASCII art alternatives
# Before emoji we used emoticons made from characters

world = 'o'
python = '~~~-<'
happy = ':-)'
heart = '♡' # or '<3'
star = '☆'
sparkles = '✺'
silly = ';)'
sums = '+-*/'
hundred = '100!'
plead = '◔◔'
fire = '/\\'
books = '≣'
rainbow = '⌒'
dice = '⊡'
clock = '◷'
calendar = '▦'

END
end