daiku 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ea12ee95a2500430471e9afbae6a3348d1800a33
4
- data.tar.gz: 70440ea6816cf4069e2d3992c973a29f224a107e
3
+ metadata.gz: 48684cf445ae133682d5a8af71b8ecde004c5e4b
4
+ data.tar.gz: f0d5f467f8dd0b2b1c6d429252cbcbf115cd813c
5
5
  SHA512:
6
- metadata.gz: 43a594f9f70de2468ab4bc093fb9b08de4f145780572b8db4f29b2a288df3d0d9454b5285a6c801004942958e2b08f7d1df1a4b4220a45ac2aa5aa50071cf8e0
7
- data.tar.gz: 2810331d3b90801f397278fd8fc9b27ecee3fadab3bd352499a8a0019631bb6deedf0fb7294187744d26d8433094c6889b5adfb3058b2661b0692f358258c34c
6
+ metadata.gz: d0274e94331688fadbb2d78caa4a3f04bd4651220970f65ae63b4e1d0a912540aecd7870afe8261d31217670b99c7507b5b14bf277af6788df5645b26d162950
7
+ data.tar.gz: 5b45d1a6f7078efb9f9c58abf66080cb5f10991d5266ae3c75b738c9ddb495edbb8c5e2478514cf615d3957c47216fce2a2bc51e1473755d04ab2144d4693594
data/README.md CHANGED
@@ -51,7 +51,7 @@ You can further customize the app that's generated by passing additional options
51
51
  -j, [--jobs=JOBS] # Choose the background jobs lib this project uses.
52
52
  # Possible values: sidekiq
53
53
  -m, [--models=MODELS] # Choose the data modeling lib this project uses.
54
- # Possible values: datamapper
54
+ # Possible values: datamapper, sequel
55
55
  -M, [--monitors=MONITORS] # Choose the monitoring lib this project uses.
56
56
  # Possible values: newrelic
57
57
  [--vcr] # Include `vcr` in this project's BDD stack?
@@ -89,6 +89,7 @@ myapp
89
89
  ├── Gemfile
90
90
  ├── Gruntfile.coffee
91
91
  ├── Procfile
92
+ ├── README.md
92
93
  ├── Rakefile
93
94
  ├── app.rb
94
95
  ├── assets
@@ -124,7 +125,9 @@ myapp
124
125
  │   ├── services
125
126
  │   │   └── .gitkeep
126
127
  │   ├── tasks
127
- │   │   └── .gitkeep
128
+ │   │   ├── .gitkeep
129
+ │   │   ├── datamapper.rake
130
+ │   │   └── db.rake
128
131
  │   └── values
129
132
  │   └── .gitkeep
130
133
  ├── package.json
@@ -0,0 +1,23 @@
1
+ <%= @app -%>
2
+ =======
3
+ <%= @app -%> description...
4
+
5
+ ## Getting Started
6
+
7
+ git clone git@github.com:YOUR_USER_OR_ORG/stylegame.git ${PROJECTS_DIR}/stylegame
8
+ cd ${PROJECTS_DIR}/stylegame
9
+ bundle install
10
+
11
+ ## Run It
12
+
13
+ be foreman start
14
+ open http://localhost:<%= @port -%>
15
+
16
+ ## Test It
17
+
18
+ # all specs
19
+ be rake
20
+
21
+ # specific test suite
22
+ be ruby -I spec -I lib ./spec/path/to/file_spec.rb
23
+
@@ -16,14 +16,14 @@ require 'dotenv/tasks'
16
16
  require 'rake/testtask'
17
17
 
18
18
  # tasks
19
+ task :environment => :dotenv do
20
+ require 'boot'
21
+ end
22
+
19
23
  Rake::TestTask.new do |t|
20
24
  t.libs << "spec"
21
25
  t.pattern = "spec/**/*_spec.rb"
22
26
  end
23
27
  task :default => [:environment, :test]
24
28
 
25
- task :environment => :dotenv do
26
- require 'boot'
27
- end
28
-
29
29
  Dir.glob('./lib/tasks/**/*.rake').each { |tasks| import tasks }
@@ -0,0 +1,12 @@
1
+ namespace :db do
2
+ desc "Create databases *(postgres only)"
3
+ task :init => :environment do
4
+ puts "Creating #{ENV['DB_NAME']} database..."
5
+ `createdb #{ENV['DB_NAME']}`
6
+ puts "Done!"
7
+
8
+ puts "Creating #{ENV['DB_NAME']}_test database..."
9
+ `createdb #{ENV['DB_NAME']}_test`
10
+ puts 'Done!'
11
+ end
12
+ end
@@ -23,15 +23,48 @@ module Daiku
23
23
  end
24
24
 
25
25
  def config
26
- template('_templates/db_helper.rb.tt', "#{app}/spec/db_helper.rb")
26
+ template '_templates/db_helper.rb.tt', "#{app}/spec/db_helper.rb"
27
27
  end
28
28
 
29
29
  def gemfile
30
30
  insert_into_file "#{app}/Gemfile", " gem 'database_cleaner'\n", after: "group :test do\n"
31
31
  end
32
32
 
33
- def spechelper
34
- insert_into_file "#{app}/spec/spec_helper.rb", "DatabaseCleaner.strategy = :truncation\n", after: "Bundler.setup(:test)\n"
33
+ def rake
34
+ template "_templates/db.rake.tt", "#{app}/lib/tasks/db.rake"
35
+ end
36
+
37
+ def readme
38
+ content = <<-DBREADME
39
+ ## Sync It
40
+
41
+ _Instructions on how to sync the database..._
42
+
43
+ `production` to `staging`
44
+
45
+ Sync DB:
46
+
47
+ # instructions go here...
48
+
49
+ ---
50
+
51
+ ### `production` to `development`
52
+
53
+ Sync DB:
54
+
55
+ # instructions go here...
56
+
57
+ ---
58
+
59
+ ### `staging` to `development`
60
+
61
+ Sync DB:
62
+
63
+ # instructions go here...
64
+
65
+
66
+ DBREADME
67
+ append_to_file "#{app}/README.md", content
35
68
  end
36
69
 
37
70
  def travisyml
@@ -0,0 +1,49 @@
1
+ namespace :db do
2
+ namespace :datamapper do
3
+ desc "Migrate tables for DataMapper models (potentially destructive)"
4
+ task :migrate => :environment do
5
+ puts "Warning: Potentially Destructive Action!"
6
+ puts "Data loss WILL occur in modified tables!"
7
+ puts "Auto-Migrating models in 2 seconds..."
8
+ sleep 2
9
+ DataMapper.auto_migrate!
10
+ puts "Done!"
11
+ end
12
+
13
+ desc "Upgrade tables to reflect DataMapper models"
14
+ task :upgrade => :environment do
15
+ puts "Auto-Upgrading models..."
16
+ DataMapper.auto_upgrade!
17
+ puts "Done!"
18
+ end
19
+
20
+ desc "Add hstore support"
21
+ task :hstore => :environment do
22
+ puts "Adding hstore support..."
23
+ DataMapper.repository.adapter.execute('CREATE EXTENSION hstore;')
24
+ puts "Done!"
25
+ end
26
+
27
+ desc "Add postgis support"
28
+ task :postgis => :environment do
29
+ puts "Adding postgis support..."
30
+ DataMapper.repository.adapter.execute('CREATE EXTENSION postgis;')
31
+ puts "Done!"
32
+ end
33
+
34
+ desc "Add postgis_topology support"
35
+ task :postgis_topology => :environment do
36
+ puts "Adding postgis_topology support..."
37
+ DataMapper.repository.adapter.execute('CREATE EXTENSION postgis_topology;')
38
+ puts "Done!"
39
+ end
40
+
41
+ desc "Add postgis_tiger_geocoder support"
42
+ task :postgis_tiger_geocoder => :environment do
43
+ puts "Adding postgis_tiger_geocoder support..."
44
+ DataMapper.repository.adapter.execute('CREATE EXTENSION fuzzystrmatch;')
45
+ DataMapper.repository.adapter.execute('CREATE EXTENSION postgis_tiger_geocoder;')
46
+ puts "Done!"
47
+ end
48
+ end
49
+ end
@@ -44,6 +44,30 @@ module Daiku
44
44
  DMGEMS
45
45
  append_to_file "#{app}/Gemfile", content
46
46
  end
47
+
48
+ def rake
49
+ template "_templates/datamapper.rake.tt", "#{app}/lib/tasks/datamapper.rake"
50
+ end
51
+
52
+ def readme
53
+ append_to_file "#{app}/README.md" do
54
+ <<-SREADME.strip_heredoc
55
+ # Migrate It
56
+
57
+ # create postgres extensions, optional but recommended (run once)
58
+ bundle exec rake db:datamapper:hstore
59
+ bundle exec rake db:datamapper:postgis
60
+ bundle exec rake db:datamapper:postgis_topology
61
+ bundle exec rake db:datamapper:postgis_tiger_geocoder
62
+
63
+ # upgrade database (safe migration)
64
+ bundle exec rake db:datamapper:upgrade
65
+
66
+ # migrate database (drops and recreates tables - danger!)
67
+ bundle exec rake db:datamapper:migrate
68
+ SREADME
69
+ end
70
+ end
47
71
  end
48
72
  end
49
73
  end
@@ -26,6 +26,22 @@ module Daiku
26
26
  insert_into_file "#{app}/views/layout.slim", %Q( script src="/assets/html5shiv.js"\n), before: " body\n"
27
27
  insert_into_file "#{app}/views/layout.slim", %Q( script src="/assets/app.js"\n), after: " == yield\n"
28
28
  end
29
+
30
+ def readme
31
+ insert_into_file "#{app}/README.md", "bower install\n", after: " bundle install\n"
32
+ insert_into_file "#{app}/README.md", "npm install\n", after: " bundle install\n"
33
+ insert_into_file "#{app}/README.md", before: "## Run It\n" do
34
+ <<-GREADME.strip_heredoc
35
+ ## Compile It
36
+
37
+ # for development and staging
38
+ grunt default
39
+
40
+ # for production
41
+ grunt production
42
+ GREADME
43
+ end
44
+ end
29
45
  end
30
46
  end
31
47
  end
@@ -0,0 +1,16 @@
1
+ namespace :db do
2
+ namespace :sequel do
3
+ desc "Run Sequel migrations"
4
+ task :migrate, [:version] => :environment do |t, args|
5
+ Sequel.extension :migration
6
+ db = Sequel.connect(ENV.fetch("DATABASE_URL"))
7
+ if args[:version]
8
+ puts "Migrating to version #{args[:version]}"
9
+ Sequel::Migrator.run(db, "#{$app_root}/db/migrations", target: args[:version].to_i)
10
+ else
11
+ puts "Migrating to latest"
12
+ Sequel::Migrator.run(db, "#{$app_root}/db/migrations")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -40,12 +40,31 @@ module Daiku
40
40
  def gemfile
41
41
  content = <<-SGEMS.strip_heredoc
42
42
  group :sequel do
43
+ gem 'pg'
43
44
  gem 'sequel'
44
45
  gem 'sequel_pg'
45
46
  end
46
47
  SGEMS
47
48
  append_to_file "#{app}/Gemfile", content
48
49
  end
50
+
51
+ def rake
52
+ template "_templates/sequel.rake.tt", "#{app}/lib/tasks/sequel.rake"
53
+ end
54
+
55
+ def readme
56
+ append_to_file "#{app}/README.md" do
57
+ <<-SREADME.strip_heredoc
58
+ # Migrate It
59
+
60
+ # migrate to latest version
61
+ bundle exec rake db:sequel:migrate
62
+
63
+ # migrate up to specific version
64
+ bundle exec rake db:sequel:migrate[001]
65
+ SREADME
66
+ end
67
+ end
49
68
  end
50
69
  end
51
70
  end
@@ -1,3 +1,3 @@
1
1
  module Daiku
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daiku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Marden
@@ -76,6 +76,7 @@ files:
76
76
  - lib/daiku/_app/.travis.yml.tt
77
77
  - lib/daiku/_app/Gemfile.tt
78
78
  - lib/daiku/_app/Procfile.tt
79
+ - lib/daiku/_app/README.md.tt
79
80
  - lib/daiku/_app/Rakefile.tt
80
81
  - lib/daiku/_app/app.rb.tt
81
82
  - lib/daiku/_app/assets/images/.gitkeep
@@ -109,9 +110,11 @@ files:
109
110
  - lib/daiku/plugin.rb
110
111
  - lib/daiku/plugins.rb
111
112
  - lib/daiku/plugins/database-sql.rb
113
+ - lib/daiku/plugins/database-sql/_templates/db.rake.tt
112
114
  - lib/daiku/plugins/database-sql/_templates/db_helper.rb.tt
113
115
  - lib/daiku/plugins/database-sql/cli.rb
114
116
  - lib/daiku/plugins/datamapper.rb
117
+ - lib/daiku/plugins/datamapper/_templates/datamapper.rake.tt
115
118
  - lib/daiku/plugins/datamapper/_templates/datamapper.rb.tt
116
119
  - lib/daiku/plugins/datamapper/cli.rb
117
120
  - lib/daiku/plugins/grunt.rb
@@ -136,7 +139,7 @@ files:
136
139
  - lib/daiku/plugins/sequel.rb
137
140
  - lib/daiku/plugins/sequel/_templates/001_create_extension_hstore.rb.tt
138
141
  - lib/daiku/plugins/sequel/_templates/002_create_extension_postgis.rb.tt
139
- - lib/daiku/plugins/sequel/_templates/db.rake.tt
142
+ - lib/daiku/plugins/sequel/_templates/sequel.rake.tt
140
143
  - lib/daiku/plugins/sequel/_templates/sequel.rb.tt
141
144
  - lib/daiku/plugins/sequel/cli.rb
142
145
  - lib/daiku/plugins/sidekiq.rb
@@ -1,14 +0,0 @@
1
- namespace :db do
2
- desc "Run Sequel migrations"
3
- task :migrate => :environment, [:version] do |t, args|
4
- Sequel.extension :migration
5
- db = Sequel.connect(ENV.fetch("DATABASE_URL"))
6
- if args[:version]
7
- puts "Migrating to version #{args[:version]}"
8
- Sequel::Migrator.run(db, "#{$app_root}/db/migrations", target: args[:version].to_i)
9
- else
10
- puts "Migrating to latest"
11
- Sequel::Migrator.run(db, "#{$app_root}/db/migrations")
12
- end
13
- end
14
- end