daddy 0.3.2 → 0.3.3

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: ecb6adb5b397bfb763d5451e0913459fd8b6a64b
4
- data.tar.gz: cb020d0962a0cc40b54b2cbbd98b94aa66c13738
3
+ metadata.gz: 8aeac8bf25bd609ea29610b0bce2c16f774d1589
4
+ data.tar.gz: 189af199b7ded6a1fa1e5db857619c4084943129
5
5
  SHA512:
6
- metadata.gz: db51c044c618d0ccbdbdbd8d5d7acc12c4ba62040678b039ab6b135a67ab8a7b54a9a8b511ed6ebc158598df099c56a96f4e04cf1072a6300df5eaeb29516273
7
- data.tar.gz: c506f05ca7742bf1f233cd8feac0970519cb2e871cda8d91778533cf09e2b127c3721fad134704fcab75e77cb1338899fe482b8ba0f7431ed09b849d2d36324a
6
+ metadata.gz: c627c940ee573cbd552fc5cc4e5cc4fee859a771ed30b7c7000cfa4ba3eb63bee706d5872b18e1a4deeae441ce0f02162247edf455a92996f6a5477e102f99fe
7
+ data.tar.gz: c50962006c4ce222e56df474d3b4fda7d19009d932d49971c6fb98d6c18bbe6f39677dfc282509353fec30252fd6f5c761b6eca2dcffbb8919a00fff5e4d90c3
data/lib/daddy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Daddy
2
- VERSION = '0.3.2'.freeze
2
+ VERSION = '0.3.3'.freeze
3
3
  end
@@ -2,7 +2,7 @@
2
2
  app_name_short = ENV['APP_NAME'][0..15]
3
3
  -%>
4
4
  # MySQL. Versions 4.1 and 5.0 are recommended.
5
- #
5
+ #
6
6
  # Install the MYSQL driver
7
7
  # gem install mysql2
8
8
  #
@@ -14,7 +14,6 @@
14
14
  development:
15
15
  adapter: mysql2
16
16
  encoding: utf8
17
- reconnect: false
18
17
  database: <%= app_name_short %>_dev
19
18
  pool: 5
20
19
  username: <%= app_name_short %>
@@ -27,7 +26,6 @@ development:
27
26
  test:
28
27
  adapter: mysql2
29
28
  encoding: utf8
30
- reconnect: false
31
29
  database: <%= app_name_short %>_test
32
30
  pool: 5
33
31
  username: <%= app_name_short %>
@@ -37,7 +35,6 @@ test:
37
35
  production:
38
36
  adapter: mysql2
39
37
  encoding: utf8
40
- reconnect: false
41
38
  database: <%= app_name_short %>_pro
42
39
  pool: 5
43
40
  username: <%= app_name_short %>
@@ -1,5 +1,3 @@
1
- # coding: UTF-8
2
-
3
1
  require 'rake'
4
2
 
5
3
  namespace :dad do
@@ -1,5 +1,5 @@
1
1
  require 'rake'
2
- require 'erb'
2
+ require_relative '../task_helper'
3
3
 
4
4
  namespace :dad do
5
5
  namespace :generate do
@@ -19,7 +19,7 @@ namespace :dad do
19
19
  @model_class = @resource.classify.constantize
20
20
  @controller_name = @resources.split('_').map{|a| a.capitalize}.join
21
21
 
22
- template = File.join(File.dirname(__FILE__), 'templates', 'controller.rb.erb')
22
+ template = File.join(template_dir, 'app', 'controllers', 'controller.rb.erb')
23
23
  controller_file = "#{Rails.root}/app/controllers/#{@resources}_controller.rb"
24
24
  File.write(controller_file, ERB.new(File.read(template)).result)
25
25
  end
@@ -1,7 +1,4 @@
1
- # coding: UTF-8
2
-
3
1
  require 'rake'
4
- require 'erb'
5
2
 
6
3
  namespace :dad do
7
4
  namespace :generate do
@@ -23,7 +20,7 @@ namespace :dad do
23
20
  @tag_begin = '<%'
24
21
  @tag_end = '%>'
25
22
 
26
- Dir[File.join(File.dirname(__FILE__), 'templates/*.html.erb')].each do |template|
23
+ Dir[File.join(template_dir, 'app', 'views', '*.html.erb')].each do |template|
27
24
  view_dir = "#{Rails.root}/app/views/#{@resources}"
28
25
  FileUtils.mkdir_p(view_dir)
29
26
 
@@ -1,8 +1,4 @@
1
- # coding: UTF-8
2
-
3
1
  require 'rake'
4
- require 'term/ansicolor'
5
- include Term::ANSIColor
6
2
 
7
3
  namespace :dad do
8
4
  namespace :jenkins do
@@ -22,7 +18,7 @@ namespace :dad do
22
18
  "sudo chown jenkins:jenkins /var/lib/jenkins/plugins",
23
19
  ]
24
20
  commands.each do |command|
25
- print blue, bold, command, reset, "\n"
21
+ puts command
26
22
  system(command)
27
23
  end
28
24
 
@@ -38,12 +34,12 @@ namespace :dad do
38
34
 
39
35
  unless File.exist?(download_path)
40
36
  command = "sudo wget http://updates.jenkins-ci.org/download/plugins/#{p[:name]}/#{p[:version]}/#{p[:name]}.hpi -O #{download_path}"
41
- print blue, bold, command, reset, "\n"
37
+ puts command
42
38
  system(command)
43
39
  end
44
40
 
45
41
  command = "sudo cp -f #{download_path} /var/lib/jenkins/plugins/#{p[:name]}.hpi"
46
- print blue, bold, command, reset, "\n"
42
+ puts command
47
43
  system(command)
48
44
  end
49
45
  end
@@ -12,3 +12,7 @@ end
12
12
  def self.app_name
13
13
  YAML.load_file("#{rails_root}/config/database.yml")[Rails.env]['database']
14
14
  end
15
+
16
+ def self.template_dir
17
+ File.join(File.dirname(File.dirname(File.dirname(__FILE__))), 'templates')
18
+ end
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
  gem 'rails', '<%= RAILS_VERSION %>'
5
5
 
6
6
  gem 'coffee-rails', '~> 4.0.0'
7
- gem 'daddy', '~> 0.3.0'
7
+ gem 'daddy', '~> 0.3'
8
8
  gem 'jbuilder', '~> 1.2'
9
9
  gem 'jquery-rails'
10
10
  gem 'mysql2'
@@ -1,5 +1,3 @@
1
- # coding: UTF-8
2
-
3
1
  class <%= @controller_name %>Controller < ApplicationController
4
2
 
5
3
  def index
@@ -15,8 +13,8 @@ class <%= @controller_name %>Controller < ApplicationController
15
13
  end
16
14
 
17
15
  def create
18
- @<%= @resource %> = <%= @model_class.name %>.new(params[:<%= @resource %>])
19
-
16
+ @<%= @resource %> = <%= @model_class.name %>.new(<%= @resource %>_params)
17
+
20
18
  begin
21
19
  @<%= @resource %>.transaction do
22
20
  @<%= @resource %>.save!
@@ -35,10 +33,10 @@ class <%= @controller_name %>Controller < ApplicationController
35
33
 
36
34
  def update
37
35
  @<%= @resource %> = <%= @model_class.name %>.find(params[:id])
38
-
36
+ @<%= @resource %>.attributes = params[:<%= @resource %>_params]
37
+
39
38
  begin
40
39
  @<%= @resource %>.transaction do
41
- @<%= @resource %>.attributes = params[:<%= @resource %>]
42
40
  @<%= @resource %>.save!
43
41
  end
44
42
 
@@ -51,12 +49,18 @@ class <%= @controller_name %>Controller < ApplicationController
51
49
 
52
50
  def destroy
53
51
  @<%= @resource %> = <%= @model_class.name %>.find(params[:id])
54
-
52
+
55
53
  @<%= @resource %>.transaction do
56
54
  @<%= @resource %>.destroy_logically!
57
55
  end
58
-
56
+
59
57
  redirect_to :action => 'index'
60
58
  end
61
59
 
60
+ private
61
+
62
+ def <%= @resource %>_params
63
+ params.require(:<%= @resource %>).permit!
64
+ end
65
+
62
66
  end
@@ -0,0 +1,22 @@
1
+ <%= @tag_begin %>= form_for @<%= @resource %> do |f| <%= @tag_end %>
2
+ <%= @tag_begin %> if @<%= @resource %>.errors.any? <%= @tag_end %>
3
+ <div class="errors">
4
+ <ul>
5
+ <%= @tag_begin %> @<%= @resource %>.errors.full_messages.each do |msg| <%= @tag_end %>
6
+ <li><%= @tag_begin %>= msg <%= @tag_end %></li>
7
+ <%= @tag_begin %> end <%= @tag_end %>
8
+ </ul>
9
+ </div>
10
+ <%= @tag_begin %> end <%= @tag_end %>
11
+
12
+ <table>
13
+ <% @model_class.columns.each do |column| -%>
14
+ <% next if %w{ id deleted created_at updated_at }.include?(column.name.to_s) -%>
15
+ <tr>
16
+ <th><%= @tag_begin %>= f.label :<%= column.name %> <%= @tag_end %></th>
17
+ <td><%= @tag_begin %>= f.text_field :<%= column.name %> <%= @tag_end %></td>
18
+ </tr>
19
+ <% end -%>
20
+ </table>
21
+ <%= @tag_begin %>= f.submit <%= @tag_end %>
22
+ <%= @tag_begin %> end <%= @tag_end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
@@ -180,16 +180,22 @@ dependencies:
180
180
  name: rails-i18n
181
181
  requirement: !ruby/object:Gem::Requirement
182
182
  requirements:
183
- - - ~>
183
+ - - '>='
184
184
  - !ruby/object:Gem::Version
185
- version: '3.0'
185
+ version: 3.2.0
186
+ - - <
187
+ - !ruby/object:Gem::Version
188
+ version: 5.0.0
186
189
  type: :runtime
187
190
  prerelease: false
188
191
  version_requirements: !ruby/object:Gem::Requirement
189
192
  requirements:
190
- - - ~>
193
+ - - '>='
191
194
  - !ruby/object:Gem::Version
192
- version: '3.0'
195
+ version: 3.2.0
196
+ - - <
197
+ - !ruby/object:Gem::Version
198
+ version: 5.0.0
193
199
  - !ruby/object:Gem::Dependency
194
200
  name: resque
195
201
  requirement: !ruby/object:Gem::Requirement
@@ -330,12 +336,6 @@ files:
330
336
  - lib/tasks/fluentd.repo
331
337
  - lib/tasks/fluentd_nginx.conf.erb
332
338
  - lib/tasks/generate/controller.rake
333
- - lib/tasks/generate/templates/_form.html.erb
334
- - lib/tasks/generate/templates/controller.rb.erb
335
- - lib/tasks/generate/templates/edit.html.erb
336
- - lib/tasks/generate/templates/index.html.erb
337
- - lib/tasks/generate/templates/new.html.erb
338
- - lib/tasks/generate/templates/show.html.erb
339
339
  - lib/tasks/generate/view.rake
340
340
  - lib/tasks/god.rake
341
341
  - lib/tasks/god/god
@@ -366,6 +366,12 @@ files:
366
366
  - lib/tasks/unicorn.rb.erb
367
367
  - lib/tax.rb
368
368
  - templates/Gemfile.erb
369
+ - templates/app/controllers/controller.rb.erb
370
+ - templates/app/views/_form.html.erb
371
+ - templates/app/views/edit.html.erb
372
+ - templates/app/views/index.html.erb
373
+ - templates/app/views/new.html.erb
374
+ - templates/app/views/show.html.erb
369
375
  - templates/config/routes.rb.erb
370
376
  - vendor/assets/javascripts/jquery-ui/ympicker-ja.js
371
377
  - vendor/assets/javascripts/jquery-ui/ympicker.js
@@ -1,12 +0,0 @@
1
- <%= @tag_begin %>= form_for @<%= @resources.singularize %> do |f| <%= @tag_end %>
2
- <table>
3
- <% @model_class.columns.each do |column| -%>
4
- <% next if %w{ id deleted created_at updated_at }.include?(column.name.to_s) -%>
5
- <tr>
6
- <th><%= @tag_begin %>= f.label :<%= column.name %> <%= @tag_end %></th>
7
- <td><%= @tag_begin %>= f.text_field :<%= column.name %> <%= @tag_end %></td>
8
- </tr>
9
- <% end -%>
10
- </table>
11
- <%= @tag_begin %>= f.submit <%= @tag_end %>
12
- <%= @tag_begin %> end <%= @tag_end %>