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.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +104 -0
  3. data/.circleci/setup-rubygems.sh +3 -0
  4. data/.rubocop.yml +0 -1
  5. data/.ruby-version +1 -1
  6. data/CHANGELOG.md +19 -1
  7. data/Gemfile +2 -0
  8. data/Gemfile.lock +189 -166
  9. data/README.md +365 -103
  10. data/app/controllers/power_api/base_controller.rb +0 -1
  11. data/app/helpers/power_api/application_helper.rb +57 -0
  12. data/bin/clean_test_app +2 -0
  13. data/lib/generators/power_api/controller/controller_generator.rb +27 -15
  14. data/lib/generators/power_api/exposed_api_config/USAGE +5 -0
  15. data/lib/generators/power_api/exposed_api_config/exposed_api_config_generator.rb +58 -0
  16. data/lib/generators/power_api/install/install_generator.rb +2 -44
  17. data/lib/generators/power_api/internal_api_config/USAGE +5 -0
  18. data/lib/generators/power_api/internal_api_config/internal_api_config_generator.rb +31 -0
  19. data/lib/generators/power_api/version/version_generator.rb +2 -2
  20. data/lib/power_api/engine.rb +6 -1
  21. data/lib/power_api/errors.rb +2 -0
  22. data/lib/power_api/generator_helper/active_record_resource.rb +10 -6
  23. data/lib/power_api/generator_helper/ams_helper.rb +5 -11
  24. data/lib/power_api/generator_helper/api_helper.rb +61 -0
  25. data/lib/power_api/generator_helper/controller_helper.rb +45 -15
  26. data/lib/power_api/generator_helper/routes_helper.rb +22 -7
  27. data/lib/power_api/generator_helper/rspec_controller_helper.rb +306 -0
  28. data/lib/power_api/generator_helper/swagger_helper.rb +14 -24
  29. data/lib/power_api/generator_helpers.rb +2 -1
  30. data/lib/power_api/version.rb +1 -1
  31. data/power_api.gemspec +3 -2
  32. data/spec/dummy/Rakefile +1 -1
  33. data/spec/dummy/app/assets/config/manifest.js +0 -2
  34. data/spec/dummy/app/controllers/api/base_controller.rb +2 -0
  35. data/spec/dummy/app/controllers/api/internal/base_controller.rb +5 -0
  36. data/spec/dummy/app/controllers/api/internal/blogs_controller.rb +36 -0
  37. data/spec/dummy/app/controllers/application_controller.rb +0 -1
  38. data/spec/dummy/app/{assets/javascripts → javascript/packs}/application.js +2 -0
  39. data/spec/dummy/app/jobs/application_job.rb +5 -0
  40. data/spec/dummy/app/serializers/api/internal/blog_serializer.rb +12 -0
  41. data/spec/dummy/app/views/layouts/application.html.erb +3 -2
  42. data/spec/dummy/bin/rails +2 -2
  43. data/spec/dummy/bin/rake +2 -2
  44. data/spec/dummy/bin/setup +7 -12
  45. data/spec/dummy/config/application.rb +12 -16
  46. data/spec/dummy/config/boot.rb +1 -1
  47. data/spec/dummy/config/cable.yml +2 -2
  48. data/spec/dummy/config/database.yml +8 -16
  49. data/spec/dummy/config/environment.rb +1 -1
  50. data/spec/dummy/config/environments/development.rb +28 -6
  51. data/spec/dummy/config/environments/production.rb +45 -16
  52. data/spec/dummy/config/environments/test.rb +24 -7
  53. data/spec/dummy/config/initializers/active_model_serializers.rb +1 -0
  54. data/spec/dummy/config/initializers/api_pagination.rb +32 -0
  55. data/spec/dummy/config/initializers/assets.rb +0 -2
  56. data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -3
  57. data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
  58. data/spec/dummy/config/initializers/filter_parameter_logging.rb +3 -1
  59. data/spec/dummy/config/initializers/permissions_policy.rb +11 -0
  60. data/spec/dummy/config/locales/en.yml +1 -1
  61. data/spec/dummy/config/puma.rb +14 -27
  62. data/spec/dummy/config/routes.rb +2 -7
  63. data/spec/dummy/config/storage.yml +34 -0
  64. data/spec/dummy/config.ru +2 -1
  65. data/spec/dummy/spec/helpers/power_api/application_helper_spec.rb +171 -0
  66. data/spec/dummy/spec/lib/power_api/generator_helper/ams_helper_spec.rb +50 -12
  67. data/spec/dummy/spec/lib/power_api/generator_helper/api_helper_spec.rb +115 -0
  68. data/spec/dummy/spec/lib/power_api/generator_helper/controller_helper_spec.rb +126 -34
  69. data/spec/dummy/spec/lib/power_api/generator_helper/routes_helper_spec.rb +29 -5
  70. data/spec/dummy/spec/lib/power_api/generator_helper/rspec_controller_helper_spec.rb +559 -0
  71. data/spec/dummy/spec/lib/power_api/generator_helper/swagger_helper_spec.rb +10 -20
  72. data/spec/dummy/spec/support/shared_examples/active_record_resource_atrributes.rb +22 -3
  73. metadata +114 -87
  74. data/.hound.yml +0 -4
  75. data/.travis.yml +0 -16
  76. data/app/controllers/concerns/api/versioned.rb +0 -36
  77. data/lib/power_api/generator_helper/version_helper.rb +0 -16
  78. data/spec/dummy/app/assets/javascripts/cable.js +0 -13
  79. data/spec/dummy/app/controllers/concerns/api/versioned_spec.rb +0 -64
  80. data/spec/dummy/bin/bundle +0 -3
  81. data/spec/dummy/bin/update +0 -29
  82. data/spec/dummy/bin/yarn +0 -11
  83. data/spec/dummy/config/secrets.yml +0 -32
  84. data/spec/dummy/config/spring.rb +0 -6
  85. 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"] %>
@@ -1,6 +0,0 @@
1
- %w(
2
- .ruby-version
3
- .rbenv-vars
4
- tmp/restart.txt
5
- tmp/caching-dev.txt
6
- ).each { |path| Spring.watch(path) }
@@ -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