factory_toys 0.4.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/factory_toys.gemspec +25 -34
- data/lib/factory_toys/f_factory.rb +41 -19
- metadata +11 -17
- data/.gitignore +0 -22
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/factory_toys.gemspec
CHANGED
@@ -1,54 +1,45 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.
|
7
|
+
s.name = "factory_toys"
|
8
|
+
s.version = "1.0.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["David Henry", "Thomas Brand"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2011-09-23"
|
13
|
+
s.description = "Simplify Feature Management"
|
14
|
+
s.email = "dw_henry@yahoo.com.au"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
17
|
+
"README.rdoc"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
20
|
".document",
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
"lib/factory_toys/parser.rb",
|
30
|
-
"spec/factory_toys/f_factory_spec.rb",
|
31
|
-
"spec/factory_toys/parser_spec.rb",
|
32
|
-
"spec/factory_toys_spec.rb",
|
33
|
-
"spec/spec.opts",
|
34
|
-
"spec/spec_helper.rb",
|
35
|
-
"tmp/features/simple_factory.feature",
|
36
|
-
"tmp/ffactories/simple_factory.rb"
|
37
|
-
]
|
38
|
-
s.homepage = %q{http://github.com/tom025/factory-toys}
|
39
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
40
|
-
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = %q{1.3.7}
|
42
|
-
s.summary = %q{Simplify Feature Management}
|
43
|
-
s.test_files = [
|
21
|
+
"LICENSE",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"factory_toys.gemspec",
|
26
|
+
"lib/factory_toys.rb",
|
27
|
+
"lib/factory_toys/f_factory.rb",
|
28
|
+
"lib/factory_toys/parser.rb",
|
44
29
|
"spec/factory_toys/f_factory_spec.rb",
|
45
|
-
|
46
|
-
|
47
|
-
|
30
|
+
"spec/factory_toys/parser_spec.rb",
|
31
|
+
"spec/factory_toys_spec.rb",
|
32
|
+
"spec/spec.opts",
|
33
|
+
"spec/spec_helper.rb",
|
34
|
+
"tmp/features/simple_factory.feature",
|
35
|
+
"tmp/ffactories/simple_factory.rb"
|
48
36
|
]
|
37
|
+
s.homepage = "http://github.com/tom025/factory-toys"
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = "1.8.10"
|
40
|
+
s.summary = "Simplify Feature Management"
|
49
41
|
|
50
42
|
if s.respond_to? :specification_version then
|
51
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
52
43
|
s.specification_version = 3
|
53
44
|
|
54
45
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
@@ -11,35 +11,55 @@ module FactoryToys
|
|
11
11
|
|
12
12
|
def initialize(filename)
|
13
13
|
@filename = filename
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@
|
17
|
-
@
|
14
|
+
@header = ["# last update: #{File.mtime(@filename)}"]
|
15
|
+
@header << "# Auto Generated Features"
|
16
|
+
@header << "# Generated: #{Time.now.to_s}"
|
17
|
+
@header << "# Source File: #{@filename}"
|
18
|
+
@header << ''
|
19
|
+
check_output_length
|
18
20
|
end
|
19
|
-
|
20
|
-
def
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
def write
|
26
|
-
File.open(self.output_filename, 'w') do |f|
|
27
|
-
f.puts self.output
|
21
|
+
|
22
|
+
def check_output_length
|
23
|
+
@outputs ||= []
|
24
|
+
unless @output && @output.size > 400
|
25
|
+
@output = []
|
26
|
+
@outputs << @output
|
28
27
|
end
|
29
28
|
end
|
30
|
-
|
31
|
-
def
|
29
|
+
|
30
|
+
def process_files
|
32
31
|
eval(self.data[:base])
|
33
32
|
self.add_feature(self.data[:feature])
|
34
33
|
conf_names = self.instance_variables
|
35
34
|
self.process_file(conf_names)
|
36
|
-
@output
|
37
35
|
end
|
38
|
-
|
36
|
+
|
37
|
+
def output_filename
|
38
|
+
filename = File.basename(@filename, ".rb")
|
39
|
+
dir = FactoryToys.features_location + filename
|
40
|
+
File.join(dir, "#{filename}_0.feature")
|
41
|
+
end
|
42
|
+
|
43
|
+
def write
|
44
|
+
process_files
|
45
|
+
|
46
|
+
filename = File.basename(@filename, ".rb")
|
47
|
+
dir = File.join(FactoryToys.features_location, filename)
|
48
|
+
FileUtils.mkdir_p(dir)
|
49
|
+
FileUtils.rm_r(Dir.glob(File.join(dir, "*.feature")))
|
50
|
+
|
51
|
+
@outputs.each_with_index do |output, i|
|
52
|
+
File.open(File.join(dir, "#{filename}_#{i}.feature"), 'w') do |f|
|
53
|
+
f.puts (@header + output).join("\n")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
39
58
|
def add_feature(feature_def)
|
40
59
|
raise FactoryToys::MissingFeatureDefinitionError if feature_def.blank?
|
41
60
|
eval(feature_def)
|
42
|
-
@
|
61
|
+
@header << eval('feature')
|
62
|
+
@header << ""
|
43
63
|
end
|
44
64
|
|
45
65
|
def process_file(conf_names)
|
@@ -62,7 +82,9 @@ module FactoryToys
|
|
62
82
|
scenario_name = self.get_scenario_name(feature_name)
|
63
83
|
raise MissingScenarioError, scenario_name unless self.data[scenario_name]
|
64
84
|
eval(self.data[scenario_name])
|
65
|
-
@output
|
85
|
+
@output << eval(scenario_name.to_s)
|
86
|
+
@output << ''
|
87
|
+
check_output_length
|
66
88
|
end
|
67
89
|
|
68
90
|
def get_scenario_name(feature_name)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_toys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 23
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
7
9
|
- 0
|
8
|
-
|
9
|
-
- 2
|
10
|
-
version: 0.4.2
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Henry
|
@@ -16,8 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
20
|
-
default_executable:
|
19
|
+
date: 2011-09-23 00:00:00 Z
|
21
20
|
dependencies:
|
22
21
|
- !ruby/object:Gem::Dependency
|
23
22
|
name: rspec
|
@@ -46,7 +45,6 @@ extra_rdoc_files:
|
|
46
45
|
- README.rdoc
|
47
46
|
files:
|
48
47
|
- .document
|
49
|
-
- .gitignore
|
50
48
|
- LICENSE
|
51
49
|
- README.rdoc
|
52
50
|
- Rakefile
|
@@ -62,13 +60,12 @@ files:
|
|
62
60
|
- spec/spec_helper.rb
|
63
61
|
- tmp/features/simple_factory.feature
|
64
62
|
- tmp/ffactories/simple_factory.rb
|
65
|
-
has_rdoc: true
|
66
63
|
homepage: http://github.com/tom025/factory-toys
|
67
64
|
licenses: []
|
68
65
|
|
69
66
|
post_install_message:
|
70
|
-
rdoc_options:
|
71
|
-
|
67
|
+
rdoc_options: []
|
68
|
+
|
72
69
|
require_paths:
|
73
70
|
- lib
|
74
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -92,12 +89,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
89
|
requirements: []
|
93
90
|
|
94
91
|
rubyforge_project:
|
95
|
-
rubygems_version: 1.
|
92
|
+
rubygems_version: 1.8.10
|
96
93
|
signing_key:
|
97
94
|
specification_version: 3
|
98
95
|
summary: Simplify Feature Management
|
99
|
-
test_files:
|
100
|
-
|
101
|
-
- spec/factory_toys/parser_spec.rb
|
102
|
-
- spec/factory_toys_spec.rb
|
103
|
-
- spec/spec_helper.rb
|
96
|
+
test_files: []
|
97
|
+
|