card 1.15.5 → 1.15.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,201 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'timecop'
3
+
4
+ class SharedData
5
+ #attr_accessor :users
6
+ USERS = [
7
+ 'Joe User', 'Joe Admin', 'Joe Camel', 'Sample User', 'No count',
8
+ 'u1', 'u2', 'u3',
9
+ 'Big Brother', 'Optic fan', 'Sunglasses fan', 'Narcissist'
10
+ ]
11
+
12
+ def self.account_args hash
13
+ { "+*account" => { "+*password" =>'joe_pass' }.merge( hash ) }
14
+ end
15
+
16
+ def self.add_test_data
17
+
18
+ Card::Cache.reset_global
19
+ Card::Env.reset
20
+ Card::Auth.as_bot
21
+
22
+ Card.create! :name=>"Joe User", :type_code=>'user', :content=>"I'm number two", :subcards=>account_args( '+*email'=>'joe@user.com' )
23
+ Card.create! :name=>"Joe Admin", :type_code=>'user', :content=>"I'm number one", :subcards=>account_args( '+*email'=>'joe@admin.com' )
24
+ Card.create! :name=>"Joe Camel", :type_code=>'user', :content=>"Mr. Buttz", :subcards=>account_args( '+*email'=>'joe@camel.com' )
25
+
26
+ Card['Joe Admin'].fetch(:trait=>:roles, :new=>{:type_code=>'pointer'}).items = [ Card::AdministratorID ]
27
+
28
+ Card.create! :name=>'signup alert email+*to', :content=>'signups@wagn.org'
29
+
30
+ # generic, shared attribute card
31
+ color = Card.create! :name=>"color"
32
+ basic = Card.create! :name=>"Basic Card"
33
+
34
+ # data for testing users and account requests
35
+
36
+ Card.create! :type_code=>'user', :name=>"No Count", :content=>"I got no account"
37
+
38
+
39
+ Card.create! :name=>"Sample User", :type_code=>'user', :subcards=>account_args('+*email'=>'sample@user.com', '+*password'=>'sample_pass')
40
+
41
+ # CREATE A CARD OF EACH TYPE
42
+
43
+ Card.create! :type_id=>Card::SignupID, :name=>"Sample Signup" #, :email=>"invitation@request.com"
44
+ #above still necessary? try commenting out above and 'Sign up' below
45
+ Card::Auth.current_id = Card::WagnBotID # need to reset after creating sign up, which changes current_id for extend phase
46
+
47
+ Card::Auth.createable_types.each do |type|
48
+ next if ['User', 'Sign up', 'Set', 'Number'].include? type
49
+ Card.create! :type=>type, :name=>"Sample #{type}"
50
+ end
51
+
52
+
53
+
54
+ # data for role_test.rb
55
+
56
+ Card.create! :name=>"u1", :type_code=>'user', :subcards=>account_args('+*email'=>'u1@user.com', '+*password'=>'u1_pass')
57
+ Card.create! :name=>"u2", :type_code=>'user', :subcards=>account_args('+*email'=>'u2@user.com', '+*password'=>'u2_pass')
58
+ Card.create! :name=>"u3", :type_code=>'user', :subcards=>account_args('+*email'=>'u3@user.com', '+*password'=>'u3_pass')
59
+
60
+ r1 = Card.create!( :type_code=>'role', :name=>'r1' )
61
+ r2 = Card.create!( :type_code=>'role', :name=>'r2' )
62
+ r3 = Card.create!( :type_code=>'role', :name=>'r3' )
63
+ r4 = Card.create!( :type_code=>'role', :name=>'r4' )
64
+
65
+ Card['u1'].fetch( :trait=>:roles, :new=>{} ).items = [ r1, r2, r3 ]
66
+ Card['u2'].fetch( :trait=>:roles, :new=>{} ).items = [ r1, r2, r4 ]
67
+ Card['u3'].fetch( :trait=>:roles, :new=>{} ).items = [ r1, r4, Card::AdministratorID ]
68
+
69
+ c1 = Card.create! :name=>'c1'
70
+ c2 = Card.create! :name=>'c2'
71
+ c3 = Card.create! :name=>'c3'
72
+
73
+ # cards for rename_test
74
+ # FIXME: could probably refactor these..
75
+ z = Card.create! :name=>"Z", :content=>"I'm here to be referenced to"
76
+ a = Card.create! :name=>"A", :content=>"Alpha [[Z]]"
77
+ b = Card.create! :name=>"B", :content=>"Beta {{Z}}"
78
+ t = Card.create! :name=>"T", :content=>"Theta"
79
+ x = Card.create! :name=>"X", :content=>"[[A]] [[A+B]] [[T]]"
80
+ y = Card.create! :name=>"Y", :content=>"{{B}} {{A+B}} {{A}} {{T}}"
81
+ ab = Card.create! :name => "A+B", :content => "AlphaBeta"
82
+
83
+ Card.create! :name=>"One+Two+Three"
84
+ Card.create! :name=>"Four+One+Five"
85
+
86
+ # for wql & permissions
87
+ %w{ A+C A+D A+E C+A D+A F+A A+B+C }.each do |name| Card.create!(:name=>name) end
88
+ Card.create! :type_code=>'cardtype', :name=>"Cardtype A", :codename=>"cardtype_a"
89
+ Card.create! :type_code=>'cardtype', :name=>"Cardtype B", :codename=>"cardtype_b"
90
+ Card.create! :type_code=>'cardtype', :name=>"Cardtype C", :codename=>"cardtype_c"
91
+ Card.create! :type_code=>'cardtype', :name=>"Cardtype D", :codename=>"cardtype_d"
92
+ Card.create! :type_code=>'cardtype', :name=>"Cardtype E", :codename=>"cardtype_e"
93
+ Card.create! :type_code=>'cardtype', :name=>"Cardtype F", :codename=>"cardtype_f"
94
+
95
+ Card.create! :name=>'basicname', :content=>'basiccontent'
96
+ Card.create! :type_code=>'cardtype_a', :name=>"type-a-card", :content=>"type_a_content"
97
+ Card.create! :type_code=>'cardtype_b', :name=>"type-b-card", :content=>"type_b_content"
98
+ Card.create! :type_code=>'cardtype_c', :name=>"type-c-card", :content=>"type_c_content"
99
+ Card.create! :type_code=>'cardtype_d', :name=>"type-d-card", :content=>"type_d_content"
100
+ Card.create! :type_code=>'cardtype_e', :name=>"type-e-card", :content=>"type_e_content"
101
+ Card.create! :type_code=>'cardtype_f', :name=>"type-f-card", :content=>"type_f_content"
102
+
103
+ #warn "current user #{User.session_user.inspect}. always ok? #{Card::Auth.always_ok?}"
104
+ c = Card.create! :name=>'revtest', :content=>'first'
105
+ c.update_attributes! :content=>'second'
106
+ c.update_attributes! :content=>'third'
107
+ #Card.create! :type_code=>'cardtype', :name=>'*priority'
108
+
109
+ # for template stuff
110
+ Card.create! :type_id=>Card::CardtypeID, :name=> "UserForm"
111
+ Card.create! :name=>"UserForm+*type+*structure", :content=>"{{+name}} {{+age}} {{+description}}"
112
+
113
+ Card::Auth.current_id = Card['joe_user'].id
114
+ Card.create!( :name=>"JoeLater", :content=>"test")
115
+ Card.create!( :name=>"JoeNow", :content=>"test")
116
+
117
+ Card::Auth.current_id = Card::WagnBotID
118
+ Card.create!(:name=>"AdminNow", :content=>"test")
119
+
120
+ Card.create :name=>'Cardtype B+*type+*create', :type=>'Pointer', :content=>'[[r1]]'
121
+
122
+ Card.create! :type=>"Cardtype", :name=>"Book"
123
+ Card.create! :name=>"Book+*type+*structure", :content=>"by {{+author}}, design by {{+illustrator}}"
124
+ Card.create! :name => "Iliad", :type=>"Book"
125
+
126
+
127
+ ### -------- Notification data ------------
128
+ Timecop.freeze(Cardio.future_stamp - 1.day) do
129
+ # fwiw Timecop is apparently limited by ruby Time object, which goes only to 2037 and back to 1900 or so.
130
+ # whereas DateTime can represent all dates.
131
+
132
+
133
+ followers = {
134
+ 'John' => ['John Following', 'All Eyes On Me'],
135
+ 'Sara' => ['Sara Following', 'All Eyes On Me', 'Optic+*type', 'Google Glass'],
136
+ 'Big Brother' => ['All Eyes on Me', 'Look at me+*self', 'Optic+*type', 'lens+*right', 'Optic+tint+*type plus right', ['*all','*created'], ['*all','*edited']],
137
+ 'Optic fan' => ['Optic+*type'],
138
+ 'Sunglasses fan' => ['Sunglasses'],
139
+ 'Narcissist' => [['*all','*created'], ['*all','*edited']]
140
+ }
141
+
142
+ followers.each do |name, follow|
143
+ user = Card.create! :name=>name, :type_code=>'user', :subcards=>account_args('+*email'=>"#{name.parameterize}@user.com", '+*password'=>"#{name.parameterize}_pass")
144
+ end
145
+
146
+ Card.create! :name => "All Eyes On Me"
147
+ Card.create! :name => "No One Sees Me"
148
+ Card.create! :name => "Look At Me"
149
+ Card.create! :name => "Optic", :type => "Cardtype"
150
+ Card.create! :name => "Sara Following"
151
+ Card.create! :name => "John Following", :content => "{{+her}}"
152
+ Card.create! :name => "John Following+her"
153
+ magnifier = Card.create! :name => "Magnifier+lens"
154
+
155
+ Card::Auth.current_id = Card['Narcissist'].id
156
+ magnifier.update_attributes! :content=>"zoom in"
157
+ Card.create! :name => "Sunglasses", :type=>"Optic", :content=>"{{+tint}}{{+lens}}"
158
+
159
+ Card::Auth.current_id = Card['Optic fan'].id
160
+ Card.create! :name => "Google glass", :type=>"Optic", :content=>"{{+price}}"
161
+
162
+ Card::Auth.current_id = Card::WagnBotID
163
+ Card.create! :name=>'Google glass+*self+*follow_fields', :content=>''
164
+ Card.create! :name=>'Sunglasses+*self+*follow_fields', :content=>"[[#{Card[:includes].name}]]\n[[_self+price]]\n[[_self+producer]]"
165
+ Card.create! :name => "Sunglasses+tint"
166
+ Card.create! :name => "Sunglasses+price"
167
+
168
+ followers.each do |name, follow|
169
+ user = Card[name]
170
+ follow.each do |f|
171
+ user.follow *f
172
+ end
173
+ end
174
+ end
175
+
176
+
177
+ ## --------- create templated permissions -------------
178
+ ctt = Card.create! :name=> 'Cardtype E+*type+*default'
179
+
180
+
181
+ ## --------- Fruit: creatable by anon but not readable ---
182
+ f = Card.create! :type=>"Cardtype", :name=>"Fruit"
183
+ Card.create! :name=>'Fruit+*type+*create', :type=>'Pointer', :content=>'[[Anyone]]'
184
+ Card.create! :name=>'Fruit+*type+*read', :type=>'Pointer', :content=>'[[Administrator]]'
185
+
186
+ # codenames for card_accessor tests
187
+ Card.create! :name=>'*write', :codename=>:write
188
+
189
+ # -------- For toc testing: ------------
190
+
191
+ Card.create! :name=>"OnneHeading", :content => "<h1>This is one heading</h1>\r\n<p>and some text</p>"
192
+ Card.create! :name=>'TwwoHeading', :content => "<h1>One Heading</h1>\r\n<p>and some text</p>\r\n<h2>And a Subheading</h2>\r\n<p>and more text</p>"
193
+ Card.create! :name=>'ThreeHeading', :content =>"<h1>A Heading</h1>\r\n<p>and text</p>\r\n<h2>And Subhead</h2>\r\n<p>text</p>\r\n<h1>And another top Heading</h1>"
194
+
195
+ # -------- For history testing: -----------
196
+ first = Card.create! :name=>"First", :content => 'egg'
197
+ first.update_attributes! :content=> 'chicken'
198
+ first.update_attributes! :content=> 'chick'
199
+
200
+ end
201
+ end
@@ -5,7 +5,7 @@ view :raw do |args|
5
5
  content = File.read("#{bootstrap_path}/_variables.scss")
6
6
  content += %{
7
7
  $bootstrap-sass-asset-helper: false;
8
- $icon-font-path: "#{card_url '/assets/fonts/'}";
8
+ $icon-font-path: "#{card_path '/assets/fonts/'}";
9
9
  }
10
10
  # mixins
11
11
  content += Dir.glob("#{bootstrap_path}/mixins/*.scss").map do |name|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.5
4
+ version: 1.15.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-06-10 00:00:00.000000000 Z
14
+ date: 2015-06-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: smartname
@@ -327,6 +327,21 @@ files:
327
327
  - db/migrate_core_cards/data/themes/yeti/_bootswatch.scss
328
328
  - db/migrate_core_cards/data/themes/yeti/_variables.scss
329
329
  - db/schema.rb
330
+ - db/seed/README.md
331
+ - db/seed/new/card_actions.yml
332
+ - db/seed/new/card_acts.yml
333
+ - db/seed/new/card_changes.yml
334
+ - db/seed/new/card_references.yml
335
+ - db/seed/new/cards.yml
336
+ - db/seed/test/fixtures/.gitkeep
337
+ - db/seed/test/fixtures/card_actions.yml
338
+ - db/seed/test/fixtures/card_acts.yml
339
+ - db/seed/test/fixtures/card_changes.yml
340
+ - db/seed/test/fixtures/card_references.yml
341
+ - db/seed/test/fixtures/cards.yml
342
+ - db/seed/test/fixtures/mao2.jpg
343
+ - db/seed/test/fixtures/rails.gif
344
+ - db/seed/test/seed.rb
330
345
  - db/version.txt
331
346
  - db/version_core_cards.txt
332
347
  - lib/card.rb