ocelot 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/ocelot/cli.rb +5 -1
  2. data/ocelot.gemspec +1 -1
  3. metadata +1 -2
  4. data/go.rb +0 -214
@@ -1,6 +1,10 @@
1
1
  # Rails wants to include AR first.
2
2
  puts "Loading Rails environment..."
3
- require File.join(ARGV[0], 'environment')
3
+
4
+
5
+ abort "Usage: ocelot [path to environment.rb in rails] [path to ocelot script]" if ARGV.length < 2
6
+
7
+ require File.join(ARGV[0])
4
8
 
5
9
  require 'bundler'
6
10
  require 'ocelot/dsl'
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ocelot"
6
- s.version = "0.0.6"
6
+ s.version = "0.0.7"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["spencer p"]
9
9
  s.email = ["exussum@gmail.com"]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ocelot
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - spencer p
@@ -27,7 +27,6 @@ files:
27
27
  - README
28
28
  - Rakefile
29
29
  - bin/ocelot
30
- - go.rb
31
30
  - lib/ocelot.rb
32
31
  - lib/ocelot/cli.rb
33
32
  - lib/ocelot/database.rb
data/go.rb DELETED
@@ -1,214 +0,0 @@
1
- source Hash[
2
- :adapter => "mysql",
3
- :host => "patchreport-mysql.websys.aol.com",
4
- :database => "polar_production",
5
- :username => 'patch_r',
6
- :password => 'p@tchprd'
7
- ]
8
-
9
- include File.join(Rails.root, "config", "active_spider_target.rb")
10
-
11
- target Hash[
12
- :adapter => "mysql",
13
- :host => "localhost",
14
- :database => "yo_mama",
15
- :username => 'root'
16
- ]
17
-
18
- log_level "ERROR"
19
-
20
- TARGET_ID = 18
21
- ATTACHMENTS = 20
22
-
23
- seeds { [
24
- Neighborhood.find(169302),
25
- ContentBlock.find(:all, :order => "id desc"),
26
- ContentPage.find(:all),
27
- Publication.find(TARGET_ID),
28
- Publication.find(1) ] }
29
-
30
- init do
31
- u = User.new(:name => 'mc hammer', :email=>'import@example.com')
32
- u.permalink = "__patch_patch_baby__"
33
- u.save(false)
34
- end
35
-
36
- classes %q{
37
- Address
38
- Answer
39
- Article
40
- AssetAttachment
41
- Author
42
- Boundary
43
- Category
44
- Characteristic
45
- UserContribution
46
- City
47
- Classified
48
- AdtechAdZone
49
- Coupon
50
- County
51
- Country
52
- CouponPackage
53
- Review
54
- RelatedLink
55
- Claim
56
- ClassificationsObject
57
- Column
58
- Comment
59
- ContentBlock
60
- ContentPage
61
- CurrentWeather
62
- Event
63
- Feature
64
- InfoPage
65
- Language
66
- Listing
67
- Location
68
- Logo
69
- Neighborhood
70
- ObjectCounter
71
- Pdf
72
- Photo
73
- Publication
74
- PublicationAttachment
75
- PublicationGroup
76
- Region
77
- Question
78
- Schedule
79
- State
80
- TwitterTweet
81
- User
82
- Video
83
- VideoInfo
84
- WeatherForecast
85
- Workflow
86
- WorkflowChange
87
- ZipCode
88
- }
89
-
90
- filter Location do |obj, collection, name|
91
- result [] unless :locator == name
92
- end
93
-
94
- filter Column do |obj, collection, name|
95
- result collection.find(:all, :limit => 3, :order => "id desc") if :articles == name
96
- end
97
-
98
- filter Category do |obj, collection, name|
99
- nothing if [:classifications_objects, :all_photos, :all_videos, :all_pdfs].include? name
100
- end
101
-
102
- [Boundary, Borough, City, Country, County, Neighborhood, State, Zipcode].each do |c|
103
- filter c do |obj, collection, name|
104
- nothing if :notes != name
105
- end
106
- end
107
-
108
- filter Schedule do |obj, collection, name|
109
- nothing if :schedule_occurrences == name
110
- end
111
-
112
- [Announcement, Article, Classified, Coupon, Employee, Listing, Event, InfoPage].each do |c|
113
- filter c do |obj, collection, name|
114
- if [:all_assets,
115
- :similarities1, :similarities2,
116
- :links_to, :links_from,
117
- :photos, :pdfs,
118
- :videos, :all_photos,
119
- :all_videos, :all_pdfs].include? name
120
- nothing
121
- elsif :located_locations == name
122
- # total abuse of located_locations. grrrr
123
- result obj.locations
124
- elsif :assets == name
125
- result collection.find(:all, :limit => 5)
126
- end
127
- end
128
- end
129
-
130
- filter Publication do |obj, collection, name|
131
- if [:permissions, :listing_similarities, :publication_attachments, :claims].include? name
132
- nothing
133
- elsif :columns == name
134
- result collection.find( :all, :limit => 3, :order => "id desc")
135
- elsif [:events, :announcements, :claims, :articles, :listings, :events, :twitter_tweets, :users, :classifieds].include? name
136
- result collection.find(:all, :limit => ATTACHMENTS, :order => "id desc")
137
- end
138
- end
139
-
140
- rule Publication do |obj, *args|
141
- persist obj
142
- if obj.id == 1 or obj.id == TARGET_ID
143
- inspect
144
- end
145
- end
146
-
147
- rule Column do |obj|
148
- use_target_db!
149
- obj.user = User.find_by_email('import@example.com')
150
- obj.publications << Publication.find(TARGET_ID)
151
-
152
- persist obj
153
- inspect
154
- end
155
-
156
- rule PublicationAttachment do |obj, pub, to|
157
- if obj.id.nil?
158
- pub, to = to, pub unless pub.class == Publication
159
-
160
- obj.publication = pub
161
- obj.object = to
162
- persist obj
163
- inspect
164
- end
165
- end
166
-
167
- rule AssetAttachment do |obj, contained, to|
168
- if obj.id.nil?
169
- use_target_db!
170
- obj.to = contained
171
- obj.from = to
172
- obj.user = User.find_by_email('import@example.com')
173
- persist obj
174
- end
175
- end
176
-
177
- rule User do |obj, *args|
178
- obj.password = "123456"
179
- obj.password_confirmation = "123456"
180
- persist obj
181
- end
182
-
183
- [Question, Answer].each do |c|
184
- rule c do |obj, *args|
185
- user = obj.user
186
- use_target_db!
187
- obj.user ||= User.find_by_email('import@example.com')
188
- persist obj
189
- inspect
190
- end
191
- end
192
-
193
- rule UserContribution do |obj, *args|
194
- persist obj
195
- end
196
-
197
- rule Schedule do |obj, *args|
198
- persist obj
199
- use_target_db!
200
-
201
- obj.send(:generate_occurrences_with_default_horizon!)
202
- inspect
203
- end
204
-
205
- rule Video do |obj, *args|
206
- persist obj
207
- inspect
208
- end
209
-
210
- [Region, Address, Language, LocalFact, Characteristic].each do |c|
211
- rule c do |obj, *args|
212
- persist obj
213
- end
214
- end