snaptoken 0.20.0 → 0.21.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: 1fe965284492ad49b9d3bebd2b91e34c2c8500ab
4
- data.tar.gz: d437d4a1291efa2e02012fec122f0a7c4bb3a923
3
+ metadata.gz: 5732a03e103535a0b8cc6bb03fdd9d3f8e0e51ac
4
+ data.tar.gz: 109ad0fdef8fef34e41c8e4d3650e07926daa4e4
5
5
  SHA512:
6
- metadata.gz: 0b8628f7ec5d77ec35c810cb27b0361da74bf4d007ba38f9e6ea0011bb562492c82e5c993965f07ea55d131fb5ee0ab9294cec866e37200185031bf7250f507b
7
- data.tar.gz: df1904475d297fb6ee708a2a173a30e0738a497f17b3c9c6ee30fdc94f08ef2a153472826b0f1f78b75f0027d2e9984d4c1c694d65809c87bb4e023e67b2fe7e
6
+ metadata.gz: fb0722a5833263147c8bbf89c13b506829e6e963497136411348de04487f2fafdd1bf00a01f71a96b520abfa46ba68638b7a33c335e5f4743bbeb8e0f2fecc81
7
+ data.tar.gz: e4fcbe58bac981544cfb8181161f2ac1d0653ef1828067e07efd6273f031e0a6bfe86af365e5220f60f45133850ce2a399b05f1c46baa5136f3f6e1352d9fa08
data/lib/snaptoken/cli.rb CHANGED
@@ -9,10 +9,11 @@ class Snaptoken::CLI
9
9
  while FileUtils.pwd != last_dir
10
10
  if File.exist?(CONFIG_FILE)
11
11
  @config = YAML.load(File.read(CONFIG_FILE))
12
- unless @config.is_a? Hash
12
+ if @config == false
13
13
  puts "Error: Invalid config file."
14
14
  exit!
15
15
  end
16
+ @config = {} unless @config.is_a?(Hash)
16
17
  @config[:path] = FileUtils.pwd
17
18
  @config[:step_path] = last_dir2
18
19
  @config[:orig_path] = initial_dir
@@ -17,12 +17,6 @@ class Snaptoken::Commands::BaseCommand
17
17
  true: "You are not in a leg working directory.",
18
18
  false: "You are already in a leg working directory."
19
19
  },
20
- config_name: {
21
- true: "You need to set a name in leg.yml."
22
- },
23
- config_title: {
24
- true: "You need to set a title in leg.yml."
25
- },
26
20
  steps_folder: {
27
21
  true: "There is no steps folder.",
28
22
  false: "There is already a steps folder."
@@ -60,10 +54,6 @@ class Snaptoken::Commands::BaseCommand
60
54
  case what
61
55
  when :config
62
56
  valid = true if @config
63
- when :config_name
64
- valid = true if @config[:name]
65
- when :config_title
66
- valid = true if @config[:title]
67
57
  when :steps_folder
68
58
  valid = true if File.exist?(File.join(@config[:path], "steps"))
69
59
  when :steps
@@ -8,7 +8,7 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
8
8
  end
9
9
 
10
10
  def run
11
- needs! :config, :config_name, :config_title, :steps_folder, :steps, :doc
11
+ needs! :config, :steps_folder, :steps, :doc
12
12
 
13
13
  FileUtils.cd(File.join(@config[:path], "doc")) do
14
14
  FileUtils.rm_rf("html_out")
@@ -135,7 +135,7 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
135
135
  html = html_template.dup
136
136
  end
137
137
 
138
- html.gsub!("{{title}}") { "Table of contents | #{@config[:title]}" }
138
+ html.gsub!("{{title}}") { @config[:title] }
139
139
  html.gsub!("{{prev_link}}") { "<a href='#'></a>" }
140
140
  html.gsub!("{{next_link}}") { "<a href='#{pages.first}.html'>next &rarr;</a>" }
141
141
  html.gsub!("{{version}}") { @config[:version] }
@@ -146,7 +146,7 @@ class Snaptoken::Commands::Doc < Snaptoken::Commands::BaseCommand
146
146
  end
147
147
 
148
148
  def create_archive
149
- name = "kilo-tutorial-#{@config[:version]}"
149
+ name = "#{@config[:name]}-tutorial-#{@config[:version]}"
150
150
 
151
151
  FileUtils.mv("html_offline", name)
152
152
 
@@ -101,7 +101,7 @@ class Snaptoken::Diff
101
101
  formatter = Rouge::Formatters::HTML.new
102
102
  formatter = HTMLLineByLine.new(formatter)
103
103
 
104
- lexer = Rouge::Lexer.guess(filename: @filename)
104
+ lexer = Rouge::Lexer.guess(filename: @filename, source: @file_contents)
105
105
  code_hl = formatter.format(lexer.lex(@file_contents)).lines.each(&:chomp!)
106
106
 
107
107
  html = ""
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.20.0
4
+ version: 0.21.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-04-06 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged