Skip to content

Commit 86f121b

Browse files
committed
change organization of the files
fix typos and missing cross-refs.
1 parent add9929 commit 86f121b

File tree

293 files changed

+1132
-896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

293 files changed

+1132
-896
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ progit.pdfmarks
99
progit.epub
1010
progit-kf8.epub
1111
progit.mobi
12-
/images/
12+

book/A-git-in-other-environments/1-git-other-environments.asc renamed to A-git-in-other-environments.asc

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

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

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

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

2425

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

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

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

3132
//////////////////////////
3233
=== Summary

book/B-embedding-git/1-embedding-git.asc renamed to B-embedding-git.asc

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

19-
include::sections/command-line.asc[]
20+
include::book/B-embedding-git/sections/command-line.asc[]
2021

21-
include::sections/libgit2.asc[]
22+
include::book/B-embedding-git/sections/libgit2.asc[]
2223

23-
include::sections/jgit.asc[]
24+
include::book/B-embedding-git/sections/jgit.asc[]

book/C-git-commands/1-git-commands.asc renamed to C-git-commands.asc

+237-236
Large diffs are not rendered by default.

Gemfile

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
source 'https://rubygems.org'
22

33
gem 'rake'
4-
gem 'asciidoctor', '1.5.4'
4+
gem 'asciidoctor', '1.5.6.1'
55

66
gem 'json'
77
gem 'awesome_print'
88

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

1314
gem 'coderay'
1415
gem 'pygments.rb'
1516
gem 'thread_safe'
16-
gem 'epubcheck'
17+
gem 'epubcheck-ruby'
1718
gem 'kindlegen'
19+
20+
gem 'octokit'
21+
gem 'github_changelog_generator', github: 'Furtif/github-changelog-generator'

Rakefile

+219-16
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,233 @@
1-
namespace :book do
2-
desc 'prepare build'
3-
task :prebuild do
4-
Dir.mkdir 'images' unless Dir.exists? 'images'
5-
Dir.glob("book/*/images/*").each do |image|
6-
FileUtils.copy(image, "images/" + File.basename(image))
7-
end
1+
# coding: utf-8
2+
require 'octokit'
3+
require 'github_changelog_generator'
4+
5+
def exec_or_raise(command)
6+
puts `#{command}`
7+
if (! $?.success?)
8+
raise "'#{command}' failed"
89
end
10+
end
11+
12+
module GitHubChangelogGenerator
13+
14+
#OPTIONS = %w[ user project token date_format output
15+
# bug_prefix enhancement_prefix issue_prefix
16+
# header merge_prefix issues
17+
# add_issues_wo_labels add_pr_wo_labels
18+
# pulls filter_issues_by_milestone author
19+
# unreleased_only unreleased unreleased_label
20+
# compare_link include_labels exclude_labels
21+
# bug_labels enhancement_labels
22+
# between_tags exclude_tags exclude_tags_regex since_tag max_issues
23+
# github_site github_endpoint simple_list
24+
# future_release release_branch verbose release_url
25+
# base configure_sections add_sections]
26+
27+
def get_log(&task_block)
28+
options = Parser.default_options
29+
yield(options) if task_block
30+
31+
options[:user],options[:project] = ENV['TRAVIS_REPO_SLUG'].split('/')
32+
options[:token] = ENV['GITHUB_API_TOKEN']
33+
options[:unreleased] = false
934

35+
generator = Generator.new options
36+
generator.compound_changelog
37+
end
38+
39+
module_function :get_log
40+
end
41+
42+
namespace :book do
1043
desc 'build basic book formats'
11-
task :build => :prebuild do
44+
task :build do
45+
46+
puts "Generating contributors list"
47+
exec_or_raise("git shortlog -s --all| grep -v -E '(Straub|Chacon)' | cut -f 2- | column -c 120 > book/contributors.txt")
48+
49+
# detect if the deployment is using glob
50+
travis = File.read(".travis.yml")
51+
version_string = ENV['TRAVIS_TAG'] || '0'
52+
if travis.match(/file_glob/)
53+
progit_v = "progit_v#{version_string}"
54+
else
55+
progit_v = "progit"
56+
end
57+
text = File.read('progit.asc')
58+
new_contents = text.gsub("$$VERSION$$", version_string).gsub("$$DATE$$", Time.now.strftime("%Y-%m-%d"))
59+
File.open("#{progit_v}.asc", "w") {|file| file.puts new_contents }
60+
1261
puts "Converting to HTML..."
13-
`bundle exec asciidoctor progit.asc`
14-
puts " -- HTML output at progit.html"
62+
exec_or_raise("bundle exec asciidoctor #{progit_v}.asc")
63+
puts " -- HTML output at #{progit_v}.html"
1564

1665
puts "Converting to EPub..."
17-
`bundle exec asciidoctor-epub3 progit.asc`
18-
puts " -- Epub output at progit.epub"
66+
exec_or_raise("bundle exec asciidoctor-epub3 #{progit_v}.asc")
67+
puts " -- Epub output at #{progit_v}.epub"
68+
69+
exec_or_raise("epubcheck #{progit_v}.epub")
1970

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

77+
repo = ENV['TRAVIS_REPO_SLUG']
2478
puts "Converting to PDF... (this one takes a while)"
25-
`bundle exec asciidoctor-pdf -r asciidoctor-pdf-cjk-kai_gen_gothic -a pdf-style=KaiGenGothicKR progit.asc 2>/dev/null`
26-
puts " -- PDF output at progit.pdf"
79+
exec_or_raise("asciidoctor-pdf-cjk-kai_gen_gothic-install")
80+
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")
81+
puts " -- PDF output at #{progit_v}.pdf"
82+
end
83+
84+
desc 'tag the repo with the latest version'
85+
task :tag do
86+
api_token = ENV['GITHUB_API_TOKEN']
87+
if ((api_token) && (ENV['TRAVIS_PULL_REQUEST'] == 'false'))
88+
repo = ENV['TRAVIS_REPO_SLUG']
89+
@octokit = Octokit::Client.new(:access_token => api_token)
90+
begin
91+
last_version=@octokit.latest_release(repo).tag_name
92+
rescue
93+
last_version="2.1.-1"
94+
end
95+
new_patchlevel= last_version.split('.')[-1].to_i + 1
96+
new_version="2.1.#{new_patchlevel}"
97+
if (ENV['TRAVIS_BRANCH']=='master')
98+
obj = @octokit.create_tag(repo, new_version, "Version " + new_version,
99+
ENV['TRAVIS_COMMIT'], 'commit',
100+
'Automatic build', '[email protected]',
101+
Time.now.utc.iso8601)
102+
@octokit.create_ref(repo, "tags/#{new_version}", obj.sha)
103+
p "Created tag #{last_version}"
104+
elsif (ENV['TRAVIS_TAG'])
105+
version = ENV['TRAVIS_TAG']
106+
changelog = GitHubChangelogGenerator.get_log do |config|
107+
config[:since_tag] = last_version
108+
end
109+
credit_line = "*This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*"
110+
changelog.gsub!(credit_line, "")
111+
@octokit.create_release(repo, new_version, {:name => "v#{new_version}", :body => changelog})
112+
p "Created release #{new_version}"
113+
else
114+
p 'This only runs on a commit to master'
115+
end
116+
else
117+
p 'No interaction with GitHub'
118+
end
119+
end
120+
121+
desc 'convert book to asciidoctor compatibility'
122+
task:convert do
123+
`cp -aR ../progit2/images .`
124+
`sed -i -e 's!/images/!!' .gitignore`
125+
`git add images`
126+
`git rm -r book/*/images`
127+
128+
chapters = [
129+
["01", "introduction" ],
130+
["02", "git-basics" ],
131+
["03", "git-branching" ],
132+
["04", "git-server" ],
133+
["05", "distributed-git" ],
134+
["06", "github" ],
135+
["07", "git-tools" ],
136+
["08", "customizing-git" ],
137+
["09", "git-and-other-scms" ],
138+
["10", "git-internals" ],
139+
["A", "git-in-other-environments" ],
140+
["B", "embedding-git" ],
141+
["C", "git-commands" ]
142+
]
143+
144+
crossrefs = {}
145+
chapters.each { | num, title |
146+
if num =~ /[ABC]/
147+
chap = "#{num}-#{title}"
148+
else
149+
chap = "ch#{num}-#{title}"
150+
end
151+
Dir[File.join ["book","#{num}-#{title}" , "sections","*.asc"]].map { |filename|
152+
File.read(filename).scan(/\[\[(.*?)\]\]/)
153+
}.flatten.each { |ref|
154+
crossrefs[ref] = "#{chap}"
155+
}
156+
}
157+
158+
headrefs = {}
159+
chapters.each { | num, title |
160+
if num =~ /[ABC]/
161+
chap = "#{num}-#{title}"
162+
else
163+
chap = "ch#{num}-#{title}"
164+
end
165+
Dir[File.join ["book","#{num}-#{title}", "*.asc"]].map { |filename|
166+
File.read(filename).scan(/\[\[([_a-z0-9]*?)\]\]/)
167+
}.flatten.each { |ref|
168+
headrefs[ref] = "#{chap}"
169+
}
170+
}
171+
172+
# transform all internal cross refs
173+
chapters.each { | num, title |
174+
if num =~ /[ABC]/
175+
chap = "#{num}-#{title}"
176+
else
177+
chap = "ch#{num}-#{title}"
178+
end
179+
files = Dir[File.join ["book","#{num}-#{title}" , "sections","*.asc"]] +
180+
Dir[File.join ["book","#{num}-#{title}" ,"1-*.asc"]]
181+
p files
182+
files.each { |filename|
183+
content = File.read(filename)
184+
new_contents = content.gsub(/\[\[([_a-z0-9]*?)\]\]/, '[[r\1]]').gsub(
185+
"&rarr;", "→").gsub(/<<([_a-z0-9]*?)>>/) { |match|
186+
ch = crossrefs[$1]
187+
h = headrefs[$1]
188+
# p " #{match} -> #{ch}, #{h}"
189+
if ch
190+
# if local do not add the file
191+
if ch==chap
192+
"<<r#{$1}>>"
193+
else
194+
"<<#{ch}#r#{$1}>>"
195+
end
196+
elsif h
197+
if h==chap
198+
"<<#{chap}>>"
199+
else
200+
"<<#{h}##{h}>>"
201+
end
202+
else
203+
p "could not match xref #{$1}"
204+
"<<#{$1}>>"
205+
end
206+
}
207+
File.open(filename, "w") {|file| file.puts new_contents }
208+
}
209+
}
210+
211+
chapters.each { | num, title |
212+
if num =~ /[ABC]/
213+
chap = "#{num}-#{title}"
214+
else
215+
chap = "ch#{num}-#{title}"
216+
end
217+
Dir[File.join ["book","#{num}-#{title}" ,"1*.asc"]].map { |filename|
218+
content = File.read (filename)
219+
new_contents = content.gsub(/include::(.*?)asc/) {|match|
220+
"include::book/#{num}-#{title}/#{$1}asc"}
221+
`git rm -f #{filename}`
222+
File.open("#{chap}.asc", "w") {|file|
223+
file.puts "[##{chap}]\n"
224+
file.puts new_contents }
225+
`git add "#{chap}.asc"`
226+
}
227+
}
27228
end
28229
end
29230

231+
232+
30233
task :default => "book:build"

book/01-introduction/sections/basics.asc

+7-7
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ image::images/snapshots.png[시간순으로 프로젝트의 스냅샷을 저장.
5959
This is an important distinction between Git and nearly all other VCSs.
6060
It makes Git reconsider almost every aspect of version control that most other systems copied from the previous generation.
6161
This makes Git more like a mini filesystem with some incredibly powerful tools built on top of it, rather than simply a VCS.
62-
We'll explore some of the benefits you gain by thinking of your data this way when we cover Git branching in <<_git_branching>>.
62+
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>>.
6363
//////////////////////////
6464
이것이 Git이 다른 VCS와 구분되는 점이다.
6565
이점 때문에 Git은 다른 시스템들이 과거로부터 답습해왔던 버전 컨트롤의 개념과 다르다는 것이고 많은 부분을 새로운 관점에서 바라본다.
6666
Git은 강력한 도구를 지원하는 작은 파일시스템이다. Git은 단순한 VCS가 아니다.
67-
<<_git_branching>>에서 설명할 Git 브랜치를 사용하면 얻게 되는 이득이 무엇인지 설명한다.
67+
<<ch03-git-branching#ch03-git-branching>>에서 설명할 Git 브랜치를 사용하면 얻게 되는 이득이 무엇인지 설명한다.
6868
6969
//////////////////////////
7070
==== Nearly Every Operation Is Local
@@ -156,10 +156,10 @@ Git으로 무얼 하든 Git 데이터베이스에 데이터가 추가된다.
156156
157157
//////////////////////////
158158
This makes using Git a joy because we know we can experiment without the danger of severely screwing things up.
159-
For a more in-depth look at how Git stores its data and how you can recover data that seems lost, see <<_undoing>>.
159+
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>>.
160160
//////////////////////////
161161
Git을 사용하면 프로젝트가 심각하게 망가질 걱정 없이 매우 즐겁게 여러 가지 실험을 해 볼 수 있다.
162-
<<_undoing>>을 보면 Git에서 데이터를 어떻게 저장하고 손실을 어떻게 복구하는지 알 수 있다.
162+
<<ch02-git-basics#r_undoing>>을 보면 Git에서 데이터를 어떻게 저장하고 손실을 어떻게 복구하는지 알 수 있다.
163163
164164
//////////////////////////
165165
==== The Three States
@@ -212,7 +212,7 @@ The staging area is a file, generally contained in your Git directory, that stor
212212
It's sometimes referred to as the ``index'', but it's also common to refer to it as the staging area.
213213
//////////////////////////
214214
Staging Area는 Git 디렉토리에 있다. 단순한 파일이고 곧 커밋할 파일에 대한 정보를 저장한다.
215-
종종 ``Index``라고 불리기도 하지만, Staging Area라는 명칭이 표준이 되어가고 있다.
215+
종종 ``Index'' 라고 불리기도 하지만, Staging Area라는 명칭이 표준이 되어가고 있다.
216216
217217
//////////////////////////
218218
The basic Git workflow goes something like this:
@@ -232,9 +232,9 @@ Git으로 하는 일은 기본적으로 아래와 같다.
232232
If a particular version of a file is in the Git directory, it's considered committed.
233233
If it has been modified but was added to the staging area, it is staged.
234234
And if it was changed since it was checked out but has not been staged, it is modified.
235-
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.
235+
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.
236236
//////////////////////////
237237
Git 디렉토리에 있는 파일들은 Committed 상태이다.
238238
파일을 수정하고 Staging Area에 추가했다면 Staged이다.
239239
그리고 Checkout 하고 나서 수정했지만, 아직 Staging Area에 추가하지 않았으면 Modified이다.
240-
<<_git_basics_chapter>>에서 이 상태에 대해 좀 더 자세히 배운다. 특히 Staging Area를 이용하는 방법부터 아예 생략하는 방법까지도 설명한다.
240+
<<ch02-git-basics#ch02-git-basics>>에서 이 상태에 대해 좀 더 자세히 배운다. 특히 Staging Area를 이용하는 방법부터 아예 생략하는 방법까지도 설명한다.

book/01-introduction/sections/first-time-setup.asc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[[_first_time]]
1+
[[r_first_time]]
22
//////////////////////////
33
=== First-Time Git Setup
44
//////////////////////////

book/01-introduction/sections/help.asc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[[_git_help]]
1+
[[r_git_help]]
22
//////////////////////////
33
=== Getting Help
44
//////////////////////////

0 commit comments

Comments
 (0)