tagen 0.2.3 → 0.2.4

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.
@@ -1,12 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- guten (0.0.1)
4
+ tagen (0.2.3)
5
+ activesupport
6
+ pd
5
7
 
6
8
  GEM
7
9
  remote: http://rubygems.org/
8
10
  specs:
11
+ activesupport (3.0.5)
9
12
  diff-lcs (1.1.2)
13
+ pd (1.0.1)
10
14
  rspec (2.4.0)
11
15
  rspec-core (~> 2.4.0)
12
16
  rspec-expectations (~> 2.4.0)
@@ -20,5 +24,5 @@ PLATFORMS
20
24
  ruby
21
25
 
22
26
  DEPENDENCIES
23
- guten!
24
27
  rspec
28
+ tagen!
@@ -21,10 +21,13 @@ module ClassMethods::Path
21
21
  get(path).sub(%r!^#{Regexp.escape(ENV["HOME"])}!, "~")
22
22
  end
23
23
 
24
- # print current work directory
24
+ # return current work directory
25
25
  # @return [String] path
26
26
  def pwd() Dir.getwd end
27
27
 
28
+ # @return [Pa] path
29
+ def pwd2() Pa(Dir.getwd) end
30
+
28
31
  # change directory
29
32
  #
30
33
  # @param [String,Pa] path
@@ -230,12 +233,12 @@ module Path
230
233
 
231
234
  def initialize_variables
232
235
  super
233
- @absolute = Pa.absolute(@path)
234
- @dir = Pa.dirname(@path)
235
- @base = Pa.basename(@path)
236
- @name, @ext = Pa.basename(@path, ext: true)
236
+ @absolute = File.absolute_path(@path)
237
+ @dir = File.dirname(@path)
238
+ @base = File.basename(@path)
239
+ @name, @ext = @base.match(NAME_EXT_PAT).captures
240
+ @ext ||= ""
237
241
  @fext = @ext.empty? ? "" : "."+@ext
238
- @short = Pa.shorten(@path)
239
242
  end
240
243
 
241
244
  alias a absolute
@@ -245,12 +248,17 @@ module Path
245
248
  alias e ext
246
249
  alias fe fext
247
250
 
251
+ def short
252
+ @short ||= Pa.shorten(@path)
253
+ end
254
+
248
255
  # @return [Pa] absolute path
249
- def absolute_path() Pa(absolute) end
256
+ def absolute2() @absolute2 ||= Pa(absolute) end
257
+
250
258
  # @return [Pa] dirname
251
259
  # @example
252
260
  # Pa(__FILE__).dirname.join('.opts')
253
- def dirname() Pa(dir) end
261
+ def dir2() @dir2 ||= Pa(dir) end
254
262
 
255
263
  # add string to path
256
264
  #
@@ -23,7 +23,7 @@ class ERB
23
23
  @locals = locals
24
24
  evalstr = <<-EOF
25
25
  def run_erb
26
- #{locals.map{|k,v| "#{k} = @locals[:#{k}]"}.join(';')}
26
+ #{locals.map{|k,v| %~#{k} = @locals[ #{Symbol===k ? ':' : ''}'#{k}' ]~}.join(';')}
27
27
  #{self.src}
28
28
  _erbout
29
29
  end
@@ -1,6 +1,25 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe Pa do
4
+
5
+ describe "#dir2" do
6
+ it "runs ok" do
7
+ Pa('/home/foo').dir2.should be_an_instance_of Pa
8
+ end
9
+ end
10
+
11
+ describe "#absoulte2" do
12
+ it "runs ok" do
13
+ Pa('.').absolute2.should be_an_instance_of Pa
14
+ end
15
+ end
16
+
17
+ describe "pwd2" do
18
+ it "runs ok" do
19
+ Pa.pwd2.should be_an_instance_of Pa
20
+ end
21
+ end
22
+
4
23
  describe ".shorten" do
5
24
  it "short /home/usr/file into ~/file" do
6
25
  ENV["HOME"] = "/home/foo"
@@ -15,5 +15,10 @@ describe ERB do
15
15
  it "runs ok with local " do
16
16
  @erb.result(nil, a: 2).should == "2"
17
17
  end
18
+
19
+ it "support string as key in locals" do
20
+ @erb.result(nil, "a" => 2).should == "2"
21
+ end
22
+
18
23
  end
19
24
  end
data/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module VERSION
2
2
  MAJOR = 0
3
3
  MINOR = 2
4
- PATCH = 3
4
+ PATCH = 4
5
5
 
6
6
  IS = [MAJOR, MINOR, PATCH].join(".")
7
7
  end
metadata CHANGED
@@ -1,8 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tagen
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.2.3
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 4
9
+ version: 0.2.4
6
10
  platform: ruby
7
11
  authors:
8
12
  - Guten
@@ -10,7 +14,7 @@ autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
16
 
13
- date: 2011-03-19 00:00:00 +08:00
17
+ date: 2011-03-20 00:00:00 +08:00
14
18
  default_executable:
15
19
  dependencies:
16
20
  - !ruby/object:Gem::Dependency
@@ -21,6 +25,8 @@ dependencies:
21
25
  requirements:
22
26
  - - ">="
23
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
24
30
  version: "0"
25
31
  type: :runtime
26
32
  version_requirements: *id001
@@ -32,6 +38,8 @@ dependencies:
32
38
  requirements:
33
39
  - - ">="
34
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
35
43
  version: "0"
36
44
  type: :runtime
37
45
  version_requirements: *id002
@@ -124,17 +132,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
132
  requirements:
125
133
  - - ">="
126
134
  - !ruby/object:Gem::Version
135
+ segments:
136
+ - 0
127
137
  version: "0"
128
138
  required_rubygems_version: !ruby/object:Gem::Requirement
129
139
  none: false
130
140
  requirements:
131
141
  - - ">="
132
142
  - !ruby/object:Gem::Version
143
+ segments:
144
+ - 0
133
145
  version: "0"
134
146
  requirements: []
135
147
 
136
148
  rubyforge_project: xx
137
- rubygems_version: 1.6.1
149
+ rubygems_version: 1.3.7
138
150
  signing_key:
139
151
  specification_version: 3
140
152
  summary: a core and extra extension to ruby library