Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lecture pull #24

Open
wants to merge 212 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
84ce009
Empty webpage
vkaynig Jul 20, 2015
6a6d6c3
Added page placeholders
vkaynig Jul 20, 2015
689d1f7
I heard index.md is important
vkaynig Jul 20, 2015
3ff89eb
Modified Piazza link, but forum is still missing
vkaynig Jul 20, 2015
bd98ec5
changing baselink to point to this year
vkaynig Jul 20, 2015
d57011a
New placeholder figure
vkaynig Jul 20, 2015
cb4c83b
updated schedule
vkaynig Jul 20, 2015
ab9744e
Trying to get the schedule readable
vkaynig Jul 20, 2015
95d03bf
Trying to get the schedule readable
vkaynig Jul 20, 2015
a0e7d34
added caption
vkaynig Jul 22, 2015
36c8736
changed homework comment
vkaynig Jul 22, 2015
e037086
changed piazza link, deleted readings to put into resources
vkaynig Jul 22, 2015
6a7dfb6
project file broken
vkaynig Jul 22, 2015
03de2ef
fixing broken files
vkaynig Jul 22, 2015
0a890e3
Github link instead of homework
vkaynig Jul 22, 2015
7544e73
Github link instead of homework
vkaynig Jul 22, 2015
46c1854
listing resources
vkaynig Jul 22, 2015
49dcd6d
changing due dates to italic
vkaynig Jul 22, 2015
e64e71f
changed title picture
vkaynig Jul 22, 2015
c308f5f
changed title picture
vkaynig Jul 22, 2015
02867a4
changed title picture
vkaynig Jul 22, 2015
1c67e1a
syllabus and project descriptions
vkaynig Jul 22, 2015
aaf41be
converted figure to jpg
vkaynig Jul 22, 2015
ddc41ca
sanity check
vkaynig Jul 22, 2015
e0d7391
trying html directly
vkaynig Jul 22, 2015
eecaf7f
trying html directly
vkaynig Jul 22, 2015
981d616
trying html directly
vkaynig Jul 22, 2015
02e7434
trying case sensitive renames
vkaynig Jul 22, 2015
655f12f
trying case sensitive renames
vkaynig Jul 22, 2015
b0ce246
removing relative path
vkaynig Jul 22, 2015
2b8a63f
Comments from Joe and Hanspeter partly finished.
vkaynig Jul 24, 2015
14d3963
test for logo updates. Something is fishy.
vkaynig Jul 24, 2015
5237da3
This works for the logo
vkaynig Jul 24, 2015
4068eb2
Adjusted figure sizes
vkaynig Jul 24, 2015
b7cd6e9
added section topics to schedule
vkaynig Jul 24, 2015
00a8553
Added comments to syllabus from HP
vkaynig Jul 28, 2015
9efe997
Fixing logo
vkaynig Jul 29, 2015
0bdb167
Fixing logo
vkaynig Jul 29, 2015
179430d
Fixing logo with BASE_PATH
vkaynig Jul 29, 2015
1653972
Not great, but seems to work
vkaynig Jul 29, 2015
e1d4cfe
added first week section and lecture room
vkaynig Aug 25, 2015
56d305d
Added video link
vkaynig Sep 2, 2015
dfa0be9
Changed schedule
vkaynig Sep 2, 2015
e2e8f06
Changed schedule
vkaynig Sep 2, 2015
3fc9be5
Changed schedule
vkaynig Sep 2, 2015
1b8a3e7
added section schedule
rahuldave Sep 3, 2015
f8456bc
fixes heading formatting in schedule
rahuldave Sep 3, 2015
b0e6c92
fixes heading formatting in schedule, 2
rahuldave Sep 3, 2015
b4025e0
added staff contact email
rahuldave Sep 3, 2015
68283e5
added section
rahuldave Sep 3, 2015
c3484d8
dedicated class material page
rahuldave Sep 5, 2015
8b28bf7
preamble added
rahuldave Sep 5, 2015
6d9ff4b
formatting
rahuldave Sep 5, 2015
b489b3f
more formatting, title change
rahuldave Sep 5, 2015
cd158ef
Change added in place of example.com url in main page
sushantmagoo Sep 6, 2015
bf7656d
Merge pull request #1 from sushantmagoo/gh-pages
rahuldave Sep 6, 2015
4637114
removed common schedule
rahuldave Sep 8, 2015
7a7f035
changing schedule
rahuldave Sep 8, 2015
9e06227
changed index to add mention of schedule page
rahuldave Sep 8, 2015
002a028
added youtube videos link, formatting on videos page
rahuldave Sep 8, 2015
d6988a7
added notebook info to slides page for lec 1
rahuldave Sep 8, 2015
007c4be
formatting-a
rahuldave Sep 8, 2015
879e56e
added lecture 2 videos
rahuldave Sep 10, 2015
0cc344e
added lec 3 and lab2
rahuldave Sep 11, 2015
9d27cb9
added videos
rahuldave Sep 12, 2015
5a82045
added captions for lec3, added lec 4
rahuldave Sep 16, 2015
cc2803c
updated videos
rahuldave Sep 18, 2015
b857342
starting to change resources page-a
rahuldave Sep 22, 2015
bdb5d6e
added 06
rahuldave Sep 22, 2015
8b3eae2
fixed location
rahuldave Sep 22, 2015
4f03538
added some new videos, lec slides
rahuldave Sep 25, 2015
4f78d4d
added Luis'ssection
rahuldave Sep 25, 2015
af2b065
added email and office hours
vkaynig Sep 29, 2015
c9b8671
more videos
rahuldave Sep 30, 2015
dff0fd0
Merge branch 'gh-pages' of github.com:cs109/2015 into gh-pages
rahuldave Sep 30, 2015
c2be107
added Joe's office hours
vkaynig Oct 1, 2015
d5696b1
uploaded lecture 9
rahuldave Oct 2, 2015
a1d7da5
Merge branch 'gh-pages' of github.com:cs109/2015 into gh-pages
rahuldave Oct 2, 2015
279c59a
added additional video, more captions
rahuldave Oct 3, 2015
1ddee7b
updated slides, captioned videos
rahuldave Oct 7, 2015
c866bfa
added new lan and lec 10
rahuldave Oct 9, 2015
d979e2c
added lab supplement
rahuldave Oct 11, 2015
eb3b983
temp
rahuldave Oct 16, 2015
99b8b98
updated videos
rahuldave Oct 16, 2015
0dadf99
updated videos
rahuldave Oct 23, 2015
c134a85
added spark stuff
rahuldave Oct 23, 2015
362cf32
fixed lec no
rahuldave Oct 23, 2015
ed54632
added last week and labs
rahuldave Nov 2, 2015
bfd304b
updated
rahuldave Nov 6, 2015
b1b9b81
added latest lectures
rahuldave Nov 13, 2015
2e48ef6
added captions and experimental design
rahuldave Nov 19, 2015
0df705e
Update Project Dates
lfcampos Nov 20, 2015
538e94c
more changes project
lfcampos Nov 20, 2015
d3c6648
Updated project section
lfcampos Dec 3, 2015
9b85bcf
adding last videos
rahuldave Dec 5, 2015
630c2fe
adding last videos
rahuldave Dec 5, 2015
5ad4896
Added remark about homework not being public this year.
vkaynig Jan 12, 2016
62ecdfe
deleted staff email
vkaynig Jan 21, 2016
8c5b685
testing changes to 2015
pavlosprotopapas May 18, 2020
f67ca67
Adding landing page
pavlosprotopapas May 22, 2020
a6d5e78
Adding landing page
pavlosprotopapas May 22, 2020
e64e4da
Adding landing page
pavlosprotopapas May 22, 2020
a974c91
minor change for testing
Dec 14, 2022
0f2d4bd
minor change for testing
Dec 14, 2022
0cd5b36
minor change for testing
Dec 14, 2022
36ba42b
minor change for testing
Dec 14, 2022
d4c2e09
minor change for testing
Dec 14, 2022
614145a
minor change for testing
Dec 14, 2022
2c98dc3
minor change for testing
Dec 14, 2022
f1007aa
minor change for testing
Dec 14, 2022
00cf09e
minor change for testing
Dec 14, 2022
beac195
minor change for testing
Dec 14, 2022
40d4284
fixing
Dec 14, 2022
671a40f
fixing
Dec 14, 2022
1d3ca27
fixing
Dec 14, 2022
49e3b31
fixing
Dec 14, 2022
b9953bd
fixing
Dec 14, 2022
11befa6
remove header tabs
pavlosprotopapas Dec 15, 2022
6f2ce91
remove header tabs
pavlosprotopapas Dec 15, 2022
f07ea60
remove header tabs
pavlosprotopapas Dec 15, 2022
de3ab91
remove header tabs
pavlosprotopapas Dec 15, 2022
92175ea
remove header tabs
pavlosprotopapas Dec 15, 2022
f0421fc
remove header tabs
pavlosprotopapas Dec 15, 2022
d94b193
remove header tabs
pavlosprotopapas Dec 15, 2022
72aeb64
remove header tabs
pavlosprotopapas Dec 15, 2022
37c92b7
remove header tabs
pavlosprotopapas Dec 15, 2022
2e3b438
remove header tabs
pavlosprotopapas Dec 15, 2022
d75af5b
add a diagram
pavlosprotopapas Dec 15, 2022
4f8b028
add a diagram
pavlosprotopapas Dec 15, 2022
5ff0879
add a diagram
pavlosprotopapas Dec 15, 2022
c5fbeb8
add a diagram
pavlosprotopapas Dec 15, 2022
da07415
add a diagram
pavlosprotopapas Dec 15, 2022
84227fd
add a diagram
pavlosprotopapas Dec 17, 2022
dc304c9
add a diagram
pavlosprotopapas Dec 17, 2022
159029c
add a diagram
pavlosprotopapas Dec 17, 2022
ea93069
add a diagram
pavlosprotopapas Dec 17, 2022
8bf02c1
add a diagram
pavlosprotopapas Dec 17, 2022
f5bb551
add a diagram
pavlosprotopapas Dec 17, 2022
3fe8183
add a diagram
pavlosprotopapas Dec 17, 2022
cfda173
add a diagram
pavlosprotopapas Dec 17, 2022
ef57230
add a diagram
pavlosprotopapas Dec 17, 2022
edda0a6
add a diagram
pavlosprotopapas Dec 17, 2022
0bfe0e5
add a diagram
pavlosprotopapas Dec 17, 2022
c2e7e68
add a diagram
pavlosprotopapas Dec 17, 2022
ac231b2
add a diagram
pavlosprotopapas Dec 17, 2022
e3123f0
add a diagram
pavlosprotopapas Dec 17, 2022
1e6d4f4
adding more content on how to take this course
Dec 17, 2022
9f0f5a8
adding more content on how to take this course
Dec 17, 2022
a6a0a8c
add a diagram
pavlosprotopapas Dec 17, 2022
e530925
add a diagram
pavlosprotopapas Dec 18, 2022
3c6407c
add a diagram
pavlosprotopapas Dec 18, 2022
3d84f56
add a diagram
pavlosprotopapas Dec 18, 2022
cc3a732
add a diagram
pavlosprotopapas Dec 18, 2022
7275222
add a diagram
pavlosprotopapas Dec 18, 2022
5d32064
add a diagram
pavlosprotopapas Dec 18, 2022
8645ede
add a diagram
pavlosprotopapas Dec 18, 2022
189e799
add a diagram
pavlosprotopapas Dec 18, 2022
de552f6
Added how to take this course and more details
Dec 18, 2022
f01eb3f
Added the tree
Dec 18, 2022
de9dfda
Added the tree
Dec 18, 2022
b22346d
Added the tree
Dec 18, 2022
b098be2
Added the tree
Dec 18, 2022
800dfb1
Added the tree
Dec 18, 2022
c4500b1
Added the tree
Dec 18, 2022
a6406e1
Added the tree
Dec 18, 2022
7de8191
Added the tree
Dec 18, 2022
e3711cf
Added the tree
Dec 18, 2022
06909df
Added the tree
Dec 18, 2022
9fab7ec
Added the tree
Dec 18, 2022
3ad98ef
Added the tree
Dec 18, 2022
052da7a
Added the tree with variance bias
Dec 19, 2022
9676bdd
fixing diagrams
Dec 19, 2022
2a41801
fixing diagrams
Dec 19, 2022
e8330e3
corrected Joes last name
pavlosprotopapas Dec 19, 2022
0830fa9
corrected Joes last name
pavlosprotopapas Dec 19, 2022
99a4b48
corrected added fig on 2015
pavlosprotopapas Dec 19, 2022
69a78fc
adding map
Dec 20, 2022
b3ac7be
map map map
Dec 20, 2022
35b5c8d
map map map
Dec 20, 2022
c5084f5
map map map
Dec 20, 2022
83c84a3
almost got the mapping
Dec 20, 2022
1567328
almost got the mapping
Dec 20, 2022
893c358
done with mapping
Dec 20, 2022
e5178ee
review 2013-2015 pages
Dec 20, 2022
751f412
review 2013-2015 pages
Dec 20, 2022
e2fe7ea
review 2013-2015 pages
Dec 20, 2022
e95da80
review 2016 pages
Dec 21, 2022
070837c
review 2016 pages
Dec 21, 2022
88b07d1
review 2016 pages
Dec 21, 2022
83a6283
review 2016 pages
Dec 21, 2022
1286fe3
review 2016 pages
Dec 21, 2022
1d3f207
removing title
Dec 21, 2022
85a9acc
removing title
Dec 21, 2022
3008796
removing title
Dec 21, 2022
14618fc
removing title
Dec 21, 2022
6a528f4
removing title
Dec 21, 2022
c45baad
removing title
Dec 21, 2022
cd479a3
removing title
Dec 21, 2022
2c30670
removing title
Dec 21, 2022
92dfc1b
final touches
Dec 21, 2022
cfa576b
final touches
Dec 21, 2022
da0e942
final touches
Dec 21, 2022
6b2cbdf
final touches
Dec 21, 2022
67037ca
final touches
Dec 21, 2022
7e96772
final touches
Dec 21, 2022
6617c27
final touches
Dec 21, 2022
fee0227
final touches
Dec 21, 2022
9d08be7
final;
Dec 22, 2022
d374a26
Update index.md
pavlosprotopapas Dec 22, 2022
1e1a341
redirect started
Dec 22, 2022
10eb804
redirect started
Dec 22, 2022
4557374
redirect started
Dec 22, 2022
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
1 change: 1 addition & 0 deletions 'https:/harvard-iacs.github.io/2017-CS109A/.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file added .DS_Store
Binary file not shown.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -87,3 +88,21 @@ Temporary Items

#Temporary data
tempdata/
=======
<<<<<<< HEAD
homework-solutions/.ipynb_checkpoints
homework/.ipynb_checkpoints
labs/.ipynb_checkpoints
labs/.DS_Store
lectures/2014_09_30-lecture/.ipynb_checkpoints

=======
homework-solutions/.ipynb_checkpoints
homework/.ipynb_checkpoints
labs/.ipynb_checkpoints
labs/.DS_Store
lectures/2014_09_30-lecture/.ipynb_checkpoints
lectures/2014_10_02-lecture/.ipynb_checkpoints

>>>>>>> dc2ae1d7ddf792b45befc396ec5e4860c1aa70ff
>>>>>>> 2a41801e303157e8ac33562c8e6ba5d038fc39d9
2 changes: 2 additions & 0 deletions License.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
My parts of this web site is licensed under
[CC BY](http://creativecommons.org/licenses/by/3.0/).
309 changes: 309 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,309 @@
require "rubygems"
require 'rake'
require 'yaml'
require 'time'

SOURCE = "."
CONFIG = {
'version' => "0.3.0",
'themes' => File.join(SOURCE, "_includes", "themes"),
'layouts' => File.join(SOURCE, "_layouts"),
'posts' => File.join(SOURCE, "_posts"),
'post_ext' => "md",
'theme_package_version' => "0.1.0"
}

# Path configuration helper
module JB
class Path
SOURCE = "."
Paths = {
:layouts => "_layouts",
:themes => "_includes/themes",
:theme_assets => "assets/themes",
:theme_packages => "_theme_packages",
:posts => "_posts"
}

def self.base
SOURCE
end

# build a path relative to configured path settings.
def self.build(path, opts = {})
opts[:root] ||= SOURCE
path = "#{opts[:root]}/#{Paths[path.to_sym]}/#{opts[:node]}".split("/")
path.compact!
File.__send__ :join, path
end

end #Path
end #JB

# Usage: rake post title="A Title" [date="2012-02-09"] [tags=[tag1, tag2]]
desc "Begin a new post in #{CONFIG['posts']}"
task :post do
abort("rake aborted: '#{CONFIG['posts']}' directory not found.") unless FileTest.directory?(CONFIG['posts'])
title = ENV["title"] || "new-post"
tags = ENV["tags"] || "[]"
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
begin
date = (ENV['date'] ? Time.parse(ENV['date']) : Time.now).strftime('%Y-%m-%d')
rescue Exception => e
puts "Error - date format must be YYYY-MM-DD, please check you typed it correctly!"
exit -1
end
filename = File.join(CONFIG['posts'], "#{date}-#{slug}.#{CONFIG['post_ext']}")
if File.exist?(filename)
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
end

puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
post.puts "---"
post.puts "layout: post"
post.puts "title: \"#{title.gsub(/-/,' ')}\""
post.puts 'description: ""'
post.puts "category: "
post.puts "tags: []"
post.puts "---"
post.puts "{% include JB/setup %}"
end
end # task :post

# Usage: rake page name="about.html"
# You can also specify a sub-directory path.
# If you don't specify a file extention we create an index.html at the path specified
desc "Create a new page."
task :page do
name = ENV["name"] || "new-page.md"
filename = File.join(SOURCE, "#{name}")
filename = File.join(filename, "index.html") if File.extname(filename) == ""
title = File.basename(filename, File.extname(filename)).gsub(/[\W\_]/, " ").gsub(/\b\w/){$&.upcase}
if File.exist?(filename)
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
end

mkdir_p File.dirname(filename)
puts "Creating new page: #{filename}"
open(filename, 'w') do |post|
post.puts "---"
post.puts "layout: page"
post.puts "title: \"#{title}\""
post.puts 'description: ""'
post.puts "---"
post.puts "{% include JB/setup %}"
end
end # task :page

desc "Launch preview environment"
task :preview do
system "jekyll --auto --server"
end # task :preview

# Public: Alias - Maintains backwards compatability for theme switching.
task :switch_theme => "theme:switch"

namespace :theme do

# Public: Switch from one theme to another for your blog.
#
# name - String, Required. name of the theme you want to switch to.
# The the theme must be installed into your JB framework.
#
# Examples
#
# rake theme:switch name="the-program"
#
# Returns Success/failure messages.
desc "Switch between Jekyll-bootstrap themes."
task :switch do
theme_name = ENV["name"].to_s
theme_path = File.join(CONFIG['themes'], theme_name)
settings_file = File.join(theme_path, "settings.yml")
non_layout_files = ["settings.yml"]

abort("rake aborted: name cannot be blank") if theme_name.empty?
abort("rake aborted: '#{theme_path}' directory not found.") unless FileTest.directory?(theme_path)
abort("rake aborted: '#{CONFIG['layouts']}' directory not found.") unless FileTest.directory?(CONFIG['layouts'])

Dir.glob("#{theme_path}/*") do |filename|
next if non_layout_files.include?(File.basename(filename).downcase)
puts "Generating '#{theme_name}' layout: #{File.basename(filename)}"

open(File.join(CONFIG['layouts'], File.basename(filename)), 'w') do |page|
if File.basename(filename, ".html").downcase == "default"
page.puts "---"
page.puts File.read(settings_file) if File.exist?(settings_file)
page.puts "---"
else
page.puts "---"
page.puts "layout: default"
page.puts "---"
end
page.puts "{% include JB/setup %}"
page.puts "{% include themes/#{theme_name}/#{File.basename(filename)} %}"
end
end

puts "=> Theme successfully switched!"
puts "=> Reload your web-page to check it out =)"
end # task :switch

# Public: Install a theme using the theme packager.
# Version 0.1.0 simple 1:1 file matching.
#
# git - String, Optional path to the git repository of the theme to be installed.
# name - String, Optional name of the theme you want to install.
# Passing name requires that the theme package already exist.
#
# Examples
#
# rake theme:install git="https://github.com/jekyllbootstrap/theme-twitter.git"
# rake theme:install name="cool-theme"
#
# Returns Success/failure messages.
desc "Install theme"
task :install do
if ENV["git"]
manifest = theme_from_git_url(ENV["git"])
name = manifest["name"]
else
name = ENV["name"].to_s.downcase
end

packaged_theme_path = JB::Path.build(:theme_packages, :node => name)

abort("rake aborted!
=> ERROR: 'name' cannot be blank") if name.empty?
abort("rake aborted!
=> ERROR: '#{packaged_theme_path}' directory not found.
=> Installable themes can be added via git. You can find some here: http://github.com/jekyllbootstrap
=> To download+install run: `rake theme:install git='[PUBLIC-CLONE-URL]'`
=> example : rake theme:install git='[email protected]:jekyllbootstrap/theme-the-program.git'
") unless FileTest.directory?(packaged_theme_path)

manifest = verify_manifest(packaged_theme_path)

# Get relative paths to packaged theme files
# Exclude directories as they'll be recursively created. Exclude meta-data files.
packaged_theme_files = []
FileUtils.cd(packaged_theme_path) {
Dir.glob("**/*.*") { |f|
next if ( FileTest.directory?(f) || f =~ /^(manifest|readme|packager)/i )
packaged_theme_files << f
}
}

# Mirror each file into the framework making sure to prompt if already exists.
packaged_theme_files.each do |filename|
file_install_path = File.join(JB::Path.base, filename)
if File.exist? file_install_path and ask("#{file_install_path} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
next
else
mkdir_p File.dirname(file_install_path)
cp_r File.join(packaged_theme_path, filename), file_install_path
end
end

puts "=> #{name} theme has been installed!"
puts "=> ---"
if ask("=> Want to switch themes now?", ['y', 'n']) == 'y'
system("rake switch_theme name='#{name}'")
end
end

# Public: Package a theme using the theme packager.
# The theme must be structured using valid JB API.
# In other words packaging is essentially the reverse of installing.
#
# name - String, Required name of the theme you want to package.
#
# Examples
#
# rake theme:package name="twitter"
#
# Returns Success/failure messages.
desc "Package theme"
task :package do
name = ENV["name"].to_s.downcase
theme_path = JB::Path.build(:themes, :node => name)
asset_path = JB::Path.build(:theme_assets, :node => name)

abort("rake aborted: name cannot be blank") if name.empty?
abort("rake aborted: '#{theme_path}' directory not found.") unless FileTest.directory?(theme_path)
abort("rake aborted: '#{asset_path}' directory not found.") unless FileTest.directory?(asset_path)

## Mirror theme's template directory (_includes)
packaged_theme_path = JB::Path.build(:themes, :root => JB::Path.build(:theme_packages, :node => name))
mkdir_p packaged_theme_path
cp_r theme_path, packaged_theme_path

## Mirror theme's asset directory
packaged_theme_assets_path = JB::Path.build(:theme_assets, :root => JB::Path.build(:theme_packages, :node => name))
mkdir_p packaged_theme_assets_path
cp_r asset_path, packaged_theme_assets_path

## Log packager version
packager = {"packager" => {"version" => CONFIG["theme_package_version"].to_s } }
open(JB::Path.build(:theme_packages, :node => "#{name}/packager.yml"), "w") do |page|
page.puts packager.to_yaml
end

puts "=> '#{name}' theme is packaged and available at: #{JB::Path.build(:theme_packages, :node => name)}"
end

end # end namespace :theme

# Internal: Download and process a theme from a git url.
# Notice we don't know the name of the theme until we look it up in the manifest.
# So we'll have to change the folder name once we get the name.
#
# url - String, Required url to git repository.
#
# Returns theme manifest hash
def theme_from_git_url(url)
tmp_path = JB::Path.build(:theme_packages, :node => "_tmp")
abort("rake aborted: system call to git clone failed") if !system("git clone #{url} #{tmp_path}")
manifest = verify_manifest(tmp_path)
new_path = JB::Path.build(:theme_packages, :node => manifest["name"])
if File.exist?(new_path) && ask("=> #{new_path} theme package already exists. Override?", ['y', 'n']) == 'n'
remove_dir(tmp_path)
abort("rake aborted: '#{manifest["name"]}' already exists as theme package.")
end

remove_dir(new_path) if File.exist?(new_path)
mv(tmp_path, new_path)
manifest
end

# Internal: Process theme package manifest file.
#
# theme_path - String, Required. File path to theme package.
#
# Returns theme manifest hash
def verify_manifest(theme_path)
manifest_path = File.join(theme_path, "manifest.yml")
manifest_file = File.open( manifest_path )
abort("rake aborted: repo must contain valid manifest.yml") unless File.exist? manifest_file
manifest = YAML.load( manifest_file )
manifest_file.close
manifest
end

def ask(message, valid_options)
if valid_options
answer = get_stdin("#{message} #{valid_options.to_s.gsub(/"/, '').gsub(/, /,'/')} ") while !valid_options.include?(answer)
else
answer = get_stdin(message)
end
answer
end

def get_stdin(message)
print message
STDIN.gets.chomp
end

#Load custom rake scripts
Dir['_rake/*.rake'].each { |r| load r }
Loading