cybele 0.3.0 → 0.4.0

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: ea91a1148f0bec7e672785bf1a8285584f73561c
4
- data.tar.gz: 2bf48e609159ed3f70a5f01db1c0c5d700efd23d
3
+ metadata.gz: f570938250882a406f85090afd9334301b237d9b
4
+ data.tar.gz: 5f939cbb679d29491d7db96818d59cf5f2c05c74
5
5
  SHA512:
6
- metadata.gz: 2ccd9c3b8c9b81a6d9a918b550c77fce49fe973fde39d298ec2d11905e119bc1814e93fe129dbc8e06325bf67087a2312068bc132a585625b7d14c96d6c0faee
7
- data.tar.gz: 5932b07b0ab0a9da3f47e086f9713d425d3c213db9d5b8296b920c011de14fcaac8e9a38e1c909cb4d1af21467fd37c3d699310dcdb45551b354ea9afeccf574
6
+ metadata.gz: 163f6faaa8ba07d219d838bbe6b6ee6d347fead967b781eb3fcf6a50b8da52bc3823fbdfe36879efcf8024b1165d5638218603bb04a01619f1789f0071248f43
7
+ data.tar.gz: fac8f5069ba36fc103706d61044f3de2d0198539c7cbd55aa49566d2d852b9471f0ea4fa230b5681a8e505aa045f1a0d4ed8d3168fd15d0d550ca82ecd4f32eb
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cybele (0.2.0)
4
+ cybele (0.3.0)
5
5
  bundler (~> 1.3)
6
6
  rails (~> 4.0.0.rc1)
7
7
 
data/README.md CHANGED
@@ -1,11 +1,10 @@
1
1
  # Cybele
2
2
 
3
3
  [![Code Climate](https://codeclimate.com/github/lab2023/cybele.png)](https://codeclimate.com/github/lab2023/cybele)
4
+ [![Dependency Status](https://gemnasium.com/lab2023/cybele.png)](https://gemnasium.com/lab2023/cybele)
4
5
 
5
6
  NOTE: Don't use this gem until v1.0.0
6
7
 
7
- This is yet an other Rails Template which inspired from [suspenders](https://github.com/thoughtbot/suspenders).
8
-
9
8
  **Cybele** pron.: /ˈsɪbɨliː/ was an originally Anatolian mother goddess. Little is known of her oldest Anatolian cults,
10
9
  other than her association with mountains, hawks and lions. She may have been Phrygia's State deity; her Phrygian cult
11
10
  was adopted and adapted by Greek colonists of Asia Minor, and spread from there to mainland Greece and its more distant
@@ -38,6 +37,8 @@ http://github.com/lab2023/cybele/issues
38
37
 
39
38
  ## Contributing
40
39
 
40
+ Cybele uses [TomDoc](http://tomdoc.org/), [rDoc](http://rubydoc.info/gems/cybele) and [SemVer](http://semver.org/), and takes it seriously.
41
+
41
42
  Once you've made your great commits:
42
43
 
43
44
  1. Fork Template
@@ -46,21 +47,10 @@ Once you've made your great commits:
46
47
  4. Create a Pull Request from your branch
47
48
  5. That's it!
48
49
 
49
- ## Documentation
50
-
51
-
52
- Cybele uses [TomDoc](http://tomdoc.org/) and [rDoc](http://rubydoc.info/gems/cybele) .
53
-
54
- ## Backwards Compatibility
55
-
56
- Cybele uses [SemVer](http://semver.org/), and takes it seriously.
57
-
58
50
  ## Credits
59
51
 
60
52
  Cybele is maintained and funded by [lab2023 - internet technologies](http://lab2023.com/)
61
-
62
53
  Thank you to all the [contributors!](https://github.com/lab2023/cybele/graphs/contributors)
63
-
64
54
  The names and logos for lab2023 are trademarks of lab2023, inc.
65
55
 
66
56
  ## License
@@ -1,7 +1,7 @@
1
1
  module Cybele #:nodoc:#
2
2
 
3
3
  # Public: This allows you to override entire operations, like the creation of the
4
- # Gemfile_new, README, or JavaScript files, without needing to know exactly
4
+ # cybele_Gemfile, README, or JavaScript files, without needing to know exactly
5
5
  # what those operations do so you can create another template action.
6
6
  class AppBuilder < Rails::AppBuilder
7
7
 
@@ -28,7 +28,7 @@ module Cybele #:nodoc:#
28
28
  # Internal: Replace gemfile
29
29
  def replace_gemfile
30
30
  remove_file 'Gemfile'
31
- copy_file 'Gemfile_new', 'Gemfile'
31
+ copy_file 'cybele_Gemfile', 'Gemfile'
32
32
  end
33
33
 
34
34
  # Internal: Replace erb files with html files
@@ -36,5 +36,136 @@ module Cybele #:nodoc:#
36
36
  remove_file 'app/views/layouts/application.html.erb'
37
37
  template 'app/views/layouts/application.html.haml.erb', 'app/views/layouts/application.html.haml', :force => true
38
38
  end
39
+
40
+ # Internal: Replace responders controller template
41
+ def install_responder_gem
42
+ copy_file 'lib/application_responder.rb', 'lib/application_responder.rb'
43
+ remove_file 'app/controllers/application_controller.rb'
44
+ copy_file 'app/controllers/application_controller.rb', 'app/controllers/application_controller.rb'
45
+ copy_file 'lib/templates/rails/responders_controller/controller.rb', 'lib/templates/rails/responders_controller/controller.rb'
46
+ copy_file 'config/locales/responders.en.yml', 'config/locales/responders.en.yml'
47
+ copy_file 'config/locales/responders.tr.yml', 'config/locales/responders.tr.yml'
48
+ end
49
+
50
+ # Internal: Setup database config
51
+ def replace_database_yml
52
+ template 'config/database.yml.erb', 'config/database.yml', :force => true
53
+ end
54
+
55
+ # Internal: Create database
56
+ def create_database
57
+ bundle_command 'exec rake db:create'
58
+ end
59
+
60
+ # Internal: Setup gitignore files
61
+ def setup_gitignore_files
62
+ remove_file '.gitignore'
63
+ copy_file 'cybele_gitignore', '.gitignore'
64
+ end
65
+
66
+ # Internal: Setup gitignore folders
67
+ def setup_gitignore_folders
68
+ %w(
69
+ app/assets/images
70
+ db/migrate
71
+ spec/support
72
+ spec/lib
73
+ spec/models
74
+ spec/views
75
+ spec/controllers
76
+ spec/helpers
77
+ ).each do |dir|
78
+ empty_directory_with_keep_file dir
79
+ end
80
+ end
81
+
82
+ # Internal: Setup asset precompile
83
+ # Look for information https://github.com/thomas-mcdonald/bootstrap-sass#rails-4
84
+ def setup_asset_precompile
85
+
86
+ config = <<-RUBY
87
+
88
+
89
+ config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
90
+ config.sass.preferred_syntax = :sass
91
+ RUBY
92
+
93
+ inject_into_file 'config/application.rb', config, :after => '# config.i18n.default_locale = :de'
94
+ end
95
+
96
+ # Interval: Convert application.js to application.js.coffee
97
+ def convert_application_js_to_coffee
98
+ remove_file 'app/assets/javascripts/application.js'
99
+ copy_file 'app/assets/javascripts/application.js.coffee', 'app/assets/javascripts/application.js.coffee'
100
+ end
101
+
102
+ # Interval: Convert application.css to application.css.sass
103
+ def convert_application_css_to_sass
104
+ remove_file 'app/assets/stylesheets/application.css'
105
+ copy_file 'app/assets/stylesheets/application.css.sass', 'app/assets/stylesheets/application.css.sass'
106
+ end
107
+
108
+ # Interval: Configure smtp
109
+ def configure_smtp
110
+ copy_file 'config/initializers/mail.rb', 'config/initializers/mail.rb'
111
+
112
+ prepend_file 'config/environments/production.rb',
113
+ "require Rails.root.join('config/initializers/mail')\n"
114
+
115
+ config = <<-RUBY
116
+
117
+
118
+ # Mail Settings
119
+ config.action_mailer.delivery_method = :smtp
120
+ config.action_mailer.smtp_settings = MAIL_SETTING
121
+ RUBY
122
+
123
+ inject_into_file 'config/environments/production.rb', config,
124
+ :after => 'config.action_mailer.raise_delivery_errors = false'
125
+ end
126
+
127
+ # Interval: Configure action mailer
128
+ def configure_action_mailer
129
+ action_mailer_host 'development', "#{app_name}.dev"
130
+ action_mailer_host 'test', 'www.example.com'
131
+ action_mailer_host 'production', "#{app_name}.com"
132
+ end
133
+
134
+ # Interval: Setup letter opener
135
+ def setup_letter_opener
136
+ config = 'config.action_mailer.delivery_method = :letter_opener'
137
+ configure_environment 'development', config
138
+ end
139
+
140
+ # Internal: Leftovers
141
+ def leftovers
142
+ end
143
+
144
+ private
145
+
146
+ # Internal: Set action mailer hostname
147
+ #
148
+ # rail_env - rails env like development, text, production
149
+ # host - domain.dev, domain.com or example.com
150
+ #
151
+ # Returns nothing
152
+ def action_mailer_host(rails_env, host)
153
+ config = "config.action_mailer.default_url_options = { host: '#{host}' }"
154
+ configure_environment(rails_env, config)
155
+ end
156
+
157
+ # Internal: Set configure environment
158
+ #
159
+ # rail_env - rails env like development, text, production
160
+ # config - config string which will add to rails_env file
161
+ #
162
+ # Return nothing
163
+ def configure_environment(rails_env, config)
164
+ inject_into_file(
165
+ "config/environments/#{rails_env}.rb",
166
+ "\n\n #{config}",
167
+ before: "\nend"
168
+ )
169
+ end
39
170
  end
40
171
  end
@@ -25,8 +25,13 @@ module Cybele #:nodoc:#
25
25
  # Internal: Customization template
26
26
  def customization
27
27
  invoke :customize_gemfile
28
+ invoke :setup_database
28
29
  invoke :remove_files_we_dont_need
29
30
  invoke :replace_files
31
+ invoke :install_gems
32
+ invoke :gitignore_files_and_folders
33
+ invoke :setup_bootstrap_sass_coffee
34
+ invoke :configure_mail_setting
30
35
  end
31
36
 
32
37
  # Internal: Customize gemfile
@@ -47,8 +52,49 @@ module Cybele #:nodoc:#
47
52
  def replace_files
48
53
  say 'Replace files'
49
54
  build :replace_erb_with_haml
55
+ build :replace_database_yml
50
56
  end
51
57
 
58
+ # Internal: Install gems
59
+ def install_gems
60
+ say 'Install gems'
61
+ say 'Install responder gem'
62
+ build :install_responder_gem
63
+ end
64
+
65
+ # Internal: Setup database
66
+ def setup_database
67
+ say 'Setting up database'
68
+
69
+ if 'postgresql' == options[:database]
70
+ build :replace_database_yml
71
+ end
72
+
73
+ build :create_database
74
+ end
75
+
76
+ # Internal: Ignore files and folder
77
+ def gitignore_files_and_folders
78
+ build :setup_gitignore_files
79
+ build :setup_gitignore_folders
80
+ end
81
+
82
+ # Internal: Setup up bootstrap, sass, coffee
83
+ def setup_bootstrap_sass_coffee
84
+ build :setup_asset_precompile
85
+ build :setup_application_js
86
+ build :convert_application_js_to_coffee
87
+ build :convert_application_css_to_sass
88
+ end
89
+
90
+ # Internal: Setup mail setting
91
+ def configure_mail_setting
92
+ build :configure_mail_setting
93
+ build :configure_action_mailer
94
+ build :setup_letter_opener
95
+ end
96
+
97
+
52
98
  # Internal: Let's not: We'll bundle manually at the right spot.
53
99
  def run_bundle
54
100
  end
@@ -1,4 +1,4 @@
1
1
  module Cybele #:nodoc:
2
2
  # Public: Cybele version
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
@@ -0,0 +1,17 @@
1
+ # This is a manifest file that will be compiled into application.js, which will include all the files
2
+ # listed below.
3
+ #
4
+ # Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ # or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ #
7
+ # It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ # compiled file.
9
+ #
10
+ # WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ # GO AFTER THE REQUIRES BELOW.
12
+ #
13
+ #= require jquery
14
+ #= require jquery_ujs
15
+ #= require turbolinks
16
+ #= require bootstrap
17
+ #= require_tree .
@@ -0,0 +1,12 @@
1
+ /*
2
+ * This is a manifest file that will be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
@@ -0,0 +1,10 @@
1
+ require 'application_responder'
2
+
3
+ class ApplicationController < ActionController::Base
4
+ self.responder = ApplicationResponder
5
+ respond_to :html, :json
6
+
7
+ # Prevent CSRF attacks by raising an exception.
8
+ # For APIs, you may want to use :null_session instead.
9
+ protect_from_forgery with: :exception
10
+ end
@@ -0,0 +1,13 @@
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
+ host: localhost
9
+ port: 5432
10
+
11
+ test:
12
+ <<: *default
13
+ database: <%= app_name %>_test
@@ -0,0 +1,13 @@
1
+ if Rails.env.production?
2
+ MAIL_SETTING = {
3
+ address: ENV['MAIL_ADDRESS'], # example 'smtp.mandrillapp.com'
4
+ port: '587',
5
+ enable_starttls_auto: true,
6
+ domain: ENV['MAIL_DOMAIN'], # example 'domain.com'
7
+ user_name: ENV['MAIL_USERNAME'], # example 'email@gmail.com'
8
+ password: ENV['MAIL_PASSWORD'],
9
+ authentication: 'plain'
10
+ }
11
+ end
12
+
13
+
@@ -0,0 +1,10 @@
1
+ en:
2
+ flash:
3
+ actions:
4
+ create:
5
+ notice: '%{resource_name} was successfully created.'
6
+ update:
7
+ notice: '%{resource_name} was successfully updated.'
8
+ destroy:
9
+ notice: '%{resource_name} was successfully destroyed.'
10
+ alert: '%{resource_name} could not be destroyed.'
@@ -0,0 +1,10 @@
1
+ tr:
2
+ flash:
3
+ actions:
4
+ create:
5
+ notice: '%{resource_name} başarı ile yaratıldı.'
6
+ update:
7
+ notice: '%{resource_name} başarı ile güncellendi.'
8
+ destroy:
9
+ notice: '%{resource_name} başarı ile silindi.'
10
+ alert: '%{resource_name} silinemedi.'
@@ -7,9 +7,13 @@ gem 'uglifier', '>= 1.3.0'
7
7
  gem 'coffee-rails', '~> 4.0.0'
8
8
  gem 'jquery-rails'
9
9
  gem 'turbolinks'
10
- gem "haml", "~> 4.0.2"
11
- gem "haml-rails", "~> 0.4"
10
+ gem 'haml', '~> 4.0.2'
11
+ gem 'haml-rails', '~> 0.4'
12
+ gem 'bootstrap-sass', '~> 2.3.1.0'
13
+ gem 'responders'
12
14
 
13
15
  group :doc do
14
16
  gem 'sdoc', require: false
15
- end
17
+ end
18
+
19
+ gem 'letter_opener', :group => :development
@@ -0,0 +1,36 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+
10
+ # Ignore the default SQLite database.
11
+ /db/*.sqlite3
12
+ /db/*.sqlite3-journal
13
+
14
+ # Ignore log
15
+ /log/*.log
16
+
17
+ /tmp
18
+ !.keep
19
+ *.swp
20
+ .env
21
+ bin/stubs
22
+ public/system
23
+ tags
24
+ vendor/bundler_gems
25
+
26
+ # Ignore ide and text editor
27
+ .idea
28
+ .idea/**/*
29
+
30
+ # Ignore pow files
31
+ .powrc
32
+
33
+ # Ignore mac files
34
+ .DS_Store
35
+ *.DS_Store
36
+ **/.DS_Store
@@ -0,0 +1,8 @@
1
+ class ApplicationResponder < ActionController::Responder
2
+ include Responders::FlashResponder
3
+ include Responders::HttpCacheResponder
4
+
5
+ # Uncomment this responder if you want your resources to redirect to the collection
6
+ # path (index action) instead of the resource path for POST/PUT/DELETE requests.
7
+ # include Responders::CollectionResponder
8
+ end
@@ -0,0 +1,51 @@
1
+ # encoding: UTF-8
2
+ <% module_namespacing do -%>
3
+ class <%= controller_class_name %>Controller < ApplicationController
4
+ before_action :<%= "set_#{singular_table_name}" %>, only: [:show, :edit, :update, :destroy]
5
+
6
+ <% unless options[:singleton] -%>
7
+ def index
8
+ @<%= table_name %> = <%= class_name %>.all
9
+ respond_with(@<%= table_name %>)
10
+ end
11
+ <% end -%>
12
+
13
+ def show
14
+ respond_with(@<%= file_name %>)
15
+ end
16
+
17
+ def new
18
+ @<%= file_name %> = <%= orm_class.build(class_name) %>
19
+ respond_with(@<%= file_name %>)
20
+ end
21
+
22
+ def edit
23
+ end
24
+
25
+ def create
26
+ @<%= file_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
27
+ @<%= orm_instance.save %>
28
+ respond_with(@<%= file_name %>)
29
+ end
30
+
31
+ def update
32
+ @<%= orm_instance.update_attributes("#{singular_table_name}_params") %>
33
+ respond_with(@<%= file_name %>)
34
+ end
35
+
36
+ def destroy
37
+ @<%= orm_instance.destroy %>
38
+ respond_with(@<%= file_name %>)
39
+ end
40
+
41
+ private
42
+
43
+ def <%= "set_#{singular_table_name}" %>
44
+ @<%= file_name %> = <%= orm_class.find(class_name, "params[:id]") %>
45
+ end
46
+
47
+ def <%= "#{singular_table_name}_params" %>
48
+ params.require(<%= ":#{singular_table_name}" %>).permit(<%= attributes.map {|a| ":#{a.name}" }.sort.join(', ') %>)
49
+ end
50
+ end
51
+ <% end -%>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cybele
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lab2023
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-11 00:00:00.000000000 Z
11
+ date: 2013-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,9 +86,19 @@ files:
86
86
  - lib/cybele/app_builder.rb
87
87
  - lib/cybele/generators/app_generator.rb
88
88
  - lib/cybele/version.rb
89
- - templates/Gemfile_new
90
89
  - templates/README.md.erb
90
+ - templates/app/assets/javascripts/application.js.coffee
91
+ - templates/app/assets/stylesheets/application.css.sass
92
+ - templates/app/controllers/application_controller.rb
91
93
  - templates/app/views/layouts/application.html.haml.erb
94
+ - templates/config/database.yml.erb
95
+ - templates/config/initializers/mail.rb
96
+ - templates/config/locales/responders.en.yml
97
+ - templates/config/locales/responders.tr.yml
98
+ - templates/cybele_Gemfile
99
+ - templates/cybele_gitignore
100
+ - templates/lib/application_responder.rb
101
+ - templates/lib/templates/rails/responders_controller/controller.rb
92
102
  homepage: https://github.com/lab2023/cybele
93
103
  licenses:
94
104
  - MIT