madness 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dadff00fee43c6ea58e44609fb742b110efcbea6
4
- data.tar.gz: 9848f143341d6eca6c1ff992e4eee297f7c86cb8
3
+ metadata.gz: 14bbd2ee1af23197d85f0bcf860e60427a8649d3
4
+ data.tar.gz: 5da1263cd2eeb2bae35eff8fb890f93373029c89
5
5
  SHA512:
6
- metadata.gz: 62b95fede3b14d95b58d7e0bf40ee443624769977263b000afa899c969efb7aa0deab3307a400cc3dcd903c9e496e9b4c7fc3399c4197654e0800eec257a1be4
7
- data.tar.gz: dcf13061a53c804639638763e216b4599b78b675cb25c99f7d0dae6f54dc1e29a3817e41d0e585f4b7835cd86d8baa20802a84ac12a9dc6dac0a11930b4d1418
6
+ metadata.gz: 97c3567ea71a545b739211c0fc640df165ee7fc0b24feb7cd03757cb8b79e2afc83407f6130e1db1990cf78b1b5911285f3feb34a6aac36a741d6dc3d88c969c
7
+ data.tar.gz: 6f6c10c43eef42c130a6286589ac77fee130998cfdeeffd793bc1a0f4c82df589696785d66ec25ba77fb39842a03d2a7fc8417d33bfdda96f77aff09850f4b60
data/README.md CHANGED
@@ -86,6 +86,7 @@ bind: '0.0.0.0'
86
86
  autoh1: true
87
87
  highlighter: true
88
88
  line_numbers: true
89
+ index: false
89
90
  ```
90
91
 
91
92
 
@@ -5,14 +5,9 @@ module Madness
5
5
  include Singleton
6
6
  include Colsole
7
7
 
8
- # Without any argument, we run the server in the current directory.
9
- # Otherwise, we will set some options before executing.
8
+ # Launch the server
10
9
  def execute(argv=[])
11
- if argv.empty?
12
- launch_server
13
- else
14
- launch_server_with_options argv
15
- end
10
+ launch_server_with_options argv
16
11
  end
17
12
 
18
13
  private
@@ -24,11 +19,10 @@ module Madness
24
19
  begin
25
20
  args = Docopt::docopt(doc, argv: argv, version: VERSION)
26
21
  set_config args
27
- if args['--index']
28
- build_index
29
- else
30
- launch_server
31
- end
22
+
23
+ build_index if config.index
24
+ launch_server unless args['--and-quit']
25
+
32
26
  rescue Docopt::Exit => e
33
27
  puts e.message
34
28
  end
@@ -42,7 +36,7 @@ module Madness
42
36
  STDERR.puts "Invalid path (#{config.path})"
43
37
  return
44
38
  end
45
-
39
+
46
40
  show_status
47
41
  Server.prepare
48
42
  Server.run!
@@ -57,6 +51,7 @@ module Madness
57
51
  config.autoh1 = false if args['--no-auto-h1']
58
52
  config.highlighter = false if args['--no-syntax']
59
53
  config.line_numbers = false if args['--no-line-numbers']
54
+ config.index = true if args['--index']
60
55
  end
61
56
 
62
57
  # Say hello to everybody when the server starts, showing the known
@@ -64,7 +59,7 @@ module Madness
64
59
  def show_status
65
60
  say_status :start, 'the madness'
66
61
  say_status :listen, "#{config.bind}:#{config.port}", :txtblu
67
- say_status :path, config.path, :txtblu
62
+ say_status :path, File.realpath(config.path), :txtblu
68
63
  say_status :use, config.filename if config.file_exist?
69
64
  say "-" * 40
70
65
  end
@@ -29,8 +29,12 @@ Options:
29
29
  --index
30
30
  Build or rebuild the index for the search page.
31
31
 
32
+ --and-quit
33
+ Quit after building the index (applicable only with --index).
34
+
32
35
  Examples:
33
36
  madness
34
37
  madness docs
35
38
  madness docs --no-auto-h1 -p 4567
39
+ madness --index --and-quit
36
40
 
@@ -10,7 +10,7 @@ module Madness
10
10
  include Singleton
11
11
 
12
12
  attr_accessor :port, :bind, :path, :autoh1,
13
- :highlighter, :line_numbers
13
+ :highlighter, :line_numbers, :index
14
14
 
15
15
  def initialize
16
16
  reset
@@ -41,6 +41,7 @@ module Madness
41
41
  self.autoh1 = true
42
42
  self.highlighter = true
43
43
  self.line_numbers = true
44
+ self.index = false
44
45
  end
45
46
 
46
47
  def load_from_file
@@ -1,3 +1,3 @@
1
1
  module Madness
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: madness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-26 00:00:00.000000000 Z
11
+ date: 2016-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -328,7 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
328
  version: '0'
329
329
  requirements: []
330
330
  rubyforge_project:
331
- rubygems_version: 2.5.1
331
+ rubygems_version: 2.6.6
332
332
  signing_key:
333
333
  specification_version: 4
334
334
  summary: Instant Markdown Server