quickl 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.
Files changed (46) hide show
  1. data/CHANGELOG.md +9 -0
  2. data/README.md +118 -0
  3. data/Rakefile +64 -0
  4. data/bin/quickl +116 -0
  5. data/examples/delegate/README.md +86 -0
  6. data/examples/delegate/bin/delegate +9 -0
  7. data/examples/delegate/lib/delegate.rb +41 -0
  8. data/examples/delegate/lib/hello_world.rb +39 -0
  9. data/examples/delegate/lib/help.rb +24 -0
  10. data/examples/delegate/test/delegate_test.rb +68 -0
  11. data/examples/hello/README.md +74 -0
  12. data/examples/hello/hello +57 -0
  13. data/examples/hello/hello_test.rb +65 -0
  14. data/examples/helper.rb +6 -0
  15. data/lib/quickl.rb +47 -0
  16. data/lib/quickl/command.rb +154 -0
  17. data/lib/quickl/command/builder.rb +58 -0
  18. data/lib/quickl/command/delegate.rb +53 -0
  19. data/lib/quickl/command/options.rb +55 -0
  20. data/lib/quickl/command/robustness.rb +18 -0
  21. data/lib/quickl/command/single.rb +27 -0
  22. data/lib/quickl/errors.rb +196 -0
  23. data/lib/quickl/ext/object.rb +29 -0
  24. data/lib/quickl/naming.rb +53 -0
  25. data/lib/quickl/ruby_tools.rb +60 -0
  26. data/quickl.gemspec +38 -0
  27. data/templates/single.erb +40 -0
  28. data/test/command/command_name.spec +16 -0
  29. data/test/command/documentation.spec +23 -0
  30. data/test/command/overview.spec +14 -0
  31. data/test/command/run.spec +22 -0
  32. data/test/command/subcommands.spec +20 -0
  33. data/test/command/usage.spec +16 -0
  34. data/test/mini_client.rb +59 -0
  35. data/test/naming/command2module.spec +17 -0
  36. data/test/naming/module2command.spec +21 -0
  37. data/test/ruby_tools/class_unqualified_name.spec +28 -0
  38. data/test/ruby_tools/extract_file_rdoc.spec +28 -0
  39. data/test/ruby_tools/fixtures.rb +27 -0
  40. data/test/ruby_tools/fixtures/RubyTools.rdoc +12 -0
  41. data/test/ruby_tools/fixtures/Utils.rdoc +3 -0
  42. data/test/ruby_tools/optional_args_block_call.spec +37 -0
  43. data/test/ruby_tools/parent_module.spec +23 -0
  44. data/test/spec_helper.rb +13 -0
  45. data/test/wrapping.rb +39 -0
  46. metadata +129 -0
@@ -0,0 +1,12 @@
1
+
2
+ This is a fixtures helper that matches documentation conventions.
3
+
4
+ This is a second paragraph
5
+ That append on two lines
6
+
7
+
8
+ WARNING:
9
+ This kind of indentation should not be interpreted as code
10
+
11
+ But this one yes
12
+
@@ -0,0 +1,3 @@
1
+
2
+ This is the documentation of the Utils module
3
+
@@ -0,0 +1,37 @@
1
+ require File.expand_path('../fixtures', __FILE__)
2
+ module Quickl
3
+ describe "RubyTools#optional_args_block_call /" do
4
+
5
+ subject{ RubyTools::optional_args_block_call(block, args) }
6
+
7
+ describe "when block has no arguments /" do
8
+ let(:block){ lambda {
9
+ "ok"
10
+ } }
11
+
12
+ describe "when no args are given" do
13
+ let(:args){ [ ] }
14
+ it { should == "ok" }
15
+ end
16
+
17
+ describe "when no args are given" do
18
+ let(:args){ [ "hello" ] }
19
+ it { should == "ok" }
20
+ end
21
+
22
+ end
23
+
24
+ describe "when block has one arguments /" do
25
+ let(:block){ lambda {|name|
26
+ name
27
+ } }
28
+
29
+ describe "when args are given" do
30
+ let(:args){ [ "hello" ] }
31
+ it { should == "hello" }
32
+ end
33
+
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path('../fixtures', __FILE__)
2
+ module Quickl
3
+ describe "RubyTools#parent_module /" do
4
+
5
+ subject{ RubyTools::parent_module(clazz) }
6
+
7
+ describe "when called on unqualified class" do
8
+ let(:clazz){ ::String }
9
+ it{ should be_nil }
10
+ end
11
+
12
+ describe "when called on qualified class" do
13
+ let(:clazz){ RubyTools }
14
+ it{ should == Quickl }
15
+ end
16
+
17
+ describe "when called on long qualified class" do
18
+ let(:clazz){ Quickl::Fixtures::Utils }
19
+ it{ should == Quickl::Fixtures }
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,13 @@
1
+ dir = File.dirname(__FILE__)
2
+ $LOAD_PATH.unshift "#{dir}/../lib"
3
+
4
+ require 'rubygems'
5
+ require 'spec'
6
+ require 'spec/autorun'
7
+ require 'pp'
8
+ require 'fileutils'
9
+ require 'quickl'
10
+ require 'mini_client'
11
+
12
+ Spec::Runner.configure do |config|
13
+ end
@@ -0,0 +1,39 @@
1
+ $LOAD_PATH.unshift('../../lib', __FILE__)
2
+ require "quickl"
3
+ $wrappers = []
4
+
5
+ def wrap(filter, &block)
6
+ $wrappers << [ filter, block ]
7
+ end
8
+
9
+ def build_wrapper(command, filter, continuation)
10
+ lambda{|cont|
11
+ if !filter || command.instance_eval(&filter)
12
+ command.instance_exec(continuation, &b)
13
+ else
14
+ continuation.call
15
+ end
16
+ }
17
+ end
18
+
19
+ def execute(command, &block)
20
+ first = build_wrapper(command, *$wrappers.first)
21
+ c = $wrappers[1..-1].inject(first){|cont,wrapper|
22
+ build_wrapper(command, *wrapper)
23
+ }
24
+ c.call(block)
25
+ end
26
+
27
+ wrap(lambda{ true }){|cont|
28
+ puts "wrap 1"
29
+ cont.call
30
+ puts "end wrap 1"
31
+ }
32
+ wrap(lambda{ true }){|cont|
33
+ puts "wrap 2"
34
+ cont.call
35
+ puts "end wrap 2"
36
+ }
37
+ execute(self){
38
+ puts "hello"
39
+ }
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quickl
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 1
10
+ version: 0.1.1
11
+ platform: ruby
12
+ authors:
13
+ - Bernard Lambeau
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-12-24 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rake
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :development
34
+ version_requirements: *id001
35
+ description: Generate Ruby command line apps quickly
36
+ email: blambeau@gmail.com
37
+ executables:
38
+ - quickl
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README.md
43
+ files:
44
+ - lib/quickl/command/builder.rb
45
+ - lib/quickl/command/delegate.rb
46
+ - lib/quickl/command/options.rb
47
+ - lib/quickl/command/robustness.rb
48
+ - lib/quickl/command/single.rb
49
+ - lib/quickl/command.rb
50
+ - lib/quickl/errors.rb
51
+ - lib/quickl/ext/object.rb
52
+ - lib/quickl/naming.rb
53
+ - lib/quickl/ruby_tools.rb
54
+ - lib/quickl.rb
55
+ - examples/delegate/bin/delegate
56
+ - examples/delegate/lib/delegate.rb
57
+ - examples/delegate/lib/hello_world.rb
58
+ - examples/delegate/lib/help.rb
59
+ - examples/delegate/README.md
60
+ - examples/delegate/test/delegate_test.rb
61
+ - examples/hello/hello
62
+ - examples/hello/hello_test.rb
63
+ - examples/hello/README.md
64
+ - examples/helper.rb
65
+ - templates/single.erb
66
+ - bin/quickl
67
+ - test/command/command_name.spec
68
+ - test/command/documentation.spec
69
+ - test/command/overview.spec
70
+ - test/command/run.spec
71
+ - test/command/subcommands.spec
72
+ - test/command/usage.spec
73
+ - test/mini_client.rb
74
+ - test/naming/command2module.spec
75
+ - test/naming/module2command.spec
76
+ - test/ruby_tools/class_unqualified_name.spec
77
+ - test/ruby_tools/extract_file_rdoc.spec
78
+ - test/ruby_tools/fixtures/RubyTools.rdoc
79
+ - test/ruby_tools/fixtures/Utils.rdoc
80
+ - test/ruby_tools/fixtures.rb
81
+ - test/ruby_tools/optional_args_block_call.spec
82
+ - test/ruby_tools/parent_module.spec
83
+ - test/spec_helper.rb
84
+ - test/wrapping.rb
85
+ - quickl.gemspec
86
+ - Rakefile
87
+ - README.md
88
+ - CHANGELOG.md
89
+ has_rdoc: true
90
+ homepage: http://github.com/blambeau/quickl
91
+ licenses: []
92
+
93
+ post_install_message:
94
+ rdoc_options:
95
+ - --line-numbers
96
+ - --inline-source
97
+ - --title
98
+ - Quickl
99
+ - --main
100
+ - Quickl
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 3
118
+ segments:
119
+ - 0
120
+ version: "0"
121
+ requirements: []
122
+
123
+ rubyforge_project:
124
+ rubygems_version: 1.3.7
125
+ signing_key:
126
+ specification_version: 3
127
+ summary: Generate Ruby command line apps quickly
128
+ test_files: []
129
+