power_api 0.2.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +104 -0
- data/.circleci/setup-rubygems.sh +3 -0
- data/.rubocop.yml +0 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +19 -1
- data/Gemfile +2 -0
- data/Gemfile.lock +189 -166
- data/README.md +365 -103
- data/app/controllers/power_api/base_controller.rb +0 -1
- data/app/helpers/power_api/application_helper.rb +57 -0
- data/bin/clean_test_app +2 -0
- data/lib/generators/power_api/controller/controller_generator.rb +27 -15
- data/lib/generators/power_api/exposed_api_config/USAGE +5 -0
- data/lib/generators/power_api/exposed_api_config/exposed_api_config_generator.rb +58 -0
- data/lib/generators/power_api/install/install_generator.rb +2 -44
- data/lib/generators/power_api/internal_api_config/USAGE +5 -0
- data/lib/generators/power_api/internal_api_config/internal_api_config_generator.rb +31 -0
- data/lib/generators/power_api/version/version_generator.rb +2 -2
- data/lib/power_api/engine.rb +6 -1
- data/lib/power_api/errors.rb +2 -0
- data/lib/power_api/generator_helper/active_record_resource.rb +10 -6
- data/lib/power_api/generator_helper/ams_helper.rb +5 -11
- data/lib/power_api/generator_helper/api_helper.rb +61 -0
- data/lib/power_api/generator_helper/controller_helper.rb +45 -15
- data/lib/power_api/generator_helper/routes_helper.rb +22 -7
- data/lib/power_api/generator_helper/rspec_controller_helper.rb +306 -0
- data/lib/power_api/generator_helper/swagger_helper.rb +14 -24
- data/lib/power_api/generator_helpers.rb +2 -1
- data/lib/power_api/version.rb +1 -1
- data/power_api.gemspec +3 -2
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/config/manifest.js +0 -2
- data/spec/dummy/app/controllers/api/base_controller.rb +2 -0
- data/spec/dummy/app/controllers/api/internal/base_controller.rb +5 -0
- data/spec/dummy/app/controllers/api/internal/blogs_controller.rb +36 -0
- data/spec/dummy/app/controllers/application_controller.rb +0 -1
- data/spec/dummy/app/{assets/javascripts → javascript/packs}/application.js +2 -0
- data/spec/dummy/app/jobs/application_job.rb +5 -0
- data/spec/dummy/app/serializers/api/internal/blog_serializer.rb +12 -0
- data/spec/dummy/app/views/layouts/application.html.erb +3 -2
- data/spec/dummy/bin/rails +2 -2
- data/spec/dummy/bin/rake +2 -2
- data/spec/dummy/bin/setup +7 -12
- data/spec/dummy/config/application.rb +12 -16
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/cable.yml +2 -2
- data/spec/dummy/config/database.yml +8 -16
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/development.rb +28 -6
- data/spec/dummy/config/environments/production.rb +45 -16
- data/spec/dummy/config/environments/test.rb +24 -7
- data/spec/dummy/config/initializers/active_model_serializers.rb +1 -0
- data/spec/dummy/config/initializers/api_pagination.rb +32 -0
- data/spec/dummy/config/initializers/assets.rb +0 -2
- data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -3
- data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +3 -1
- data/spec/dummy/config/initializers/permissions_policy.rb +11 -0
- data/spec/dummy/config/locales/en.yml +1 -1
- data/spec/dummy/config/puma.rb +14 -27
- data/spec/dummy/config/routes.rb +2 -7
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +2 -1
- data/spec/dummy/spec/helpers/power_api/application_helper_spec.rb +171 -0
- data/spec/dummy/spec/lib/power_api/generator_helper/ams_helper_spec.rb +50 -12
- data/spec/dummy/spec/lib/power_api/generator_helper/api_helper_spec.rb +115 -0
- data/spec/dummy/spec/lib/power_api/generator_helper/controller_helper_spec.rb +126 -34
- data/spec/dummy/spec/lib/power_api/generator_helper/routes_helper_spec.rb +29 -5
- data/spec/dummy/spec/lib/power_api/generator_helper/rspec_controller_helper_spec.rb +559 -0
- data/spec/dummy/spec/lib/power_api/generator_helper/swagger_helper_spec.rb +10 -20
- data/spec/dummy/spec/support/shared_examples/active_record_resource_atrributes.rb +22 -3
- metadata +114 -87
- data/.hound.yml +0 -4
- data/.travis.yml +0 -16
- data/app/controllers/concerns/api/versioned.rb +0 -36
- data/lib/power_api/generator_helper/version_helper.rb +0 -16
- data/spec/dummy/app/assets/javascripts/cable.js +0 -13
- data/spec/dummy/app/controllers/concerns/api/versioned_spec.rb +0 -64
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/update +0 -29
- data/spec/dummy/bin/yarn +0 -11
- data/spec/dummy/config/secrets.yml +0 -32
- data/spec/dummy/config/spring.rb +0 -6
- data/spec/dummy/spec/lib/power_api/generator_helper/version_helper_spec.rb +0 -55
@@ -1,32 +0,0 @@
|
|
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 `rails secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
# Shared secrets are available across all environments.
|
14
|
-
|
15
|
-
# shared:
|
16
|
-
# api_key: a1B2c3D4e5F6
|
17
|
-
|
18
|
-
# Environmental secrets are only available for that specific environment.
|
19
|
-
|
20
|
-
development:
|
21
|
-
secret_key_base: a5a2020513b8f39701d582ebbaa944f8f08e785d753734480a55bcead376273d016b61f2669d3897ef16eeac08c714aaca718ea9750ece793be7dba48f0d8dd1
|
22
|
-
|
23
|
-
test:
|
24
|
-
secret_key_base: 6417e0708df89fc50a8099e9655f044b679843ceda904b88c23a7c4762143ee8dfa411d5310ab048023f542b0139b976b67e76ad839bab1e418f5c06b368429c
|
25
|
-
|
26
|
-
# Do not keep production secrets in the unencrypted secrets file.
|
27
|
-
# Instead, either read values from the environment.
|
28
|
-
# Or, use `bin/rails secrets:setup` to configure encrypted secrets
|
29
|
-
# and move the `production:` environment over there.
|
30
|
-
|
31
|
-
production:
|
32
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
data/spec/dummy/config/spring.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
RSpec.describe PowerApi::GeneratorHelper::VersionHelper, type: :generator do
|
2
|
-
describe "#version_number" do
|
3
|
-
def perform
|
4
|
-
generators_helper.version_number
|
5
|
-
end
|
6
|
-
|
7
|
-
it { expect(perform).to eq(1) }
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "version_number=" do
|
11
|
-
context "with invalid version number" do
|
12
|
-
let(:version_number) { "A" }
|
13
|
-
|
14
|
-
it { expect { generators_helper }.to raise_error("invalid version number") }
|
15
|
-
end
|
16
|
-
|
17
|
-
context "with zero version number" do
|
18
|
-
let(:version_number) { 0 }
|
19
|
-
|
20
|
-
it { expect { generators_helper }.to raise_error("invalid version number") }
|
21
|
-
end
|
22
|
-
|
23
|
-
context "with nil version number" do
|
24
|
-
let(:version_number) { nil }
|
25
|
-
|
26
|
-
it { expect { generators_helper }.to raise_error("invalid version number") }
|
27
|
-
end
|
28
|
-
|
29
|
-
context "with nil blank number" do
|
30
|
-
let(:version_number) { "" }
|
31
|
-
|
32
|
-
it { expect { generators_helper }.to raise_error("invalid version number") }
|
33
|
-
end
|
34
|
-
|
35
|
-
context "with negative version number" do
|
36
|
-
let(:version_number) { -1 }
|
37
|
-
|
38
|
-
it { expect { generators_helper }.to raise_error("invalid version number") }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe "#first_version?" do
|
43
|
-
def perform
|
44
|
-
generators_helper.first_version?
|
45
|
-
end
|
46
|
-
|
47
|
-
it { expect(perform).to eq(true) }
|
48
|
-
|
49
|
-
context "when version in not first version" do
|
50
|
-
let(:version_number) { "2" }
|
51
|
-
|
52
|
-
it { expect(perform).to eq(false) }
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|