puffs 0.1.94 → 0.1.95
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/puffs +7 -23
- data/lib/db_connection.rb +4 -2
- data/lib/version.rb +1 -1
- data/template/Gemfile +1 -1
- data/template/db/seeds.rb +27 -0
- metadata +2 -2
- data/template/db/seed.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fdf133d4152c6cf01443be9bb61724366b39ad7
|
4
|
+
data.tar.gz: 708a909c0f2787e2361b787345a8f3b8f3fd8615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c41170c9188cfd64ef89c07ad7a83edd3046164ad98105473c4a0c9174f7cd6634f1fff8630e4561116aef3237431f2e54608efa3ebc186f8401d300145b135
|
7
|
+
data.tar.gz: 8f2b2ae98410d9f7fd42a721f9f23cc63c70d14d8bb3905b5fa45de0106aade469cb212c180f095098beaf2bb82fe1d4cb63c7f34f37bcfc45110021e0f94d4f
|
data/bin/puffs
CHANGED
@@ -96,44 +96,28 @@ class Puffs < Thor
|
|
96
96
|
|
97
97
|
desc 'new', 'creates a new Puffs app'
|
98
98
|
def new(name)
|
99
|
+
require 'byebug'
|
100
|
+
debugger
|
101
|
+
|
99
102
|
Dir.mkdir "./#{name}"
|
100
103
|
Dir.mkdir "./#{name}/app"
|
101
104
|
Dir.mkdir "./#{name}/app/models"
|
102
105
|
Dir.mkdir "./#{name}/app/views"
|
103
106
|
Dir.mkdir "./#{name}/app/controllers"
|
104
107
|
File.open("./#{name}/app/controllers/application_controller.rb", "w") do |f|
|
105
|
-
f.write(
|
106
|
-
f.write("project_root = File.dirname(File.absolute_path(__FILE__))\n")
|
107
|
-
f.write("Dir.glob(project_root + '/../models/*.rb') { |file| require file }\n\n")
|
108
|
-
|
109
|
-
f.write("class ApplicationController < ControllerBase\n\n")
|
110
|
-
f.write("end")
|
108
|
+
f.write File.read(File.expand_path('../../template/app/controllers/application_controller.rb', __FILE__))
|
111
109
|
end
|
112
110
|
Dir.mkdir "./#{name}/app/config"
|
113
111
|
File.open("./#{name}/app/config/routes.rb", "w") do |f|
|
114
|
-
f.write(
|
115
|
-
f.write("ROUTER.draw do\n")
|
116
|
-
f.write("\t#Some sample routes:\n\n")
|
117
|
-
f.write("\t# get Regexp.new('^/cats/new$'), CatsController, :new\n")
|
118
|
-
f.write("\t# post Regexp.new('^/cats/create$'), CatsController, :create\n")
|
119
|
-
f.write("\t# get Regexp.new('^/cats$'), CatsController, :index\n")
|
120
|
-
f.write("\t# get Regexp.new('^/cats/(?<cat_id>\\d+)$'), CatsController, :show\n")
|
121
|
-
f.write("end")
|
112
|
+
f.write File.read(File.expand_path('../../template/config/routes.rb', __FILE__))
|
122
113
|
end
|
123
114
|
Dir.mkdir "./#{name}/db"
|
124
115
|
Dir.mkdir "./#{name}/db/migrate"
|
125
116
|
File.open("./#{name}/db/seeds.rb", "w") do |f|
|
126
|
-
f.write
|
127
|
-
f.write("Dir.glob(project_root + '/../app/models/*.rb') {|file| require file}\n")
|
128
|
-
f.write("class Seed\n")
|
129
|
-
f.write("\tdef self.populate\n")
|
130
|
-
f.write("\t\t#Put your seeds in here\n")
|
131
|
-
f.write("\tend\n")
|
132
|
-
f.write("end")
|
117
|
+
f.write File.read(File.expand_path('../../template/db/seeds.rb', __FILE__))
|
133
118
|
end
|
134
119
|
File.open("./#{name}/Gemfile", "w") do |f|
|
135
|
-
f.write
|
136
|
-
f.write("gem 'puffs', '~>0.1.94'")
|
120
|
+
f.write File.read(File.expand_path('../../template/Gemfile', __FILE__))
|
137
121
|
end
|
138
122
|
end
|
139
123
|
end
|
data/lib/db_connection.rb
CHANGED
@@ -3,8 +3,10 @@ require 'pg'
|
|
3
3
|
APP_NAME = "Puffs"
|
4
4
|
|
5
5
|
PRINT_QUERIES = ENV['PRINT_QUERIES'] == 'true'
|
6
|
-
project_root = File.dirname(File.absolute_path(__FILE__))
|
7
|
-
MIGRATIONS = Dir.glob(project_root + '/../db/migrate/*.sql').to_a
|
6
|
+
# project_root = File.dirname(File.absolute_path(__FILE__))
|
7
|
+
# MIGRATIONS = Dir.glob(project_root + '/../db/migrate/*.sql').to_a
|
8
|
+
|
9
|
+
MIGRATIONS = Dir.glob('./db/migrate/*.sql').to_a
|
8
10
|
|
9
11
|
class DBConnection
|
10
12
|
def self.open
|
data/lib/version.rb
CHANGED
data/template/Gemfile
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
project_root = File.dirname(File.absolute_path(__FILE__))
|
2
|
+
Dir.glob(project_root + '/../app/models/*.rb') {|file| require file}
|
3
|
+
|
4
|
+
class Seed
|
5
|
+
def self.populate
|
6
|
+
#Create seeds in this method. Here's an example:
|
7
|
+
|
8
|
+
# Cat.destroy_all!
|
9
|
+
# Human.destroy_all!
|
10
|
+
# House.destroy_all!
|
11
|
+
#
|
12
|
+
# h1 = House.new(address: '26th and Guerrero').save
|
13
|
+
# h2 = House.new(address: 'Dolores and Market').save
|
14
|
+
# h3 = House.new(address: '123 4th Street').save
|
15
|
+
#
|
16
|
+
# devon = Human.new(fname: 'Devon', lname: 'Watts', house_id: h1.id).save
|
17
|
+
# matt = Human.new(fname: 'Matt', lname: 'Rubens', house_id: h1.id).save
|
18
|
+
# ned = Human.new(fname: 'Ned', lname: 'Ruggeri', house_id: h2.id).save
|
19
|
+
# catless = Human.new(fname: 'Catless', lname: 'Human', house_id: h3.id).save
|
20
|
+
#
|
21
|
+
# Cat.new(name: 'Breakfast', owner_id: devon.id).save
|
22
|
+
# Cat.new(name:'Earl', owner_id: matt.id).save
|
23
|
+
# Cat.new(name: 'Haskell', owner_id: ned.id).save
|
24
|
+
# Cat.new(name: 'Markov', owner_id: ned.id).save
|
25
|
+
# Cat.new(name: 'Stray Cat')
|
26
|
+
end
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puffs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.95
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zachary Moroni
|
@@ -186,7 +186,7 @@ files:
|
|
186
186
|
- template/Gemfile
|
187
187
|
- template/app/controllers/application_controller.rb
|
188
188
|
- template/config/routes.rb
|
189
|
-
- template/db/
|
189
|
+
- template/db/seeds.rb
|
190
190
|
homepage: http://github.com/snackzone
|
191
191
|
licenses:
|
192
192
|
- MIT
|
data/template/db/seed.rb
DELETED
File without changes
|