straptible 0.1.1 → 0.1.2
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 +4 -4
- data/.rspec +2 -0
- data/.travis.yml +1 -0
- data/lib/straptible/rails/builders/api.rb +10 -0
- data/lib/straptible/rails/templates/Gemfile.api +2 -1
- data/lib/straptible/rails/templates/README.md.tt +11 -0
- data/lib/straptible/rails/templates/Rakefile.tt +4 -2
- data/lib/straptible/rails/templates/config.api/application.rb.tt +15 -0
- data/lib/straptible/rails/templates/config.api/environments/development.rb.tt +5 -1
- data/lib/straptible/rails/templates/config.api/environments/production.rb.tt +6 -2
- data/lib/straptible/rails/templates/config.api/environments/test.rb.tt +6 -5
- data/lib/straptible/rails/templates/config.api/initializers/mime_types.rb +1 -0
- data/lib/straptible/rails/templates/config.api/initializers/rabl.rb +1 -1
- data/lib/straptible/rails/templates/gitignore +2 -0
- data/lib/straptible/rails/templates/package.json +13 -0
- data/lib/straptible/rails/templates/travis.yml.api +3 -0
- data/lib/straptible/version.rb +1 -1
- data/spec/integration/api_spec.rb +28 -0
- data/straptible.gemspec +1 -1
- metadata +9 -9
- data/lib/straptible/rails/templates/config.api/initializers/filter_parameter_logging.rb +0 -1
- data/lib/straptible/rails/templates/config.api/initializers/secret_token.rb.tt +0 -3
- data/lib/straptible/rails/templates/config.api/initializers/session_store.rb.tt +0 -1
- data/lib/straptible/rails/templates/initializers/filter_parameter_logging.rb +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e46a7cbb0934f2c311be1bbfbc512daa0d7333ee
|
|
4
|
+
data.tar.gz: acb54cea21f51c3fb34da6df27d426e444c3a2d0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3853628e60f6c19dccb6ba19a30cd4c2b8d389e9000613036bcf19435bf5f4b795a0155f24cb3c72cd56a5c718078941051cae198e871543989d33e350f96c5f
|
|
7
|
+
data.tar.gz: 9c47b9222ff0d36bc9391c10a6ef29b7d816e68ae44f99a14cd6510d6d8960cca671cb734f6b6dcce3caa76936a5ea969edb9bb8df960e72a94622f19013acd0
|
data/.rspec
ADDED
data/.travis.yml
CHANGED
|
@@ -21,10 +21,20 @@ module Straptible
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def leftovers
|
|
24
|
+
travis_yml
|
|
25
|
+
package_json
|
|
24
26
|
restructure_app
|
|
25
27
|
super
|
|
26
28
|
end
|
|
27
29
|
|
|
30
|
+
def travis_yml
|
|
31
|
+
copy_file 'travis.yml.api', '.travis.yml'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def package_json
|
|
35
|
+
copy_file 'package.json'
|
|
36
|
+
end
|
|
37
|
+
|
|
28
38
|
def restructure_app
|
|
29
39
|
remove_dir 'app/assets'
|
|
30
40
|
remove_dir 'app/controllers/concerns'
|
|
@@ -4,11 +4,12 @@ gem 'rails'
|
|
|
4
4
|
gem 'pg'
|
|
5
5
|
gem 'draper'
|
|
6
6
|
gem 'rabl'
|
|
7
|
+
gem 'oj'
|
|
7
8
|
|
|
8
9
|
group :development, :test do
|
|
9
10
|
gem 'annotate'
|
|
10
11
|
gem 'aptible-tasks'
|
|
11
|
-
gem '
|
|
12
|
+
gem 'rabl-generators'
|
|
12
13
|
gem 'rspec'
|
|
13
14
|
gem 'rspec-rails'
|
|
14
15
|
gem 'pry'
|
|
@@ -16,6 +16,17 @@ The following command will run Ruby style guide checking, unit tests, and integr
|
|
|
16
16
|
|
|
17
17
|
bundle exec rake ci
|
|
18
18
|
|
|
19
|
+
## API Blueprint
|
|
20
|
+
|
|
21
|
+
We use [API Blueprint](http://apiblueprint.org/) for API documentation. To compose your blueprint, edit `blueprint.md` according to to the API Blueprint [format](https://github.com/apiaryio/api-blueprint/blob/master/API%20Blueprint%20Specification.md). [This tutorial](http://apiary.io/blueprint) might be a good starting point.
|
|
22
|
+
|
|
23
|
+
To validate the API implementation against its blueprint, first fire up a Rails server, then invoke Dredd:
|
|
24
|
+
|
|
25
|
+
bundle exec rails server -p 3000 -d
|
|
26
|
+
dredd blueprint.md http://localhost:3000
|
|
27
|
+
|
|
28
|
+
To preview the documentation, use Aglio: `aglio -i blueprint.md -p 4000 -s`. Then visit [localhost:4000](http://localhost:4000/).
|
|
29
|
+
|
|
19
30
|
## Copyright
|
|
20
31
|
|
|
21
32
|
Copyright (c) <%= Time.now.strftime("%Y") %> [Aptible](https://www.aptible.com). All rights reserved.
|
|
@@ -8,5 +8,20 @@ Bundler.require(:default, Rails.env)
|
|
|
8
8
|
module <%= app_const_base %>
|
|
9
9
|
class Application < Rails::Application
|
|
10
10
|
config.assets.enabled = false
|
|
11
|
+
config.app_generators.template_engine false
|
|
12
|
+
|
|
13
|
+
config.generators do |g|
|
|
14
|
+
g.stylesheets = false
|
|
15
|
+
g.javascripts = false
|
|
16
|
+
g.helper = false
|
|
17
|
+
g.view_specs = false
|
|
18
|
+
|
|
19
|
+
g.hide_namespace :test_unit
|
|
20
|
+
g.hide_namespace :js
|
|
21
|
+
g.hide_namespace :erb
|
|
22
|
+
g.hide_namespace :mongoid
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
config.filter_parameters += [:password]
|
|
11
26
|
end
|
|
12
27
|
end
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
<%= app_const %>.configure do
|
|
2
|
+
config.secret_key_base =
|
|
3
|
+
'<%= SecureRandom.hex(32) %>' +
|
|
4
|
+
'<%= SecureRandom.hex(32) %>'
|
|
5
|
+
|
|
2
6
|
config.cache_classes = false
|
|
3
7
|
|
|
4
8
|
config.eager_load = false
|
|
5
9
|
|
|
6
|
-
config.consider_all_requests_local =
|
|
10
|
+
config.consider_all_requests_local = false
|
|
7
11
|
config.action_controller.perform_caching = false
|
|
8
12
|
|
|
9
13
|
config.active_support.deprecation = :log
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
<%= app_const %>.configure do
|
|
2
|
+
unless config.secret_key_base = ENV['RAILS_SECRET_KEY']
|
|
3
|
+
fail 'RAILS_SECRET_KEY must be set in production mode'
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
config.force_ssl = true
|
|
7
|
+
|
|
2
8
|
config.cache_classes = true
|
|
3
9
|
|
|
4
10
|
config.eager_load = true
|
|
@@ -6,8 +12,6 @@
|
|
|
6
12
|
config.consider_all_requests_local = false
|
|
7
13
|
config.action_controller.perform_caching = true
|
|
8
14
|
|
|
9
|
-
config.serve_static_assets = false
|
|
10
|
-
|
|
11
15
|
config.log_level = :info
|
|
12
16
|
|
|
13
17
|
config.i18n.fallbacks = true
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<%= app_const %>.configure do
|
|
2
|
+
config.secret_key_base =
|
|
3
|
+
'<%= SecureRandom.hex(32) %>' +
|
|
4
|
+
'<%= SecureRandom.hex(32) %>'
|
|
5
|
+
|
|
2
6
|
config.cache_classes = true
|
|
3
7
|
|
|
4
8
|
config.eager_load = false
|
|
5
9
|
|
|
6
|
-
config.
|
|
7
|
-
config.static_cache_control = 'public, max-age=3600'
|
|
8
|
-
|
|
9
|
-
config.consider_all_requests_local = true
|
|
10
|
+
config.consider_all_requests_local = false
|
|
10
11
|
config.action_controller.perform_caching = false
|
|
11
12
|
|
|
12
|
-
config.action_dispatch.show_exceptions =
|
|
13
|
+
config.action_dispatch.show_exceptions = true
|
|
13
14
|
|
|
14
15
|
config.action_controller.allow_forgery_protection = false
|
|
15
16
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Mime::Type.register 'application/vnd.api+json', :json_api
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name" : "auth.aptible.com",
|
|
3
|
+
"version" : "0.1.0",
|
|
4
|
+
"repository" : {
|
|
5
|
+
"type" : "git",
|
|
6
|
+
"url" : "https://github.com/aptible/auth.aptible.com.git"
|
|
7
|
+
},
|
|
8
|
+
"dependencies" : {
|
|
9
|
+
"aglio" : "git://github.com/fancyremarker/aglio.git#published",
|
|
10
|
+
"supervisor": "*",
|
|
11
|
+
"dredd" : "*"
|
|
12
|
+
}
|
|
13
|
+
}
|
data/lib/straptible/version.rb
CHANGED
|
@@ -67,6 +67,34 @@ describe 'straptible api' do
|
|
|
67
67
|
git_log = `cd #{File.join(@tmpdir, 'foobar')} && git log --oneline`
|
|
68
68
|
git_log.should =~ /Initial commit.*#{Straptible::VERSION}/
|
|
69
69
|
end
|
|
70
|
+
|
|
71
|
+
it 'has a .travis.yml file which includes JRuby in the build matrix' do
|
|
72
|
+
travis_yml = File.join(@tmpdir, 'foobar', '.travis.yml')
|
|
73
|
+
File.exist?(travis_yml).should be_true
|
|
74
|
+
File.read(travis_yml).should match /jruby/
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'has a package.json for Node dependencies' do
|
|
78
|
+
package_json = File.join(@tmpdir, 'foobar', 'package.json')
|
|
79
|
+
File.exist?(package_json).should be_true
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'has an initializer for the JSON-API MIME type' do
|
|
83
|
+
initializers = File.join(@tmpdir, 'foobar', 'config', 'initializers')
|
|
84
|
+
mime_types = File.join(initializers, 'mime_types.rb')
|
|
85
|
+
File.exist?(mime_types).should be_true
|
|
86
|
+
File.read(mime_types).should match /:json_api/
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it 'sets config in application.rb instead of config/initializers' do
|
|
90
|
+
initializers = File.join(@tmpdir, 'foobar', 'config', 'initializers')
|
|
91
|
+
filter_parameters = File.join(initializers, 'filter_parameters.rb')
|
|
92
|
+
File.exist?(filter_parameters).should be_false
|
|
93
|
+
|
|
94
|
+
application = File.join(@tmpdir, 'foobar', 'config', 'application.rb')
|
|
95
|
+
File.exist?(application).should be_true
|
|
96
|
+
File.read(application).should match /filter_parameters/
|
|
97
|
+
end
|
|
70
98
|
end
|
|
71
99
|
|
|
72
100
|
context 'executing bundle install' do
|
data/straptible.gemspec
CHANGED
|
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
|
23
23
|
spec.add_dependency 'rails'
|
|
24
24
|
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
|
26
|
-
spec.add_development_dependency 'aptible-tasks', '~> 0.1.
|
|
26
|
+
spec.add_development_dependency 'aptible-tasks', '~> 0.1.2'
|
|
27
27
|
spec.add_development_dependency 'rake'
|
|
28
28
|
spec.add_development_dependency 'rspec'
|
|
29
29
|
spec.add_development_dependency 'pry'
|
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.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Frank Macreery
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-11
|
|
11
|
+
date: 2013-12-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - ~>
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.1.
|
|
47
|
+
version: 0.1.2
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - ~>
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.1.
|
|
54
|
+
version: 0.1.2
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: rake
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -103,6 +103,7 @@ extensions: []
|
|
|
103
103
|
extra_rdoc_files: []
|
|
104
104
|
files:
|
|
105
105
|
- .gitignore
|
|
106
|
+
- .rspec
|
|
106
107
|
- .travis.yml
|
|
107
108
|
- Gemfile
|
|
108
109
|
- LICENSE.md
|
|
@@ -123,19 +124,18 @@ files:
|
|
|
123
124
|
- lib/straptible/rails/templates/config.api/environments/development.rb.tt
|
|
124
125
|
- lib/straptible/rails/templates/config.api/environments/production.rb.tt
|
|
125
126
|
- lib/straptible/rails/templates/config.api/environments/test.rb.tt
|
|
126
|
-
- lib/straptible/rails/templates/config.api/initializers/
|
|
127
|
+
- lib/straptible/rails/templates/config.api/initializers/mime_types.rb
|
|
127
128
|
- lib/straptible/rails/templates/config.api/initializers/rabl.rb
|
|
128
|
-
- lib/straptible/rails/templates/config.api/initializers/secret_token.rb.tt
|
|
129
|
-
- lib/straptible/rails/templates/config.api/initializers/session_store.rb.tt
|
|
130
129
|
- lib/straptible/rails/templates/config.api/initializers/wrap_parameters.rb
|
|
131
130
|
- lib/straptible/rails/templates/config.api/routes.rb.tt
|
|
132
131
|
- lib/straptible/rails/templates/gitignore
|
|
133
|
-
- lib/straptible/rails/templates/
|
|
132
|
+
- lib/straptible/rails/templates/package.json
|
|
134
133
|
- lib/straptible/rails/templates/public.api/favicon.ico
|
|
135
134
|
- lib/straptible/rails/templates/public.api/icon-72-cropped.png
|
|
136
135
|
- lib/straptible/rails/templates/public.api/icon-72.png
|
|
137
136
|
- lib/straptible/rails/templates/public.api/robots.txt
|
|
138
137
|
- lib/straptible/rails/templates/spec/spec_helper.rb
|
|
138
|
+
- lib/straptible/rails/templates/travis.yml.api
|
|
139
139
|
- lib/straptible/version.rb
|
|
140
140
|
- spec/integration/api_spec.rb
|
|
141
141
|
- spec/spec_helper.rb
|
|
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
160
160
|
version: '0'
|
|
161
161
|
requirements: []
|
|
162
162
|
rubyforge_project:
|
|
163
|
-
rubygems_version: 2.0.
|
|
163
|
+
rubygems_version: 2.0.14
|
|
164
164
|
signing_key:
|
|
165
165
|
specification_version: 4
|
|
166
166
|
summary: A tool for bootstrapping new Aptible projects
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Rails.application.config.filter_parameters += [:password]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= app_const %>.config.session_store :cookie_store
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Rails.application.config.filter_parameters += [:password]
|