state_flow 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,91 @@
1
+ # -*- coding: utf-8 -*-
2
+ $KCODE='u'
3
+
4
+ ENV['RAILS_ENV'] ||= 'test'
5
+ unless defined?(RAILS_ENV)
6
+ RAILS_ENV = 'test'
7
+ RAILS_ROOT = File.dirname(__FILE__) unless defined?(RAILS_ROOT)
8
+
9
+ require 'rubygems'
10
+ require 'spec'
11
+
12
+ require 'active_support'
13
+ require 'active_record'
14
+ require 'active_record/fixtures'
15
+ # require 'action_mailer'
16
+ # require 'action_controller'
17
+ # require 'action_view'
18
+ require 'initializer'
19
+
20
+ require 'yaml'
21
+ config = YAML.load(IO.read(File.join(File.dirname(__FILE__), 'database.yml')))
22
+
23
+ class FormatterWithThread < Logger::Formatter
24
+ Format = "%s %s, [%s#%d] %5s -- %s: %s\n"
25
+ def call(severity, time, progname, msg)
26
+ Format % [(Thread.current[:name] || Thread.current.object_id).to_s,
27
+ severity[0..0], format_datetime(time), $$, severity, progname,
28
+ msg2str(msg)]
29
+ end
30
+ end
31
+
32
+ ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), 'debug.log'))
33
+ ActiveRecord::Base.logger.formatter = FormatterWithThread.new
34
+ # ActionController::Base.logger = ActiveRecord::Base.logger
35
+
36
+ ActiveRecord::Base.establish_connection(
37
+ {:pool => 10}.update(config[ENV['DB'] || 'sqlite3'])
38
+ )
39
+
40
+ load(File.join(File.dirname(__FILE__), 'schema.rb'))
41
+
42
+ # ActionController::Routing::Routes.draw do |map|
43
+ # map.connect ':controller/:action/:id.:format'
44
+ # map.connect ':controller/:action/:id'
45
+ # end
46
+
47
+ gem 'selectable_attr' , ">=0.3.7"
48
+ gem 'selectable_attr_rails', ">=0.3.7"
49
+ require 'selectable_attr'
50
+ require 'selectable_attr_i18n'
51
+ require 'selectable_attr_rails'
52
+ SelectableAttrRails.add_features_to_active_record
53
+
54
+
55
+ # %w(resources/models resources/controllers).each do |path|
56
+ %w(resources/models).each do |path|
57
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), path)
58
+ ActiveSupport::Dependencies.load_paths << File.join(File.dirname(__FILE__), path)
59
+ end
60
+
61
+ require 'spec/autorun'
62
+ # require 'spec/rails'
63
+
64
+ $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
65
+ require File.join(File.dirname(__FILE__), '..', 'init')
66
+
67
+ # Dir.glob("resources/**/*.rb") do |filename|
68
+ # require filename
69
+ # end
70
+
71
+ class ActiveSupport::TestCase
72
+ include ActiveRecord::TestFixtures
73
+ self.fixture_path = File.join(File.dirname(__FILE__), 'fixtures')
74
+ self.use_transactional_fixtures = false
75
+ self.use_instantiated_fixtures = false
76
+ self.pre_loaded_fixtures = false
77
+ fixtures :all
78
+
79
+ def setup_fixtures_with_set_fixture_path
80
+ # ここでなぜか fixture_path の値が変わってしまっています。。。
81
+ self.class.fixture_path = File.join(File.dirname(__FILE__), 'fixtures')
82
+ setup_fixtures_without_set_fixture_path
83
+ end
84
+ alias_method_chain :setup_fixtures, :set_fixture_path
85
+ end
86
+
87
+ ActiveRecord::Base.configurations = true
88
+
89
+
90
+
91
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :state_flow do
3
+ # # Task goes here
4
+ # end
data/uninstall.rb ADDED
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: state_flow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Takeshi Akima
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-27 00:00:00 +09:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: state_flow provides a DSL for State Transition
17
+ email: akima@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ files:
25
+ - .gitignore
26
+ - MIT-LICENSE
27
+ - README.rdoc
28
+ - Rakefile
29
+ - VERSION
30
+ - init.rb
31
+ - install.rb
32
+ - lib/state_flow.rb
33
+ - lib/state_flow/action.rb
34
+ - lib/state_flow/base.rb
35
+ - lib/state_flow/builder.rb
36
+ - lib/state_flow/entry.rb
37
+ - lib/state_flow/event.rb
38
+ - lib/state_flow/log.rb
39
+ - lib/state_flow/named_action.rb
40
+ - spec/.gitignore
41
+ - spec/base_spec.rb
42
+ - spec/concurrency_spec.rb
43
+ - spec/database.yml
44
+ - spec/page_spec.rb
45
+ - spec/resources/models/page.rb
46
+ - spec/schema.rb
47
+ - spec/spec.opts
48
+ - spec/spec_helper.rb
49
+ - tasks/state_flow_tasks.rake
50
+ - uninstall.rb
51
+ has_rdoc: true
52
+ homepage: http://github.com/akm/state_flow/
53
+ licenses: []
54
+
55
+ post_install_message:
56
+ rdoc_options:
57
+ - --charset=UTF-8
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ version:
72
+ requirements: []
73
+
74
+ rubyforge_project:
75
+ rubygems_version: 1.3.5
76
+ signing_key:
77
+ specification_version: 3
78
+ summary: state_flow provides a DSL for State Transition
79
+ test_files:
80
+ - spec/base_spec.rb
81
+ - spec/concurrency_spec.rb
82
+ - spec/page_spec.rb
83
+ - spec/resources/models/page.rb
84
+ - spec/schema.rb
85
+ - spec/spec_helper.rb