snaptoken 0.20.0 → 0.21.0
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 +4 -4
- data/lib/snaptoken/cli.rb +2 -1
- data/lib/snaptoken/commands/base_command.rb +0 -10
- data/lib/snaptoken/commands/doc.rb +3 -3
- data/lib/snaptoken/diff.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5732a03e103535a0b8cc6bb03fdd9d3f8e0e51ac
|
|
4
|
+
data.tar.gz: 109ad0fdef8fef34e41c8e4d3650e07926daa4e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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, :
|
|
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}}") {
|
|
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 →</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 = "
|
|
149
|
+
name = "#{@config[:name]}-tutorial-#{@config[:version]}"
|
|
150
150
|
|
|
151
151
|
FileUtils.mv("html_offline", name)
|
|
152
152
|
|
data/lib/snaptoken/diff.rb
CHANGED
|
@@ -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.
|
|
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-
|
|
11
|
+
date: 2017-04-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rugged
|