snaptoken 0.17.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ecc91e0a30895dd4821e2da35602b38a8d5d68cf
4
- data.tar.gz: 74ae9e091a3c50452c5421c8873b51993942fb3d
3
+ metadata.gz: 2cdda0b4122ad8de3618fbe31a5bb47444c4c028
4
+ data.tar.gz: 847bf9a36e8a2985abead05a23d61ea946fbb2ff
5
5
  SHA512:
6
- metadata.gz: c40cad24f4935310d55101d30ea6b84037e5393b96c38b7b9448bd5231ad65e724f170bc2a63dcaf9289ab71b2875990e440317127c33cd7914aa5c5b5d2431d
7
- data.tar.gz: 66c826b887014796a835bf0fb1c8095e79b5087f787505a1795e5757700a18b97d5cafc7e4c28fb88f52373fa05aa330c7c37cc1781d28b331c02f759867b380
6
+ metadata.gz: 80c11378a11b53fdb0d81bcd74abe044b71e608095e39328bc9b31eea958d0fef049c0ee4f02813d1366c0d376d3d4d7e69dfea1fe498f3fdd4de97e5c6b66a0
7
+ data.tar.gz: d5e76857782a44258e6dcde59d774cd480f3f237cd7201154c68a170a48c3947c9eee21ccc626441fd04a23eccb041f59a91f58e554358cdbd6fd294ceea0c08
@@ -58,8 +58,13 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
58
58
  theme.palette @config[:rouge_theme]
59
59
  end
60
60
 
61
+ theme_css = theme.render(scope: ".highlight")
62
+ if @config[:bold_weight]
63
+ theme_css.gsub!("font-weight: bold;", "font-weight: #{@config[:bold_weight]}")
64
+ end
65
+
61
66
  css = File.read("html_in/style.css")
62
- css << theme.render(scope: ".highlight")
67
+ css << theme_css
63
68
 
64
69
  File.write("html_out/style.css", css)
65
70
  end
@@ -92,6 +97,17 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
92
97
  def write_html_files(diffs)
93
98
  html_template = File.read("html_in/template.html")
94
99
 
100
+ commit_hash = nil
101
+ FileUtils.cd(@config[:path]) do
102
+ commit_hash = `git rev-parse --short HEAD`.chomp
103
+ end
104
+
105
+ if @config[:version]
106
+ version = "#{@config[:version]}-#{commit_hash}"
107
+ else
108
+ version = commit_hash
109
+ end
110
+
95
111
  index = ""
96
112
  markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
97
113
  pages = Dir["*.md"].sort.map { |f| f.sub(/\.md$/, '') }
@@ -121,6 +137,8 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
121
137
  html.gsub!("{{title}}") { "#{idx+1}. #{title} | #{@config[:title]}" }
122
138
  html.gsub!("{{prev_link}}") { prev_link }
123
139
  html.gsub!("{{next_link}}") { next_link }
140
+ html.gsub!("{{version}}") { version }
141
+ html.gsub!("{{commit}}") { commit_hash }
124
142
  html.gsub!("{{content}}") { content }
125
143
 
126
144
  File.write(File.join("html_out", "#{page}.html"), html)
@@ -139,6 +157,8 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
139
157
  html.gsub!("{{title}}") { "Table of contents | #{@config[:title]}" }
140
158
  html.gsub!("{{prev_link}}") { "<a href='#'></a>" }
141
159
  html.gsub!("{{next_link}}") { "<a href='#{pages.first}.html'>next &rarr;</a>" }
160
+ html.gsub!("{{version}}") { version }
161
+ html.gsub!("{{commit}}") { commit_hash }
142
162
  html.gsub!("{{content}}") { content }
143
163
 
144
164
  File.write("html_out/index.html", html)
@@ -49,6 +49,14 @@ class Snaptoken::Commands::Repo < Snaptoken::Commands::BaseCommand
49
49
 
50
50
  options = {}
51
51
  options[:tree] = index.write_tree(repo)
52
+ if @config[:repo_author]
53
+ options[:author] = {
54
+ name: @config[:repo_author][:name],
55
+ email: @config[:repo_author][:email],
56
+ time: Time.now
57
+ }
58
+ options[:committer] = options[:author]
59
+ end
52
60
  options[:message] = step ? step.commit_msg : "-"
53
61
  options[:parents] = repo.empty? ? [] : [repo.head.target]
54
62
  options[:update_ref] = 'HEAD'
@@ -107,9 +107,9 @@ class Snaptoken::Diff
107
107
  html = ""
108
108
  html << "<div class=\"diff\">\n"
109
109
  html << "<div class=\"diff-header\">\n"
110
- html << " <div class=\"step-filename\"><a href=\"https://github.com/snaptoken/#{config[:name]}/blob/#{step.name}/#{@filename}\">#{@filename}</a></div>\n"
110
+ html << " <div class=\"step-filename\"><a href=\"https://github.com/snaptoken/#{config[:name]}-src/blob/#{step.name}/#{@filename}\">#{@filename}</a></div>\n"
111
111
  html << " <div class=\"step-number\">Step #{step.number}</div>\n"
112
- html << " <div class=\"step-name\"><a href=\"https://github.com/snaptoken/#{config[:name]}/tree/#{step.name}\">#{step.name}</a></div>\n"
112
+ html << " <div class=\"step-name\"><a href=\"https://github.com/snaptoken/#{config[:name]}-src/tree/#{step.name}\">#{step.name}</a></div>\n"
113
113
  html << "</div>"
114
114
  html << "<pre class=\"highlight\"><code>"
115
115
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snaptoken
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Ruten
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-30 00:00:00.000000000 Z
11
+ date: 2017-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged