rack-blogengine 0.0.5 → 0.0.6

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: d327885342532b11ebb39c4c878b76e3757e0b72
4
- data.tar.gz: a50c577d31309b8cd1cccb10e686cc5cabba8576
3
+ metadata.gz: 9db5da82e83eb236a86e369e4e161d853c0934d2
4
+ data.tar.gz: 11ccce1b61bc92a6b2275407884b1a41ccdee2af
5
5
  SHA512:
6
- metadata.gz: e9ab94168c4386de3e18c07118a38abd42964e6189aa9c37f15375f750097c14614d45704c96be68a484b5c38929f9c5de20111f158c1d63356b3abdcf27fa24
7
- data.tar.gz: ce9313f3058948e4b8441516473da47c6a546464eb71c6bba9f1184237a3389678ea08d957b1c1080c2d46c534da8b5cd6dd6a462f3a261ad3278ce03b66eb2a
6
+ metadata.gz: 89ec6a8b8508d10078c12a025de15de3fe40175fb5de11d6196d28bb56ae6bf73c5c9fe58c611db55238edd17edf3307ab8778fa400f324c584f52d5cdb992ae
7
+ data.tar.gz: a09b762e2d637e37bffaeff1171efb08aa2f793ee287d83307fb941b72cd07c13c68be1c976968f39c66aabb63c94726684f385f4ea208650009550d979c82e3
data/bin/rack-blogengine CHANGED
@@ -1,38 +1,22 @@
1
1
  #!/usr/bin/env ruby
2
- require 'rack/blogengine'
3
- require 'rack'
2
+ require 'rack/blogengine/command_line_interface'
4
3
 
5
4
 
6
- command = ARGV[0]
5
+ command = ARGV[0].to_sym
7
6
 
8
- if ARGV[1]
9
- target = ARGV[1]
10
- else
11
- target = "";
12
- end
13
7
 
14
- if command == "run"
15
- #To stuff here
16
- unless target.empty?
17
- $targetfolder = target
18
- app = Rack::Builder.new do
19
- use Rack::CommonLogger
20
- use Rack::ShowExceptions
8
+ target = ARGV[1]
9
+ target = "" if !ARGV[1]
21
10
 
22
- map "/assets" do
23
- run Rack::Directory.new("#{$targetfolder}/assets")
24
- end
25
11
 
26
- use Rack::Lint
27
- run Rack::Blogengine::Application
28
- end
12
+ cli = Rack::Blogengine::CommandLineInterface.new
13
+ methods = Rack::Blogengine::CommandLineInterface.instance_methods(false)
29
14
 
30
- Rack::Server.start( :app => app )
31
- else
32
- puts "Specify a targetfolder!"
33
- end
34
- else
35
- puts "Use rake-blogengine run!"
15
+ begin
16
+ cli.send(command, target)
17
+ rescue TypeError
18
+ puts "Available commands are #{methods}"
19
+ rescue NoMethodError
20
+ puts "Available commands are #{methods}"
36
21
  end
37
-
38
22
 
@@ -0,0 +1,35 @@
1
+ require 'rack'
2
+ require 'rack/blogengine'
3
+
4
+ module Rack
5
+ module Blogengine
6
+ class CommandLineInterface
7
+ # Method to run the cli command
8
+ # @param [String] target
9
+ def run(target)
10
+ unless target.empty?
11
+ $targetfolder = target
12
+ app = Rack::Builder.new do
13
+ use Rack::CommonLogger
14
+ use Rack::ShowExceptions
15
+
16
+ map "/assets" do
17
+ run Rack::Directory.new("#{$targetfolder}/assets")
18
+ end
19
+
20
+ use Rack::Lint
21
+ run Rack::Blogengine::Application
22
+ end
23
+
24
+ Rack::Server.start( :app => app, :Port => 3000 )
25
+ else
26
+ puts "Specify a targetfolder!"
27
+ end
28
+ end
29
+
30
+ # TODO write generate method to generate blog skeleton (assets, layout etc)
31
+ def generate(folder)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  module Blogengine
3
- VERSION = "0.0.5".freeze
3
+ VERSION = "0.0.6".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-blogengine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benny1992
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-11 00:00:00.000000000 Z
11
+ date: 2013-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,6 +83,7 @@ files:
83
83
  - lib/rack/blogengine.rb
84
84
  - lib/rack/blogengine/application.rb
85
85
  - lib/rack/blogengine/application_router.rb
86
+ - lib/rack/blogengine/command_line_interface.rb
86
87
  - lib/rack/blogengine/doc_parser.rb
87
88
  - lib/rack/blogengine/version.rb
88
89
  - rack-blogengine.gemspec