wired 0.0.2 → 0.0.3

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjNlNzEzNDUzNGJmODVlNDAwYTc4YzVjMDE4NWI4MTc3ZDk4MDgyNw==
4
+ YTc0OThkNDhkNGVmMTI4ZjFjOGRmNGY4OTcwN2Y4NjU4OWUxNjVkNA==
5
5
  data.tar.gz: !binary |-
6
- ZDM0ODRiYTBiN2JhMzBhMGJhYTc5MDc1NzMzYzEyOWIwMjVlMGUyOA==
6
+ YWJlNjA5MzdjZTI2NzBiOTJlZmYyMTdlYWMzNjQ1MzNkZDdkM2NkZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NmViMWNjMzk3OGE2NjE2ZjBiNzJmNDc1ZDdjNDcyNGFhNmMxMjNkNDBkMDUw
10
- MTVmYzVkNWQyZjhlNThiM2Y0OTE4YzdkMjM5N2I4OWI1ZWIwNjc1MDZjN2Q1
11
- MzhhOThmZGM5OWMxMmVkNTk2YmY5MWJhYTNkZmYyMGM0OGZlZGY=
9
+ MTI0MTQ1NTA2MzJlMDZkNmI4Zjc3NWRhZDFjMjc1ZDAxN2I4MWZhN2IwOTJk
10
+ ZmIyNzU0NzA2ZGM0MTU4ZjliNmJkZTAwOWMwNTI2MTk5ZGU2ZWEzOTgzZDhj
11
+ NzVlMGUwMWFiNjc3Yjg5MjVhMmIzNTYwZjljNjM4ZDM3M2EwNDY=
12
12
  data.tar.gz: !binary |-
13
- Y2MxNGNjZTFhNzUwYTNmZmQ2MzRlZjQxNmU4YmIwYWVjMDE3NjgwOGQ4ODc4
14
- NTZlOTI0NjBiZDU1YjNhODU2NjA1ZmVjMTI4M2IyMGM1MWJiMzc0YmQwY2Yz
15
- MDY2NWUyMTA0ODBhM2FkZWQwYmE2OTI0MDhjODEyMDc1NjQzYjE=
13
+ ZjU2OGNkNzAzN2NjZjVlYzEwYzRmOGUyMGUzYzgwZTE1MjJkZTRjYTQ4NGVl
14
+ ZmZlNmMxODJmMWM2YjE5OGQ0MDY0NmFmODAxZjMxYjc0OGU3ZjI4NjJlNTI4
15
+ YjFlMjNiYjdiNDQ3ZTM1MzdmMTExNTA4NzQ2MzliYjZhOGYwZGM=
@@ -18,5 +18,36 @@ module Wired
18
18
  inject_into_file 'Gemfile', "\n\nruby '#{RUBY_VERSION}'",
19
19
  after: /source 'https:\/\/rubygems.org'/
20
20
  end
21
+
22
+ def setup_database_config
23
+ template 'database.yml.erb', 'config/database.yml', :force => true
24
+ end
25
+
26
+ def create_database
27
+ bundle_command 'exec rake db:create'
28
+ end
29
+
30
+ def create_partials_directory
31
+ empty_directory 'app/views/application'
32
+ end
33
+
34
+ def create_shared_flashes
35
+ copy_file '_flashes.html.erb',
36
+ 'app/views/application/_flashes.html.erb'
37
+ end
38
+
39
+ def create_application_layout
40
+ template 'layout.html.erb.erb',
41
+ 'app/views/layouts/application.html.erb',
42
+ :force => true
43
+ end
44
+
45
+ def configure_time_zone
46
+ config = <<-RUBY
47
+ config.time_zone = 'Amsterdam'
48
+
49
+ RUBY
50
+ inject_into_class 'config/application.rb', 'Application', config
51
+ end
21
52
  end
22
53
  end
@@ -3,9 +3,6 @@ require 'rails/generators/rails/app/app_generator'
3
3
 
4
4
  module Wired
5
5
  class AppGenerator < Rails::Generators::AppGenerator
6
- class_option :database, :type => :string, :aliases => '-d', :default => 'postgresql',
7
- :desc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
8
-
9
6
  class_option :skip_test_unit, :type => :boolean, :aliases => '-T', :default => true,
10
7
  :desc => 'Skip Test::Unit files'
11
8
 
@@ -17,6 +14,16 @@ module Wired
17
14
  def wired_customization
18
15
  invoke :remove_files_we_dont_need
19
16
  invoke :customize_gemfile
17
+ invoke :create_wired_views
18
+ invoke :setup_database
19
+ invoke :configure_app
20
+ #invoke :setup_stylesheets
21
+ #invoke :copy_miscellaneous_files
22
+ #invoke :customize_error_pages
23
+ #invoke :remove_routes_comment_lines
24
+ #invoke :setup_git
25
+ #invoke :create_heroku_apps
26
+ #invoke :create_github_repo
20
27
  invoke :outro
21
28
  end
22
29
 
@@ -31,6 +38,25 @@ module Wired
31
38
  bundle_command 'install --binstubs=bin/stubs'
32
39
  end
33
40
 
41
+ def create_wired_views
42
+ say 'Creating views'
43
+ build :create_partials_directory
44
+ build :create_shared_flashes
45
+ build :create_application_layout
46
+ end
47
+
48
+ def setup_database
49
+ say 'Setting up database'
50
+ build :setup_database_config
51
+ build :create_database
52
+ end
53
+
54
+ def configure_app
55
+ say 'Configuring app'
56
+ build :configure_time_zone
57
+ build :add_email_validator
58
+ end
59
+
34
60
  def outro
35
61
  say 'Wired up!'
36
62
  end
data/lib/wired/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wired
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -0,0 +1,5 @@
1
+ <div id="flash">
2
+ <% flash.each do |key, value| -%>
3
+ <div id="flash_<%= key %>"><%= value %></div>
4
+ <% end -%>
5
+ </div>
@@ -0,0 +1,11 @@
1
+ development: &default
2
+ adapter: postgresql
3
+ database: <%= app_name %>_development
4
+ encoding: utf8
5
+ min_messages: warning
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ test:
10
+ <<: *default
11
+ database: <%= app_name %>_test
@@ -0,0 +1,7 @@
1
+ class EmailValidator < ActiveModel::EachValidator
2
+ def validate_each(record, attribute, value)
3
+ unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
4
+ record.errors[attribute] << (options[:message] || "is not an email")
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title><%%= page_title %></title>
6
+ <%%= stylesheet_link_tag :application, :media => 'all' %>
7
+ <%%= csrf_meta_tags %>
8
+ </head>
9
+ <body class="<%%= body_class %>">
10
+ <%%= render 'flashes' -%>
11
+ <%%= yield %>
12
+ </body>
13
+ </html>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wired
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wirelab Creative
@@ -68,6 +68,10 @@ files:
68
68
  - lib/wired/generators/app_generator.rb
69
69
  - lib/wired/version.rb
70
70
  - templates/Gemfile_clean
71
+ - templates/_flashes.html.erb
72
+ - templates/database.yml.erb
73
+ - templates/email_validator.rb
74
+ - templates/layout.html.erb.erb
71
75
  - wired.gemspec
72
76
  homepage: https://github.com/Wirelab/wired
73
77
  licenses: []