shoestrap 0.0.1 → 0.0.2.pre

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.
data/.travis.yml CHANGED
@@ -7,5 +7,7 @@ rvm:
7
7
  - jruby-19mode # JRuby in 1.9 mode
8
8
  - rbx-18mode
9
9
  - rbx-19mode
10
+ notifications:
11
+ campfire: "AylPbg/2kJ8sHjuLGfc0rcDFO5LDSNa+kuH5trCYiLzGD+4hkpftqkvRWyWN\nW3GSOIU32elrb3wqo2jU22c5dhQoYtEgV0Cpv25X4kY2aTlMqSAkCc2Uywxb\n8bmIM3VThTolQUw9F5nhM9aw7wzVXDufSsOwQqUftEmJ2yjrTh4="
10
12
  # uncomment this line if your project needs to run something other than `rake`:
11
13
  # script: bundle exec rspec spec
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
1
  #Changelog
2
2
 
3
+ ## master
4
+
5
+ * Add lib/ to autoload path
6
+ * fix MailInterceptor
7
+
3
8
  ## v0.0.1 - 2013-01-14
4
9
  First Release
data/README.md CHANGED
@@ -1,12 +1,29 @@
1
- # Screen Concept Rails App Bootstrapper
1
+ [![Build Status](https://api.travis-ci.org/screenconcept/shoestrap.png)](http://travis-ci.org/screenconcept/shoestrap)
2
2
 
3
- TBD
3
+ # Shoestrap
4
4
 
5
- More Docs:
5
+ Shoestrap is Screen Concept's Rails App bootstrapper, very similar and
6
+ heavily inspired by https://github.com/thoughtbot/suspenders.
6
7
 
7
- http://guides.rubyonrails.org/rails_application_templates.html
8
- http://guides.rubyonrails.org/generators.html#application-templates
8
+ It is currently under heavy development.
9
9
 
10
- # LICENSE
10
+ # Installation
11
+
12
+ `gem install shoestrap`
13
+
14
+ # Using Shoestrap
15
+
16
+ ## Create a shoestrapped Rails Application
17
+
18
+ `shoestrap <app_name>`
19
+
20
+ ## Using shoestrap generators
21
+
22
+ Add shoestrap to your Gemfile.
23
+
24
+ Run `rails generate shoestrap:cms cms/ModelName` to generate CMS Backend
25
+ views. The cms/ prefix is necessary!
26
+
27
+ # License
11
28
 
12
29
  See the file LICENSE.
data/bin/shoestrap CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require File.expand_path(File.join('..', 'generators', 'app_generator'), File.dirname(__FILE__))
3
+ require File.expand_path(File.join('..', 'lib', 'generators', 'shoestrap', 'app_generator'), File.dirname(__FILE__))
4
4
  require File.expand_path(File.join('..', 'lib', 'shoestrap', 'app_builder'), File.dirname(__FILE__))
5
5
 
6
6
  templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
@@ -12,6 +12,7 @@ module Shoestrap
12
12
  # TODO: rvm! (generate rvmrc from currently used ruby/gemset)
13
13
  build :remove_files_we_dont_need
14
14
  build :bundle
15
+ build :configure_application
15
16
  build :setup_bdd_env
16
17
  build :setup_database
17
18
  build :configure_generators
@@ -0,0 +1,47 @@
1
+ require "rails/generators/active_record/model/model_generator"
2
+
3
+ # TODO: add shoestrap to gemfile
4
+
5
+ module Shoestrap
6
+ class CmsGenerator < ActiveRecord::Generators::ModelGenerator
7
+ source_root File.expand_path('../templates', __FILE__)
8
+ # ... and those files are from: activerecord-3.2.11/lib/rails/generators/active_record/model/templates
9
+
10
+ remove_hook_for :test_framework
11
+
12
+ def create_migration_file
13
+ return unless options[:migration] && options[:parent].nil?
14
+ migration_template "migration.rb", "db/migrate/create_#{table_name.gsub('cms_','')}.rb"
15
+ end
16
+
17
+ def create_model_file
18
+ template 'model.rb', File.join('app/models', "#{file_name}.rb")
19
+ end
20
+
21
+ def create_module_file
22
+ end
23
+
24
+ def generate_scaffolds
25
+ generate 'scaffold_controller', "#{name} #{attributes_string} --routing-specs=false --request-specs=false --controller-specs=false --view-specs=false"
26
+ end
27
+
28
+ def generate_route
29
+ generate 'resource_route', name
30
+ end
31
+
32
+ def generate_translations
33
+ template 'model.yml.erb', "config/locales/de/#{real_table_name}.yml"
34
+ end
35
+
36
+ protected
37
+
38
+ def attributes_string
39
+ attributes.map{ |a| "#{a.name}:#{a.type}" }.join(' ')
40
+ end
41
+
42
+ def real_table_name
43
+ table_name.gsub('cms_', '')
44
+ end
45
+ end
46
+ end
47
+
@@ -0,0 +1,15 @@
1
+ class <%= migration_class_name %> < ActiveRecord::Migration
2
+ def change
3
+ create_table :<%= table_name.gsub('cms_','') %> do |t|
4
+ <% attributes.each do |attribute| -%>
5
+ t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
6
+ <% end -%>
7
+ <% if options[:timestamps] %>
8
+ t.timestamps
9
+ <% end -%>
10
+ end
11
+ <% attributes_with_index.each do |attribute| -%>
12
+ add_index :<%= table_name.gsub('cms_','') %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
13
+ <% end -%>
14
+ end
15
+ end
@@ -0,0 +1,10 @@
1
+ class <%= class_name.split('::').last %> < <%= parent_class_name.classify %>
2
+ <% attributes.select {|attr| attr.reference? }.each do |attribute| -%>
3
+ belongs_to :<%= attribute.name %>
4
+ <% end -%>
5
+ <% if !accessible_attributes.empty? -%>
6
+ attr_accessible <%= accessible_attributes.map {|a| ":#{a.name}" }.sort.join(', ') %>
7
+ <% else -%>
8
+ # attr_accessible :title, :body
9
+ <% end -%>
10
+ end
@@ -0,0 +1,9 @@
1
+ de:
2
+ activerecord:
3
+ attributes:
4
+ <%= real_table_name %>:
5
+ <%- attributes.each do |attr| -%>
6
+ <%= attr.name %>: TRANSLATEME
7
+ <%- end %>
8
+ models:
9
+ <%= real_table_name %>: TRANSLATEME
data/lib/shoestrap.rb ADDED
@@ -0,0 +1,8 @@
1
+ module Shoestrap
2
+ class Railtie < Rails::Railtie
3
+ config.app_generators do |g|
4
+ g.templates.unshift File::expand_path('../../templates', __FILE__)
5
+ end
6
+ end
7
+ end
8
+
@@ -34,8 +34,48 @@ module Shoestrap
34
34
  end
35
35
 
36
36
  def configure_generators
37
- # TODO: implement
38
- # use haml, sass, rspec
37
+ # depends on haml-rails and bootstrap-sass
38
+ copy_file 'bootstrap_and_overrides.css.sass', 'app/assets/stylesheets/bootstrap_and_overrides.css.sass'
39
+ generate 'simple_form:install --bootstrap'
40
+ remove_file 'lib/templates/haml/scaffold/_form.html.haml'
41
+
42
+ inject_into_file 'config/application.rb', :after => "config.assets.version = '1.0'" do
43
+ <<-eos.gsub(/^ {6}/, '').chomp
44
+
45
+ # Configure Generators
46
+ config.generators do |g|
47
+ g.template_engine :haml
48
+ g.test_framework :rspec
49
+ g.stylesheets false
50
+ g.javascripts false
51
+ g.assets false
52
+ g.helper false
53
+ end
54
+ eos
55
+ end
56
+
57
+ inject_into_file 'app/assets/javascripts/application.js', "\n //= require bootstrap", :before => '//= require_tree .'
58
+ end
59
+
60
+ def configure_application
61
+ gsub_file 'config/application.rb', '# config.autoload_paths += %W(#{config.root}/extras)' do
62
+ <<-'eos'.gsub(/^ {10}/, '').chomp
63
+ config.autoload_paths += %W(#{config.root}/lib)
64
+ eos
65
+ end
66
+
67
+ gsub_file 'config/application.rb', ' # config.i18n.default_locale = :de' do
68
+ <<-'eos'.gsub(/^ {6}/, '').chomp
69
+ config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
70
+ config.i18n.available_locales = [:de]
71
+ config.i18n.default_locale = :de
72
+ eos
73
+ end
74
+
75
+ empty_directory 'config/locales/de'
76
+ copy_file 'shoestrap.yml', 'config/locales/de/shoestrap.yml'
77
+ template 'application.html.haml', 'app/views/layouts/application.html.haml'
78
+ remove_file 'app/views/layouts/application.html.erb'
39
79
  end
40
80
 
41
81
  def remove_files_we_dont_need
@@ -51,8 +91,8 @@ module Shoestrap
51
91
 
52
92
  def setup_mail_interceptor
53
93
  # depends on mail gem
54
- template 'mail_interceptor.rb', 'lib/mail_interceptor.rb'
55
- template 'setup_mail.rb', 'config/initializers/setup_mail.rb'
94
+ copy_file 'development_mail_interceptor.rb', 'lib/development_mail_interceptor.rb'
95
+ copy_file 'setup_mail.rb', 'config/initializers/setup_mail.rb'
56
96
  end
57
97
 
58
98
  def setup_rspec
data/shoestrap.gemspec CHANGED
@@ -3,13 +3,13 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "shoestrap"
6
- s.version = '0.0.1'
6
+ s.version = '0.0.2.pre'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Immanuel Häussermann", "Felipe Kaufmann", "Phil Schilter", "Noëlle Rosenberg"]
9
9
  s.email = "info@screenconcept.ch"
10
10
  s.homepage = "http://github.com/screenconcept/shoestrap"
11
11
  s.summary = %q{A tool that helps you bootstrap your rails projects}
12
- s.description = %q{shoestrap is a rails app bootstrapper}
12
+ s.description = %q{shoestrap is a rails app bootstrapper}
13
13
 
14
14
  s.rubyforge_project = "shoestrap"
15
15
 
@@ -15,9 +15,12 @@ gem 'jbuilder'
15
15
  gem 'unicorn'
16
16
  gem 'blazing'
17
17
  gem 'haml'
18
+ gem 'haml-rails'
19
+ gem 'bootstrap-sass'
18
20
  gem 'simple_form'
19
21
  gem 'mail'
20
22
  gem 'fabrication'
23
+ gem 'shoestrap'
21
24
 
22
25
  group :development, :test do
23
26
  gem 'pry'
@@ -0,0 +1,24 @@
1
+ !!! 5
2
+ %html
3
+ %head
4
+ %meta{ charset: "utf-8" }
5
+ -#%meta{ name: "viewport", content: "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" }
6
+
7
+ %title <%= app_name %>
8
+
9
+ = stylesheet_link_tag "application", :media => "all"
10
+ = javascript_include_tag "application"
11
+ = csrf_meta_tags
12
+
13
+ %body
14
+ .navbar.navbar-fixed-top
15
+ .navbar-inner
16
+ .container
17
+ = link_to <%= app_name %>, '#', :class => 'brand'
18
+ %ul.nav
19
+
20
+ .container
21
+ .row-fluid
22
+ .span-12
23
+ = yield
24
+
@@ -0,0 +1,7 @@
1
+ @import "bootstrap"
2
+
3
+ body
4
+ padding-top: 60px
5
+
6
+ @import "bootstrap-responsive"
7
+
@@ -1,7 +1,7 @@
1
- class MailInterceptor
1
+ class DevelopmentMailInterceptor
2
2
  def self.delivering_email(message)
3
3
  message.subject = "DIES-IST-EIN-TEST: #{message.to} #{message.subject}"
4
- message.to = "support@screenconcept.ch"
4
+ message.to = `git config user.email`.chomp
5
5
  end
6
6
  end
7
7
 
@@ -0,0 +1,10 @@
1
+ = simple_form_for([:cms, @<%= singular_table_name %>]) do |f|
2
+ = f.error_notification
3
+
4
+ .form-inputs
5
+ <%- attributes.each do |attribute| -%>
6
+ = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %>
7
+ <%- end -%>
8
+
9
+ .form-actions
10
+ = f.button :submit
@@ -0,0 +1,8 @@
1
+ <% sg_table_name = singular_table_name.gsub('cms_','') -%>
2
+ %h1= "#{ t('cms.<%= sg_table_name %>') } #{ t('cms.edit') }"
3
+
4
+ = render 'form'
5
+
6
+ = link_to t('cms.show'), <%= singular_table_name %>_path(@<%= singular_table_name %>)
7
+ \|
8
+ = link_to t('cms.back'), <%= index_helper %>_path
@@ -0,0 +1,29 @@
1
+ <% pl_table_name = plural_table_name.gsub('cms_','') -%>
2
+ <% sg_table_name = singular_table_name.gsub('cms_','') -%>
3
+ %h1= t('cms.<%= pl_table_name %>')
4
+
5
+ .row-fluid.actions
6
+ .pull-right.padded
7
+ = link_to new_cms_<%= sg_table_name %>_path, :class => 'btn btn-primary' do
8
+ %i.icon-plus-sign.icon-white
9
+ #{ t('cms.new') } <%= human_name %>
10
+
11
+ %table.table.table-bordered.table-striped
12
+ %tr
13
+ <% for attribute in attributes -%>
14
+ %th= t('cms.<%= attribute.human_name %>')
15
+ <% end -%>
16
+ %th
17
+ %th
18
+ %th
19
+
20
+ - @<%= plural_table_name %>.each do |<%= singular_table_name %>|
21
+ %tr
22
+ <% for attribute in attributes -%>
23
+ %td= <%= singular_table_name %>.<%= attribute.name %>
24
+ <% end -%>
25
+ %td= link_to t('cms.show'), <%= singular_table_name %>_path(<%= singular_table_name %>)
26
+ %td= link_to t('cms.edit'), edit_<%= singular_table_name %>_path(<%= singular_table_name %>)
27
+ %td= link_to t('cms.destroy'), <%= singular_table_name %>_path(<%= singular_table_name %>), <%= key_value :method, ":delete" %>, <%= key_value :data, "{ #{key_value :confirm, "t('cms.are_you_sure')"} }" %>
28
+
29
+ %br
@@ -0,0 +1,5 @@
1
+ %h1= t('cms.<%= singular_table_name.gsub('cms_', '') %>')
2
+
3
+ = render 'form'
4
+
5
+ = link_to t('cms.back'), <%= index_helper %>_path
@@ -0,0 +1,27 @@
1
+ %h1 Listing <%= plural_table_name %>
2
+
3
+ .row-fluid.actions
4
+ .pull-right.padded
5
+ = link_to new_<%= singular_table_name %>_path, :class => 'btn btn-primary' do
6
+ %i.icon-plus-sign.icon-white
7
+ New <%= human_name %>
8
+
9
+ %table.table.table-bordered.table-striped
10
+ %tr
11
+ <% for attribute in attributes -%>
12
+ %th <%= attribute.human_name %>
13
+ <% end -%>
14
+ %th
15
+ %th
16
+ %th
17
+
18
+ - @<%= plural_table_name %>.each do |<%= singular_table_name %>|
19
+ %tr
20
+ <% for attribute in attributes -%>
21
+ %td= <%= singular_table_name %>.<%= attribute.name %>
22
+ <% end -%>
23
+ %td= link_to 'Show', <%= singular_table_name %>
24
+ %td= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>)
25
+ %td= link_to 'Destroy', <%= singular_table_name %>, <%= key_value :method, ":delete" %>, <%= key_value :data, "{ #{key_value :confirm, "'Are you sure?'"} }" %>
26
+
27
+ %br
@@ -0,0 +1,89 @@
1
+ <% if namespaced? -%>
2
+ require_dependency "<%= namespaced_file_path %>/application_controller"
3
+
4
+ <% end -%>
5
+ <% module_namespacing do -%>
6
+ class <%= controller_class_name %>Controller < ApplicationController
7
+ # GET <%= route_url %>
8
+ # GET <%= route_url %>.json
9
+ def index
10
+ @<%= plural_table_name %> = <%= orm_class.all(class_name.gsub('Cms::','')) %>
11
+
12
+ respond_to do |format|
13
+ format.html # index.html.erb
14
+ format.json { render <%= key_value :json, "@#{plural_table_name}" %> }
15
+ end
16
+ end
17
+
18
+ # GET <%= route_url %>/1
19
+ # GET <%= route_url %>/1.json
20
+ def show
21
+ @<%= singular_table_name %> = <%= orm_class.find(class_name.gsub('Cms::',''), "params[:id]") %>
22
+
23
+ respond_to do |format|
24
+ format.html # show.html.erb
25
+ format.json { render <%= key_value :json, "@#{singular_table_name}" %> }
26
+ end
27
+ end
28
+
29
+ # GET <%= route_url %>/new
30
+ # GET <%= route_url %>/new.json
31
+ def new
32
+ @<%= singular_table_name %> = <%= orm_class.build(class_name.gsub('Cms::','')) %>
33
+
34
+ respond_to do |format|
35
+ format.html # new.html.erb
36
+ format.json { render <%= key_value :json, "@#{singular_table_name}" %> }
37
+ end
38
+ end
39
+
40
+ # GET <%= route_url %>/1/edit
41
+ def edit
42
+ @<%= singular_table_name %> = <%= orm_class.find(class_name.gsub('Cms::',''), "params[:id]") %>
43
+ end
44
+
45
+ # POST <%= route_url %>
46
+ # POST <%= route_url %>.json
47
+ def create
48
+ @<%= singular_table_name %> = <%= orm_class.build(class_name.gsub('Cms::',''), "params[:#{singular_table_name}]") %>
49
+
50
+ respond_to do |format|
51
+ if @<%= orm_instance.save %>
52
+ format.html { redirect_to <%= singular_table_name %>_path(@<%= singular_table_name %>), <%= key_value :notice, "'#{human_name} was successfully created.'" %> }
53
+ format.json { render <%= key_value :json, "@#{singular_table_name}" %>, <%= key_value :status, ':created' %>, <%= key_value :location, "#{singular_table_name}_path(@#{singular_table_name})" %> }
54
+ else
55
+ format.html { render <%= key_value :action, '"new"' %> }
56
+ format.json { render <%= key_value :json, "@#{orm_instance.errors}" %>, <%= key_value :status, ':unprocessable_entity' %> }
57
+ end
58
+ end
59
+ end
60
+
61
+ # PUT <%= route_url %>/1
62
+ # PUT <%= route_url %>/1.json
63
+ def update
64
+ @<%= singular_table_name %> = <%= orm_class.find(class_name.gsub('Cms::',''), "params[:id]") %>
65
+
66
+ respond_to do |format|
67
+ if @<%= orm_instance.update_attributes("params[:#{singular_table_name}]") %>
68
+ format.html { redirect_to <%= singular_table_name %>_path(@<%= singular_table_name %>), <%= key_value :notice, "'#{human_name} was successfully updated.'" %> }
69
+ format.json { head :no_content }
70
+ else
71
+ format.html { render <%= key_value :action, '"edit"' %> }
72
+ format.json { render <%= key_value :json, "@#{orm_instance.errors}" %>, <%= key_value :status, ':unprocessable_entity' %> }
73
+ end
74
+ end
75
+ end
76
+
77
+ # DELETE <%= route_url %>/1
78
+ # DELETE <%= route_url %>/1.json
79
+ def destroy
80
+ @<%= singular_table_name %> = <%= orm_class.find(class_name.gsub('Cms::',''), "params[:id]") %>
81
+ @<%= orm_instance.destroy %>
82
+
83
+ respond_to do |format|
84
+ format.html { redirect_to <%= index_helper %>_url }
85
+ format.json { head :no_content }
86
+ end
87
+ end
88
+ end
89
+ <% end -%>
@@ -0,0 +1,8 @@
1
+ de:
2
+ cms:
3
+ are_you_sure: sind sie sicher?
4
+ destroy: Löschen
5
+ edit: Bearbeiten
6
+ show: Anzeigen
7
+ back: Zurück
8
+ new: Neue
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoestrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2.pre
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Immanuel Häussermann
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-01-14 00:00:00.000000000 Z
15
+ date: 2013-01-21 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rspec
@@ -79,14 +79,28 @@ files:
79
79
  - README.md
80
80
  - Rakefile
81
81
  - bin/shoestrap
82
- - generators/app_generator.rb
82
+ - lib/generators/shoestrap/app_generator.rb
83
+ - lib/generators/shoestrap/cms_generator.rb
84
+ - lib/generators/shoestrap/templates/migration.rb
85
+ - lib/generators/shoestrap/templates/model.rb
86
+ - lib/generators/shoestrap/templates/model.yml.erb
87
+ - lib/shoestrap.rb
83
88
  - lib/shoestrap/app_builder.rb
84
89
  - shoestrap.gemspec
85
90
  - templates/Gemfile.erb
86
91
  - templates/Guardfile
87
92
  - templates/README.md.erb
88
- - templates/mail_interceptor.rb
93
+ - templates/application.html.haml
94
+ - templates/bootstrap_and_overrides.css.sass
95
+ - templates/development_mail_interceptor.rb
96
+ - templates/haml/scaffold/_form.html.haml
97
+ - templates/haml/scaffold/edit.html.haml
98
+ - templates/haml/scaffold/index.html.haml
99
+ - templates/haml/scaffold/new.html.haml
100
+ - templates/index.html.haml
101
+ - templates/rails/scaffold_controller/controller.rb
89
102
  - templates/setup_mail.rb
103
+ - templates/shoestrap.yml
90
104
  homepage: http://github.com/screenconcept/shoestrap
91
105
  licenses: []
92
106
  post_install_message:
@@ -99,18 +113,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
113
  - - ! '>='
100
114
  - !ruby/object:Gem::Version
101
115
  version: '0'
102
- segments:
103
- - 0
104
- hash: -786510774943773429
105
116
  required_rubygems_version: !ruby/object:Gem::Requirement
106
117
  none: false
107
118
  requirements:
108
- - - ! '>='
119
+ - - ! '>'
109
120
  - !ruby/object:Gem::Version
110
- version: '0'
111
- segments:
112
- - 0
113
- hash: -786510774943773429
121
+ version: 1.3.1
114
122
  requirements: []
115
123
  rubyforge_project: shoestrap
116
124
  rubygems_version: 1.8.24