straptible 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/lib/straptible/gem/templates/newgem.gemspec.tt +5 -5
- data/lib/straptible/rails/builders/api.rb +6 -0
- data/lib/straptible/rails/templates/Gemfile.api +2 -0
- data/lib/straptible/rails/templates/Rakefile.tt +6 -3
- data/lib/straptible/rails/templates/config.api/application.rb.tt +16 -1
- data/lib/straptible/rails/templates/config.api/database.yml.tt +2 -0
- data/lib/straptible/rails/templates/config.api/environments/development.rb.tt +2 -2
- data/lib/straptible/rails/templates/config.api/environments/test.rb.tt +2 -2
- data/lib/straptible/rails/templates/lib.api/tasks/auto_annotate_models.rake +22 -0
- data/lib/straptible/rails/templates/spec/spec_helper.rb +5 -5
- data/lib/straptible/version.rb +1 -1
- data/spec/integration/api_spec.rb +14 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b861fd978d3dc4e05365ffe32e0faeb58acf8fd8
|
4
|
+
data.tar.gz: 8093b574eb4ef4786559e6f28283aad47d222d89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15450e6888839b435de96bc8523778081cf390addc8541e2634333bcfe5b0b8d9e82505e31e4f9f0d3f168caa1b7736c877e522f47b4dd6431059c7913ea7cc8
|
7
|
+
data.tar.gz: 7ab40ddcc1039583c49384373202619c1e465f9406109cd6f75e348f722a415d037b869eadf54993f8ddcb3cc4d8ac598871a49cf60b4e1e6f4c7bb655649752
|
data/.travis.yml
CHANGED
@@ -10,17 +10,17 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.version = <%= config[:constant_name] %>::VERSION
|
11
11
|
spec.authors = ['<%= config[:author] %>']
|
12
12
|
spec.email = ['<%= config[:email] %>']
|
13
|
-
spec.description =
|
14
|
-
spec.summary =
|
13
|
+
spec.description = 'TODO: Write a gem description'
|
14
|
+
spec.summary = 'TODO: Write a gem summary'
|
15
15
|
spec.homepage = 'https://github.com/aptible/<%= config[:name] %>'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
18
|
spec.files = `git ls-files`.split($RS)
|
19
|
-
spec.test_files = spec.files.grep(
|
19
|
+
spec.test_files = spec.files.grep(%r{^spec/})
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency 'bundler'
|
22
|
+
spec.add_development_dependency 'bundler'
|
23
23
|
spec.add_development_dependency 'aptible-tasks'
|
24
24
|
spec.add_development_dependency 'rake'
|
25
|
-
spec.add_development_dependency 'rspec'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
26
|
end
|
@@ -16,6 +16,10 @@ module Straptible
|
|
16
16
|
directory 'config.api', 'config'
|
17
17
|
end
|
18
18
|
|
19
|
+
def lib
|
20
|
+
directory 'lib.api', 'lib'
|
21
|
+
end
|
22
|
+
|
19
23
|
def public_directory
|
20
24
|
directory 'public.api', 'public'
|
21
25
|
end
|
@@ -43,6 +47,8 @@ module Straptible
|
|
43
47
|
remove_dir 'app/models/concerns'
|
44
48
|
remove_dir 'app/views/layouts'
|
45
49
|
|
50
|
+
remove_file 'bin/setup'
|
51
|
+
|
46
52
|
empty_directory 'app/decorators'
|
47
53
|
end
|
48
54
|
end
|
@@ -5,6 +5,7 @@ gem 'pg'
|
|
5
5
|
gem 'draper'
|
6
6
|
gem 'rabl'
|
7
7
|
gem 'oj'
|
8
|
+
gem 'rack-cors'
|
8
9
|
|
9
10
|
group :development, :test do
|
10
11
|
gem 'annotate'
|
@@ -12,5 +13,6 @@ group :development, :test do
|
|
12
13
|
gem 'rabl-generators'
|
13
14
|
gem 'rspec'
|
14
15
|
gem 'rspec-rails'
|
16
|
+
gem 'fabrication'
|
15
17
|
gem 'pry'
|
16
18
|
end
|
@@ -1,9 +1,12 @@
|
|
1
1
|
require File.expand_path('../config/application', __FILE__)
|
2
2
|
|
3
|
+
<%= app_const %>.load_tasks
|
4
|
+
|
5
|
+
Annotate.load_tasks if defined?(Annotate)
|
6
|
+
|
3
7
|
# Load shared Aptible Rake tasks
|
4
8
|
require 'aptible/tasks'
|
5
9
|
Aptible::Tasks.load_tasks
|
6
10
|
|
7
|
-
|
8
|
-
|
9
|
-
task default: :ci
|
11
|
+
Aptible::Tasks.clear_task :default
|
12
|
+
task default: ['db:create', :ci]
|
@@ -15,7 +15,8 @@ module <%= app_const_base %>
|
|
15
15
|
g.javascripts = false
|
16
16
|
g.helper = false
|
17
17
|
g.view_specs = false
|
18
|
-
|
18
|
+
g.test_framework :rspec, fixture: true
|
19
|
+
g.fixture_replacement :fabrication
|
19
20
|
g.hide_namespace :test_unit
|
20
21
|
g.hide_namespace :js
|
21
22
|
g.hide_namespace :erb
|
@@ -23,5 +24,19 @@ module <%= app_const_base %>
|
|
23
24
|
end
|
24
25
|
|
25
26
|
config.filter_parameters += [:password]
|
27
|
+
|
28
|
+
config.middleware.insert 0, Rack::Cors do
|
29
|
+
allow do
|
30
|
+
if ENV['CORS_DOMAIN'].present?
|
31
|
+
origins(*(ENV['CORS_DOMAIN'].split(',')))
|
32
|
+
else
|
33
|
+
origins 'dashboard.aptible.com'
|
34
|
+
end
|
35
|
+
resource '/*',
|
36
|
+
headers: %w(Accept Authorization Origin Content-Type),
|
37
|
+
methods: [:options, :patch, :post, :get, :put, :delete],
|
38
|
+
credentials: true
|
39
|
+
end
|
40
|
+
end
|
26
41
|
end
|
27
42
|
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
development:
|
2
2
|
adapter: postgresql
|
3
3
|
encoding: unicode
|
4
|
+
template: template0
|
4
5
|
database: <%= app_name.gsub('-', '_') %>_development
|
5
6
|
pool: 5
|
6
7
|
|
7
8
|
test:
|
8
9
|
adapter: postgresql
|
9
10
|
encoding: unicode
|
11
|
+
template: template0
|
10
12
|
database: <%= app_name.gsub('-', '_') %>_test
|
11
13
|
pool: 5
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<%= app_const %>.configure do
|
2
2
|
config.secret_key_base =
|
3
|
-
'<%= SecureRandom.hex(32) %>'
|
3
|
+
'<%= SecureRandom.hex(32) %>' \
|
4
4
|
'<%= SecureRandom.hex(32) %>'
|
5
5
|
|
6
6
|
config.cache_classes = false
|
7
7
|
|
8
8
|
config.eager_load = false
|
9
9
|
|
10
|
-
config.consider_all_requests_local
|
10
|
+
config.consider_all_requests_local = false
|
11
11
|
config.action_controller.perform_caching = false
|
12
12
|
|
13
13
|
config.active_support.deprecation = :log
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<%= app_const %>.configure do
|
2
2
|
config.secret_key_base =
|
3
|
-
'<%= SecureRandom.hex(32) %>'
|
3
|
+
'<%= SecureRandom.hex(32) %>' \
|
4
4
|
'<%= SecureRandom.hex(32) %>'
|
5
5
|
|
6
6
|
config.cache_classes = true
|
7
7
|
|
8
8
|
config.eager_load = false
|
9
9
|
|
10
|
-
config.consider_all_requests_local
|
10
|
+
config.consider_all_requests_local = false
|
11
11
|
config.action_controller.perform_caching = false
|
12
12
|
|
13
13
|
config.action_dispatch.show_exceptions = true
|
@@ -0,0 +1,22 @@
|
|
1
|
+
if Rails.env.development?
|
2
|
+
task :set_annotation_options do
|
3
|
+
ENV['position_in_class'] = 'before'
|
4
|
+
ENV['position_in_test'] = 'before'
|
5
|
+
ENV['position_in_factory'] = 'before'
|
6
|
+
ENV['show_indexes'] = 'false'
|
7
|
+
ENV['include_version'] = 'false'
|
8
|
+
ENV['exclude_tests'] = 'true'
|
9
|
+
ENV['exclude_factories'] = 'false'
|
10
|
+
ENV['ignore_model_sub_dir'] = 'false'
|
11
|
+
ENV['skip_on_db_migrate'] = 'false'
|
12
|
+
ENV['model_dir'] = 'app/models'
|
13
|
+
end
|
14
|
+
|
15
|
+
Rake::Task['db:migrate'].enhance do
|
16
|
+
Rake::Task[:annotate_models].invoke
|
17
|
+
end
|
18
|
+
|
19
|
+
Rake::Task['db:rollback'].enhance do
|
20
|
+
Rake::Task[:annotate_models].invoke
|
21
|
+
end
|
22
|
+
end
|
@@ -3,16 +3,16 @@ require File.expand_path('../../config/environment', __FILE__)
|
|
3
3
|
require 'rspec/rails'
|
4
4
|
require 'rspec/autorun'
|
5
5
|
|
6
|
+
require 'rspec/its'
|
7
|
+
|
6
8
|
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
9
|
+
Dir[Rails.root.join('spec/shared/**/*.rb')].each { |f| require f }
|
7
10
|
|
8
|
-
ActiveRecord::Migration.
|
11
|
+
ActiveRecord::Migration.maintain_test_schema!
|
9
12
|
|
10
13
|
RSpec.configure do |config|
|
11
|
-
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
12
|
-
|
13
14
|
config.use_transactional_fixtures = true
|
14
|
-
|
15
15
|
config.infer_base_class_for_anonymous_controllers = false
|
16
|
-
|
16
|
+
config.infer_spec_type_from_file_location!
|
17
17
|
config.order = 'random'
|
18
18
|
end
|
data/lib/straptible/version.rb
CHANGED
@@ -96,6 +96,17 @@ describe 'straptible api' do
|
|
96
96
|
expect(File.exist?(application)).to eq true
|
97
97
|
expect(File.read(application)).to match(/filter_parameters/)
|
98
98
|
end
|
99
|
+
|
100
|
+
it 'includes auto_annotate_models.rake' do
|
101
|
+
tasks = File.join(@tmpdir, 'foobar', 'lib', 'tasks')
|
102
|
+
auto_annotate = File.join(tasks, 'auto_annotate_models.rake')
|
103
|
+
expect(File.exist?(auto_annotate)).to eq true
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'loads Annotate tasks' do
|
107
|
+
rakefile = File.join(@tmpdir, 'foobar', 'Rakefile')
|
108
|
+
expect(File.read(rakefile)).to match(/Annotate.load_tasks/)
|
109
|
+
end
|
99
110
|
end
|
100
111
|
|
101
112
|
context 'executing bundle install' do
|
@@ -109,7 +120,9 @@ describe 'straptible api' do
|
|
109
120
|
end
|
110
121
|
|
111
122
|
it 'passes Rubocop muster' do
|
112
|
-
|
123
|
+
Bundler.with_clean_env do
|
124
|
+
`cd #{File.join(@tmpdir, 'foobar')} && bundle exec rake rubocop`
|
125
|
+
end
|
113
126
|
expect($CHILD_STATUS.exitstatus).to eq 0
|
114
127
|
end
|
115
128
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: straptible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frank Macreery
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -141,6 +141,7 @@ files:
|
|
141
141
|
- lib/straptible/rails/templates/config.api/initializers/wrap_parameters.rb
|
142
142
|
- lib/straptible/rails/templates/config.api/routes.rb.tt
|
143
143
|
- lib/straptible/rails/templates/gitignore
|
144
|
+
- lib/straptible/rails/templates/lib.api/tasks/auto_annotate_models.rake
|
144
145
|
- lib/straptible/rails/templates/package.json
|
145
146
|
- lib/straptible/rails/templates/public.api/favicon.ico
|
146
147
|
- lib/straptible/rails/templates/public.api/icon-60px.png
|
@@ -172,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
173
|
version: '0'
|
173
174
|
requirements: []
|
174
175
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.
|
176
|
+
rubygems_version: 2.4.5
|
176
177
|
signing_key:
|
177
178
|
specification_version: 4
|
178
179
|
summary: A tool for bootstrapping new Aptible projects
|