serb 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +5 -0
  2. data/bin/serb +12 -4
  3. data/serb.gemspec +1 -1
  4. metadata +4 -4
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  Use serb to interactively generate an output file from an erb template.
2
2
 
3
+ ## Usage
4
+
3
5
  template.txt.erb
4
6
 
5
7
  Hello, <%= name %>
@@ -12,3 +14,6 @@ Usage
12
14
  $ cat template.txt
13
15
  Hello, Daniel
14
16
 
17
+ ## Installation
18
+
19
+ gem install serb
data/bin/serb CHANGED
@@ -15,14 +15,22 @@ class SerbLocals < OpenStruct
15
15
  binding
16
16
  end
17
17
 
18
- def method_missing(name, *args, &block)
18
+ def method_missing(var, *args, &block)
19
19
  super
20
- return define_variable(name) if args.empty?
20
+ if args.empty?
21
+ value = SerbLocals.get_input(var)
22
+ self.send("#{var}=", value)
23
+ return value
24
+ end
21
25
  end
22
26
 
23
- private
27
+ def self.const_missing(var)
28
+ value = SerbLocals.get_input(var)
29
+ const_set(var, value)
30
+ return value
31
+ end
24
32
 
25
- def define_variable(var)
33
+ def self.get_input(var)
26
34
  print "Define \"#{var}\": "
27
35
  return gets.chomp
28
36
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "serb"
3
- s.version = "0.1.1"
3
+ s.version = "0.1.2"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">=0") if s.respond_to? :required_rubygems_version=
6
6
  s.specification_version = 2 if s.respond_to? :specification_version=
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel MacDougall
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-14 00:00:00 -07:00
18
+ date: 2011-05-15 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21