blueberry_rails 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +8 -0
- data/README.md +1 -1
- data/Rakefile +9 -1
- data/blueberry_rails.gemspec +9 -4
- data/lib/blueberry_rails/app_builder.rb +14 -4
- data/lib/blueberry_rails/generators/app_generator.rb +7 -1
- data/lib/blueberry_rails/version.rb +1 -1
- data/spec/blueberry_rails_spec.rb +60 -0
- data/templates/Capfile +8 -0
- data/templates/Gemfile_custom.erb +4 -1
- data/templates/capistrano_dotenv.cap +24 -0
- data/templates/database_cleaner_setup.rb +23 -0
- data/templates/deploy.rb.erb +16 -28
- data/templates/deploy_production.rb.erb +6 -4
- data/templates/deploy_staging.rb.erb +7 -4
- data/templates/root_controller_spec.rb +12 -0
- data/templates/users_factory.rb +6 -0
- metadata +42 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddc00961037dec35550d81a01209ec15b9236ff8
|
4
|
+
data.tar.gz: f9e0c9a4f44f5b0fed5f25fe972bad8e430e543b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4649cf6aeac71649e3073ce058a57f1f765f611c3ff08062fdb0b336b848c7b880e005688ec1005c5d142e857126c4a4f95fb602dbbb7806f8edc093fa83bcc8
|
7
|
+
data.tar.gz: c29f8e2e771a2a1127a65a39266953979acad6ef5a7488ad35b8fa5152d769099d82703b02ae339059410607a9ea010069fe8f1ad457b417a2f5240f3633bebc
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/blueberry_rails.gemspec
CHANGED
@@ -6,7 +6,7 @@ require 'blueberry_rails/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'blueberry_rails'
|
8
8
|
spec.version = BlueberryRails::VERSION
|
9
|
-
spec.authors = ['
|
9
|
+
spec.authors = ['BlueberryApps']
|
10
10
|
spec.email = ['jzajpt@blueberry.cz']
|
11
11
|
spec.description = %q{A Rails app template by BlueberryApps }
|
12
12
|
spec.summary = %q{A Rails app template by BlueberryApps}
|
@@ -16,10 +16,15 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.add_development_dependency 'rake'
|
21
|
+
spec.add_dependency 'bundler', '~> 1.3'
|
23
22
|
spec.add_dependency 'rails', '4.0.0'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'minitest', '~> 4.7'
|
26
|
+
|
27
|
+
spec.required_ruby_version = '>= 1.9.2'
|
28
|
+
|
24
29
|
end
|
25
30
|
|
@@ -82,8 +82,9 @@ module BlueberryRails
|
|
82
82
|
copy_file 'factories_spec.rb', 'spec/models/factories_spec.rb'
|
83
83
|
end
|
84
84
|
|
85
|
-
def
|
85
|
+
def setup_rspec_support_files
|
86
86
|
copy_file 'factory_girl_syntax.rb', 'spec/support/factory_girl.rb'
|
87
|
+
copy_file 'database_cleaner_setup.rb', 'spec/support/databse_cleaner.rb'
|
87
88
|
end
|
88
89
|
|
89
90
|
def init_guard
|
@@ -143,12 +144,21 @@ module BlueberryRails
|
|
143
144
|
end
|
144
145
|
|
145
146
|
def setup_capistrano
|
146
|
-
|
147
|
-
remove_file 'config/deploy.rb'
|
147
|
+
template 'Capfile', 'Capfile'
|
148
148
|
template 'deploy.rb.erb', 'config/deploy.rb'
|
149
149
|
template 'deploy_production.rb.erb', 'config/deploy/production.rb'
|
150
150
|
template 'deploy_staging.rb.erb', 'config/deploy/staging.rb'
|
151
|
-
|
151
|
+
template 'capistrano_dotenv.cap', 'lib/capistrano/tasks/dotenv.cap'
|
152
|
+
end
|
153
|
+
|
154
|
+
def replace_users_factory
|
155
|
+
remove_file 'spec/factories/users.rb'
|
156
|
+
template 'users_factory.rb', 'spec/factories/users.rb'
|
157
|
+
end
|
158
|
+
|
159
|
+
def replace_root_controller_spec
|
160
|
+
remove_file 'spec/controllers/root_controller_spec.rb'
|
161
|
+
template 'root_controller_spec.rb', 'spec/controllers/root_controller_spec.rb'
|
152
162
|
end
|
153
163
|
|
154
164
|
def setup_gitignore
|
@@ -34,6 +34,7 @@ module BlueberryRails
|
|
34
34
|
invoke :configure_app
|
35
35
|
invoke :remove_routes_comment_lines
|
36
36
|
invoke :setup_gems
|
37
|
+
invoke :fix_specs
|
37
38
|
invoke :setup_git
|
38
39
|
end
|
39
40
|
|
@@ -64,7 +65,7 @@ module BlueberryRails
|
|
64
65
|
say 'Setting up the test environment'
|
65
66
|
build :generate_rspec
|
66
67
|
build :configure_rspec
|
67
|
-
build :
|
68
|
+
build :setup_rspec_support_files
|
68
69
|
build :test_factories_first
|
69
70
|
build :init_guard
|
70
71
|
end
|
@@ -101,6 +102,11 @@ module BlueberryRails
|
|
101
102
|
build :setup_capistrano
|
102
103
|
end
|
103
104
|
|
105
|
+
def fix_specs
|
106
|
+
build :replace_users_factory
|
107
|
+
build :replace_root_controller_spec
|
108
|
+
end
|
109
|
+
|
104
110
|
def setup_git
|
105
111
|
say 'Initializing git'
|
106
112
|
build :setup_gitignore
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
class BlueberryRailsTest < Minitest::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
FileUtils.rm_rf 'test_project'
|
8
|
+
cmd 'dropdb test_project_development'
|
9
|
+
cmd 'dropdb test_project_test'
|
10
|
+
|
11
|
+
%w[RUBYOPT BUNDLE_PATH BUNDLE_BIN_PATH BUNDLE_GEMFILE].each do |key|
|
12
|
+
set_env key, nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def teardown
|
17
|
+
restore_env
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_rake_runs_cleanly_first
|
21
|
+
create_project 'test_project'
|
22
|
+
assert run_rake('test_project')
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def create_project(project_name)
|
28
|
+
bin = File.expand_path(File.join('..', 'bin', 'blueberry_rails'), File.dirname(__FILE__))
|
29
|
+
cmd "#{bin} #{project_name}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def run_rake(project_name)
|
33
|
+
Dir.chdir(project_name) do
|
34
|
+
cmd 'bundle exec rake db:create'
|
35
|
+
cmd 'bundle exec rake db:migrate'
|
36
|
+
cmd 'bundle exec rake db:test:prepare'
|
37
|
+
cmd('bundle exec rake')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def cmd(command)
|
42
|
+
system "#{command}"
|
43
|
+
end
|
44
|
+
|
45
|
+
def original_env
|
46
|
+
@original_env ||= {}
|
47
|
+
end
|
48
|
+
|
49
|
+
def set_env(key, value)
|
50
|
+
original_env[key] = ENV.delete(key)
|
51
|
+
ENV[key] = value
|
52
|
+
end
|
53
|
+
|
54
|
+
def restore_env
|
55
|
+
original_env.each do |key, val|
|
56
|
+
ENV[key] = val
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
data/templates/Capfile
ADDED
@@ -16,7 +16,10 @@ gem 'uglifier', '>= 1.3.0'
|
|
16
16
|
|
17
17
|
group :development do
|
18
18
|
gem 'better_errors'
|
19
|
-
gem 'capistrano'
|
19
|
+
gem 'capistrano', '~> 3.0.0'
|
20
|
+
gem 'capistrano-bundler'
|
21
|
+
gem 'capistrano-rails'
|
22
|
+
gem 'capistrano-rbenv', github: 'capistrano/rbenv'
|
20
23
|
gem 'guard-rails'
|
21
24
|
gem 'mailcatcher'
|
22
25
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
namespace :deploy do
|
2
|
+
|
3
|
+
after :updating, 'dotenv:symlink'
|
4
|
+
|
5
|
+
end
|
6
|
+
|
7
|
+
namespace :dotenv do
|
8
|
+
|
9
|
+
desc "Symlink .env file"
|
10
|
+
task :symlink do
|
11
|
+
on roles(:app) do
|
12
|
+
target = release_path.join('.env')
|
13
|
+
source = shared_path.join('config/dotenv')
|
14
|
+
unless test "[ -L #{target} ]"
|
15
|
+
if test "[ -f #{target} ]"
|
16
|
+
execute :rm, target
|
17
|
+
end
|
18
|
+
execute :ln, '-s', source, target
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
RSpec.configure do |config|
|
2
|
+
|
3
|
+
config.before(:suite) do
|
4
|
+
DatabaseCleaner.clean_with(:truncation)
|
5
|
+
end
|
6
|
+
|
7
|
+
config.before(:each) do
|
8
|
+
DatabaseCleaner.strategy = :transaction
|
9
|
+
end
|
10
|
+
|
11
|
+
config.before(:each, :js => true) do
|
12
|
+
DatabaseCleaner.strategy = :truncation
|
13
|
+
end
|
14
|
+
|
15
|
+
config.before(:each) do
|
16
|
+
DatabaseCleaner.start
|
17
|
+
end
|
18
|
+
|
19
|
+
config.after(:each) do
|
20
|
+
DatabaseCleaner.clean
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/templates/deploy.rb.erb
CHANGED
@@ -1,40 +1,28 @@
|
|
1
|
-
require 'bundler/capistrano'
|
2
|
-
set :bundle_without, [:darwin, :test]
|
3
|
-
|
4
|
-
set :stages, %w(staging production)
|
5
|
-
require 'capistrano/ext/multistage'
|
6
|
-
|
7
1
|
set :application, '<%= app_name %>'
|
8
|
-
set :
|
2
|
+
set :repo_url, 'git@github.com:blueberryapps/<%= app_name %>.git'
|
9
3
|
set :branch, 'master'
|
4
|
+
set :scm, :git
|
5
|
+
|
6
|
+
set :format, :pretty
|
7
|
+
set :log_level, :debug
|
10
8
|
|
11
|
-
|
12
|
-
|
9
|
+
set :linked_files, %w(config/database.yml)
|
10
|
+
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
|
13
11
|
|
14
|
-
set :
|
15
|
-
set :
|
16
|
-
set :keep_releases, 3
|
17
|
-
set :group_writable, false
|
18
|
-
ssh_options[:forward_agent] = true
|
12
|
+
set :rbenv_type, :system
|
13
|
+
set :rbenv_ruby, `git show #{fetch(:branch)}:.ruby-version`
|
19
14
|
|
20
|
-
|
21
|
-
after 'deploy:update_code', 'deploy:symlink_shared'
|
22
|
-
load 'deploy/assets'
|
15
|
+
set :keep_releases, 5
|
23
16
|
|
24
17
|
namespace :deploy do
|
25
18
|
|
26
|
-
|
27
|
-
task :
|
28
|
-
|
29
|
-
|
19
|
+
desc 'Restart application'
|
20
|
+
task :restart do
|
21
|
+
on roles(:app), in: :sequence, wait: 5 do
|
22
|
+
execute :touch, release_path.join('tmp/restart.txt')
|
23
|
+
end
|
30
24
|
end
|
31
25
|
|
32
|
-
|
33
|
-
task :symlink_shared, roles: [:app] do
|
34
|
-
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
|
35
|
-
run "ln -nfs #{shared_path}/system #{release_path}/public/system"
|
36
|
-
run "ln -nfs #{shared_path}/config/dotenv #{release_path}/.env"
|
37
|
-
end
|
26
|
+
after :finishing, 'deploy:cleanup'
|
38
27
|
|
39
28
|
end
|
40
|
-
|
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
set :rails_env,
|
3
|
-
set :
|
4
|
-
set :deploy_to, '/var/www/<%= app_name %>_com'
|
1
|
+
set :stage, :production
|
2
|
+
set :rails_env, 'production'
|
3
|
+
set :deploy_to, '/var/www/<%= app_name %>_com'
|
5
4
|
|
5
|
+
server 'REPLACE_ME',
|
6
|
+
user: '<%= app_name %>',
|
7
|
+
roles: %w(web app db)
|
@@ -1,5 +1,8 @@
|
|
1
|
-
|
2
|
-
set :
|
3
|
-
set :
|
4
|
-
|
1
|
+
set :stage, :staging
|
2
|
+
set :deploy_to, '/var/www/<%= app_name %>_webapps_cz'
|
3
|
+
set :rails_env, 'staging'
|
4
|
+
|
5
|
+
server 'REPLACE_ME',
|
6
|
+
user: '<%= app_name %>_webapps_cz',
|
7
|
+
roles: %w(web app db)
|
5
8
|
|
metadata
CHANGED
@@ -1,57 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blueberry_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- BlueberryApps
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
|
-
type: :
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.0.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- -
|
45
|
+
- - '>='
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- -
|
52
|
+
- - '>='
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: minitest
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - ~>
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.
|
48
|
-
type: :
|
61
|
+
version: '4.7'
|
62
|
+
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - ~>
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.
|
68
|
+
version: '4.7'
|
55
69
|
description: 'A Rails app template by BlueberryApps '
|
56
70
|
email:
|
57
71
|
- jzajpt@blueberry.cz
|
@@ -60,7 +74,8 @@ executables:
|
|
60
74
|
extensions: []
|
61
75
|
extra_rdoc_files: []
|
62
76
|
files:
|
63
|
-
-
|
77
|
+
- .gitignore
|
78
|
+
- .travis.yml
|
64
79
|
- Gemfile
|
65
80
|
- LICENSE.txt
|
66
81
|
- README.md
|
@@ -72,10 +87,14 @@ files:
|
|
72
87
|
- lib/blueberry_rails/app_builder.rb
|
73
88
|
- lib/blueberry_rails/generators/app_generator.rb
|
74
89
|
- lib/blueberry_rails/version.rb
|
90
|
+
- spec/blueberry_rails_spec.rb
|
91
|
+
- templates/Capfile
|
75
92
|
- templates/Gemfile_custom.erb
|
76
93
|
- templates/README.md.erb
|
77
94
|
- templates/_flashes.html.slim
|
95
|
+
- templates/capistrano_dotenv.cap
|
78
96
|
- templates/database.yml.erb
|
97
|
+
- templates/database_cleaner_setup.rb
|
79
98
|
- templates/deploy.rb.erb
|
80
99
|
- templates/deploy_production.rb.erb
|
81
100
|
- templates/deploy_staging.rb.erb
|
@@ -84,8 +103,10 @@ files:
|
|
84
103
|
- templates/factory_girl_syntax.rb
|
85
104
|
- templates/gitignore
|
86
105
|
- templates/layout.html.slim.erb
|
106
|
+
- templates/root_controller_spec.rb
|
87
107
|
- templates/secret_token.rb.erb
|
88
108
|
- templates/spec_helper.rb
|
109
|
+
- templates/users_factory.rb
|
89
110
|
homepage: https://github.com/blueberryapps/blueberry_rails
|
90
111
|
licenses:
|
91
112
|
- MIT
|
@@ -96,18 +117,19 @@ require_paths:
|
|
96
117
|
- lib
|
97
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
98
119
|
requirements:
|
99
|
-
- -
|
120
|
+
- - '>='
|
100
121
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
122
|
+
version: 1.9.2
|
102
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
124
|
requirements:
|
104
|
-
- -
|
125
|
+
- - '>='
|
105
126
|
- !ruby/object:Gem::Version
|
106
127
|
version: '0'
|
107
128
|
requirements: []
|
108
129
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.
|
130
|
+
rubygems_version: 2.1.10
|
110
131
|
signing_key:
|
111
132
|
specification_version: 4
|
112
133
|
summary: A Rails app template by BlueberryApps
|
113
|
-
test_files:
|
134
|
+
test_files:
|
135
|
+
- spec/blueberry_rails_spec.rb
|