ytools 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,10 +1,7 @@
1
- source :rubygems
2
-
3
- gem 'choosy', '~> 0.2.4'
4
1
 
5
- group :development do
6
- gem 'rspec', :require => "spec"
7
- gem 'autotest'
8
- gem 'autotest-notification'
9
- end
2
+ require 'rubygems'
3
+ require 'choosy'
4
+ require 'rake'
10
5
 
6
+ source :rubygems
7
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,3 +1,9 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ytools (0.2.1)
5
+ choosy (>= 0.4.3)
6
+
1
7
  GEM
2
8
  remote: http://rubygems.org/
3
9
  specs:
@@ -6,7 +12,7 @@ GEM
6
12
  ZenTest (>= 4.4.1)
7
13
  autotest-notification (2.3.1)
8
14
  autotest (~> 4.3)
9
- choosy (0.2.5)
15
+ choosy (0.4.3)
10
16
  diff-lcs (1.1.2)
11
17
  rspec (2.5.0)
12
18
  rspec-core (~> 2.5.0)
@@ -21,7 +27,8 @@ PLATFORMS
21
27
  ruby
22
28
 
23
29
  DEPENDENCIES
30
+ ZenTest
24
31
  autotest
25
32
  autotest-notification
26
- choosy (~> 0.2.4)
27
33
  rspec
34
+ ytools!
data/Rakefile CHANGED
@@ -1,49 +1,17 @@
1
- $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
- $LOAD_PATH.unshift File.expand_path("../spec", __FILE__)
1
+ #$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
+ #$LOAD_PATH.unshift File.expand_path("../spec", __FILE__)
3
3
 
4
+ require 'rubygems'
4
5
  require 'fileutils'
5
6
  require 'rake'
6
- require 'rubygems'
7
7
  require 'rspec/core/rake_task'
8
- require 'ytools/version'
8
+ require 'choosy/version'
9
+ require 'choosy/rake'
9
10
 
10
11
  task :default => :spec
11
12
 
12
13
  desc "Run the RSpec tests"
13
14
  RSpec::Core::RakeTask.new
14
15
 
15
- begin
16
- require 'jeweler'
17
- Jeweler::Tasks.new do |gem|
18
- gem.name = 'ytools'
19
- gem.version = YTools::Version.to_s
20
- gem.executables = %W{ypath ytemplates}
21
- gem.summary = 'For reading or writing configuration files using YAML.'
22
- gem.description = "Installs the ypath tool for reading YAML files using an XPath-like syntax. Installs the ytemplates tool for writing ERB templates using YAML files as the template binding object."
23
- gem.email = ['madeonamac@gmail.com']
24
- gem.authors = ['Gabe McArthur']
25
- gem.homepage = 'http://github.com/gabemc/ytools'
26
- gem.files = FileList["[A-Z]*", "{bin,lib,spec}/**/*"]
27
-
28
- gem.add_dependency 'choosy', '>=0.2.5'
29
- gem.add_development_dependency 'rspec', '>=2.5.0'
30
- end
31
- rescue LoadError
32
- puts "Jeweler or dependencies are not available. Install it with: sudo gem install jeweler"
33
- end
34
-
35
- desc "Deploys the gem to rubygems.org"
36
- task :gem => :release do
37
- system("gem build ytools.gemspec")
38
- system("gem push ytools-#{YTools::Version.to_s}.gem")
39
- end
40
-
41
- desc "Does the full release cycle."
42
- task :deploy => [:gem, :clean] do
43
- end
44
-
45
16
  desc "Cleans the gem files up."
46
- task :clean do
47
- FileUtils.rm(Dir.glob('*.gemspec'))
48
- FileUtils.rm(Dir.glob('*.gem'))
49
- end
17
+ task :clean => ['gem:clean']
data/lib/VERSION.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ version:
3
+ major: 0
4
+ minor: 3
5
+ tiny: 0
6
+ date: 30/03/2011
@@ -1,6 +1,6 @@
1
1
  require 'ytools/errors'
2
2
  require 'ytools/utils'
3
- require 'ytools/version'
3
+ require 'choosy'
4
4
 
5
5
  module YTools
6
6
  class BaseCLI
@@ -33,7 +33,7 @@ module YTools
33
33
  end
34
34
  end
35
35
  boolean_ :debug, "Prints out the merged YAML as a ruby object to STDERR."
36
- version YTools::Version
36
+ version Choosy::Version.new(File.join(File.dirname(__FILE__), '..', 'VERSION.yml'))
37
37
  help
38
38
 
39
39
  arguments do
@@ -11,11 +11,11 @@ module YTools::Path
11
11
  printer :standard, :max_width => 80
12
12
  executor Executor.new
13
13
 
14
- header 'Description:'
14
+ heading 'Description:'
15
15
  para "This tool uses a kind of XPath syntax for locating and printing elements from within YAML files. Check out the '--examples' flag for details on the exact path syntax."
16
16
  para "It accepts multiple yaml files, and will merge their contents in the order in which they are given. Thus, files listed later, if their keys conflict with ones listed earlier, override the earlier listed values. If you pass in files that don't exist, no error will be raised unless the '--strict' flag is passed."
17
17
 
18
- header 'Option:'
18
+ heading 'Option:'
19
19
  string :path, "The YAML Path pattern syntax to run against the input." do
20
20
  required
21
21
  depends_on :examples
@@ -11,13 +11,13 @@ module YTools::Templates
11
11
  executor Executor.new
12
12
  printer :standard, :max_width => 80
13
13
 
14
- header 'Description:'
14
+ heading 'Description:'
15
15
  para 'This tool uses an ERB template file and a set of YAML files to generate a merged file. For convenience, all of the keys in hashes in regular YAML can work like methods in the ERB templates. Thus, the YAML "{ \'a\' : {\'b\' : 3 } }" could be used in an ERB template with "<%= a.b %>" instead of the more verbose hash syntax. Indeed, the root hash values can only be accessed by those method attributes, because the root YAML context object is simply assumed.'
16
16
  para "It accepts multiple yaml files, and will merge their contents in the order in which they are given. Thus, files listed later, if their keys conflict with ones listed earlier, override the earlier listed values. If you pass in files that don't exist, no error will be raised unless the '--strict' flag is passed."
17
17
  para "Instead of reading from the template, you can also supply an expression to evaluate from the command line."
18
18
  para "Check out the '--examples' flag for more details."
19
19
 
20
- header 'Options:'
20
+ heading 'Options:'
21
21
  string :template, "The ERB template file to use for generation" do
22
22
  depends_on :examples
23
23
 
data/lib/ytools/utils.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'optparse'
2
2
  require 'ytools/errors'
3
- require 'ytools/version'
4
3
 
5
4
  module YTools
6
5
  module Utils
@@ -17,7 +16,7 @@ module YTools
17
16
  def self.stdin?
18
17
  begin
19
18
  require 'fcntl'
20
- STDIN.fcntl(Fcntl::F_GETFL, 0) == 0 && $stdin.tty?
19
+ STDIN.fcntl(Fcntl::F_GETFL, 0) == 0 && !$stdin.tty?
21
20
  rescue
22
21
  $stdin.stat.size != 0
23
22
  end
metadata CHANGED
@@ -1,197 +1,140 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ytools
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 4
10
- version: 0.2.4
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Gabe McArthur
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-03-17 00:00:00 -07:00
12
+ date: 2011-03-30 00:00:00.000000000 -07:00
19
13
  default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
22
16
  name: choosy
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &74253030 !ruby/object:Gem::Requirement
25
18
  none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 31
30
- segments:
31
- - 0
32
- - 2
33
- - 4
34
- version: 0.2.4
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.4.3
35
23
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: rspec
39
24
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *74253030
26
+ - !ruby/object:Gem::Dependency
27
+ name: rspec
28
+ requirement: &74252610 !ruby/object:Gem::Requirement
41
29
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
49
34
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: autotest
53
35
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *74252610
37
+ - !ruby/object:Gem::Dependency
38
+ name: autotest
39
+ requirement: &74251990 !ruby/object:Gem::Requirement
55
40
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
63
45
  type: :development
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: autotest-notification
67
46
  prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *74251990
48
+ - !ruby/object:Gem::Dependency
49
+ name: autotest-notification
50
+ requirement: &74251490 !ruby/object:Gem::Requirement
69
51
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
- version: "0"
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
77
56
  type: :development
78
- version_requirements: *id004
79
- - !ruby/object:Gem::Dependency
80
- name: choosy
81
57
  prerelease: false
82
- requirement: &id005 !ruby/object:Gem::Requirement
58
+ version_requirements: *74251490
59
+ - !ruby/object:Gem::Dependency
60
+ name: ZenTest
61
+ requirement: &74251110 !ruby/object:Gem::Requirement
83
62
  none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 29
88
- segments:
89
- - 0
90
- - 2
91
- - 5
92
- version: 0.2.5
93
- type: :runtime
94
- version_requirements: *id005
95
- - !ruby/object:Gem::Dependency
96
- name: rspec
97
- prerelease: false
98
- requirement: &id006 !ruby/object:Gem::Requirement
99
- none: false
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- hash: 27
104
- segments:
105
- - 2
106
- - 5
107
- - 0
108
- version: 2.5.0
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
109
67
  type: :development
110
- version_requirements: *id006
111
- description: Installs the ypath tool for reading YAML files using an XPath-like syntax. Installs the ytemplates tool for writing ERB templates using YAML files as the template binding object.
112
- email:
68
+ prerelease: false
69
+ version_requirements: *74251110
70
+ description: Installs the ypath tool for reading YAML files using an XPath-like syntax.
71
+ Installs the ytemplates tool for turning YAML-based configuration files into other
72
+ files using erb temlates.
73
+ email:
113
74
  - madeonamac@gmail.com
114
- executables:
75
+ executables:
115
76
  - ypath
116
77
  - ytemplates
117
78
  extensions: []
118
-
119
- extra_rdoc_files:
120
- - README.markdown
121
- files:
79
+ extra_rdoc_files: []
80
+ files:
81
+ - Rakefile
122
82
  - Gemfile
123
- - Gemfile.lock
124
83
  - README.markdown
125
- - Rakefile
126
- - bin/ypath
84
+ - Gemfile.lock
127
85
  - bin/ytemplates
128
- - lib/VERSION
129
- - lib/ytools/basecli.rb
130
- - lib/ytools/errors.rb
131
- - lib/ytools/path/cli.rb
132
- - lib/ytools/path/examples.txt
133
- - lib/ytools/path/executor.rb
86
+ - bin/ypath
87
+ - lib/VERSION.yml
88
+ - lib/ytools/utils.rb
89
+ - lib/ytools/yaml_object.rb
134
90
  - lib/ytools/path/lexer.rb
135
91
  - lib/ytools/path/parser.rb
136
92
  - lib/ytools/path/selectors.rb
93
+ - lib/ytools/path/cli.rb
94
+ - lib/ytools/path/executor.rb
95
+ - lib/ytools/path/examples.txt
96
+ - lib/ytools/templates/yaml_object.rb
137
97
  - lib/ytools/templates/cli.rb
138
- - lib/ytools/templates/examples.txt
139
98
  - lib/ytools/templates/executor.rb
140
- - lib/ytools/templates/yaml_object.rb
141
- - lib/ytools/utils.rb
142
- - lib/ytools/version.rb
143
- - lib/ytools/yaml_object.rb
99
+ - lib/ytools/templates/examples.txt
100
+ - lib/ytools/errors.rb
144
101
  - lib/ytools/yreader.rb
145
- - spec/helpers.rb
102
+ - lib/ytools/basecli.rb
146
103
  - spec/path/executor_spec.rb
147
- - spec/path/lexer_spec.rb
148
- - spec/path/parser_spec.rb
149
104
  - spec/path/selectors_spec.rb
105
+ - spec/path/lexer_spec.rb
106
+ - spec/path/yamls/6.yml
150
107
  - spec/path/yamls/1.yml
108
+ - spec/path/yamls/5.yml
109
+ - spec/path/yamls/4.yml
151
110
  - spec/path/yamls/2.yml
152
111
  - spec/path/yamls/3.yml
153
- - spec/path/yamls/4.yml
154
- - spec/path/yamls/5.yml
155
- - spec/path/yamls/6.yml
112
+ - spec/path/parser_spec.rb
156
113
  - spec/yaml_object_spec.rb
114
+ - spec/helpers.rb
157
115
  has_rdoc: true
158
116
  homepage: http://github.com/gabemc/ytools
159
117
  licenses: []
160
-
161
118
  post_install_message:
162
119
  rdoc_options: []
163
-
164
- require_paths:
120
+ require_paths:
165
121
  - lib
166
- required_ruby_version: !ruby/object:Gem::Requirement
122
+ required_ruby_version: !ruby/object:Gem::Requirement
167
123
  none: false
168
- requirements:
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- hash: 3
172
- segments:
173
- - 0
174
- version: "0"
175
- required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
129
  none: false
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- hash: 3
181
- segments:
182
- - 0
183
- version: "0"
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: 1.3.6
184
134
  requirements: []
185
-
186
135
  rubyforge_project:
187
136
  rubygems_version: 1.6.1
188
137
  signing_key:
189
138
  specification_version: 3
190
- summary: For reading or writing configuration files using YAML.
191
- test_files:
192
- - spec/helpers.rb
193
- - spec/path/executor_spec.rb
194
- - spec/path/lexer_spec.rb
195
- - spec/path/parser_spec.rb
196
- - spec/path/selectors_spec.rb
197
- - spec/yaml_object_spec.rb
139
+ summary: For reading or writing configuration files using yaml.
140
+ test_files: []
data/lib/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.4
@@ -1,12 +0,0 @@
1
- require 'scanf'
2
-
3
- module YTools
4
- class Version
5
- CURRENT = File.read(File.dirname(__FILE__) + '/../VERSION')
6
- MAJOR, MINOR, TINY = CURRENT.scanf('%d.%d.%d')
7
-
8
- def self.to_s
9
- CURRENT
10
- end
11
- end
12
- end