snaptoken 0.24.0 → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b6525154b59c8cca1e88b42cb2368311fa54332
4
- data.tar.gz: 9651c5f3d0fd6c7936498fabe7c39e7f919f2b84
3
+ metadata.gz: 626846dd7ebd33ca6b903375b605b8474da93fec
4
+ data.tar.gz: d29d44ce3b90536e8122771b607d947f5ad72576
5
5
  SHA512:
6
- metadata.gz: 9d6f248e6a9a3e163ec598eda5fc9084e193079f36f0b2b88908d9686eaeffc897ae0dbf5a5343fbfce25bef0d61e69e43d8b43252faabfd536bc35fa8b66af1
7
- data.tar.gz: 39140694465988218f57547a027929eaa6173d75a3f3f7fcd2e0fec6cd36c6cd786ef3e3c684356c5998e99fec714496ebaff940d3ecd843d0e9290fe42bc1fa
6
+ metadata.gz: a2e8893bf535a1ddc43ed101d4b63073fc033a14e5f4ed325ed14ca773fbe5ad98f42eaa65f3cfd625f291ca9e1b1b85d7102e8bfcf4df4d463d86cc5177f3af
7
+ data.tar.gz: d52c6dc70c08969ade6fbe34f9a47dc9ab904d31906affe7c8878b0a7ece6727d2cce678c6557ae7d35b8c57d172f6b8425dded0b1caa504a162ce3f5006b702
@@ -5,7 +5,6 @@ class Snaptoken::CLI
5
5
  initial_dir = FileUtils.pwd
6
6
 
7
7
  last_dir = nil
8
- last_dir2 = nil
9
8
  while FileUtils.pwd != last_dir
10
9
  if File.exist?(CONFIG_FILE)
11
10
  @config = YAML.load(File.read(CONFIG_FILE))
@@ -15,12 +14,9 @@ class Snaptoken::CLI
15
14
  end
16
15
  @config = {} unless @config.is_a?(Hash)
17
16
  @config[:path] = FileUtils.pwd
18
- @config[:step_path] = last_dir2
19
- @config[:orig_path] = initial_dir
20
17
  break
21
18
  end
22
19
 
23
- last_dir2 = last_dir
24
20
  last_dir = FileUtils.pwd
25
21
  FileUtils.cd('..')
26
22
  end
@@ -16,7 +16,7 @@ class Snaptoken::Commands::BaseCommand
16
16
 
17
17
  def parseopts!
18
18
  parser = OptionParser.new do |o|
19
- o.banner = "Usage: leg #{self.class.name} #{self.class.usage}"
19
+ o.banner = "Usage: leg #{self.class.name} #{self.class.usage}"
20
20
  self.class.summary.split("\n").each do |line|
21
21
  o.separator " #{line}"
22
22
  end
@@ -80,31 +80,31 @@ class Snaptoken::Commands::BaseCommand
80
80
  no = Array(options[:not]).map { |w| [w, false] }
81
81
 
82
82
  (yes + no).each do |what, v|
83
- valid = false
84
- case what
85
- when :config
86
- valid = true if @config
87
- when :config_sync
88
- valid = true if %w(repo steps).include?(@config[:sync])
89
- when :steps_folder
90
- valid = true if File.exist?(File.join(@config[:path], "steps"))
91
- when :steps
92
- valid = true if steps.length > 0
93
- when :repo
94
- valid = true if File.exist?(File.join(@config[:path], "repo"))
95
- when :diff
96
- valid = true if File.exist?(File.join(@config[:path], "steps.diff"))
97
- when :doc
98
- valid = true if File.exist?(File.join(@config[:path], "doc"))
99
- when :doc_out
100
- valid = true if File.exist?(File.join(@config[:path], "doc/html_out"))
101
- when :cached_diffs
102
- valid = true if File.exist?(File.join(@config[:path], ".cached-diffs"))
103
- when :ftp
104
- valid = true if File.exist?(File.join(@config[:path], "ftp.yml"))
105
- else
106
- raise NotImplementedError
107
- end
83
+ valid =
84
+ case what
85
+ when :config
86
+ !!@config
87
+ when :config_sync
88
+ %w(repo steps).include?(@config[:sync])
89
+ when :steps_folder
90
+ File.exist?(File.join(@config[:path], "steps"))
91
+ when :steps
92
+ steps.length > 0
93
+ when :repo
94
+ File.exist?(File.join(@config[:path], "repo"))
95
+ when :diff
96
+ File.exist?(File.join(@config[:path], "steps.diff"))
97
+ when :doc
98
+ File.exist?(File.join(@config[:path], "doc"))
99
+ when :doc_out
100
+ File.exist?(File.join(@config[:path], "doc/html_out"))
101
+ when :cached_diffs
102
+ File.exist?(File.join(@config[:path], ".cached-diffs"))
103
+ when :ftp
104
+ File.exist?(File.join(@config[:path], "ftp.yml"))
105
+ else
106
+ raise NotImplementedError
107
+ end
108
108
 
109
109
  if valid != v
110
110
  puts "Error: " + ERROR_MSG[what][v.to_s.to_sym]
@@ -119,27 +119,12 @@ class Snaptoken::Commands::BaseCommand
119
119
  end.compact.sort_by(&:number)
120
120
  end
121
121
 
122
- def current_step
123
- if @config[:step_path]
124
- Snaptoken::Step.from_folder_name(File.basename(@config[:step_path]))
125
- end
126
- end
127
-
128
122
  def latest_step
129
123
  steps.last
130
124
  end
131
125
 
132
- def current_or_latest_step
133
- current_step || latest_step
134
- end
135
-
136
126
  def step_path(step)
137
127
  File.join(@config[:path], "steps", step.folder_name)
138
128
  end
139
-
140
- def select_step(step, &block)
141
- puts "Selecting step: #{step.folder_name}"
142
- FileUtils.cd(step_path(step), &block)
143
- end
144
129
  end
145
130
 
@@ -79,7 +79,7 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
79
79
 
80
80
  theme_css = theme.render(scope: ".highlight")
81
81
  if @config[:bold_weight]
82
- theme_css.gsub!("font-weight: bold;", "font-weight: #{@config[:bold_weight]}")
82
+ theme_css.gsub!("font-weight: bold;", "font-weight: #{@config[:bold_weight]};")
83
83
  end
84
84
 
85
85
  css = File.read("html_in/style.css")
@@ -104,7 +104,6 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
104
104
  print "\r\e[K[steps/ -> .cached-diffs] #{step.folder_name}" unless @opts[:quiet]
105
105
 
106
106
  diff = Snaptoken::Diff.new(@config, last_step, step)
107
-
108
107
  diffs[step.name] = diff.html.values.join("\n")
109
108
 
110
109
  last_step = step
@@ -145,7 +144,9 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
145
144
  content = markdown.render(md)
146
145
  content = Redcarpet::Render::SmartyPants.render(content)
147
146
  content.gsub!(/<\/code>&lsquo;/) { "</code>&rsquo;" }
148
- content.gsub!(/^\s*<h([23456]) id="([^"]+)">(.+)<\/h\d>$/) { "<h#{$1} id=\"#{$2}\"><a href=\"##{$2}\">#{$3}</a></h#{$1}>" }
147
+ content.gsub!(/^\s*<h([23456]) id="([^"]+)">(.+)<\/h\d>$/) {
148
+ "<h#{$1} id=\"#{$2}\"><a href=\"##{$2}\">#{$3}</a></h#{$1}>"
149
+ }
149
150
  content.gsub!(/<p>{{([\w-]+)}}<\/p>/) { diffs[$1] }
150
151
 
151
152
  html = html_template.dup
@@ -119,7 +119,7 @@ class Snaptoken::Diff
119
119
  if cur.dirty?
120
120
  to_render = cur.contents + to_render
121
121
  else
122
- summary = cur.lines.map { |n| code_hl[n] }.join(" ... ").gsub("\n", "")
122
+ summary = cur.lines.map { |n| code_hl[n] }.join(" &hellip; ").gsub("\n", "")
123
123
  html << "<div class=\"line folded\">#{summary}</div>"
124
124
  end
125
125
  elsif !cur.omit?
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.24.0
4
+ version: 0.24.1
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-04-30 00:00:00.000000000 Z
11
+ date: 2017-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 2.6.8
99
+ rubygems_version: 2.6.11
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: tools for .leg files