hx 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/.gitignore +22 -0
  2. data/VERSION +1 -1
  3. data/lib/hx/cli.rb +17 -0
  4. metadata +12 -11
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
22
+ hx.gemspec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.10.0
data/lib/hx/cli.rb CHANGED
@@ -26,6 +26,10 @@ require 'ostruct'
26
26
  require 'optparse'
27
27
  require 'pathname'
28
28
  require 'tempfile'
29
+ require 'webrick'
30
+ require 'rack'
31
+ require 'rack/handler/webrick'
32
+ require 'hx/rack/application'
29
33
 
30
34
  module Hx
31
35
  module CLI
@@ -43,6 +47,7 @@ Usage: hx [--config CONFIG_FILE] [upgen]
43
47
  hx [--config CONFIG_FILE] post[up] SOURCE:PATH
44
48
  hx [--config CONFIG_FILE] edit[up] SOURCE:PATH
45
49
  hx [--config CONFIG_FILE] list SOURCE:PATTERN
50
+ hx [--config CONFIG_FILE] serve [PORT]
46
51
 
47
52
  EOS
48
53
 
@@ -96,6 +101,18 @@ EOS
96
101
  m.call(site, *args)
97
102
  end
98
103
 
104
+ def self.cmd_serve(site, port=nil)
105
+ server = WEBrick::HTTPServer.new({:Port => port || 0})
106
+ real_port = server.config[:Port]
107
+ base_url = "http://localhost:#{real_port}/"
108
+ server.logger.info "Serving on #{base_url}"
109
+ site.options[:base_url] = base_url
110
+ app = Hx::Rack::Application.new(site, site.options)
111
+ server.mount('/', ::Rack::Handler::WEBrick, app)
112
+ %w(INT TERM).each { |s| trap(s) { server.shutdown } }
113
+ server.start
114
+ end
115
+
99
116
  def self.cmd_regen(site)
100
117
  do_gen(site, false)
101
118
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hx
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 55
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 9
8
+ - 10
9
9
  - 0
10
- version: 0.9.0
10
+ version: 0.10.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - MenTaLguY
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-14 00:00:00 -08:00
18
+ date: 2011-03-01 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -50,6 +50,7 @@ extra_rdoc_files:
50
50
  - README.rdoc
51
51
  files:
52
52
  - .document
53
+ - .gitignore
53
54
  - LICENSE
54
55
  - README.rdoc
55
56
  - Rakefile
@@ -85,8 +86,8 @@ homepage: http://github.com/mental/hx
85
86
  licenses: []
86
87
 
87
88
  post_install_message:
88
- rdoc_options: []
89
-
89
+ rdoc_options:
90
+ - --charset=UTF-8
90
91
  require_paths:
91
92
  - lib
92
93
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -115,14 +116,14 @@ signing_key:
115
116
  specification_version: 3
116
117
  summary: A miniature static site generator.
117
118
  test_files:
119
+ - spec/spec_helper.rb
120
+ - spec/rawfiles_spec.rb
118
121
  - spec/cache_spec.rb
119
122
  - spec/hx_dummy.rb
120
- - spec/hx_dummy2.rb
121
123
  - spec/nullinput_spec.rb
124
+ - spec/site_spec.rb
125
+ - spec/hx_dummy2.rb
126
+ - spec/rack_spec.rb
122
127
  - spec/overlay_spec.rb
123
128
  - spec/pathops_spec.rb
124
- - spec/rack_spec.rb
125
- - spec/rawfiles_spec.rb
126
129
  - spec/selector_spec.rb
127
- - spec/site_spec.rb
128
- - spec/spec_helper.rb