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
8 changes: 4 additions & 4 deletions lib/tasks/book2.rake
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ task remote_genbook2: :environment do
books = Book.all_books.select { |code, repo| code == ENV["GENLANG"] }
else
books = Book.all_books.select do |code, repo|
repo_head = @octokit.ref(repo, "heads/master").object[:sha]
repo_head = @octokit.commit(repo, "HEAD").commit.sha
book = Book.where(edition: 2, code: code).first_or_create
repo_head != book.ebook_html
end
Expand All @@ -202,18 +202,18 @@ task remote_genbook2: :environment do
content = Base64.decode64(@octokit.blob(repo, sha, encoding: "base64").content)
blobs[sha] = content.force_encoding("UTF-8")
end
repo_tree = @octokit.tree(repo, "HEAD", recursive: true)
repo_head = @octokit.commit(repo, "HEAD").commit
repo_tree = @octokit.tree(repo, repo_head.tree.sha, recursive: true)
Book.transaction do
genbook(code) do |filename|
file_handle = repo_tree.tree.detect { |tree| tree[:path] == filename }
if file_handle
blob_content[file_handle[:sha]]
end
end
repo_head = @octokit.ref(repo, "heads/master").object[:sha]

book = Book.where(edition: 2, code: code).first_or_create
book.ebook_html = repo_head
book.ebook_html = repo_head.sha

begin
rel = @octokit.latest_release(repo)
Expand Down
4 changes: 2 additions & 2 deletions lib/tasks/index.rake
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def github_index_doc(index_fun, repo)
tags = tags.select { |t| t.name == tagname }
end
else
tags=[Struct.new(:name).new("heads/master")]
tags=[Struct.new(:name).new("HEAD")]
end
tags.collect do |tag|
# extract metadata
Expand Down Expand Up @@ -340,7 +340,7 @@ def local_index_doc(index_fun)
tags = tags.select { |t| t == tagname }
end
else
tags=["master"]
tags=["HEAD"]
end
tags.collect do |tag|
# extract metadata
Expand Down