SampleApp 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/lib/tasks/sample_data.rake +45 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTJjOWE2OGQ2NGY1Yjk0ODE5NDk2M2M3OTdkMzdmOTM3ODU4NmU0NA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Mzk1ZGU3MDM3Y2IyZWQ3N2UxNTU4Nzg0OTE4NGY5MDQ4ZDFlY2U0Nw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YzRhMWEwZDVhNTUzNDJlMzU4MDAxOTE2YjBkMWMwNzNhNjljMzYwMDE1NGYz
|
10
|
+
YTk1NDdjMGIyMDk4MDAxOWM3NzliNjRhZTYwNTUwZTNlOTk1M2M2ODFkYjU4
|
11
|
+
ZjFhNDQ1ZGRlNmMxNzZhMzc4NzA5MGZkNjUxYjdmY2RkNzYwMzg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NGY3ZjNhNzgzOThmMzJkZGM5OTQzYzkwY2M5ZDdhMGUzM2U5MDVkOGU4NmVj
|
14
|
+
YTNjMzFkNzcxMzg4ZDg0NWFkMTY1Y2UyMWMzOTllODRhYzQ5MTUxNDhlYmNi
|
15
|
+
ZWRiODllMWUwZjJmYmI5MDFkYmZmNGVmYzE2ODZiNjAyZjJmMjc=
|
@@ -0,0 +1,45 @@
|
|
1
|
+
namespace :db do
|
2
|
+
desc "Fill database with sample data"
|
3
|
+
task populate: :environment do
|
4
|
+
make_users
|
5
|
+
make_microposts
|
6
|
+
make_relationships
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def make_users
|
11
|
+
admin = User.create!(name: "Example User", email: "example@railstutorial.org", password: "foobar", password_confirmation: "foobar")
|
12
|
+
admin.toggle!(:admin)
|
13
|
+
admin2 = User.create!(name: "Daniel Kemper", email: "dkemp04@gmail.com", password: "foobar", password_confirmation: "foobar")
|
14
|
+
admin2.toggle!(:admin)
|
15
|
+
|
16
|
+
99.times do |n|
|
17
|
+
name = Faker::Name.name
|
18
|
+
email = "example-#{n + 1}@railstutorial.org"
|
19
|
+
password = "password"
|
20
|
+
User.create!(name: name, email: email, password: password, password_confirmation: password)
|
21
|
+
end
|
22
|
+
|
23
|
+
users = User.all(limit: 6)
|
24
|
+
50.times do
|
25
|
+
content = Faker::Lorem.sentence(5)
|
26
|
+
users.each { |user| user.microposts.create(content: content) }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def make_microposts
|
31
|
+
users = User.all(limit: 6)
|
32
|
+
50.times do
|
33
|
+
content = Faker::Lorem.sentence(5)
|
34
|
+
users.each { |user| user.microposts.create!(content: content) }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def make_relationships
|
39
|
+
users = User.all
|
40
|
+
user = users.first
|
41
|
+
followed_users = users[2..50]
|
42
|
+
followers = users[3..40]
|
43
|
+
followed_users.each { |followed| user.follow!(followed) }
|
44
|
+
followers.each { |follower| follower.follow!(user) }
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: SampleApp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dkemp04
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Much longer explanation of the example!
|
14
|
+
email: dkemp04@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/tasks/sample_data.rake
|
20
|
+
homepage: http://rubygems.org/gems/sampleApp
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.0.3
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: This is an example!
|
43
|
+
test_files: []
|