story-helper 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  History.txt
2
2
  Manifest.txt
3
- README.txt
3
+ README.textile
4
4
  Rakefile
5
5
  bin/storify
6
6
  lib/story-helper.rb
@@ -1,33 +1,38 @@
1
- = story-helper
1
+ h1. story-helper
2
2
 
3
- * http://github.com/jtrupiano/story-helper
3
+ p. http://github.com/jtrupiano/story-helper
4
4
 
5
- == DESCRIPTION:
5
+ h2. DESCRIPTION
6
6
 
7
- Provides very basic baseline for using direct Ruby to define your test data and test accessors. Still a work in progress,
7
+ p. Provides very basic baseline for using direct Ruby to define your test data and test accessors. Still a work in progress,
8
8
  but something we use at SLS in lieu of fixtures. More details to come as this becomes more useful to others.
9
9
 
10
- There's some information on the wiki regarding how to use it in conjunction with fixtures.
10
+ p. There's some information on the wiki regarding how to use it in conjunction with fixtures.
11
11
 
12
- == FEATURES/PROBLEMS:
12
+ h2. FEATURES/PROBLEMS
13
13
 
14
14
  * not entirely DRY (requires you to define your accessors in addition to your test data -- this should be able to be automated)
15
15
  * could auto-convert existing fixtures
16
16
  * should only be used in conjunction with pre-built test databases (in other words, no dropping and recreating for each test case -- use DB transactions instead)
17
17
 
18
- == SYNOPSIS:
18
+ h2. SYNOPSIS
19
19
 
20
- FIX (code sample of usage)
20
+ from RAILS_ROOT
21
+ * storify .
21
22
 
22
- == REQUIREMENTS:
23
+ Implement StoryHelper#purge_all_data and StoryHelper#load_all in lib/story_helper.rb
24
+ * rake db:stories:load RAILS_ENV=____
25
+
26
+ h2. REQUIREMENTS
23
27
 
24
28
  * FIX (list of requirements)
25
29
 
26
- == INSTALL:
30
+ h2. INSTALL
27
31
 
28
- * sudo gem install story-helper
32
+ * sudo gem install story-helper (stable version from RubyForge)
33
+ * sudo gem install jtrupiano-story-helper (HEAD of the repo from github)
29
34
 
30
- == LICENSE:
35
+ h2. LICENSE
31
36
 
32
37
  (The MIT License)
33
38
 
@@ -3,12 +3,47 @@
3
3
  #############################
4
4
 
5
5
  namespace :db do
6
- desc "Load dev data into the current environment's database."
7
- task :load_stories => :environment do
8
- StoryHelper.purge_all_data
9
- # Rake::Task['db:fixtures:load'].invoke
10
- StoryHelper.load_all
11
- end
6
+ desc "Refresh all the stories"
7
+ task :stories => [:environment, "stories:purge", "stories:load"]
8
+
9
+ namespace :stories do
10
+
11
+ desc "Load the stories"
12
+ task :load => [:environment, "seed:load", "data:load"]
13
+
14
+ desc "Purge the stories"
15
+ task :purge => [:environment, "data:purge", "seed:purge"]
16
+
17
+ desc "Refresh to seed data"
18
+ task :seed => [:environment, "data:purge", "seed:purge", "seed:load"]
19
+
20
+ desc "Refresh to test data"
21
+ task :data => [:environment, "data:purge", "data:load"]
22
+
23
+ namespace :seed do
24
+ desc "Load Seed Data"
25
+ task :load => [:environment] do
26
+ StoryHelper.load_seed
27
+ end
28
+
29
+ desc "Purge Seed Data"
30
+ task :purge => [:environment] do
31
+ StoryHelper.purge_seed
32
+ end
33
+ end
34
+
35
+ namespace :data do
36
+ desc "Load test data"
37
+ task :load => [:environment] do
38
+ StoryHelper.load_data
39
+ end
40
+
41
+ desc "Purge test data"
42
+ task :purge => [:environment] do
43
+ StoryHelper.purge_data
44
+ end
45
+ end
46
+ end
12
47
  end
13
48
 
14
49
  # First, delete the Tasks we wish to override
@@ -3,15 +3,53 @@
3
3
  class StoryHelper
4
4
  self.extend StoryAccessors::Methods
5
5
 
6
- def self.load_all
7
- # Load data via Ruby -- your models are accessible here, so use those functions to create complex data!
8
- #self.load_all
6
+ # load up the seed data for your application. This is data that should be loaded when the
7
+ # application is deployed to a server for the first time. For example, an Admin account and
8
+ # models like FileType that are database-level constants.
9
+ #
10
+ # This is best run as a series of calls to private methods:
11
+ # self.load_people
12
+ # self.load_posts
13
+ # etc...
14
+ def self.load_seed
15
+
16
+ end
17
+
18
+ # Purge the seed data that you loaded
19
+ #
20
+ # The best way to do this is as follows:
21
+ # [People, Posts, ... etc ].reverse.each do |model|
22
+ # model.destroy_all
23
+ # end
24
+ # You should have an array of the models *in the same order* as in your load method. You should
25
+ # have ALL of the models in the database in this table to be safe.
26
+ def self.purge_seed
27
+
9
28
  end
10
29
 
11
- #
12
- def self.purge_all_data
13
- # Manually delete from all models and non-model join tables
14
- #self.purge_all_data
30
+ # Load up testing data for your test suite. Follows same pattern as load_seed
31
+ def self.load_data
32
+
33
+ end
34
+
35
+ # Purge the data that you loaded. Follows same pattern at purge_seed
36
+ def self.purge_data
37
+ self.purge_assets
15
38
  end
39
+
40
+ private
41
+
42
+ # Here you can run file system calls to clean out any content directories you use.
43
+ # For example:
44
+ # FileUtils.rm_rf(File.join(RAILS_ROOT, 'content', RAILS_ENV))
45
+ def self.purge_assets
46
+
47
+ end
48
+
49
+ ### Put your Seed loading methods here:
50
+
51
+
52
+ ### Put your data loading methods here:
53
+
16
54
 
17
- end
55
+ end
@@ -11,7 +11,7 @@ module StoryHelper
11
11
  end
12
12
 
13
13
  MAJOR = 0
14
- MINOR = 1
14
+ MINOR = 2
15
15
  TINY = 0
16
16
 
17
17
  STRING = [MAJOR, MINOR, TINY].join(".")
@@ -1,22 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+
1
3
  Gem::Specification.new do |s|
2
4
  s.name = %q{story-helper}
3
- s.version = "0.1.0"
5
+ s.version = "0.2.0"
4
6
 
5
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
8
  s.authors = ["John Trupiano"]
7
- s.date = %q{2008-09-16}
9
+ s.date = %q{2009-01-30}
8
10
  s.default_executable = %q{storify}
9
11
  s.description = %q{A set of helpers/features to aid in implementing the StoryHelper concept in rails apps}
10
12
  s.email = ["jtrupiano@gmail.com"]
11
13
  s.executables = ["storify"]
12
- s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
13
- s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/storify", "lib/story-helper.rb", "lib/story-helper/conf/story_accessors.rb", "lib/story-helper/conf/story_helper.rake", "lib/story-helper/conf/story_helper.rb", "lib/story-helper/version.rb", "story-helper.gemspec", "test/rails_version_test.rb", "test/test_story_helper.rb"]
14
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
15
+ s.files = ["History.txt", "Manifest.txt", "README.textile", "Rakefile", "bin/storify", "lib/story-helper.rb", "lib/story-helper/conf/story_accessors.rb", "lib/story-helper/conf/story_helper.rake", "lib/story-helper/conf/story_helper.rb", "lib/story-helper/conf/test_helper_extensions.rb", "lib/story-helper/version.rb", "story-helper.gemspec", "test/rails_version_test.rb", "test/test_story_helper.rb"]
14
16
  s.has_rdoc = true
15
- s.homepage = %q{http://github.com/jtrupiano/story-helper}
16
17
  s.rdoc_options = ["--main", "README.txt"]
17
18
  s.require_paths = ["lib"]
18
19
  s.rubyforge_project = %q{johntrupiano}
19
- s.rubygems_version = %q{1.2.0}
20
+ s.rubygems_version = %q{1.3.1}
20
21
  s.summary = %q{A set of helpers/features to aid in implementing the StoryHelper concept in rails apps}
21
22
  s.test_files = ["test/test_story_helper.rb"]
22
23
 
@@ -24,12 +25,12 @@ Gem::Specification.new do |s|
24
25
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
26
  s.specification_version = 2
26
27
 
27
- if current_version >= 3 then
28
- s.add_development_dependency(%q<hoe>, [">= 1.7.0"])
28
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
29
+ s.add_development_dependency(%q<hoe>, [">= 1.8.2"])
29
30
  else
30
- s.add_dependency(%q<hoe>, [">= 1.7.0"])
31
+ s.add_dependency(%q<hoe>, [">= 1.8.2"])
31
32
  end
32
33
  else
33
- s.add_dependency(%q<hoe>, [">= 1.7.0"])
34
+ s.add_dependency(%q<hoe>, [">= 1.8.2"])
34
35
  end
35
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: story-helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Trupiano
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-21 00:00:00 -04:00
12
+ date: 2009-01-30 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.7.0
23
+ version: 1.8.2
24
24
  version:
25
25
  description: A set of helpers/features to aid in implementing the StoryHelper concept in rails apps
26
26
  email:
@@ -32,11 +32,10 @@ extensions: []
32
32
  extra_rdoc_files:
33
33
  - History.txt
34
34
  - Manifest.txt
35
- - README.txt
36
35
  files:
37
36
  - History.txt
38
37
  - Manifest.txt
39
- - README.txt
38
+ - README.textile
40
39
  - Rakefile
41
40
  - bin/storify
42
41
  - lib/story-helper.rb
@@ -49,7 +48,7 @@ files:
49
48
  - test/rails_version_test.rb
50
49
  - test/test_story_helper.rb
51
50
  has_rdoc: true
52
- homepage: http://github.com/jtrupiano/story-helper
51
+ homepage:
53
52
  post_install_message:
54
53
  rdoc_options:
55
54
  - --main
@@ -71,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
70
  requirements: []
72
71
 
73
72
  rubyforge_project: johntrupiano
74
- rubygems_version: 1.2.0
73
+ rubygems_version: 1.3.1
75
74
  signing_key:
76
75
  specification_version: 2
77
76
  summary: A set of helpers/features to aid in implementing the StoryHelper concept in rails apps