narkisr-snipplr 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/interface/bash_api.rb +5 -2
- metadata +2 -2
data/lib/interface/bash_api.rb
CHANGED
@@ -2,6 +2,9 @@ require "model/snipplr_entry"
|
|
2
2
|
require 'rubygems'
|
3
3
|
require 'optiflag'
|
4
4
|
require 'fileutils'
|
5
|
+
|
6
|
+
HashRegexp=/\:\w*\s*\=\>\s*\'(\w|\s|\-)*\'/
|
7
|
+
|
5
8
|
META_DESC=<<END
|
6
9
|
|
7
10
|
The meta data of a new entry in the following form:
|
@@ -31,8 +34,8 @@ module Snipplr extend OptiFlagSet
|
|
31
34
|
description META_DESC
|
32
35
|
validates_against do |f,errors|
|
33
36
|
begin
|
34
|
-
|
35
|
-
hash.
|
37
|
+
raise SyntaxError.new if f.value.split(',').find{|he|!HashRegexp.match(he)}
|
38
|
+
hash=eval('{'+f.value+'}')
|
36
39
|
missing_value=[:title ,:tags ,:language].find{|sym| !hash.has_key?(sym)}
|
37
40
|
errors<< "You must pass #{missing_value} value in the meta values" if missing_value
|
38
41
|
rescue SyntaxError => e
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: narkisr-snipplr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronen Narkis
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-12 00:00:00 -07:00
|
13
13
|
default_executable: snipplr
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|