rails3_artifactor 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +0 -0
- data/.gitignore +0 -0
- data/.rspec +0 -0
- data/DESIGN_NOTES.markdown +0 -0
- data/LICENSE +0 -0
- data/README.markdown +0 -0
- data/Rakefile +5 -2
- data/VERSION +1 -1
- data/lib/rails3_artifactor/artifact/base.rb +59 -0
- data/lib/rails3_artifactor/artifact/crud/view.rb +0 -0
- data/lib/rails3_artifactor/artifact/crud.rb +7 -2
- data/lib/rails3_artifactor/artifact/file_name/artifacts.rb +0 -0
- data/lib/rails3_artifactor/artifact/file_name/migration.rb +2 -2
- data/lib/rails3_artifactor/artifact/file_name/view.rb +0 -0
- data/lib/rails3_artifactor/artifact/markers.rb +0 -3
- data/lib/rails3_artifactor/artifact/migration.rb +0 -0
- data/lib/rails3_artifactor/artifact/orm/active_record.rb +0 -0
- data/lib/rails3_artifactor/artifact/orm/data_mapper.rb +0 -0
- data/lib/rails3_artifactor/artifact/orm/mongo_mapper.rb +0 -0
- data/lib/rails3_artifactor/artifact/orm/mongoid.rb +0 -0
- data/lib/rails3_artifactor/artifact/orm/none.rb +0 -0
- data/lib/rails3_artifactor/artifact/orm.rb +5 -1
- data/lib/rails3_artifactor/base/crud/create.rb +9 -5
- data/lib/rails3_artifactor/base/crud/delete.rb +9 -2
- data/lib/rails3_artifactor/base/crud/read.rb +0 -0
- data/lib/rails3_artifactor/base/crud/update.rb +0 -0
- data/lib/rails3_artifactor/base/crud.rb +0 -0
- data/lib/rails3_artifactor/base/file_name.rb +5 -5
- data/lib/rails3_artifactor/namespaces.rb +0 -0
- data/lib/rails3_artifactor/rspec/configure.rb +0 -0
- data/lib/rails3_artifactor/rspec/macro.rb +0 -0
- data/lib/rails3_artifactor.rb +2 -0
- data/rails3_artifactor.gemspec +15 -5
- data/spec/fixtures/app/controllers/account_controller.rb +5 -1
- data/spec/fixtures/app/helpers/account_helper.rb +1 -2
- data/spec/fixtures/app/mailers/account_mailer.rb +6 -0
- data/spec/fixtures/app/models/account.rb +1 -6
- data/spec/fixtures/app/views/account/edit.html.erb +1 -0
- data/spec/fixtures/app/views/account/show.html.erb +0 -0
- data/spec/fixtures/db/migrations/20100904095012_create_account.rb +0 -0
- data/spec/fixtures.rb +0 -0
- data/spec/rails3_artifactor/artifact/base_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/crud/controller_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/crud/helper_spec.rb +7 -7
- data/spec/rails3_artifactor/artifact/crud/mailer_spec.rb +33 -0
- data/spec/rails3_artifactor/artifact/crud/migration_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/crud/model_spec.rb +1 -3
- data/spec/rails3_artifactor/artifact/crud/observer_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/crud/view_controller_action_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/crud/view_controller_default_action_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/file_name/artifacts_spec.rb +8 -4
- data/spec/rails3_artifactor/artifact/file_name/migration_spec.rb +7 -6
- data/spec/rails3_artifactor/artifact/file_name/view_spec.rb +1 -6
- data/spec/rails3_artifactor/artifact/markers_spec.rb +1 -5
- data/spec/rails3_artifactor/artifact/migration_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/orm/active_record_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/orm/data_mapper_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/orm/mongo_mapper_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/orm/mongoid_spec.rb +0 -0
- data/spec/rails3_artifactor/artifact/orm/none_spec.rb +0 -0
- data/spec/rails3_artifactor/base/crud/create_spec.rb +0 -0
- data/spec/rails3_artifactor/base/crud/delete_spec.rb +0 -0
- data/spec/rails3_artifactor/base/crud/read_spec.rb +0 -0
- data/spec/rails3_artifactor/base/crud/update_spec.rb +0 -0
- data/spec/rails3_artifactor/base/file_name_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- metadata +42 -5
data/.document
CHANGED
File without changes
|
data/.gitignore
CHANGED
File without changes
|
data/.rspec
CHANGED
File without changes
|
data/DESIGN_NOTES.markdown
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/README.markdown
CHANGED
File without changes
|
data/Rakefile
CHANGED
@@ -7,8 +7,11 @@ begin
|
|
7
7
|
gem.email = "kmandrup@gmail.com"
|
8
8
|
gem.homepage = "http://github.com/kristianmandrup/rails3_artifact_helper"
|
9
9
|
gem.authors = ["Kristian Mandrup"]
|
10
|
-
gem.add_development_dependency "rspec", "~> 2.0.0"
|
11
|
-
gem.add_dependency "require_all",
|
10
|
+
gem.add_development_dependency "rspec", "~> 2.0.0.beta.19"
|
11
|
+
gem.add_dependency "require_all", "~> 1.1.0"
|
12
|
+
gem.add_dependency "sugar-high", "~> 0.2.3"
|
13
|
+
gem.add_dependency 'rails3_assist', "~> 0.3.1"
|
14
|
+
|
12
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
16
|
end
|
14
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Rails3::Assist
|
2
|
+
module BaseHelper
|
3
|
+
def self.included(base)
|
4
|
+
base.extend ClassMethods
|
5
|
+
base.class_eval do
|
6
|
+
include Rails3::Assist::App
|
7
|
+
include ::Thor::Actions
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def multi_aliases_for name
|
13
|
+
multi_alias :_after_ => name, :create => :new, :insert_into => [:inject_into, :update], :read => :X_content, :remove => :delete
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
protected
|
18
|
+
|
19
|
+
def get_type options = {}
|
20
|
+
case options
|
21
|
+
when Hash
|
22
|
+
raise ArgumentError, "No artifact type specified #{options}" if !options[:type]
|
23
|
+
options[:type].to_sym
|
24
|
+
when String, Symbol
|
25
|
+
options.to_sym
|
26
|
+
else
|
27
|
+
raise ArgumentError, "Bad artifact type specified #{options}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def debug?
|
32
|
+
Rails3::Assist.debug_on
|
33
|
+
end
|
34
|
+
|
35
|
+
def debug msg
|
36
|
+
puts msg if debug?
|
37
|
+
end
|
38
|
+
|
39
|
+
def set options, type
|
40
|
+
options.merge!(:type => type)
|
41
|
+
options
|
42
|
+
end
|
43
|
+
|
44
|
+
def orm_notify
|
45
|
+
''
|
46
|
+
end
|
47
|
+
|
48
|
+
def marker_option name, options={}
|
49
|
+
type = last_option(options)[:type]
|
50
|
+
marker_content = if type
|
51
|
+
method = :"#{type}_marker"
|
52
|
+
orm_marker = send method, name, options if respond_to? method
|
53
|
+
else
|
54
|
+
name.to_s.camelize
|
55
|
+
end
|
56
|
+
options[:before] ? {:before => marker_content} : {:after => marker_content}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
File without changes
|
@@ -14,9 +14,14 @@ module Rails3::Assist::Artifact
|
|
14
14
|
|
15
15
|
Rails3::Assist.artifacts.each do |name|
|
16
16
|
class_eval %{
|
17
|
-
module #{name.to_s.camelize}
|
17
|
+
module #{name.to_s.camelize}
|
18
18
|
include Rails3::Assist::BaseHelper
|
19
|
-
|
19
|
+
|
20
|
+
def self.included base
|
21
|
+
base.class_eval do
|
22
|
+
include Rails3::Assist::Artifact::CRUD
|
23
|
+
end
|
24
|
+
end
|
20
25
|
|
21
26
|
def has_#{name.to_s.pluralize}? *names
|
22
27
|
names.flatten.each do |name|
|
File without changes
|
@@ -19,7 +19,7 @@ module Rails3::Assist::Artifact
|
|
19
19
|
def migration_file_name name, options={}
|
20
20
|
number = options[:number]
|
21
21
|
|
22
|
-
migration_dir_name = File.expand_path(DIR.migration_dir options
|
22
|
+
migration_dir_name = File.expand_path(DIR.migration_dir options)
|
23
23
|
|
24
24
|
number = next_migration_number(migration_dir_name) if !number
|
25
25
|
File.join(migration_dir_name, "#{number}_#{name}.rb")
|
@@ -28,7 +28,7 @@ module Rails3::Assist::Artifact
|
|
28
28
|
def find_migration name, options={}
|
29
29
|
root_path = options[:root_path]
|
30
30
|
|
31
|
-
migration_dir_name = File.expand_path(DIR.migration_dir options
|
31
|
+
migration_dir_name = File.expand_path(DIR.migration_dir options)
|
32
32
|
|
33
33
|
migration_find_expr = "#{migration_dir_name}/[0-9]*_*.rb"
|
34
34
|
migrations = Dir.glob(migration_find_expr)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -5,7 +5,7 @@ module Rails3::Assist::Artifact::CRUD
|
|
5
5
|
def create_artifact name, options={}, &block
|
6
6
|
type = get_type(options)
|
7
7
|
file = make_file_name(name, type)
|
8
|
-
return nil if File.exist?(file)
|
8
|
+
return nil if File.exist?(file) && options[:no_overwrite]
|
9
9
|
|
10
10
|
create_artifact_dir(file)
|
11
11
|
content = get_content(name, type, options, &block)
|
@@ -19,7 +19,7 @@ module Rails3::Assist::Artifact::CRUD
|
|
19
19
|
# def new_artifact_content name, type, content=nil, &block
|
20
20
|
def new_artifact_content name, options = {}, &block
|
21
21
|
type = get_type(options)
|
22
|
-
content =
|
22
|
+
content = extract_content type, options, &block
|
23
23
|
%Q{class #{marker(name, type)}
|
24
24
|
#{content}
|
25
25
|
end}
|
@@ -37,11 +37,15 @@ end}
|
|
37
37
|
method
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
40
|
+
def extract_content type, options, &block
|
41
41
|
content = block ? yield : options[:content]
|
42
|
-
content = type == :model ?
|
42
|
+
content = type == :model ? options.merge(:content => content) : content
|
43
|
+
end
|
44
|
+
|
45
|
+
def get_content name, type, options = {}, &block
|
46
|
+
content = extract_content type, options, &block
|
43
47
|
method = content_method(type)
|
44
|
-
send method, name,
|
48
|
+
send method, name, content
|
45
49
|
end
|
46
50
|
end
|
47
51
|
end
|
@@ -4,8 +4,15 @@ module Rails3::Assist::Artifact::CRUD
|
|
4
4
|
module Delete
|
5
5
|
def remove_artifact name, type
|
6
6
|
type = type[:type] if type.kind_of? Hash
|
7
|
-
|
8
|
-
|
7
|
+
begin
|
8
|
+
file = existing_file_name name, type
|
9
|
+
FileUtils.rm_f(file)
|
10
|
+
debug "removed artifact: #{name}"
|
11
|
+
true
|
12
|
+
rescue
|
13
|
+
debug "artifact to remove not found: #{name}"
|
14
|
+
nil
|
15
|
+
end
|
9
16
|
end
|
10
17
|
alias_method :delete_artifact, :remove_artifact
|
11
18
|
|
File without changes
|
File without changes
|
File without changes
|
@@ -9,11 +9,11 @@ module Rails3::Assist::Artifact
|
|
9
9
|
send :"#{type}_file_name", name, options
|
10
10
|
end
|
11
11
|
|
12
|
-
def existing_file_name name, type=nil
|
12
|
+
def existing_file_name name, type=nil, options = {}
|
13
13
|
# first try finder method
|
14
14
|
finder_method = :"find_#{type}"
|
15
15
|
if respond_to?(finder_method)
|
16
|
-
result = send finder_method, name
|
16
|
+
result = send finder_method, name, options
|
17
17
|
if !result.kind_of? String
|
18
18
|
raise IOError, "The call to #find_#{type}(#{name}) didn't find an existing #{type} file. Error in find expression: #{result.find_expr}"
|
19
19
|
end
|
@@ -23,15 +23,15 @@ module Rails3::Assist::Artifact
|
|
23
23
|
end
|
24
24
|
|
25
25
|
# default for non-migration
|
26
|
-
file_name = make_file_name
|
26
|
+
file_name = make_file_name name, type, options
|
27
27
|
raise IOError, "No file for :#{type} found at location: #{file_name}" if !File.file?(file_name)
|
28
28
|
file_name
|
29
29
|
end
|
30
30
|
|
31
31
|
Rails3::Assist.artifacts.each do |name|
|
32
32
|
class_eval %{
|
33
|
-
def existing_#{name}_file name, type=nil
|
34
|
-
existing_file_name name, type
|
33
|
+
def existing_#{name}_file name, type=nil, options = {}
|
34
|
+
existing_file_name name, type, options
|
35
35
|
end
|
36
36
|
}
|
37
37
|
end
|
File without changes
|
File without changes
|
File without changes
|
data/lib/rails3_artifactor.rb
CHANGED
data/rails3_artifactor.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rails3_artifactor}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kristian Mandrup"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-11}
|
13
13
|
s.description = %q{Helpers for handling Rails 3 artifacts in general, such as CRUD operations etc.}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
28
|
"lib/rails3_artifactor.rb",
|
29
|
+
"lib/rails3_artifactor/artifact/base.rb",
|
29
30
|
"lib/rails3_artifactor/artifact/crud.rb",
|
30
31
|
"lib/rails3_artifactor/artifact/crud/view.rb",
|
31
32
|
"lib/rails3_artifactor/artifact/file_name/artifacts.rb",
|
@@ -56,6 +57,7 @@ Gem::Specification.new do |s|
|
|
56
57
|
"spec/fixtures/app/views/account/edit.html.erb",
|
57
58
|
"spec/fixtures/app/views/account/show.html.erb",
|
58
59
|
"spec/fixtures/db/migrations/20100904095012_create_account.rb",
|
60
|
+
"spec/rails3_artifactor/artifact/base_spec.rb",
|
59
61
|
"spec/rails3_artifactor/artifact/crud/controller_spec.rb",
|
60
62
|
"spec/rails3_artifactor/artifact/crud/helper_spec.rb",
|
61
63
|
"spec/rails3_artifactor/artifact/crud/migration_spec.rb",
|
@@ -88,12 +90,14 @@ Gem::Specification.new do |s|
|
|
88
90
|
s.test_files = [
|
89
91
|
"spec/fixtures/app/controllers/account_controller.rb",
|
90
92
|
"spec/fixtures/app/helpers/account_helper.rb",
|
93
|
+
"spec/fixtures/app/mailers/account_mailer.rb",
|
91
94
|
"spec/fixtures/app/models/account.rb",
|
92
95
|
"spec/fixtures/db/migrations/20100904095012_create_account.rb",
|
93
96
|
"spec/fixtures.rb",
|
94
97
|
"spec/rails3_artifactor/artifact/base_spec.rb",
|
95
98
|
"spec/rails3_artifactor/artifact/crud/controller_spec.rb",
|
96
99
|
"spec/rails3_artifactor/artifact/crud/helper_spec.rb",
|
100
|
+
"spec/rails3_artifactor/artifact/crud/mailer_spec.rb",
|
97
101
|
"spec/rails3_artifactor/artifact/crud/migration_spec.rb",
|
98
102
|
"spec/rails3_artifactor/artifact/crud/model_spec.rb",
|
99
103
|
"spec/rails3_artifactor/artifact/crud/observer_spec.rb",
|
@@ -122,15 +126,21 @@ Gem::Specification.new do |s|
|
|
122
126
|
s.specification_version = 3
|
123
127
|
|
124
128
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
125
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.0.0"])
|
129
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta.19"])
|
126
130
|
s.add_runtime_dependency(%q<require_all>, ["~> 1.1.0"])
|
131
|
+
s.add_runtime_dependency(%q<sugar-high>, ["~> 0.2.3"])
|
132
|
+
s.add_runtime_dependency(%q<rails3_assist>, ["~> 0.3.1"])
|
127
133
|
else
|
128
|
-
s.add_dependency(%q<rspec>, ["~> 2.0.0"])
|
134
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.19"])
|
129
135
|
s.add_dependency(%q<require_all>, ["~> 1.1.0"])
|
136
|
+
s.add_dependency(%q<sugar-high>, ["~> 0.2.3"])
|
137
|
+
s.add_dependency(%q<rails3_assist>, ["~> 0.3.1"])
|
130
138
|
end
|
131
139
|
else
|
132
|
-
s.add_dependency(%q<rspec>, ["~> 2.0.0"])
|
140
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.19"])
|
133
141
|
s.add_dependency(%q<require_all>, ["~> 1.1.0"])
|
142
|
+
s.add_dependency(%q<sugar-high>, ["~> 0.2.3"])
|
143
|
+
s.add_dependency(%q<rails3_assist>, ["~> 0.3.1"])
|
134
144
|
end
|
135
145
|
end
|
136
146
|
|
File without changes
|
File without changes
|
data/spec/fixtures.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -6,7 +6,7 @@ describe 'helper' do
|
|
6
6
|
before :each do
|
7
7
|
Rails3::Assist::Directory.rails_root = fixtures_dir
|
8
8
|
|
9
|
-
remove_helper :account if has_helper? :account
|
9
|
+
# remove_helper :account if has_helper? :account
|
10
10
|
create_helper :account do
|
11
11
|
%q{
|
12
12
|
def index
|
@@ -20,12 +20,12 @@ describe 'helper' do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should have an account_helper file that contains an index method and two inserted comments" do
|
23
|
-
insert_into_helper :account, :content => '# hello'
|
24
|
-
insert_into_helper :account do
|
25
|
-
|
26
|
-
end
|
27
|
-
read_helper(:account).should have_comment 'hello'
|
28
|
-
puts read_helper(:account)
|
23
|
+
# insert_into_helper :account, :content => '# hello'
|
24
|
+
# insert_into_helper :account do
|
25
|
+
# '# goodbye'
|
26
|
+
# end
|
27
|
+
# read_helper(:account).should have_comment 'hello'
|
28
|
+
# puts read_helper(:account)
|
29
29
|
# root_dir.should have_helper :account do |helper_file|
|
30
30
|
# helper_file.should have_method :index
|
31
31
|
# helper_file.should have_comment 'hello'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'mailer' do
|
4
|
+
use_helpers :mailer
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
Rails3::Assist::Directory.rails_root = fixtures_dir
|
8
|
+
|
9
|
+
# remove_helper :account if has_helper? :account
|
10
|
+
create_mailer :account do
|
11
|
+
%q{ def mail_it
|
12
|
+
end}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
after :each do
|
17
|
+
# remove_helper :account
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have an account_mailer file that contains a #mail_it method and two inserted comments" do
|
21
|
+
insert_into_mailer :account, :content => '# hello'
|
22
|
+
insert_into_mailer :account do
|
23
|
+
'# goodbye'
|
24
|
+
end
|
25
|
+
read_mailer(:account).should have_comment 'hello'
|
26
|
+
puts read_mailer(:account)
|
27
|
+
# root_dir.should have_mailer :account do |helper_file|
|
28
|
+
# helper_file.should have_method :index
|
29
|
+
# helper_file.should have_comment 'hello'
|
30
|
+
# helper_file.should have_comment 'goodbye'
|
31
|
+
# end
|
32
|
+
end
|
33
|
+
end
|
File without changes
|
@@ -2,12 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'model without orm' do
|
4
4
|
use_orm :none
|
5
|
-
use_helper :model
|
6
5
|
|
7
6
|
before :each do
|
8
7
|
Rails3::Assist::Directory.rails_root = fixtures_dir
|
9
8
|
|
10
|
-
|
9
|
+
delete_model(:account) if has_model? :account
|
11
10
|
create_model :account do
|
12
11
|
%q{def index
|
13
12
|
end}
|
@@ -26,7 +25,6 @@ describe 'model without orm' do
|
|
26
25
|
puts read_model(:account)
|
27
26
|
read_model(:account).should have_comment 'hello'
|
28
27
|
|
29
|
-
|
30
28
|
# root_dir.should have_model :account do |model_file|
|
31
29
|
# model_file.should have_method :index
|
32
30
|
# model_file.should have_comment 'hello'
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'rails3_artifactor/namespaces'
|
3
|
-
require 'rails3_artifactor/artifact/file_name/artifacts'
|
1
|
+
require 'spec_helper'
|
4
2
|
|
5
3
|
CLASS = Rails3::Assist::Artifact::FileName
|
6
4
|
|
@@ -19,10 +17,16 @@ describe Rails3::Assist::Artifact::FileName do
|
|
19
17
|
(Rails3::Assist.artifacts - [:migration, :view]).each do |name|
|
20
18
|
eval %{
|
21
19
|
describe '##{name}_file_name' do
|
22
|
-
it "should return the file name for #{name}" do
|
20
|
+
it "should return the file name for #{name} using class method" do
|
23
21
|
clazz = Rails3::Assist::Artifact::#{name.to_s.camelize}
|
24
22
|
clazz.#{name}_file_name('user').should match /user/
|
25
23
|
end
|
24
|
+
|
25
|
+
it "should return the file name for #{name} using instance method" do
|
26
|
+
art = ArtDir.new
|
27
|
+
art.extend Rails3::Assist::Artifact::#{name.to_s.camelize}
|
28
|
+
art.#{name}_file_name('user').should match /user/
|
29
|
+
end
|
26
30
|
end
|
27
31
|
}
|
28
32
|
end
|
@@ -1,9 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'require_all'
|
3
|
-
require 'rails3_artifactor/namespaces'
|
4
|
-
require 'rails3_artifactor/artifact/file_name/migration'
|
5
|
-
require 'rails3_artifactor/artifact/orm'
|
6
|
-
require 'rails3_artifactor/rspec/configure'
|
1
|
+
require 'spec_helper'
|
7
2
|
|
8
3
|
CLASS = Rails3::Assist::Artifact::Migration
|
9
4
|
|
@@ -26,5 +21,11 @@ describe Rails3::Assist::Artifact::Migration::FileName do
|
|
26
21
|
CLASS.migration_file_name(:create_persons).should match /create_persons/
|
27
22
|
end
|
28
23
|
end
|
24
|
+
|
25
|
+
describe '#migration_file_name' do
|
26
|
+
it "should return the file name for migration" do
|
27
|
+
CLASS.migration_file_name(:create_persons, :root_path => 'my_root').should match /my_root/
|
28
|
+
end
|
29
|
+
end
|
29
30
|
end
|
30
31
|
|
@@ -1,9 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'require_all'
|
3
|
-
require 'sugar-high/regexp'
|
4
|
-
require 'rails3_artifactor/namespaces'
|
5
|
-
require 'rails3_artifactor/artifact/file_name/view'
|
6
|
-
# require 'rails3_artifactor/rspec/configure'
|
1
|
+
require 'spec_helper'
|
7
2
|
|
8
3
|
CLASS = Rails3::Assist::Artifact::View
|
9
4
|
|
@@ -1,8 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require 'sugar-high/regexp'
|
3
|
-
require 'rails3_artifactor/namespaces'
|
4
|
-
require 'rails3_artifactor/artifact/markers'
|
5
|
-
# require 'rails3_artifactor/rspec/configure'
|
1
|
+
require 'spec_helper'
|
6
2
|
|
7
3
|
describe Rails3::Assist::Artifact::Controller do
|
8
4
|
before do
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kristian Mandrup
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-11 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -29,7 +29,9 @@ dependencies:
|
|
29
29
|
- 2
|
30
30
|
- 0
|
31
31
|
- 0
|
32
|
-
|
32
|
+
- beta
|
33
|
+
- 19
|
34
|
+
version: 2.0.0.beta.19
|
33
35
|
type: :development
|
34
36
|
version_requirements: *id001
|
35
37
|
- !ruby/object:Gem::Dependency
|
@@ -47,6 +49,36 @@ dependencies:
|
|
47
49
|
version: 1.1.0
|
48
50
|
type: :runtime
|
49
51
|
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: sugar-high
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 2
|
63
|
+
- 3
|
64
|
+
version: 0.2.3
|
65
|
+
type: :runtime
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: rails3_assist
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
- 3
|
78
|
+
- 1
|
79
|
+
version: 0.3.1
|
80
|
+
type: :runtime
|
81
|
+
version_requirements: *id004
|
50
82
|
description: Helpers for handling Rails 3 artifacts in general, such as CRUD operations etc.
|
51
83
|
email: kmandrup@gmail.com
|
52
84
|
executables: []
|
@@ -66,6 +98,7 @@ files:
|
|
66
98
|
- Rakefile
|
67
99
|
- VERSION
|
68
100
|
- lib/rails3_artifactor.rb
|
101
|
+
- lib/rails3_artifactor/artifact/base.rb
|
69
102
|
- lib/rails3_artifactor/artifact/crud.rb
|
70
103
|
- lib/rails3_artifactor/artifact/crud/view.rb
|
71
104
|
- lib/rails3_artifactor/artifact/file_name/artifacts.rb
|
@@ -96,6 +129,7 @@ files:
|
|
96
129
|
- spec/fixtures/app/views/account/edit.html.erb
|
97
130
|
- spec/fixtures/app/views/account/show.html.erb
|
98
131
|
- spec/fixtures/db/migrations/20100904095012_create_account.rb
|
132
|
+
- spec/rails3_artifactor/artifact/base_spec.rb
|
99
133
|
- spec/rails3_artifactor/artifact/crud/controller_spec.rb
|
100
134
|
- spec/rails3_artifactor/artifact/crud/helper_spec.rb
|
101
135
|
- spec/rails3_artifactor/artifact/crud/migration_spec.rb
|
@@ -119,7 +153,8 @@ files:
|
|
119
153
|
- spec/rails3_artifactor/base/crud/update_spec.rb
|
120
154
|
- spec/rails3_artifactor/base/file_name_spec.rb
|
121
155
|
- spec/spec_helper.rb
|
122
|
-
- spec/
|
156
|
+
- spec/fixtures/app/mailers/account_mailer.rb
|
157
|
+
- spec/rails3_artifactor/artifact/crud/mailer_spec.rb
|
123
158
|
has_rdoc: true
|
124
159
|
homepage: http://github.com/kristianmandrup/rails3_artifact_helper
|
125
160
|
licenses: []
|
@@ -155,12 +190,14 @@ summary: Helpers for handling Rails 3 artifacts
|
|
155
190
|
test_files:
|
156
191
|
- spec/fixtures/app/controllers/account_controller.rb
|
157
192
|
- spec/fixtures/app/helpers/account_helper.rb
|
193
|
+
- spec/fixtures/app/mailers/account_mailer.rb
|
158
194
|
- spec/fixtures/app/models/account.rb
|
159
195
|
- spec/fixtures/db/migrations/20100904095012_create_account.rb
|
160
196
|
- spec/fixtures.rb
|
161
197
|
- spec/rails3_artifactor/artifact/base_spec.rb
|
162
198
|
- spec/rails3_artifactor/artifact/crud/controller_spec.rb
|
163
199
|
- spec/rails3_artifactor/artifact/crud/helper_spec.rb
|
200
|
+
- spec/rails3_artifactor/artifact/crud/mailer_spec.rb
|
164
201
|
- spec/rails3_artifactor/artifact/crud/migration_spec.rb
|
165
202
|
- spec/rails3_artifactor/artifact/crud/model_spec.rb
|
166
203
|
- spec/rails3_artifactor/artifact/crud/observer_spec.rb
|