blueberry_rails 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c04397bcac9226a5f2d30443e0199d2ef15fc1e7
4
+ data.tar.gz: 3d27cedfe3061de5207c7dd714ea0a1afe36ebc4
5
+ SHA512:
6
+ metadata.gz: 9e0485c624a470aedb87c6c65a405a7cb665a2072773677dc3de4b0ff580d11e7084dde8f69a725d0a7b166b1b5e1c084a96fd33cea909bb070cb75c01d60e2c
7
+ data.tar.gz: 743d0bd8c7f727feeedf0d2e5ed9e61b29051a82730c7819da980f9fc347b82343f6cea9313714f4aed5a93b49b862ad81279561225303ddbae80313cdc593f2
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in blueberry_rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jiří Zajpt
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # Blueberry Rails
2
+
3
+ A Rails application template used at Blueberry Apps.
4
+
5
+ ## Installation
6
+
7
+ Install the gem:
8
+
9
+ $ gem install blueberry_rails
10
+
11
+ Then you can run
12
+
13
+ $ blueberry_rails newproject
14
+
15
+ ## Credits
16
+
17
+ Based on [suspenders](https://github.com/thoughtbot/suspenders/blob/master/README.md)
18
+ gem by [thoughtbot](http://thoughtbot.com/community).
19
+
20
+ ## Contributing
21
+
22
+ 1. Fork it
23
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
24
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
25
+ 4. Push to the branch (`git push origin my-new-feature`)
26
+ 5. Create new Pull Request
27
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join('..', 'lib', 'blueberry_rails', 'generators', 'app_generator'), File.dirname(__FILE__))
4
+ require File.expand_path(File.join('..', 'lib', 'blueberry_rails', 'action_helpers'), File.dirname(__FILE__))
5
+ require File.expand_path(File.join('..', 'lib', 'blueberry_rails', 'app_builder'), File.dirname(__FILE__))
6
+
7
+ templates_root = File.expand_path(File.join('..', 'templates'), File.dirname(__FILE__))
8
+ BlueberryRails::AppGenerator.source_root templates_root
9
+ BlueberryRails::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
10
+
11
+ BlueberryRails::AppGenerator.start
12
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'blueberry_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'blueberry_rails'
8
+ spec.version = BlueberryRails::VERSION
9
+ spec.authors = ['Blueberryapps']
10
+ spec.email = ['jzajpt@blueberry.cz']
11
+ spec.description = %q{A Rails app template by BlueberryApps }
12
+ spec.summary = %q{A Rails app template by BlueberryApps}
13
+ spec.homepage = 'https://github.com/blueberryapps/blueberry_rails'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_dependency 'rails', '4.0.0'
24
+ end
25
+
@@ -0,0 +1,5 @@
1
+ require "blueberry_rails/version"
2
+
3
+ module BlueberryRails
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,19 @@
1
+ module BlueberryRails
2
+ module ActionHelpers
3
+
4
+ def configure_environment(rails_env, config)
5
+ inject_into_file("config/environments/#{rails_env}.rb",
6
+ "\n\n #{config}", before: "\nend")
7
+ end
8
+
9
+ def replace_in_file(relative_path, find, replace)
10
+ path = File.join(destination_root, relative_path)
11
+ contents = IO.read(path)
12
+ unless contents.gsub!(find, replace)
13
+ raise "#{find.inspect} not found in #{relative_path}"
14
+ end
15
+ File.open(path, "w") { |file| file.write(contents) }
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,126 @@
1
+ module BlueberryRails
2
+ class AppBuilder < Rails::AppBuilder
3
+
4
+ include BlueberryRails::ActionHelpers
5
+
6
+ def readme
7
+ template 'README.md.erb', 'README.md'
8
+ end
9
+
10
+ def replace_gemfile
11
+ remove_file 'Gemfile'
12
+ copy_file 'Gemfile_custom', 'Gemfile'
13
+ end
14
+
15
+ def replace_secret_token
16
+ template 'secret_token.rb.erb',
17
+ 'config/initializers/secret_token.rb',
18
+ force: true
19
+ end
20
+
21
+ def disable_xml_params
22
+ copy_file 'disable_xml_params.rb', 'config/initializers/disable_xml_params.rb'
23
+ end
24
+
25
+ def set_ruby_to_version_being_used
26
+ inject_into_file 'Gemfile', "\n\nruby '#{RUBY_VERSION}'",
27
+ after: /source 'https:\/\/rubygems.org'/
28
+ end
29
+
30
+ def use_postgres_config_template
31
+ template 'database.yml.erb', 'config/database.yml',
32
+ force: true
33
+ template 'database.yml.erb', 'config/database.yml.sample'
34
+ end
35
+
36
+ def setup_staging_environment
37
+ run 'cp config/environments/production.rb config/environments/staging.rb'
38
+ end
39
+
40
+ def create_partials_directory
41
+ empty_directory 'app/views/application'
42
+ end
43
+
44
+ def create_shared_flashes
45
+ copy_file '_flashes.html.slim', 'app/views/application/_flashes.html.slim'
46
+ end
47
+
48
+ def create_application_layout
49
+ template 'layout.html.slim.erb',
50
+ 'app/views/layouts/application.html.slim',
51
+ force: true
52
+ end
53
+
54
+ def remove_turbolinks
55
+ replace_in_file 'app/assets/javascripts/application.js',
56
+ /\/\/= require turbolinks\n/,
57
+ ''
58
+ end
59
+
60
+ def create_database
61
+ bundle_command 'exec rake db:create'
62
+ end
63
+
64
+ def generate_rspec
65
+ generate 'rspec:install'
66
+ end
67
+
68
+ def configure_rspec
69
+ remove_file 'spec/spec_helper.rb'
70
+ copy_file 'spec_helper.rb', 'spec/spec_helper.rb'
71
+ end
72
+
73
+ def enable_factory_girl_syntax
74
+ copy_file 'factory_girl_syntax.rb', 'spec/support/factory_girl.rb'
75
+ end
76
+
77
+
78
+ def raise_on_unpermitted_parameters
79
+ configure_environment 'development',
80
+ 'config.action_controller.action_on_unpermitted_parameters = :raise'
81
+ end
82
+
83
+ def configure_generators
84
+ config = <<-RUBY
85
+ config.generators do |generate|
86
+ generate.helper false
87
+ generate.javascript_engine false
88
+ generate.request_specs false
89
+ generate.routing_specs false
90
+ generate.stylesheets false
91
+ generate.test_framework :rspec
92
+ generate.view_specs false
93
+ end
94
+
95
+ RUBY
96
+
97
+ inject_into_class 'config/application.rb', 'Application', config
98
+ end
99
+
100
+ def remove_routes_comment_lines
101
+ replace_in_file 'config/routes.rb',
102
+ /Application\.routes\.draw do.*end/m,
103
+ "Application.routes.draw do\nend"
104
+ end
105
+
106
+ def setup_gitignore
107
+ remove_file '.gitignore'
108
+ copy_file 'gitignore', '.gitignore'
109
+ [ 'app/views/pages',
110
+ 'spec/lib',
111
+ 'spec/controllers',
112
+ 'spec/helpers',
113
+ 'spec/support/matchers',
114
+ 'spec/support/mixins',
115
+ 'spec/support/shared_examples' ].each do |dir|
116
+ run "mkdir #{dir}"
117
+ run "touch #{dir}/.keep"
118
+ end
119
+ end
120
+
121
+ def init_git
122
+ run 'git init'
123
+ end
124
+
125
+ end
126
+ end
@@ -0,0 +1,93 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/rails/app/app_generator'
3
+
4
+ module BlueberryRails
5
+ class AppGenerator < Rails::Generators::AppGenerator
6
+
7
+ class_option :database, :type => :string, :aliases => '-d', :default => 'postgresql',
8
+ :esc => "Preconfigure for selected database (options: #{DATABASES.join('/')})"
9
+
10
+ class_option :github, :type => :string, :aliases => '-G', :default => nil,
11
+ :desc => 'Create Github repository and add remote origin pointed to repo'
12
+
13
+ class_option :skip_test_unit, :type => :boolean, :aliases => '-T', :default => true,
14
+ :desc => 'Skip Test::Unit files'
15
+
16
+ def finish_template
17
+ invoke :blueberry_customization
18
+ super
19
+ end
20
+
21
+ def blueberry_customization
22
+ invoke :customize_gemfile
23
+ invoke :setup_database
24
+ invoke :setup_development_environment
25
+ invoke :setup_test_environment
26
+ invoke :setup_staging_environment
27
+ invoke :configure_app
28
+ invoke :remove_routes_comment_lines
29
+ invoke :setup_git
30
+ end
31
+
32
+ def customize_gemfile
33
+ build :replace_gemfile
34
+ build :set_ruby_to_version_being_used
35
+ bundle_command 'install'
36
+ end
37
+
38
+ def setup_database
39
+ say 'Setting up database'
40
+
41
+ if 'postgresql' == options[:database]
42
+ build :use_postgres_config_template
43
+ end
44
+
45
+ build :create_database
46
+ end
47
+
48
+ def setup_development_environment
49
+ say 'Setting up the development environment'
50
+ build :configure_generators
51
+ build :raise_on_unpermitted_parameters
52
+ end
53
+
54
+ def setup_test_environment
55
+ say 'Setting up the test environment'
56
+ build :generate_rspec
57
+ build :configure_rspec
58
+ build :enable_factory_girl_syntax
59
+ end
60
+
61
+ def setup_staging_environment
62
+ say 'Setting up the staging environment'
63
+ build :setup_staging_environment
64
+ end
65
+
66
+ def configure_app
67
+ build :replace_secret_token
68
+ build :disable_xml_params
69
+ end
70
+
71
+ def remove_routes_comment_lines
72
+ build :remove_routes_comment_lines
73
+ end
74
+
75
+ def setup_git
76
+ say 'Initializing git'
77
+ build :setup_gitignore
78
+ build :init_git
79
+ end
80
+
81
+
82
+ def run_bundle
83
+ end
84
+
85
+ protected
86
+
87
+ def get_builder_class
88
+ BlueberryRails::AppBuilder
89
+ end
90
+
91
+ end
92
+ end
93
+
@@ -0,0 +1,3 @@
1
+ module BlueberryRails
2
+ VERSION = "0.0.1"
3
+ end
data/templates/Gemfile ADDED
File without changes
@@ -0,0 +1,38 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'coffee-rails', '~> 4.0.0'
4
+ gem 'dotenv-rails'
5
+ gem 'jquery-rails'
6
+ gem 'pg'
7
+ gem 'rails', '~> 4.0.0'
8
+ gem 'sass-rails', '~> 4.0.0'
9
+ gem 'simple_form'
10
+ gem 'slim-rails'
11
+ gem 'uglifier', '>= 1.3.0'
12
+
13
+ group :development do
14
+ gem 'better_errors'
15
+ gem 'capistrano'
16
+ gem 'mailcatcher'
17
+ end
18
+
19
+ group :development, :test do
20
+ gem 'factory_girl_rails'
21
+ gem 'rspec-rails', '>= 2.14'
22
+ end
23
+
24
+ group :doc do
25
+ gem 'sdoc', require: false
26
+ end
27
+
28
+ group :staging, :production do
29
+ gem 'newrelic_rpm', '>= 3.6.7'
30
+ end
31
+
32
+ group :test do
33
+ gem 'capybara-webkit', '>= 1.0.0'
34
+ gem 'database_cleaner'
35
+ gem 'simplecov', require: false
36
+ end
37
+
38
+
@@ -0,0 +1,9 @@
1
+ # Yet another Blueberry Rails project
2
+
3
+ Use the following guides for getting things done, programming well, and
4
+ programming in style.
5
+
6
+ * [Protocol](http://github.com/thoughtbot/guides/blob/master/protocol)
7
+ * [Best Practices](http://github.com/thoughtbot/guides/blob/master/best-practices)
8
+ * [Style](http://github.com/thoughtbot/guides/blob/master/style)
9
+
@@ -0,0 +1,5 @@
1
+ #flash
2
+ - flash.each do |key, value|
3
+ div id="flash-#{ key }"
4
+ = value
5
+
@@ -0,0 +1,12 @@
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
12
+
@@ -0,0 +1,3 @@
1
+ # Protect against injection attacks
2
+ # http://www.kb.cert.org/vuls/id/380039
3
+ ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML)
@@ -0,0 +1,3 @@
1
+ RSpec.configure do |config|
2
+ config.include FactoryGirl::Syntax::Methods
3
+ end
@@ -0,0 +1,17 @@
1
+ !.keep
2
+ *.DS_Store
3
+ *.swo
4
+ *.swp
5
+ .bundle
6
+ .sass-cache/
7
+ coverage/*
8
+ config/database.yml
9
+ db/*.sqlite3
10
+ db/schema.rb
11
+ log/*
12
+ public/system
13
+ rerun.txt
14
+ tags
15
+ tmp/*
16
+ tmp/**/*
17
+
@@ -0,0 +1,16 @@
1
+ doctype html
2
+ html
3
+ head
4
+ title Blueberryapps!:W
5
+ meta charset="utf-8"
6
+ = stylesheet_link_tag :application, :media => 'all'
7
+ = csrf_meta_tags
8
+
9
+
10
+ body
11
+ = render 'flashes'
12
+ = yield
13
+
14
+ = javascript_include_tag :application
15
+ = yield :javascript
16
+
@@ -0,0 +1,18 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ #
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+ #
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ <%= app_const %>.config.secret_key_base = if Rails.env.development? || Rails.env.test?
14
+ 'x' * 50
15
+ else
16
+ ENV['SECRET_TOKEN']
17
+ end
18
+
@@ -0,0 +1,24 @@
1
+ require 'simplecov'
2
+ SimpleCov.start 'rails'
3
+
4
+ ENV['RAILS_ENV'] = 'test'
5
+
6
+ require File.expand_path('../../config/environment', __FILE__)
7
+
8
+ require 'rspec/rails'
9
+
10
+ Dir[Rails.root.join('spec/support/**/*.rb')].each { |file| require file }
11
+
12
+ RSpec.configure do |config|
13
+ config.expect_with :rspec do |c|
14
+ c.syntax = :expect
15
+ end
16
+
17
+ config.fail_fast = true
18
+ config.infer_base_class_for_anonymous_controllers = false
19
+ config.order = 'random'
20
+ config.use_transactional_fixtures = false
21
+ end
22
+
23
+ Capybara.javascript_driver = :webkit
24
+
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blueberry_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Blueberryapps
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 4.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 4.0.0
55
+ description: 'A Rails app template by BlueberryApps '
56
+ email:
57
+ - jzajpt@blueberry.cz
58
+ executables:
59
+ - blueberry_rails
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/blueberry_rails
69
+ - blueberry_rails.gemspec
70
+ - lib/blueberry_rails.rb
71
+ - lib/blueberry_rails/action_helpers.rb
72
+ - lib/blueberry_rails/app_builder.rb
73
+ - lib/blueberry_rails/generators/app_generator.rb
74
+ - lib/blueberry_rails/version.rb
75
+ - templates/Gemfile
76
+ - templates/Gemfile_custom
77
+ - templates/README.md.erb
78
+ - templates/_flashes.html.slim
79
+ - templates/database.yml.erb
80
+ - templates/disable_xml_params.rb
81
+ - templates/factory_girl_syntax.rb
82
+ - templates/gitignore
83
+ - templates/layout.html.slim.erb
84
+ - templates/secret_token.rb.erb
85
+ - templates/spec_helper.rb
86
+ homepage: https://github.com/blueberryapps/blueberry_rails
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.0.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: A Rails app template by BlueberryApps
110
+ test_files: []