applix 0.3.8 → 0.4.2

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.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.sw?
2
+ Gemfile.lock
3
+ .DS_Store
4
+ coverage
5
+ rdoc
6
+ pkg
data/Gemfile CHANGED
@@ -1,11 +1,3 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- # Add dependencies to develop your gem here.
4
- # Include everything needed to run rake, tests, features, etc.
5
- group :development do
6
- gem "rspec", "~> 2.3.0"
7
- gem "bundler", "> 1.0.0"
8
- gem "jeweler"
9
- gem "rcov", ">= 0"
10
- gem "ZenTest", ">= 4.4.2"
11
- end
3
+ gemspec # see applix.gemspec for dependencies
data/Guardfile ADDED
@@ -0,0 +1,9 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :version => 2 do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ watch('lib/applix.rb') { "spec" }
9
+ end
data/Rakefile CHANGED
@@ -1,3 +1,7 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ __END__
1
5
  require 'rubygems'
2
6
  require 'bundler'
3
7
  begin
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.8
1
+ 0.4.0
data/applix.gemspec ADDED
@@ -0,0 +1,51 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'applix'
6
+ s.version = '0.4.2'
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ['art+com/dirk luesebrink']
9
+ s.email = ['dirk.luesebrink@artcom.de']
10
+ s.homepage = 'http://github.com/crux/applix'
11
+ s.summary = 'extracting typed option hashes from command line arguments'
12
+ s.description = %q{
13
+ ApplixHash#from_argv builds hashes from ARGV like argument vectors
14
+ according to following examples:
15
+
16
+ '-f' --> { :f => true }
17
+ '--flag' --> { :flag => true }
18
+ '--flag:false' --> { :flag => false }
19
+ '--flag=false' --> { :flag => 'false' }
20
+ '--option=value' --> { :option => "value" }
21
+ '--int=1' --> { :int => "1" }
22
+ '--float=2.3' --> { :float => "2.3" }
23
+ '--float:2.3' --> { :float => 2.3 }
24
+ '--txt="foo bar"' --> { :txt => "foo bar" }
25
+ '--txt:'"foo bar"'' --> { :txt => "foo bar" }
26
+ '--txt:%w{foo bar}' --> { :txt => ["foo", "bar"] }
27
+ '--now:Time.now' --> { :now => #<Date: 3588595/2,0,2299161> }
28
+
29
+ remaining arguments(non flag/options) are inserted as [:arguments,
30
+ args], eg:
31
+ Hash.from_argv %w(--foo --bar=loo 123 now)
32
+ becomes
33
+ { :foo => true, :bar => 'loo', :arguments => ["123", "now"] }
34
+ }
35
+
36
+ s.add_development_dependency 'rspec'
37
+ s.add_development_dependency 'rspec-mocks'
38
+ s.add_development_dependency 'guard'
39
+ s.add_development_dependency 'guard-rspec'
40
+ s.add_development_dependency 'growl'
41
+
42
+ s.add_development_dependency 'ruby-debug19'
43
+ s.add_development_dependency 'ruby-debug-base19'
44
+
45
+ s.files = `git ls-files`.split("\n")
46
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
47
+ s.executables = `git ls-files -- bin/*`.split("\n").map do |f|
48
+ File.basename(f)
49
+ end
50
+ s.require_paths = ["lib"]
51
+ end
data/lib/applix.rb CHANGED
@@ -52,7 +52,12 @@ usage: #{$0} <args...>
52
52
 
53
53
  # cluster for nesting or direct calling?
54
54
  if task[:cluster]
55
- rc = Applix.main(args, options, &task[:code])
55
+ #rc = Applix.main(args, options, &task[:code])
56
+ cluster_task = args.first.to_sym
57
+ cluster_options = options.merge(options[cluster_task] || {})
58
+ cluster_options.delete(cluster_task)
59
+ cluster_options.merge!(Hash.from_argv argv)
60
+ rc = Applix.main(args, cluster_options, &task[:code])
56
61
  else
57
62
  rc = task[:code].call(*args, options)
58
63
  end
data/spec/applix_spec.rb CHANGED
@@ -2,6 +2,21 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "Applix" do
4
4
 
5
+ it 'cluster defaults shadow globals' do
6
+ args = %w(-c=5 global cluster)
7
+ Applix.main(args, a: :global, b: 2, :cluster => {a: :cluster, c: 3}) do
8
+ handle(:cluster) do
9
+ raise 'should not be called!'
10
+ end
11
+ cluster(:global) do
12
+ handle(:cluster) do |*args, options|
13
+ options.should == {:a => :cluster, :b => 2, :c => '5'}
14
+ args
15
+ end
16
+ end
17
+ end
18
+ end
19
+
5
20
  it 'calls cluster prolog' do
6
21
  Applix.main(%w(foo a b)) do
7
22
  cluster(:foo) do
metadata CHANGED
@@ -1,164 +1,173 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: applix
3
- version: !ruby/object:Gem::Version
4
- version: 0.3.8
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 2
9
+ version: 0.4.2
6
10
  platform: ruby
7
- authors:
8
- - dirk luesebrink
11
+ authors:
12
+ - art+com/dirk luesebrink
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2011-08-28 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
16
+
17
+ date: 2012-03-20 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: rspec
16
- requirement: &2156881460 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 2.3.0
22
- type: :development
23
22
  prerelease: false
24
- version_requirements: *2156881460
25
- - !ruby/object:Gem::Dependency
26
- name: bundler
27
- requirement: &2156880080 !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
28
24
  none: false
29
- requirements:
30
- - - ! '>'
31
- - !ruby/object:Gem::Version
32
- version: 1.0.0
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
33
31
  type: :development
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: rspec-mocks
34
35
  prerelease: false
35
- version_requirements: *2156880080
36
- - !ruby/object:Gem::Dependency
37
- name: jeweler
38
- requirement: &2156878580 !ruby/object:Gem::Requirement
36
+ requirement: &id002 !ruby/object:Gem::Requirement
39
37
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
44
  type: :development
45
+ version_requirements: *id002
46
+ - !ruby/object:Gem::Dependency
47
+ name: guard
45
48
  prerelease: false
46
- version_requirements: *2156878580
47
- - !ruby/object:Gem::Dependency
48
- name: rcov
49
- requirement: &2156877440 !ruby/object:Gem::Requirement
49
+ requirement: &id003 !ruby/object:Gem::Requirement
50
50
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
56
+ version: "0"
55
57
  type: :development
58
+ version_requirements: *id003
59
+ - !ruby/object:Gem::Dependency
60
+ name: guard-rspec
56
61
  prerelease: false
57
- version_requirements: *2156877440
58
- - !ruby/object:Gem::Dependency
59
- name: ZenTest
60
- requirement: &2156876200 !ruby/object:Gem::Requirement
62
+ requirement: &id004 !ruby/object:Gem::Requirement
61
63
  none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: 4.4.2
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
66
70
  type: :development
71
+ version_requirements: *id004
72
+ - !ruby/object:Gem::Dependency
73
+ name: growl
67
74
  prerelease: false
68
- version_requirements: *2156876200
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: &2156865360 !ruby/object:Gem::Requirement
75
+ requirement: &id005 !ruby/object:Gem::Requirement
72
76
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: 2.3.0
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ segments:
81
+ - 0
82
+ version: "0"
77
83
  type: :development
84
+ version_requirements: *id005
85
+ - !ruby/object:Gem::Dependency
86
+ name: ruby-debug19
78
87
  prerelease: false
79
- version_requirements: *2156865360
80
- - !ruby/object:Gem::Dependency
81
- name: rcov
82
- requirement: &2156864240 !ruby/object:Gem::Requirement
88
+ requirement: &id006 !ruby/object:Gem::Requirement
83
89
  none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: '0'
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ segments:
94
+ - 0
95
+ version: "0"
88
96
  type: :development
97
+ version_requirements: *id006
98
+ - !ruby/object:Gem::Dependency
99
+ name: ruby-debug-base19
89
100
  prerelease: false
90
- version_requirements: *2156864240
91
- - !ruby/object:Gem::Dependency
92
- name: ZenTest
93
- requirement: &2156862960 !ruby/object:Gem::Requirement
101
+ requirement: &id007 !ruby/object:Gem::Requirement
94
102
  none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: 4.4.2
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ segments:
107
+ - 0
108
+ version: "0"
99
109
  type: :development
100
- prerelease: false
101
- version_requirements: *2156862960
102
- description: ! " ApplixHash#from_argv builds hashes from ARGV like argument vectors\n
103
- \ according to following examples: \n \n '-f' -->
104
- { :f => true }\n '--flag' --> { :flag => true }\n '--flag:false'
105
- \ --> { :flag => false }\n '--flag=false' --> { :flag =>
106
- 'false' }\n '--option=value' --> { :option => \"value\" }\n '--int=1'
107
- \ --> { :int => \"1\" }\n '--float=2.3' --> { :float
108
- \ => \"2.3\" }\n '--float:2.3' --> { :float => 2.3 }\n '--txt=\"foo
109
- bar\"' --> { :txt => \"foo bar\" }\n '--txt:'\"foo bar\"'' --> {
110
- :txt => \"foo bar\" }\n '--txt:%w{foo bar}' --> { :txt => [\"foo\",
111
- \"bar\"] }\n '--now:Time.now' --> { :now => #<Date: 3588595/2,0,2299161>
112
- }\n \n remaining arguments(non flag/options) are inserted as [:arguments,\n
113
- \ args], eg:\n Hash.from_argv %w(--foo --bar=loo 123 now)\n becomes
114
- \ \n { :foo => true, :bar => 'loo', :arguments => [\"123\", \"now\"] }\n
115
- \ \n"
116
- email: dirk@sebrink.de
110
+ version_requirements: *id007
111
+ description: "\n ApplixHash#from_argv builds hashes from ARGV like argument vectors\n according to following examples: \n \n '-f' --> { :f => true }\n '--flag' --> { :flag => true }\n '--flag:false' --> { :flag => false }\n '--flag=false' --> { :flag => 'false' }\n '--option=value' --> { :option => \"value\" }\n '--int=1' --> { :int => \"1\" }\n '--float=2.3' --> { :float => \"2.3\" }\n '--float:2.3' --> { :float => 2.3 }\n '--txt=\"foo bar\"' --> { :txt => \"foo bar\" }\n '--txt:'\"foo bar\"'' --> { :txt => \"foo bar\" }\n '--txt:%w{foo bar}' --> { :txt => [\"foo\", \"bar\"] }\n '--now:Time.now' --> { :now => #<Date: 3588595/2,0,2299161> }\n \n remaining arguments(non flag/options) are inserted as [:arguments,\n args], eg:\n Hash.from_argv %w(--foo --bar=loo 123 now)\n becomes \n { :foo => true, :bar => 'loo', :arguments => [\"123\", \"now\"] }\n "
112
+ email:
113
+ - dirk.luesebrink@artcom.de
117
114
  executables: []
115
+
118
116
  extensions: []
119
- extra_rdoc_files:
120
- - LICENSE
121
- - README.mkd
122
- files:
117
+
118
+ extra_rdoc_files: []
119
+
120
+ files:
123
121
  - .autotest
124
122
  - .document
123
+ - .gitignore
125
124
  - .rspec
126
125
  - Gemfile
126
+ - Guardfile
127
127
  - LICENSE
128
128
  - README.mkd
129
129
  - Rakefile
130
130
  - VERSION
131
+ - applix.gemspec
131
132
  - lib/applix.rb
132
133
  - lib/applix/hash.rb
133
134
  - lib/applix/oattr.rb
134
135
  - spec/applix_spec.rb
135
136
  - spec/oattr_spec.rb
136
137
  - spec/spec_helper.rb
138
+ has_rdoc: true
137
139
  homepage: http://github.com/crux/applix
138
140
  licenses: []
141
+
139
142
  post_install_message:
140
143
  rdoc_options: []
141
- require_paths:
144
+
145
+ require_paths:
142
146
  - lib
143
- required_ruby_version: !ruby/object:Gem::Requirement
147
+ required_ruby_version: !ruby/object:Gem::Requirement
144
148
  none: false
145
- requirements:
146
- - - ! '>='
147
- - !ruby/object:Gem::Version
148
- version: '0'
149
- segments:
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ segments:
150
153
  - 0
151
- hash: 3511513831159462149
152
- required_rubygems_version: !ruby/object:Gem::Requirement
154
+ version: "0"
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
156
  none: false
154
- requirements:
155
- - - ! '>='
156
- - !ruby/object:Gem::Version
157
- version: '0'
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ segments:
161
+ - 0
162
+ version: "0"
158
163
  requirements: []
164
+
159
165
  rubyforge_project:
160
- rubygems_version: 1.8.6
166
+ rubygems_version: 1.3.7
161
167
  signing_key:
162
168
  specification_version: 3
163
- summary: build typed option hashed from command line arguments
164
- test_files: []
169
+ summary: extracting typed option hashes from command line arguments
170
+ test_files:
171
+ - spec/applix_spec.rb
172
+ - spec/oattr_spec.rb
173
+ - spec/spec_helper.rb