factory_toys 0.4.0 → 0.4.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.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/factory_toys.gemspec +2 -2
- data/lib/factory_toys/f_factory.rb +7 -4
- data/lib/factory_toys.rb +4 -4
- data/spec/factory_toys/f_factory_spec.rb +1 -0
- data/spec/factory_toys_spec.rb +2 -2
- data/spec/spec_helper.rb +8 -4
- data/tmp/features/simple_factory.feature +2 -1
- metadata +4 -4
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/tom025/factory-toys"
|
12
12
|
gem.authors = ["David Henry","Thomas Brand"]
|
13
13
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
+
# gem.add_development_dependency "ruby-debug", ">= 0.10.3"
|
14
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
16
|
end
|
16
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/factory_toys.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{factory_toys}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
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 = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-05}
|
13
13
|
s.description = %q{Simplify Feature Management}
|
14
14
|
s.email = %q{dw_henry@yahoo.com.au}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -11,16 +11,19 @@ module FactoryToys
|
|
11
11
|
|
12
12
|
def initialize(filename)
|
13
13
|
@filename = filename
|
14
|
-
|
15
|
-
@output = "#last update: #{File.mtime(@file_name)}"
|
14
|
+
@output = "# last update: #{File.mtime(@filename)}\n"
|
16
15
|
@output += "# Auto Generated Features\n"
|
17
16
|
@output += "# Generated: #{Time.now.to_s}\n"
|
18
17
|
@output += "# Source File: #{@filename}\n\n"
|
19
18
|
end
|
20
19
|
|
21
|
-
def
|
20
|
+
def output_filename
|
22
21
|
filename = File.basename(@filename, '.rb') + '.feature'
|
23
|
-
|
22
|
+
FactoryToys.features_location + "/" + filename
|
23
|
+
end
|
24
|
+
|
25
|
+
def write
|
26
|
+
File.open(self.output_filename, 'w') do |f|
|
24
27
|
f.puts self.output
|
25
28
|
end
|
26
29
|
end
|
data/lib/factory_toys.rb
CHANGED
@@ -35,8 +35,8 @@ module FactoryToys
|
|
35
35
|
return "Source Directory Does not exist: #{self.source_directory}"
|
36
36
|
end
|
37
37
|
|
38
|
-
def update_required(file)
|
39
|
-
File.open(
|
38
|
+
def update_required(file, output_file)
|
39
|
+
File.open(output_file) {|f| return "# last update: #{File.mtime(file)}" != f.readline}
|
40
40
|
rescue
|
41
41
|
true
|
42
42
|
end
|
@@ -44,8 +44,8 @@ module FactoryToys
|
|
44
44
|
public
|
45
45
|
def update_features
|
46
46
|
self.source_files.each do |file|
|
47
|
-
|
48
|
-
|
47
|
+
ft = FactoryToys::FFactory.new(file)
|
48
|
+
if self.update_required(file, ft.output_filename)
|
49
49
|
ft.write
|
50
50
|
end
|
51
51
|
end
|
data/spec/factory_toys_spec.rb
CHANGED
@@ -31,7 +31,7 @@ describe "FactoryToys" do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'calls Process FFactory for each file' do
|
34
|
-
factory = mock(:fact1, :write => true)
|
34
|
+
factory = mock(:fact1, :write => true, :output_filename => '')
|
35
35
|
FactoryToys.stub!(:source_files).and_return(['file1', 'file2'])
|
36
36
|
FactoryToys::FFactory.should_receive(:new).with('file1').and_return(factory)
|
37
37
|
FactoryToys::FFactory.should_receive(:new).with('file2').and_return(factory)
|
@@ -39,7 +39,7 @@ describe "FactoryToys" do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'calls write for each file' do
|
42
|
-
factory = mock(:fact1)
|
42
|
+
factory = mock(:fact1, :output_filename => '')
|
43
43
|
FactoryToys.stub!(:source_files).and_return(['file1', 'file2'])
|
44
44
|
FactoryToys::FFactory.stub!(:new).and_return(factory)
|
45
45
|
factory.should_receive(:write).and_return(true)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
require 'ruby-debug'
|
3
|
+
#require 'ruby-debug'
|
4
4
|
require 'factory_toys'
|
5
5
|
require 'spec'
|
6
6
|
require 'spec/autorun'
|
@@ -9,9 +9,13 @@ Spec::Runner.configure do |config|
|
|
9
9
|
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
begin
|
13
|
+
SETTLEMENT_METHODS
|
14
|
+
rescue
|
15
|
+
SETTLEMENT_METHODS = [DCC_DCC = {:buy => 'dcc from dcc', :to => 'dcc to dcc'},
|
16
|
+
REG_REG = {:buy => 'reg from reg', :to => 'reg to reg'}
|
17
|
+
]
|
18
|
+
end
|
15
19
|
|
16
20
|
#implemented here to get tests to pass as in Rails Environment and not ruby core??
|
17
21
|
class String
|
@@ -1,5 +1,6 @@
|
|
1
|
+
# last update: Wed Sep 15 18:00:01 +0100 2010
|
1
2
|
# Auto Generated Features
|
2
|
-
# Generated:
|
3
|
+
# Generated: Tue Oct 05 14:22:36 +0100 2010
|
3
4
|
# Source File: /Users/tom025/rails/factory-toys/spec/../tmp/ffactories/simple_factory.rb
|
4
5
|
|
5
6
|
Test Instruction Queue and Processiung
|
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:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Henry
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-10-
|
19
|
+
date: 2010-10-05 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|