nwn-lib 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -93,3 +93,15 @@ Bernhard Stoeckner <elven@swordcoast.net> (6):
93
93
  doc: update BINARIES, CHEATSHEET
94
94
  nwn-gff-import: fix reading stdin as -
95
95
  0.3.5-rel
96
+
97
+ === 0.3.6
98
+ Bernhard Stoeckner <elven@swordcoast.net> (5):
99
+ NWN::Gff::Struct: do not sort yaml_properties
100
+ kivinen_format: print out structs in sorted order
101
+ nwn-gff-irb: support for reading/writing .yml files
102
+ NWN::Gff::Gff: do not sort yaml_properties
103
+ Rakefile: use gem1.8 instead of gem
104
+ 0.3.6-rel
105
+
106
+ Stuart Coyle <stuart.coyle@gmail.com> (1):
107
+ TwoDA: use four spaces for field separation instead of tabs, indent columns
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ include FileUtils
9
9
  # Configuration
10
10
  ##############################################################################
11
11
  NAME = "nwn-lib"
12
- VERS = "0.3.5"
12
+ VERS = "0.3.6"
13
13
  CLEAN.include ["**/.*.sw?", "pkg", ".config", "rdoc", "coverage"]
14
14
  RDOC_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', \
15
15
  'nwn-lib: a ruby library for accessing NWN resource files', \
@@ -52,18 +52,18 @@ end
52
52
  desc "Install nwn-lib gem"
53
53
  task :install do
54
54
  sh %{rake package}
55
- sh %{sudo gem install pkg/#{NAME}-#{VERS}}
55
+ sh %{sudo gem1.8 install pkg/#{NAME}-#{VERS}}
56
56
  end
57
57
 
58
58
  desc "Install nwn-lib gem without docs"
59
59
  task :install_no_docs do
60
60
  sh %{rake package}
61
- sh %{sudo gem install pkg/#{NAME}-#{VERS} --no-rdoc --no-ri}
61
+ sh %{sudo gem1.8 install pkg/#{NAME}-#{VERS} --no-rdoc --no-ri}
62
62
  end
63
63
 
64
64
  desc "Uninstall nwn-lib gem"
65
65
  task :uninstall => [:clean] do
66
- sh %{sudo gem uninstall #{NAME}}
66
+ sh %{sudo gem1.8 uninstall #{NAME}}
67
67
  end
68
68
 
69
69
  desc "Upload nwn-lib gem to rubyforge"
File without changes
@@ -23,12 +23,20 @@ else
23
23
  end
24
24
  $file = File.expand_path(file)
25
25
 
26
- GFF = NWN::Gff::Reader.read(bytes)
26
+ if File.extname($file) == ".yml"
27
+ GFF = YAML.load(bytes)
28
+ else
29
+ GFF = NWN::Gff::Reader.read(bytes)
30
+ end
27
31
 
28
32
  def save destination = nil
29
33
  destination ||= $file
30
34
  puts "Saving to ´#{destination}' .."
31
- bytes = NWN::Gff::Writer.dump(GFF)
35
+ if File.extname($file) == ".yml"
36
+ bytes = GFF.to_yaml
37
+ else
38
+ bytes = NWN::Gff::Writer.dump(GFF)
39
+ end
32
40
  File.open(destination, "w") {|f|
33
41
  f.write(bytes)
34
42
  }
File without changes
@@ -95,7 +95,7 @@ module NWN
95
95
  case s.type
96
96
  when :struct
97
97
  yield(prefix + " ____struct_type", struct_id.nil? ? s.value.struct_id : struct_id) if types_too
98
- s.value.each {|k,v|
98
+ s.value.sort.each {|k,v|
99
99
  kivinen_format v, prefix + s.label + (s.label == "" ? "" : "/"), types_too do |l,v|
100
100
  yield(l, v)
101
101
  end
@@ -163,6 +163,16 @@ class NWN::Gff::Gff
163
163
  @hash
164
164
  end
165
165
 
166
+ def to_yaml( opts = {} )
167
+ YAML::quick_emit( self, opts ) do |out|
168
+ out.map( taguri, to_yaml_style ) do |map|
169
+ to_yaml_properties.each do |m|
170
+ map.add( m[1..-1], instance_variable_get( m ) )
171
+ end
172
+ end
173
+ end
174
+ end
175
+
166
176
  # A simple accessor that can be used to
167
177
  # retrieve or set properties in the struct, delimited by slashes.
168
178
  #
@@ -412,7 +422,7 @@ class NWN::Gff::Struct
412
422
  NWN::Gff::Element::NonInline.index(x.type)
413
423
  }.size == 0
414
424
 
415
- to_yaml_properties.sort.each do |m|
425
+ to_yaml_properties.each do |m|
416
426
  map.add( m[1..-1], instance_variable_get( m ) ) # unless instance_variable_get( m ).nil?
417
427
  end
418
428
  end
@@ -122,9 +122,9 @@ module NWN
122
122
  ret = []
123
123
  ret << "2DA V2.0"
124
124
  ret << ""
125
- ret << @columns.join("\t")
125
+ ret << " " + @columns.join(" ")
126
126
  @rows.each_with_index {|row, idx|
127
- ret << [idx].concat(row).join("\t")
127
+ ret << [idx].concat(row).join(" ")
128
128
  }
129
129
  ret.join("\r\n")
130
130
  end
metadata CHANGED
@@ -1,33 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0
3
- specification_version: 1
4
2
  name: nwn-lib
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.3.5
7
- date: 2008-08-11 00:00:00 +02:00
8
- summary: a ruby library for accessing Neverwinter Nights resource files
9
- require_paths:
10
- - lib
11
- email: elven@swordcoast.net
12
- homepage: http://nwn-lib.elv.es
13
- rubyforge_project: nwn-lib
14
- description: a ruby library for accessing Neverwinter Nights resource files
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.8.4
24
- version:
4
+ version: 0.3.6
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Bernhard Stoeckner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-10 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: a ruby library for accessing Neverwinter Nights resource files
17
+ email: elven@swordcoast.net
18
+ executables:
19
+ - nwn-gff-print
20
+ - nwn-gff-irb
21
+ - nwn-gff-import
22
+ extensions: []
23
+
24
+ extra_rdoc_files:
25
+ - README
26
+ - BINARIES
27
+ - CHEATSHEET
28
+ - CHANGELOG
29
+ - COPYING
31
30
  files:
32
31
  - COPYING
33
32
  - CHANGELOG
@@ -45,8 +44,9 @@ files:
45
44
  - lib/nwn/helpers.rb
46
45
  - BINARIES
47
46
  - CHEATSHEET
48
- test_files: []
49
-
47
+ has_rdoc: true
48
+ homepage: http://nwn-lib.elv.es
49
+ post_install_message:
50
50
  rdoc_options:
51
51
  - --quiet
52
52
  - --line-numbers
@@ -57,19 +57,26 @@ rdoc_options:
57
57
  - README
58
58
  - --exclude
59
59
  - ^(examples|extras)/
60
- extra_rdoc_files:
61
- - README
62
- - BINARIES
63
- - CHEATSHEET
64
- - CHANGELOG
65
- - COPYING
66
- executables:
67
- - nwn-gff-print
68
- - nwn-gff-irb
69
- - nwn-gff-import
70
- extensions: []
71
-
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 1.8.4
67
+ version:
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "0"
73
+ version:
72
74
  requirements: []
73
75
 
74
- dependencies: []
76
+ rubyforge_project: nwn-lib
77
+ rubygems_version: 1.3.0
78
+ signing_key:
79
+ specification_version: 2
80
+ summary: a ruby library for accessing Neverwinter Nights resource files
81
+ test_files: []
75
82