artworker 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +118 -106
- data/artworker.gemspec +4 -4
- data/lib/artworker.rb +0 -46
- data/lib/artworker/version.rb +1 -1
- metadata +23 -21
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
#Artworker
|
2
2
|
|
3
|
-
The Artworker gem provides many of the basic functions needed when dealing with a collection of different fine artwork and artists. The gem does this by providing
|
3
|
+
The Artworker gem provides many of the basic functions needed when dealing with a collection of different fine artwork and artists. The gem does this by providing access to universally needed attributes (based on museum standards).
|
4
4
|
|
5
5
|
##Installation
|
6
6
|
|
7
|
-
|
7
|
+
Install the gems from rubygems.org.
|
8
8
|
|
9
|
-
|
9
|
+
gem install artworker
|
10
|
+
|
11
|
+
Or, if you are using Bundler, which you should, you can add the following to you your Gemfile
|
12
|
+
|
13
|
+
gem 'artworker'
|
10
14
|
|
11
|
-
|
15
|
+
You will also want to make sure that your database has the necessary.
|
12
16
|
|
13
17
|
In the migration file for your artwork model, make sure you have columns for the following standard artwork attributes:
|
14
18
|
|
@@ -27,66 +31,27 @@ You can also assign other dimension types like paper, or framed, or base. Simply
|
|
27
31
|
|
28
32
|
Here is a sample migration that includes the basic columns, optional columns, and columns to record the frame dimensions:
|
29
33
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
Once you have created your migration file and migrated your database. You can add the `uses_artworker_artwork` command to your model. You may alter the options to match the columns in your database (though it may not be necessary if your columns match the default options). Here is the sample usage of the `uses_artworker_artwork` command for the model based on the above sample migration:
|
53
|
-
|
54
|
-
uses_artworker_artwork :title => :title,
|
55
|
-
:date => :date,
|
56
|
-
:use_fractions => :use_fractions,
|
57
|
-
:use_metric => :use_metric,
|
58
|
-
:dimensions => { :dimensions => [:height, :width, :depth], :framed_dimensions => [:framed_height, :framed_width, :framed_depth]}
|
59
|
-
|
60
|
-
You should now be able to use the attributes that Artworker provides. Below is a list of those attributes for the sample model:
|
61
|
-
|
62
|
-
title_with_date
|
63
|
-
italic_title_with_date
|
64
|
-
height
|
65
|
-
width
|
66
|
-
depth
|
67
|
-
framed_height
|
68
|
-
framed_width
|
69
|
-
framed_depth
|
70
|
-
height_in_inches
|
71
|
-
height_in_centimeters
|
72
|
-
width_in_inches
|
73
|
-
width_in_centimeters
|
74
|
-
depth_in_inches
|
75
|
-
depth_in_centimeters
|
76
|
-
framed_height_in_inches
|
77
|
-
framed_height_in_centimeters
|
78
|
-
framed_width_in_inches
|
79
|
-
framed_width_in_centimeters
|
80
|
-
framed_depth_in_inches
|
81
|
-
framed_depth_in_centimeters
|
82
|
-
dimensions
|
83
|
-
dimensions_in_inches
|
84
|
-
dimensions_in_centimeters
|
85
|
-
framed_dimensions
|
86
|
-
framed_dimensions_in_inches
|
87
|
-
framed_dimensions_in_centimeters
|
88
|
-
|
89
|
-
###In Your Artist Model
|
34
|
+
class CreateArtworks < ActiveRecord::Migration
|
35
|
+
def self.up
|
36
|
+
create_table :artworks do |t|
|
37
|
+
t.string :title
|
38
|
+
t.string :date
|
39
|
+
t.decimal :height, :null => false, :default => 0
|
40
|
+
t.decimal :width, :null => false, :default => 0
|
41
|
+
t.decimal :depth, :null => false, :default => 0
|
42
|
+
t.decimal :framed_height, :null => false, :default => 0
|
43
|
+
t.decimal :framed_width, :null => false, :default => 0
|
44
|
+
t.decimal :framed_depth, :null => false, :default => 0
|
45
|
+
t.boolean :use_fractions, :default => true, :null => false
|
46
|
+
t.boolean :use_metric, :default => false, :null => false
|
47
|
+
t.timestamps
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.down
|
52
|
+
drop_table :artworks
|
53
|
+
end
|
54
|
+
end
|
90
55
|
|
91
56
|
In the migration file for your artist model, make sure you have columns for the following standard artist attributes:
|
92
57
|
|
@@ -98,37 +63,85 @@ In the migration file for your artist model, make sure you have columns for the
|
|
98
63
|
|
99
64
|
Here is a sample migration that includes the basic columns:
|
100
65
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
66
|
+
class CreateArtists < ActiveRecord::Migration
|
67
|
+
def self.up
|
68
|
+
create_table :artists do |t|
|
69
|
+
t.string :firstname
|
70
|
+
t.string :lastname
|
71
|
+
t.string :birth
|
72
|
+
t.string :death
|
73
|
+
t.string :nationality
|
74
|
+
t.timestamps
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.down
|
79
|
+
drop_table :artists
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
---
|
84
|
+
|
85
|
+
##Usage
|
86
|
+
|
87
|
+
###Artwork Model
|
88
|
+
|
89
|
+
You can add the `uses_artworker_artwork` command to your artwork model. You may alter the options to match the columns in your database (though it may not be necessary if your columns match the default options). Here is the sample usage of the `uses_artworker_artwork` command for the model based on the above sample migration:
|
90
|
+
|
91
|
+
uses_artworker_artwork :title => :title,
|
92
|
+
:date => :date,
|
93
|
+
:use_fractions => :use_fractions,
|
94
|
+
:use_metric => :use_metric,
|
95
|
+
:dimensions => { :dimensions => [:height, :width, :depth],
|
96
|
+
:framed_dimensions => [:framed_height, :framed_width, :framed_depth]}
|
97
|
+
|
98
|
+
You should now be able to use the attributes that Artworker provides. Below is a list of those attributes for the sample model:
|
99
|
+
|
100
|
+
title_with_date
|
101
|
+
italic_title_with_date
|
102
|
+
height
|
103
|
+
width
|
104
|
+
depth
|
105
|
+
framed_height
|
106
|
+
framed_width
|
107
|
+
framed_depth
|
108
|
+
height_in_inches
|
109
|
+
height_in_centimeters
|
110
|
+
width_in_inches
|
111
|
+
width_in_centimeters
|
112
|
+
depth_in_inches
|
113
|
+
depth_in_centimeters
|
114
|
+
framed_height_in_inches
|
115
|
+
framed_height_in_centimeters
|
116
|
+
framed_width_in_inches
|
117
|
+
framed_width_in_centimeters
|
118
|
+
framed_depth_in_inches
|
119
|
+
framed_depth_in_centimeters
|
120
|
+
dimensions
|
121
|
+
dimensions_in_inches
|
122
|
+
dimensions_in_centimeters
|
123
|
+
framed_dimensions
|
124
|
+
framed_dimensions_in_inches
|
125
|
+
framed_dimensions_in_centimeters
|
126
|
+
|
127
|
+
###Artist Model
|
117
128
|
|
118
129
|
Once you have created your migration file and migrated your database. You can add the `uses_artworker_artist` command to your model. You may alter the options to match the columns in your database (though it may not be necessary if your columns match the default options). Here is the sample usage of the `uses_artworker_artist` command for the model based on the above sample migration:
|
119
130
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
131
|
+
uses_artworker_artist :firstname => :firstname,
|
132
|
+
:lastname => :lastname,
|
133
|
+
:birth => :birth,
|
134
|
+
:death => :death,
|
135
|
+
:nationality => :nationality
|
125
136
|
|
126
137
|
You should now be able to use the attributes that Artworker provides. Below is a list of those attributes for the sample model:
|
127
138
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
139
|
+
fullname
|
140
|
+
dates
|
141
|
+
fullname_with_dates
|
142
|
+
fullname_with_nationality_and_dates
|
143
|
+
|
144
|
+
---
|
132
145
|
|
133
146
|
##Troubleshooting and FAQs
|
134
147
|
|
@@ -140,28 +153,24 @@ There's only so many times that you can write the same code in project to projec
|
|
140
153
|
|
141
154
|
For the artwork options, the defaults are:
|
142
155
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
156
|
+
:title => :title
|
157
|
+
:date => :date
|
158
|
+
:use_fractions => :use_fractions (or false if column does not exist)
|
159
|
+
:use_metric => :use_metric (or false if column does not exist)
|
160
|
+
:dimensions => { :dimensions => [:height, :width, :depth] }
|
148
161
|
|
149
162
|
For the artist options, the defaults are:
|
150
163
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
164
|
+
:firstname => :firstname
|
165
|
+
:lastname => :lastname
|
166
|
+
:birth => :birth
|
167
|
+
:death => :death
|
168
|
+
:nationality => :nationality
|
156
169
|
|
157
170
|
###The fractions aren't formatting properly in an input field?
|
158
171
|
|
159
172
|
Yes, this is as Rails intended. You can override this by explicitly declaring the value of the input field.
|
160
173
|
|
161
|
-
###Why can't this gem generate a standard migration, model, controller, etc. for me?
|
162
|
-
|
163
|
-
Most people have their own preference when it comes to scaffold generation, and they usually go so far as to create their own. It doesn't seem like putting yet another scaffold out in the wild makes much sense.
|
164
|
-
|
165
174
|
###Why doesn't this gem also handle images?
|
166
175
|
|
167
176
|
Everybody has their own methods for working with images, so it doesn't seem too advantageous at this point to include that functionality. With that being said, it may get added in the future.
|
@@ -170,9 +179,12 @@ Everybody has their own methods for working with images, so it doesn't seem too
|
|
170
179
|
|
171
180
|
Glad you asked! The testing environment is rspec, and the tests can be found in the spec directory.
|
172
181
|
|
182
|
+
---
|
183
|
+
|
173
184
|
##Development
|
174
|
-
This project can be found on github at the following URL.
|
175
185
|
|
176
|
-
|
186
|
+
If you find an issue or bug, please let us know. You can file your issue on the project's issue tracker at github.
|
187
|
+
|
188
|
+
[http://github.com/datalab/artworker/](http://github.com/datalab/artworker/)
|
177
189
|
|
178
|
-
We encourage you to fork this project and make any changes you would like!
|
190
|
+
We encourage you to fork this project and make any changes you would like! Please feel free to submit a pull request if you make any cool additions.
|
data/artworker.gemspec
CHANGED
@@ -7,11 +7,11 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = Artworker::VERSION
|
8
8
|
s.authors = ["dataLAB"]
|
9
9
|
s.email = ["info@datalabprojects.com"]
|
10
|
-
s.homepage = "
|
11
|
-
s.summary = %q{
|
12
|
-
s.description = %q{
|
10
|
+
s.homepage = "http://artworker.datalabprojects.com"
|
11
|
+
s.summary = %q{A ruby gem to help with common artist and artwork attributes.}
|
12
|
+
s.description = %q{A ruby gem to help with common artist and artwork attributes.}
|
13
13
|
|
14
|
-
s.rubyforge_project = "
|
14
|
+
s.rubyforge_project = "artworker"
|
15
15
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/artworker.rb
CHANGED
@@ -6,49 +6,3 @@ end
|
|
6
6
|
require "artworker/artworker"
|
7
7
|
require "artworker/dimensions"
|
8
8
|
require "artworker/fractions"
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
# module Artworker
|
14
|
-
#
|
15
|
-
# def uses_artworker_artwork options = {}
|
16
|
-
#
|
17
|
-
# default_options ||= {
|
18
|
-
# :title => :title,
|
19
|
-
# :date => :date,
|
20
|
-
# :use_fractions => :use_fractions,
|
21
|
-
# :use_metric => :use_metric,
|
22
|
-
# :dimensions => { :dimensions => [:height,:width,:depth] }
|
23
|
-
# }
|
24
|
-
#
|
25
|
-
# options = default_options.merge(options)
|
26
|
-
#
|
27
|
-
# Artworker::Titles.set_title_functions(options[:title],options[:date])
|
28
|
-
# Artworker::Dimensions.set_dimensions_functions(options[:dimensions],options[:use_fractions],options[:use_metric])
|
29
|
-
#
|
30
|
-
# include Artworker::Dimensions
|
31
|
-
# include Artworker::Fractions
|
32
|
-
# include Artworker::Titles
|
33
|
-
#
|
34
|
-
# end
|
35
|
-
#
|
36
|
-
# def uses_artworker_artist options = {}
|
37
|
-
#
|
38
|
-
# default_options ||= {
|
39
|
-
# :firstname => :firstname,
|
40
|
-
# :lastname => :lastname,
|
41
|
-
# :birth => :birth,
|
42
|
-
# :death => :death,
|
43
|
-
# :nationality => :nationality
|
44
|
-
# }
|
45
|
-
#
|
46
|
-
# options = default_options.merge(options)
|
47
|
-
#
|
48
|
-
# Artworker::Artists.set_artist_functions(options[:firstname],options[:lastname],options[:birth],options[:death],options[:nationality])
|
49
|
-
#
|
50
|
-
# include Artworker::Artists
|
51
|
-
#
|
52
|
-
# end
|
53
|
-
#
|
54
|
-
# end
|
data/lib/artworker/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artworker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-15 00:00:00.000000000 -05:00
|
13
|
+
default_executable:
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: railties
|
16
|
-
requirement: &
|
17
|
+
requirement: &2156650260 !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
20
|
- - ! '>='
|
@@ -21,10 +22,10 @@ dependencies:
|
|
21
22
|
version: 3.1.0
|
22
23
|
type: :runtime
|
23
24
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
+
version_requirements: *2156650260
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
27
|
name: activerecord
|
27
|
-
requirement: &
|
28
|
+
requirement: &2156649760 !ruby/object:Gem::Requirement
|
28
29
|
none: false
|
29
30
|
requirements:
|
30
31
|
- - ! '>='
|
@@ -32,10 +33,10 @@ dependencies:
|
|
32
33
|
version: 3.1.0
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
+
version_requirements: *2156649760
|
36
37
|
- !ruby/object:Gem::Dependency
|
37
38
|
name: activesupport
|
38
|
-
requirement: &
|
39
|
+
requirement: &2156649300 !ruby/object:Gem::Requirement
|
39
40
|
none: false
|
40
41
|
requirements:
|
41
42
|
- - ! '>='
|
@@ -43,10 +44,10 @@ dependencies:
|
|
43
44
|
version: 3.1.0
|
44
45
|
type: :runtime
|
45
46
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
+
version_requirements: *2156649300
|
47
48
|
- !ruby/object:Gem::Dependency
|
48
49
|
name: rspec
|
49
|
-
requirement: &
|
50
|
+
requirement: &2156648920 !ruby/object:Gem::Requirement
|
50
51
|
none: false
|
51
52
|
requirements:
|
52
53
|
- - ! '>='
|
@@ -54,10 +55,10 @@ dependencies:
|
|
54
55
|
version: '0'
|
55
56
|
type: :development
|
56
57
|
prerelease: false
|
57
|
-
version_requirements: *
|
58
|
+
version_requirements: *2156648920
|
58
59
|
- !ruby/object:Gem::Dependency
|
59
60
|
name: rake
|
60
|
-
requirement: &
|
61
|
+
requirement: &2156648460 !ruby/object:Gem::Requirement
|
61
62
|
none: false
|
62
63
|
requirements:
|
63
64
|
- - ! '>='
|
@@ -65,10 +66,10 @@ dependencies:
|
|
65
66
|
version: '0'
|
66
67
|
type: :development
|
67
68
|
prerelease: false
|
68
|
-
version_requirements: *
|
69
|
+
version_requirements: *2156648460
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
71
|
name: factory_girl_rails
|
71
|
-
requirement: &
|
72
|
+
requirement: &2156671840 !ruby/object:Gem::Requirement
|
72
73
|
none: false
|
73
74
|
requirements:
|
74
75
|
- - ! '>='
|
@@ -76,10 +77,10 @@ dependencies:
|
|
76
77
|
version: '0'
|
77
78
|
type: :development
|
78
79
|
prerelease: false
|
79
|
-
version_requirements: *
|
80
|
+
version_requirements: *2156671840
|
80
81
|
- !ruby/object:Gem::Dependency
|
81
82
|
name: sqlite3
|
82
|
-
requirement: &
|
83
|
+
requirement: &2156671420 !ruby/object:Gem::Requirement
|
83
84
|
none: false
|
84
85
|
requirements:
|
85
86
|
- - ! '>='
|
@@ -87,8 +88,8 @@ dependencies:
|
|
87
88
|
version: '0'
|
88
89
|
type: :development
|
89
90
|
prerelease: false
|
90
|
-
version_requirements: *
|
91
|
-
description:
|
91
|
+
version_requirements: *2156671420
|
92
|
+
description: A ruby gem to help with common artist and artwork attributes.
|
92
93
|
email:
|
93
94
|
- info@datalabprojects.com
|
94
95
|
executables: []
|
@@ -118,7 +119,8 @@ files:
|
|
118
119
|
- spec/models.rb
|
119
120
|
- spec/schema.rb
|
120
121
|
- spec/spec_helper.rb
|
121
|
-
|
122
|
+
has_rdoc: true
|
123
|
+
homepage: http://artworker.datalabprojects.com
|
122
124
|
licenses: []
|
123
125
|
post_install_message:
|
124
126
|
rdoc_options: []
|
@@ -137,11 +139,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
139
|
- !ruby/object:Gem::Version
|
138
140
|
version: '0'
|
139
141
|
requirements: []
|
140
|
-
rubyforge_project:
|
141
|
-
rubygems_version: 1.
|
142
|
+
rubyforge_project: artworker
|
143
|
+
rubygems_version: 1.6.2
|
142
144
|
signing_key:
|
143
145
|
specification_version: 3
|
144
|
-
summary:
|
146
|
+
summary: A ruby gem to help with common artist and artwork attributes.
|
145
147
|
test_files:
|
146
148
|
- spec/artworker/artist_spec.rb
|
147
149
|
- spec/artworker/artwork_spec.rb
|