Skip to content

Commit

Permalink
change organization of the files
Browse files Browse the repository at this point in the history
fix typos and missing cross-refs.
  • Loading branch information
jnavila committed Feb 24, 2018
1 parent add9929 commit 86f121b
Show file tree
Hide file tree
Showing 293 changed files with 1,132 additions and 896 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ progit.pdfmarks
progit.epub
progit-kf8.epub
progit.mobi
/images/

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[#A-git-in-other-environments]
[appendix]
//////////////////////////
== Git in Other Environments
Expand All @@ -15,18 +16,18 @@ Now we'll take a look at some of the other kinds of environments where Git can b
Git은 CLI말고 다른 도구로도 사용할 수 있다. CLI는 Git 생태계의 한 부분일 뿐이고 터미널이 진리인 것도 아니다.
이 장에서는 다른 환경에서 Git을 어떻게 사용할 수 있는지 살펴보고 어떤 Git 애플리케이션이 있는지도 소개한다.

include::sections/guis.asc[]
include::book/A-git-in-other-environments/sections/guis.asc[]

include::sections/visualstudio.asc[]
include::book/A-git-in-other-environments/sections/visualstudio.asc[]

include::sections/eclipse.asc[]
include::book/A-git-in-other-environments/sections/eclipse.asc[]


include::sections/bash.asc[]
include::book/A-git-in-other-environments/sections/bash.asc[]

include::sections/zsh.asc[]
include::book/A-git-in-other-environments/sections/zsh.asc[]

include::sections/powershell.asc[]
include::book/A-git-in-other-environments/sections/powershell.asc[]

//////////////////////////
=== Summary
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[#B-embedding-git]
[appendix]
//////////////////////////
== Embedding Git in your Applications
Expand All @@ -16,8 +17,8 @@ If you need to integrate Git with your application, you have essentially three c
//////////////////////////
Git을 지원하는 애플리케이션을 만들 때는 세 가지 방법의 하나를 선택할 수 있다. 쉘 명령어를 실행시키거나 Libgit2를 사용하거나 JGit을 사용한다.

include::sections/command-line.asc[]
include::book/B-embedding-git/sections/command-line.asc[]

include::sections/libgit2.asc[]
include::book/B-embedding-git/sections/libgit2.asc[]

include::sections/jgit.asc[]
include::book/B-embedding-git/sections/jgit.asc[]
473 changes: 237 additions & 236 deletions book/C-git-commands/1-git-commands.asc → C-git-commands.asc

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
source 'https://rubygems.org'

gem 'rake'
gem 'asciidoctor', '1.5.4'
gem 'asciidoctor', '1.5.6.1'

gem 'json'
gem 'awesome_print'

gem 'asciidoctor-epub3', '1.5.0.alpha.6'
gem 'asciidoctor-pdf', '1.5.0.alpha.11'
gem 'asciidoctor-pdf-cjk-kai_gen_gothic', '0.1.1'
gem 'asciidoctor-epub3', :git => 'https://github.com/asciidoctor/asciidoctor-epub3'
gem 'asciidoctor-pdf', '1.5.0.alpha.16'
gem 'asciidoctor-pdf-cjk', '~> 0.1.3'
gem 'asciidoctor-pdf-cjk-kai_gen_gothic', '~> 0.1.1'

gem 'coderay'
gem 'pygments.rb'
gem 'thread_safe'
gem 'epubcheck'
gem 'epubcheck-ruby'
gem 'kindlegen'

gem 'octokit'
gem 'github_changelog_generator', github: 'Furtif/github-changelog-generator'
235 changes: 219 additions & 16 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,233 @@
namespace :book do
desc 'prepare build'
task :prebuild do
Dir.mkdir 'images' unless Dir.exists? 'images'
Dir.glob("book/*/images/*").each do |image|
FileUtils.copy(image, "images/" + File.basename(image))
end
# coding: utf-8
require 'octokit'
require 'github_changelog_generator'

def exec_or_raise(command)
puts `#{command}`
if (! $?.success?)
raise "'#{command}' failed"
end
end

module GitHubChangelogGenerator

#OPTIONS = %w[ user project token date_format output
# bug_prefix enhancement_prefix issue_prefix
# header merge_prefix issues
# add_issues_wo_labels add_pr_wo_labels
# pulls filter_issues_by_milestone author
# unreleased_only unreleased unreleased_label
# compare_link include_labels exclude_labels
# bug_labels enhancement_labels
# between_tags exclude_tags exclude_tags_regex since_tag max_issues
# github_site github_endpoint simple_list
# future_release release_branch verbose release_url
# base configure_sections add_sections]

def get_log(&task_block)
options = Parser.default_options
yield(options) if task_block

options[:user],options[:project] = ENV['TRAVIS_REPO_SLUG'].split('/')
options[:token] = ENV['GITHUB_API_TOKEN']
options[:unreleased] = false

generator = Generator.new options
generator.compound_changelog
end

module_function :get_log
end

namespace :book do
desc 'build basic book formats'
task :build => :prebuild do
task :build do

puts "Generating contributors list"
exec_or_raise("git shortlog -s --all| grep -v -E '(Straub|Chacon)' | cut -f 2- | column -c 120 > book/contributors.txt")

# detect if the deployment is using glob
travis = File.read(".travis.yml")
version_string = ENV['TRAVIS_TAG'] || '0'
if travis.match(/file_glob/)
progit_v = "progit_v#{version_string}"
else
progit_v = "progit"
end
text = File.read('progit.asc')
new_contents = text.gsub("$$VERSION$$", version_string).gsub("$$DATE$$", Time.now.strftime("%Y-%m-%d"))
File.open("#{progit_v}.asc", "w") {|file| file.puts new_contents }

puts "Converting to HTML..."
`bundle exec asciidoctor progit.asc`
puts " -- HTML output at progit.html"
exec_or_raise("bundle exec asciidoctor #{progit_v}.asc")
puts " -- HTML output at #{progit_v}.html"

puts "Converting to EPub..."
`bundle exec asciidoctor-epub3 progit.asc`
puts " -- Epub output at progit.epub"
exec_or_raise("bundle exec asciidoctor-epub3 #{progit_v}.asc")
puts " -- Epub output at #{progit_v}.epub"

exec_or_raise("epubcheck #{progit_v}.epub")

puts "Converting to Mobi (kf8)..."
`bundle exec asciidoctor-epub3 -a ebook-format=kf8 progit.asc`
puts " -- Mobi output at progit.mobi"
exec_or_raise("bundle exec asciidoctor-epub3 -a ebook-format=kf8 #{progit_v}.asc")
# remove the fake epub that would shadow the really one
exec_or_raise("rm progit*kf8.epub")
puts " -- Mobi output at #{progit_v}.mobi"

repo = ENV['TRAVIS_REPO_SLUG']
puts "Converting to PDF... (this one takes a while)"
`bundle exec asciidoctor-pdf -r asciidoctor-pdf-cjk-kai_gen_gothic -a pdf-style=KaiGenGothicKR progit.asc 2>/dev/null`
puts " -- PDF output at progit.pdf"
exec_or_raise("asciidoctor-pdf-cjk-kai_gen_gothic-install")
exec_or_raise("bundle exec asciidoctor-pdf -r asciidoctor-pdf-cjk -r asciidoctor-pdf-cjk-kai_gen_gothic -a pdf-style=KaiGenGothicKR #{progit_v}.asc")
puts " -- PDF output at #{progit_v}.pdf"
end

desc 'tag the repo with the latest version'
task :tag do
api_token = ENV['GITHUB_API_TOKEN']
if ((api_token) && (ENV['TRAVIS_PULL_REQUEST'] == 'false'))
repo = ENV['TRAVIS_REPO_SLUG']
@octokit = Octokit::Client.new(:access_token => api_token)
begin
last_version=@octokit.latest_release(repo).tag_name
rescue
last_version="2.1.-1"
end
new_patchlevel= last_version.split('.')[-1].to_i + 1
new_version="2.1.#{new_patchlevel}"
if (ENV['TRAVIS_BRANCH']=='master')
obj = @octokit.create_tag(repo, new_version, "Version " + new_version,
ENV['TRAVIS_COMMIT'], 'commit',
'Automatic build', '[email protected]',
Time.now.utc.iso8601)
@octokit.create_ref(repo, "tags/#{new_version}", obj.sha)
p "Created tag #{last_version}"
elsif (ENV['TRAVIS_TAG'])
version = ENV['TRAVIS_TAG']
changelog = GitHubChangelogGenerator.get_log do |config|
config[:since_tag] = last_version
end
credit_line = "*This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*"
changelog.gsub!(credit_line, "")
@octokit.create_release(repo, new_version, {:name => "v#{new_version}", :body => changelog})
p "Created release #{new_version}"
else
p 'This only runs on a commit to master'
end
else
p 'No interaction with GitHub'
end
end

desc 'convert book to asciidoctor compatibility'
task:convert do
`cp -aR ../progit2/images .`
`sed -i -e 's!/images/!!' .gitignore`
`git add images`
`git rm -r book/*/images`

chapters = [
["01", "introduction" ],
["02", "git-basics" ],
["03", "git-branching" ],
["04", "git-server" ],
["05", "distributed-git" ],
["06", "github" ],
["07", "git-tools" ],
["08", "customizing-git" ],
["09", "git-and-other-scms" ],
["10", "git-internals" ],
["A", "git-in-other-environments" ],
["B", "embedding-git" ],
["C", "git-commands" ]
]

crossrefs = {}
chapters.each { | num, title |
if num =~ /[ABC]/
chap = "#{num}-#{title}"
else
chap = "ch#{num}-#{title}"
end
Dir[File.join ["book","#{num}-#{title}" , "sections","*.asc"]].map { |filename|
File.read(filename).scan(/\[\[(.*?)\]\]/)
}.flatten.each { |ref|
crossrefs[ref] = "#{chap}"
}
}

headrefs = {}
chapters.each { | num, title |
if num =~ /[ABC]/
chap = "#{num}-#{title}"
else
chap = "ch#{num}-#{title}"
end
Dir[File.join ["book","#{num}-#{title}", "*.asc"]].map { |filename|
File.read(filename).scan(/\[\[([_a-z0-9]*?)\]\]/)
}.flatten.each { |ref|
headrefs[ref] = "#{chap}"
}
}

# transform all internal cross refs
chapters.each { | num, title |
if num =~ /[ABC]/
chap = "#{num}-#{title}"
else
chap = "ch#{num}-#{title}"
end
files = Dir[File.join ["book","#{num}-#{title}" , "sections","*.asc"]] +
Dir[File.join ["book","#{num}-#{title}" ,"1-*.asc"]]
p files
files.each { |filename|
content = File.read(filename)
new_contents = content.gsub(/\[\[([_a-z0-9]*?)\]\]/, '[[r\1]]').gsub(
"&rarr;", "→").gsub(/<<([_a-z0-9]*?)>>/) { |match|
ch = crossrefs[$1]
h = headrefs[$1]
# p " #{match} -> #{ch}, #{h}"
if ch
# if local do not add the file
if ch==chap
"<<r#{$1}>>"
else
"<<#{ch}#r#{$1}>>"
end
elsif h
if h==chap
"<<#{chap}>>"
else
"<<#{h}##{h}>>"
end
else
p "could not match xref #{$1}"
"<<#{$1}>>"
end
}
File.open(filename, "w") {|file| file.puts new_contents }
}
}

chapters.each { | num, title |
if num =~ /[ABC]/
chap = "#{num}-#{title}"
else
chap = "ch#{num}-#{title}"
end
Dir[File.join ["book","#{num}-#{title}" ,"1*.asc"]].map { |filename|
content = File.read (filename)
new_contents = content.gsub(/include::(.*?)asc/) {|match|
"include::book/#{num}-#{title}/#{$1}asc"}
`git rm -f #{filename}`
File.open("#{chap}.asc", "w") {|file|
file.puts "[##{chap}]\n"
file.puts new_contents }
`git add "#{chap}.asc"`
}
}
end
end



task :default => "book:build"
14 changes: 7 additions & 7 deletions book/01-introduction/sections/basics.asc
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ image::images/snapshots.png[시간순으로 프로젝트의 스냅샷을 저장.
This is an important distinction between Git and nearly all other VCSs.
It makes Git reconsider almost every aspect of version control that most other systems copied from the previous generation.
This makes Git more like a mini filesystem with some incredibly powerful tools built on top of it, rather than simply a VCS.
We'll explore some of the benefits you gain by thinking of your data this way when we cover Git branching in <<_git_branching>>.
We'll explore some of the benefits you gain by thinking of your data this way when we cover Git branching in <<ch03-git-branching#ch03-git-branching>>.
//////////////////////////
이것이 Git이 다른 VCS와 구분되는 점이다.
이점 때문에 Git은 다른 시스템들이 과거로부터 답습해왔던 버전 컨트롤의 개념과 다르다는 것이고 많은 부분을 새로운 관점에서 바라본다.
Git은 강력한 도구를 지원하는 작은 파일시스템이다. Git은 단순한 VCS가 아니다.
<<_git_branching>>에서 설명할 Git 브랜치를 사용하면 얻게 되는 이득이 무엇인지 설명한다.
<<ch03-git-branching#ch03-git-branching>>에서 설명할 Git 브랜치를 사용하면 얻게 되는 이득이 무엇인지 설명한다.
//////////////////////////
==== Nearly Every Operation Is Local
Expand Down Expand Up @@ -156,10 +156,10 @@ Git으로 무얼 하든 Git 데이터베이스에 데이터가 추가된다.
//////////////////////////
This makes using Git a joy because we know we can experiment without the danger of severely screwing things up.
For a more in-depth look at how Git stores its data and how you can recover data that seems lost, see <<_undoing>>.
For a more in-depth look at how Git stores its data and how you can recover data that seems lost, see <<ch02-git-basics#r_undoing>>.
//////////////////////////
Git을 사용하면 프로젝트가 심각하게 망가질 걱정 없이 매우 즐겁게 여러 가지 실험을 해 볼 수 있다.
<<_undoing>>을 보면 Git에서 데이터를 어떻게 저장하고 손실을 어떻게 복구하는지 알 수 있다.
<<ch02-git-basics#r_undoing>>을 보면 Git에서 데이터를 어떻게 저장하고 손실을 어떻게 복구하는지 알 수 있다.
//////////////////////////
==== The Three States
Expand Down Expand Up @@ -212,7 +212,7 @@ The staging area is a file, generally contained in your Git directory, that stor
It's sometimes referred to as the ``index'', but it's also common to refer to it as the staging area.
//////////////////////////
Staging Area는 Git 디렉토리에 있다. 단순한 파일이고 곧 커밋할 파일에 대한 정보를 저장한다.
종종 ``Index``라고 불리기도 하지만, Staging Area라는 명칭이 표준이 되어가고 있다.
종종 ``Index'' 라고 불리기도 하지만, Staging Area라는 명칭이 표준이 되어가고 있다.
//////////////////////////
The basic Git workflow goes something like this:
Expand All @@ -232,9 +232,9 @@ Git으로 하는 일은 기본적으로 아래와 같다.
If a particular version of a file is in the Git directory, it's considered committed.
If it has been modified but was added to the staging area, it is staged.
And if it was changed since it was checked out but has not been staged, it is modified.
In <<_git_basics_chapter>>, you'll learn more about these states and how you can either take advantage of them or skip the staged part entirely.
In <<ch02-git-basics#ch02-git-basics>>, you'll learn more about these states and how you can either take advantage of them or skip the staged part entirely.
//////////////////////////
Git 디렉토리에 있는 파일들은 Committed 상태이다.
파일을 수정하고 Staging Area에 추가했다면 Staged이다.
그리고 Checkout 하고 나서 수정했지만, 아직 Staging Area에 추가하지 않았으면 Modified이다.
<<_git_basics_chapter>>에서 이 상태에 대해 좀 더 자세히 배운다. 특히 Staging Area를 이용하는 방법부터 아예 생략하는 방법까지도 설명한다.
<<ch02-git-basics#ch02-git-basics>>에서 이 상태에 대해 좀 더 자세히 배운다. 특히 Staging Area를 이용하는 방법부터 아예 생략하는 방법까지도 설명한다.
2 changes: 1 addition & 1 deletion book/01-introduction/sections/first-time-setup.asc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[[_first_time]]
[[r_first_time]]
//////////////////////////
=== First-Time Git Setup
//////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion book/01-introduction/sections/help.asc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[[_git_help]]
[[r_git_help]]
//////////////////////////
=== Getting Help
//////////////////////////
Expand Down
Loading

0 comments on commit 86f121b

Please sign in to comment.