lazyfeatures 0.0.1 → 0.0.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/History.txt +11 -0
- data/Manifest +9 -1
- data/README.textile +0 -0
- data/Rakefile +1 -1
- data/lazyfeatures.gemspec +4 -4
- data/lib/lazyfeatures/base.rb +1 -1
- data/lib/lazyfeatures/parser.rb +31 -0
- data/lib/lazyfeatures.rb +2 -1
- data/spec/fixtures/routes.rb +10 -0
- data/spec/lib/base_spec.rb +7 -0
- data/spec/lib/parser_spec.rb +48 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +13 -3
- metadata.gz.sig +2 -2
data/History.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
== 0.0.2 2010-01-09
|
|
2
|
+
|
|
3
|
+
Adding the first pieces of functionality. Adding the Parser class.
|
|
4
|
+
|
|
5
|
+
=== New Features
|
|
6
|
+
* LazyFeatures::Parser able to parse the resource names out of the routes file for singleton and collection resources
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
== 0.0.1 2010-01-09
|
|
10
|
+
|
|
11
|
+
The initial project setup, getting the gem built and pushed to gemcutter
|
data/Manifest
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
History.txt
|
|
2
|
+
Manifest
|
|
3
|
+
README.textile
|
|
1
4
|
Rakefile
|
|
5
|
+
lazyfeatures.gemspec
|
|
2
6
|
lib/lazyfeatures.rb
|
|
3
7
|
lib/lazyfeatures/base.rb
|
|
4
8
|
lib/lazyfeatures/parser.rb
|
|
5
|
-
|
|
9
|
+
spec/fixtures/routes.rb
|
|
10
|
+
spec/lib/base_spec.rb
|
|
11
|
+
spec/lib/parser_spec.rb
|
|
12
|
+
spec/spec.opts
|
|
13
|
+
spec/spec_helper.rb
|
data/README.textile
ADDED
|
File without changes
|
data/Rakefile
CHANGED
|
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
|
2
2
|
require 'rake'
|
|
3
3
|
require 'echoe'
|
|
4
4
|
|
|
5
|
-
Echoe.new('lazyfeatures', '0.0.
|
|
5
|
+
Echoe.new('lazyfeatures', '0.0.2') do |p|
|
|
6
6
|
p.description = "Lazily create Cucumber features for your Rails app"
|
|
7
7
|
p.url = "http://github.com/claytonlz/lazyfeatures"
|
|
8
8
|
p.author = "Clayton Lengel-Zigich"
|
data/lazyfeatures.gemspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{lazyfeatures}
|
|
5
|
-
s.version = "0.0.
|
|
5
|
+
s.version = "0.0.2"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Clayton Lengel-Zigich"]
|
|
@@ -10,10 +10,10 @@ Gem::Specification.new do |s|
|
|
|
10
10
|
s.date = %q{2010-01-09}
|
|
11
11
|
s.description = %q{Lazily create Cucumber features for your Rails app}
|
|
12
12
|
s.email = %q{clayton@claytonlz.com}
|
|
13
|
-
s.extra_rdoc_files = ["lib/lazyfeatures.rb", "lib/lazyfeatures/base.rb", "lib/lazyfeatures/parser.rb"]
|
|
14
|
-
s.files = ["Rakefile", "lib/lazyfeatures.rb", "lib/lazyfeatures/base.rb", "lib/lazyfeatures/parser.rb", "
|
|
13
|
+
s.extra_rdoc_files = ["README.textile", "lib/lazyfeatures.rb", "lib/lazyfeatures/base.rb", "lib/lazyfeatures/parser.rb"]
|
|
14
|
+
s.files = ["History.txt", "Manifest", "README.textile", "Rakefile", "lazyfeatures.gemspec", "lib/lazyfeatures.rb", "lib/lazyfeatures/base.rb", "lib/lazyfeatures/parser.rb", "spec/fixtures/routes.rb", "spec/lib/base_spec.rb", "spec/lib/parser_spec.rb", "spec/spec.opts", "spec/spec_helper.rb"]
|
|
15
15
|
s.homepage = %q{http://github.com/claytonlz/lazyfeatures}
|
|
16
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Lazyfeatures"]
|
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Lazyfeatures", "--main", "README.textile"]
|
|
17
17
|
s.require_paths = ["lib"]
|
|
18
18
|
s.rubyforge_project = %q{lazyfeatures}
|
|
19
19
|
s.rubygems_version = %q{1.3.5}
|
data/lib/lazyfeatures/base.rb
CHANGED
data/lib/lazyfeatures/parser.rb
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module LazyFeatures
|
|
2
|
+
class Parser
|
|
3
|
+
|
|
4
|
+
attr_accessor :route_contents, :singleton_resources, :collection_resources
|
|
5
|
+
|
|
6
|
+
def initialize(file_path)
|
|
7
|
+
self.route_contents = File.open(file_path).read.split("\n")
|
|
8
|
+
parse_resources
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def parse_resources
|
|
12
|
+
self.singleton_resources = parse_singletons
|
|
13
|
+
self.collection_resources = parse_collections
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def parse_singletons
|
|
17
|
+
route_contents.map do |route|
|
|
18
|
+
match = route.match(/^.*\.resource\s\:(\w+).*$/)
|
|
19
|
+
match[1] if match
|
|
20
|
+
end.compact
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def parse_collections
|
|
24
|
+
route_contents.map do |route|
|
|
25
|
+
match = route.match(/^.*\.resources\s\:(\w+).*$/)
|
|
26
|
+
match[1] if match
|
|
27
|
+
end.compact
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
end
|
data/lib/lazyfeatures.rb
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
require 'lazyfeatures/base'
|
|
1
|
+
require 'lazyfeatures/base'
|
|
2
|
+
require 'lazyfeatures/parser'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
|
2
|
+
map.resource :account, :controller => "users"
|
|
3
|
+
map.resource :user_session
|
|
4
|
+
map.resources :conference_sessions
|
|
5
|
+
map.resources :registrations
|
|
6
|
+
|
|
7
|
+
map.login "/login", :controller => "user_sessions", :action => "new"
|
|
8
|
+
map.logout "/logout", :controller => "user_sessions", :action => "destroy"
|
|
9
|
+
map.root :controller => "pages"
|
|
10
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
2
|
+
|
|
3
|
+
describe "LazyFeatures" do
|
|
4
|
+
describe "Parser" do
|
|
5
|
+
before(:each) do
|
|
6
|
+
# routes file
|
|
7
|
+
# map.resource :account, :controller => "users"
|
|
8
|
+
# map.resource :user_session
|
|
9
|
+
# map.resources :conference_sessions
|
|
10
|
+
# map.resources :registrations
|
|
11
|
+
|
|
12
|
+
@routes_file = File.expand_path(File.dirname(__FILE__) + '/../fixtures/routes.rb')
|
|
13
|
+
@parser = LazyFeatures::Parser.new(@routes_file)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe "parse_resources" do
|
|
17
|
+
before(:each) do
|
|
18
|
+
@parser.parse_resources
|
|
19
|
+
end
|
|
20
|
+
it "should parse singleton resources" do
|
|
21
|
+
@parser.singleton_resources.should_not be_nil
|
|
22
|
+
end
|
|
23
|
+
it "should parse collection resources" do
|
|
24
|
+
@parser.collection_resources.should_not be_nil
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
describe "parse_singletons" do
|
|
29
|
+
before(:each) do
|
|
30
|
+
@parser.parse_singletons
|
|
31
|
+
end
|
|
32
|
+
it "should parse the singleton resources" do
|
|
33
|
+
@parser.singleton_resources.should include("account")
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe "parse_collections" do
|
|
38
|
+
before(:each) do
|
|
39
|
+
@parser.parse_collections
|
|
40
|
+
end
|
|
41
|
+
it "should parse the collection resources" do
|
|
42
|
+
@parser.collection_resources.should include("registrations")
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
end
|
|
48
|
+
end
|
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../lib/lazyfeatures')
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lazyfeatures
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Clayton Lengel-Zigich
|
|
@@ -41,16 +41,24 @@ executables: []
|
|
|
41
41
|
extensions: []
|
|
42
42
|
|
|
43
43
|
extra_rdoc_files:
|
|
44
|
+
- README.textile
|
|
44
45
|
- lib/lazyfeatures.rb
|
|
45
46
|
- lib/lazyfeatures/base.rb
|
|
46
47
|
- lib/lazyfeatures/parser.rb
|
|
47
48
|
files:
|
|
49
|
+
- History.txt
|
|
50
|
+
- Manifest
|
|
51
|
+
- README.textile
|
|
48
52
|
- Rakefile
|
|
53
|
+
- lazyfeatures.gemspec
|
|
49
54
|
- lib/lazyfeatures.rb
|
|
50
55
|
- lib/lazyfeatures/base.rb
|
|
51
56
|
- lib/lazyfeatures/parser.rb
|
|
52
|
-
-
|
|
53
|
-
-
|
|
57
|
+
- spec/fixtures/routes.rb
|
|
58
|
+
- spec/lib/base_spec.rb
|
|
59
|
+
- spec/lib/parser_spec.rb
|
|
60
|
+
- spec/spec.opts
|
|
61
|
+
- spec/spec_helper.rb
|
|
54
62
|
has_rdoc: true
|
|
55
63
|
homepage: http://github.com/claytonlz/lazyfeatures
|
|
56
64
|
licenses: []
|
|
@@ -61,6 +69,8 @@ rdoc_options:
|
|
|
61
69
|
- --inline-source
|
|
62
70
|
- --title
|
|
63
71
|
- Lazyfeatures
|
|
72
|
+
- --main
|
|
73
|
+
- README.textile
|
|
64
74
|
require_paths:
|
|
65
75
|
- lib
|
|
66
76
|
required_ruby_version: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
a�e�����%L�
|
|
2
|
+
��|͇]��d���\|ڨn�1�w�V�M�7Ս����k��Q51�:�V�-�f�Ob����k���ڃ�k�->���w�uߟ�p�h;b�N2�R�)|��5A�����ӯ?{$�s�daH.�w amU�*D�N�w��+��]K�l����T�����%W��%ǁd7��.2���w��)��
|