yaml_command 0.1.0 → 0.1.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bd14765c4b9ae102ae3622ee561bcfc58336a685
4
+ data.tar.gz: 44dfcac00ad6cfb59b88646cfc50b0567088ade9
5
+ SHA512:
6
+ metadata.gz: 40fa853c61b8c86aaf1e5d3843c1aeb45213b4365df070531690e0cd9c195455c2e17d90d7d2d3aa5f5f4c268383dccf90aabb7a491bd21a0a5968e74c07defc
7
+ data.tar.gz: 1c550231c07f6eea0fa3f499c40f9aa4fe5fe6a295b644a4ff323a45c4099b8d22a13fa053ccc98c06c5449960f235aa90962af8a7e6c3e6421b846ca1b0306c
data/.index CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
- type: ruby
3
2
  revision: 2013
3
+ type: ruby
4
4
  sources:
5
5
  - Index.yml
6
6
  authors:
@@ -11,10 +11,6 @@ organizations:
11
11
  requirements:
12
12
  - name: ansi
13
13
  - name: executable
14
- - groups:
15
- - build
16
- development: true
17
- name: detroit
18
14
  - groups:
19
15
  - test
20
16
  development: true
@@ -42,17 +38,19 @@ repositories:
42
38
  scm: git
43
39
  uri: git://github.com/rubyworks/yaml_command.git
44
40
  categories: []
45
- load_path:
46
- - lib
47
41
  copyrights:
48
42
  - holder: RubyWorks
49
43
  year: '2011'
50
44
  license: BSD-2-Clause
45
+ customs: []
46
+ paths:
47
+ lib:
48
+ - lib
51
49
  name: yaml_command
52
50
  title: YAML Command
53
- version: 0.1.0
51
+ version: 0.1.1
54
52
  summary: Command-line access to YAML files.
55
53
  description: YAML Command provides a command line interface to teasing apart and reconstructing
56
54
  YAML files.
57
55
  created: '2011-10-22'
58
- date: '2012-12-12'
56
+ date: '2014-08-23'
data/HISTORY.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # RELEASE HISTORY
2
2
 
3
+ ## 0.1.1 / 2014-08-23
4
+
5
+ This release simply contains an accumilation of small changes made over
6
+ the last two years addressing issues raised.
7
+
8
+ Changes:
9
+
10
+ * Make sure input is valid YAML. (Alexey Zakhlestin)
11
+ * Set now supports any YAML key and value.
12
+
13
+
3
14
  ## 0.1.0 / 2012-12-12
4
15
 
5
16
  The project has been renamed `yaml-command` instead of the
data/README.md CHANGED
@@ -15,6 +15,10 @@ for a standardized `yaml` command line tool. While this early
15
15
  implementation is written in Ruby, ultimately the final version
16
16
  would be written in C and be widely available.
17
17
 
18
+ IMPORTANT NOTE! YPath is not yet implemented so only simple name
19
+ references can be used at this point.
20
+
21
+
18
22
  ## Usage
19
23
 
20
24
  Commands are invoked on the command line with:
@@ -30,8 +34,8 @@ The following commands are currently supported:
30
34
  it to stdout.
31
35
 
32
36
  * **set** <br/>
33
- The `set` commnd is the opposite of `get` in that it lets you change
34
- a portion of a YAML file. By defult the changed YAML document will go
37
+ The `set` command is the opposite of `get` in that it lets you change
38
+ a portion of a YAML file. By default the changed YAML document will go
35
39
  to stdout, using the `-s/--save` option rewrites the file with the change.
36
40
 
37
41
  * **sort** <br/>
@@ -41,7 +45,7 @@ The following commands are currently supported:
41
45
  The `slurp` command takes a directory and converts it's contents into a YAML file.
42
46
 
43
47
  * **splat** <br/>
44
- The `splat` command take a YAML file and converts it into a file directory structure.
48
+ The `splat` command takes a YAML file and converts it into a file directory structure.
45
49
  It is essentially the opposite of slurp.
46
50
 
47
51
  * **edit** <br/>
@@ -70,7 +74,7 @@ All (or nearly all) commands support the following options.
70
74
  Output results in JSON format.
71
75
 
72
76
  * **-m** / **--mute** <br/>
73
- Surpress all output.
77
+ Suppress all output.
74
78
 
75
79
  * **-f** / **--force** <br/>
76
80
  Used to force overwrites when necessary.
@@ -79,16 +83,38 @@ All (or nearly all) commands support the following options.
79
83
  Turn on debug mode to get detailed error report if there is a problem.
80
84
 
81
85
 
82
- ## Requirements
86
+ ## Installation
87
+
88
+ ### Ruby Interpreter
89
+
90
+ The `yaml` command is a Ruby script, so you will need a Ruby interpreter installed on your system.
91
+ There are a few of these now, such as Rubinius, JRuby and the original MRI. The latter is the typical
92
+ choice, and usually can be installed via your operating system's package manager. For example, on
93
+ dpkg-based systems like Ubuntu, you can type in a shell console:
94
+
95
+ $ apt-get install ruby
96
+
97
+ ### Using RubyGems
98
+
99
+ With Ruby installed, the easiest way to install a Ruby library is via RubyGems. To install YAML Command
100
+ just type:
101
+
102
+ $ gem install yaml_command
103
+
104
+ ### Requirements
105
+
106
+ YAML Command requires the following other packages be installed:
83
107
 
84
108
  * [Executable](http://rubyworks.github.com/executable) library handle CLI parsing.
85
109
  * [ANSI](http://rubyworks.github.com/ansi) library provides console colorization.
86
110
 
111
+ If you are using RubyGems these will be install automatically.
112
+
87
113
 
88
114
  ## Copyrights
89
115
 
90
116
  Copyright (c) 2011 Rubyworks. All rights reserved.
91
117
 
92
- YAML Comamnd may be distributed in accordance with the **BSD-2-Clause** license.
118
+ YAML Command may be distributed in accordance with the **BSD-2-Clause** license.
93
119
 
94
120
  See the LICENSE.txt file for details.
data/bin/yaml CHANGED
@@ -2,7 +2,7 @@
2
2
  require 'yaml_command'
3
3
  begin
4
4
  YAMLCommand::Command.run(ARGV)
5
- rescue Exception => error
5
+ rescue StandardError => error
6
6
  raise if $DEBUG
7
7
  puts error
8
8
  end
@@ -1,6 +1,6 @@
1
1
  ---
2
- type: ruby
3
2
  revision: 2013
3
+ type: ruby
4
4
  sources:
5
5
  - Index.yml
6
6
  authors:
@@ -11,10 +11,6 @@ organizations:
11
11
  requirements:
12
12
  - name: ansi
13
13
  - name: executable
14
- - groups:
15
- - build
16
- development: true
17
- name: detroit
18
14
  - groups:
19
15
  - test
20
16
  development: true
@@ -42,17 +38,19 @@ repositories:
42
38
  scm: git
43
39
  uri: git://github.com/rubyworks/yaml_command.git
44
40
  categories: []
45
- load_path:
46
- - lib
47
41
  copyrights:
48
42
  - holder: RubyWorks
49
43
  year: '2011'
50
44
  license: BSD-2-Clause
45
+ customs: []
46
+ paths:
47
+ lib:
48
+ - lib
51
49
  name: yaml_command
52
50
  title: YAML Command
53
- version: 0.1.0
51
+ version: 0.1.1
54
52
  summary: Command-line access to YAML files.
55
53
  description: YAML Command provides a command line interface to teasing apart and reconstructing
56
54
  YAML files.
57
55
  created: '2011-10-22'
58
- date: '2012-12-12'
56
+ date: '2014-08-23'
@@ -86,7 +86,7 @@ module YAMLCommand
86
86
  exit
87
87
  end
88
88
 
89
- # YAML Command Language
89
+ # YAML Command
90
90
  def call
91
91
  if file
92
92
  output(data)
@@ -95,7 +95,7 @@ module YAMLCommand
95
95
  end
96
96
  end
97
97
 
98
- #protected
98
+ protected
99
99
 
100
100
  #
101
101
  def data=(data)
@@ -3,7 +3,10 @@ module YAMLCommand
3
3
  class Command::SetCommand < Command
4
4
 
5
5
  # Set an indexed value of a YAML document.
6
- def call(name, new_value)
6
+ def call(name, value)
7
+ name = yaml_value(name) if String === name
8
+ new_value = yaml_value(value) if String === name
9
+
7
10
  case data
8
11
  when Array
9
12
  raise ArgumentError unless name.to_s =~ /d+/
@@ -19,6 +22,9 @@ module YAMLCommand
19
22
  key = name.to_sym
20
23
  old_value = data[key]
21
24
  data[key] = new_value
25
+ else
26
+ old_value = nil
27
+ data[name] = new_value
22
28
  end
23
29
  else
24
30
  raise NotImplementedError
@@ -28,7 +34,11 @@ module YAMLCommand
28
34
  #TODO: save
29
35
  output data
30
36
  end
37
+ end
31
38
 
39
+ #
40
+ def yaml_value(value)
41
+ YAML.load(value)
32
42
  end
33
43
 
34
44
  end
@@ -1,8 +1,10 @@
1
1
  module YAMLCommand
2
2
 
3
- # TODO: View could use a better implmentation, it is very simplistic
3
+ # TODO: View could use a better implementation, it is very simplistic
4
4
  # at this point.
5
5
 
6
+ # TODO: Color coordinate matching achors and references.
7
+
6
8
  # TODO: Should view make a YAML stream if given multiple files ?
7
9
 
8
10
 
@@ -30,6 +32,9 @@ module YAMLCommand
30
32
  end
31
33
  end
32
34
 
35
+ # Make sure it is valid YAML.
36
+ YAML.load(text)
37
+
33
38
  text.each_line do |line|
34
39
  case line
35
40
  when /^---/
metadata CHANGED
@@ -1,78 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml_command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Thomas Sawyer
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-12 00:00:00.000000000 Z
11
+ date: 2014-08-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: ansi
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: executable
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: detroit
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
38
+ - - '>='
60
39
  - !ruby/object:Gem::Version
61
40
  version: '0'
62
41
  - !ruby/object:Gem::Dependency
63
42
  name: qed
64
43
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
44
  requirements:
67
- - - ! '>='
45
+ - - '>='
68
46
  - !ruby/object:Gem::Version
69
47
  version: '0'
70
48
  type: :development
71
49
  prerelease: false
72
50
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
51
  requirements:
75
- - - ! '>='
52
+ - - '>='
76
53
  - !ruby/object:Gem::Version
77
54
  version: '0'
78
55
  description: YAML Command provides a command line interface to teasing apart and reconstructing
@@ -84,8 +61,8 @@ executables:
84
61
  extensions: []
85
62
  extra_rdoc_files:
86
63
  - LICENSE.txt
87
- - HISTORY.md
88
64
  - README.md
65
+ - HISTORY.md
89
66
  files:
90
67
  - .index
91
68
  - bin/yaml
@@ -126,26 +103,26 @@ files:
126
103
  homepage: http://rubyworks.github.com/yaml_command
127
104
  licenses:
128
105
  - BSD-2-Clause
106
+ metadata: {}
129
107
  post_install_message:
130
108
  rdoc_options: []
131
109
  require_paths:
132
110
  - lib
133
111
  required_ruby_version: !ruby/object:Gem::Requirement
134
- none: false
135
112
  requirements:
136
- - - ! '>='
113
+ - - '>='
137
114
  - !ruby/object:Gem::Version
138
115
  version: '0'
139
116
  required_rubygems_version: !ruby/object:Gem::Requirement
140
- none: false
141
117
  requirements:
142
- - - ! '>='
118
+ - - '>='
143
119
  - !ruby/object:Gem::Version
144
120
  version: '0'
145
121
  requirements: []
146
122
  rubyforge_project:
147
- rubygems_version: 1.8.23
123
+ rubygems_version: 2.0.3
148
124
  signing_key:
149
- specification_version: 3
125
+ specification_version: 4
150
126
  summary: Command-line access to YAML files.
151
127
  test_files: []
128
+ has_rdoc: