jets 1.4.10 → 1.4.11

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -3
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile +1 -0
  5. data/Gemfile.lock +6 -2
  6. data/lib/jets/application.rb +4 -0
  7. data/lib/jets/commands/templates/skeleton/Gemfile.tt +1 -0
  8. data/lib/jets/db.rb +11 -5
  9. data/lib/jets/resource/lambda/function.rb +7 -1
  10. data/lib/jets/version.rb +1 -1
  11. data/lib/jets.rb +0 -7
  12. data/vendor/jets-gems/lib/jets/gems/check.rb +2 -2
  13. metadata +2 -41
  14. data/vendor/dynomite/CHANGELOG.md +0 -45
  15. data/vendor/dynomite/Gemfile +0 -6
  16. data/vendor/dynomite/Gemfile.lock +0 -61
  17. data/vendor/dynomite/README.md +0 -141
  18. data/vendor/dynomite/Rakefile +0 -2
  19. data/vendor/dynomite/bin/console +0 -14
  20. data/vendor/dynomite/bin/setup +0 -8
  21. data/vendor/dynomite/docs/migrations/long-example.rb +0 -123
  22. data/vendor/dynomite/docs/migrations/short-example.rb +0 -40
  23. data/vendor/dynomite/dynomite.gemspec +0 -29
  24. data/vendor/dynomite/lib/dynomite/core.rb +0 -25
  25. data/vendor/dynomite/lib/dynomite/db_config.rb +0 -107
  26. data/vendor/dynomite/lib/dynomite/erb.rb +0 -53
  27. data/vendor/dynomite/lib/dynomite/item.rb +0 -292
  28. data/vendor/dynomite/lib/dynomite/log.rb +0 -15
  29. data/vendor/dynomite/lib/dynomite/migration/common.rb +0 -86
  30. data/vendor/dynomite/lib/dynomite/migration/dsl/base_secondary_index.rb +0 -73
  31. data/vendor/dynomite/lib/dynomite/migration/dsl/global_secondary_index.rb +0 -4
  32. data/vendor/dynomite/lib/dynomite/migration/dsl/local_secondary_index.rb +0 -8
  33. data/vendor/dynomite/lib/dynomite/migration/dsl.rb +0 -194
  34. data/vendor/dynomite/lib/dynomite/migration/executor.rb +0 -38
  35. data/vendor/dynomite/lib/dynomite/migration/generator.rb +0 -68
  36. data/vendor/dynomite/lib/dynomite/migration/templates/create_table.rb +0 -32
  37. data/vendor/dynomite/lib/dynomite/migration/templates/update_table.rb +0 -26
  38. data/vendor/dynomite/lib/dynomite/migration.rb +0 -27
  39. data/vendor/dynomite/lib/dynomite/version.rb +0 -3
  40. data/vendor/dynomite/lib/dynomite.rb +0 -23
  41. data/vendor/dynomite/pkg/dynomite-1.0.8.gem +0 -0
  42. data/vendor/dynomite/pkg/dynomite-1.0.9.gem +0 -0
  43. data/vendor/dynomite/pkg/dynomite-1.1.0.gem +0 -0
  44. data/vendor/dynomite/spec/fixtures/app_root/config/dynamodb.yml +0 -7
  45. data/vendor/dynomite/spec/fixtures/dynamodb/migrate/20190108061826-comments_migration.rb +0 -30
  46. data/vendor/dynomite/spec/lib/dynomite/item_spec.rb +0 -102
  47. data/vendor/dynomite/spec/lib/dynomite/migration/dsl/global_secondary_index_spec.rb +0 -106
  48. data/vendor/dynomite/spec/lib/dynomite/migration/dsl/local_secondary_index_spec.rb +0 -71
  49. data/vendor/dynomite/spec/lib/dynomite/migration/dsl_spec.rb +0 -76
  50. data/vendor/dynomite/spec/lib/dynomite/migration/generator_spec.rb +0 -23
  51. data/vendor/dynomite/spec/lib/dynomite/migration_spec.rb +0 -60
  52. data/vendor/dynomite/spec/spec_helper.rb +0 -110
@@ -1,106 +0,0 @@
1
- require "spec_helper"
2
-
3
- GSI = Dynomite::Migration::Dsl::GlobalSecondaryIndex
4
-
5
- describe GSI do
6
- context "create index" do
7
- let(:index) do
8
- Dynomite::Migration::Dsl.db = double("db").as_null_object
9
- GSI.new(:create)
10
- end
11
-
12
- # Supports this DSL, the `i` variable passed to the block is the
13
- # Dsl::GlobalSecondaryIndex instance
14
- #
15
- # class UpdateCommentsMigration < Dynomite::Migration
16
- # def up
17
- # update_table :comments do |t|
18
- # t.partition_key "post_id:string" # required
19
- # t.sort_key "created_at:string" # optional
20
- # t.provisioned_throughput(5) # sets both read and write
21
- # end
22
- # end
23
- # end
24
- it "build up the dsl in memory" do
25
- index.partition_key "id:string" # required
26
- index.sort_key "created_at:string" # optional
27
- index.provisioned_throughput(30)
28
-
29
- expect(index.key_schema).to eq([
30
- {:attribute_name=>"id", :key_type=>"HASH"},
31
- {:attribute_name=>"created_at", :key_type=>"RANGE"}])
32
- expect(index.attribute_definitions).to eq([
33
- {:attribute_name=>"id", :attribute_type=>"S"},
34
- {:attribute_name=>"created_at", :attribute_type=>"S"}])
35
- expect(index.provisioned_throughput).to eq(
36
- :read_capacity_units=>30,
37
- :write_capacity_units=>30
38
- )
39
- end
40
-
41
- context "parititon_key provided only" do
42
- it "index_name" do
43
- index.partition_key "post_id:string" # required
44
- expect(index.params[:index_name]).to eq("post_id-index")
45
- end
46
- end
47
-
48
- context "parititon_key and sort_key provided" do
49
- it "index_name" do
50
- index.partition_key "post_id:string" # required
51
- index.sort_key "created_at:string" # optional
52
- expect(index.params[:index_name]).to eq("post_id-created_at-index")
53
-
54
- expect(index.params).to eq({
55
- :index_name=>"post_id-created_at-index",
56
- :key_schema=>[
57
- {:attribute_name=>"post_id", :key_type=>"HASH"},
58
- {:attribute_name=>"created_at", :key_type=>"RANGE"}],
59
- :projection=>{:projection_type=>"ALL"},
60
- :provisioned_throughput=> {:read_capacity_units=>5, :write_capacity_units=>5}
61
- })
62
- end
63
- end
64
-
65
- it "execute uses what the dsl methods built up in memory and translates it dynmaodb params that then get used to execute and run the command" do
66
- index.partition_key "id:string" # required
67
- index.sort_key "created_at:string" # optional
68
- index.provisioned_throughput(30)
69
- # index.execute # TODO: index.execute in here
70
- end
71
- end
72
-
73
- context "update index" do
74
- let(:index) do
75
- Dynomite::Migration::Dsl.db = double("db").as_null_object
76
- GSI.new(:update) do |i|
77
- i.index_name = "update-me-index"
78
- end
79
- end
80
-
81
- it "only sets the index_name and provisioned_throughput params keys" do
82
- index.provisioned_throughput(8)
83
- params = index.params
84
- expect(params[:provisioned_throughput]).to eq({:read_capacity_units=>8, :write_capacity_units=>8})
85
- expect(params[:index_name]).not_to be nil
86
- expect(params[:key_schema]).to be nil
87
- expect(params[:projection]).to be nil
88
- end
89
- end
90
-
91
- context "delete index" do
92
- let(:index) do
93
- Dynomite::Migration::Dsl.db = double("db").as_null_object
94
- GSI.new(:delete, "delete-me-index")
95
- end
96
-
97
- it "only sets the index_name" do
98
- index.provisioned_throughput(8)
99
- params = index.params
100
- expect(params[:index_name]).not_to be nil
101
- expect(params[:provisioned_throughput]).to be nil
102
- expect(params[:key_schema]).to be nil
103
- expect(params[:projection]).to be nil
104
- end
105
- end
106
- end
@@ -1,71 +0,0 @@
1
- require "spec_helper"
2
-
3
- LSI = Dynomite::Migration::Dsl::LocalSecondaryIndex
4
-
5
- describe LSI do
6
- context "create index" do
7
- let(:index) do
8
- Dynomite::Migration::Dsl.db = double("db").as_null_object
9
- LSI.new
10
- end
11
-
12
- # Supports this DSL, the `i` variable passed to the block is the
13
- # Dsl::GlobalSecondaryIndex instance
14
- #
15
- # class UpdateCommentsMigration < Dynomite::Migration
16
- # def up
17
- # update_table :comments do |t|
18
- # t.partition_key "post_id:string" # required
19
- # t.sort_key "created_at:string" # optional
20
- # t.provisioned_throughput(5) # sets both read and write
21
- # end
22
- # end
23
- # end
24
- it "build up the dsl in memory" do
25
- index.partition_key "id:string" # required
26
- index.sort_key "created_at:string" # optional
27
- index.provisioned_throughput(30)
28
-
29
- expect(index.key_schema).to eq([
30
- {:attribute_name=>"id", :key_type=>"HASH"},
31
- {:attribute_name=>"created_at", :key_type=>"RANGE"}])
32
- expect(index.attribute_definitions).to eq([
33
- {:attribute_name=>"id", :attribute_type=>"S"},
34
- {:attribute_name=>"created_at", :attribute_type=>"S"}])
35
- expect(index.provisioned_throughput).to eq(
36
- :read_capacity_units=>30,
37
- :write_capacity_units=>30
38
- )
39
- end
40
-
41
- context "parititon_key provided only" do
42
- it "index_name" do
43
- index.partition_key "post_id:string" # required
44
- expect(index.params[:index_name]).to eq("post_id-index")
45
- end
46
- end
47
-
48
- context "parititon_key and sort_key provided" do
49
- it "index_name" do
50
- index.partition_key "post_id:string" # required
51
- index.sort_key "created_at:string" # optional
52
- expect(index.params[:index_name]).to eq("post_id-created_at-index")
53
-
54
- expect(index.params).to eq({
55
- :index_name=>"post_id-created_at-index",
56
- :key_schema=>[
57
- {:attribute_name=>"post_id", :key_type=>"HASH"},
58
- {:attribute_name=>"created_at", :key_type=>"RANGE"}],
59
- :projection=>{:projection_type=>"ALL"}
60
- })
61
- end
62
- end
63
-
64
- it "execute uses what the dsl methods built up in memory and translates it dynmaodb params that then get used to execute and run the command" do
65
- index.partition_key "id:string" # required
66
- index.sort_key "created_at:string" # optional
67
- index.provisioned_throughput(30)
68
- # index.execute # TODO: index.execute in here
69
- end
70
- end
71
- end
@@ -1,76 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Dynomite::Migration::Dsl do
4
- # Supports this DSL, the `t` variable passed to the block is the Dsl instance
5
- #
6
- # class CreateCommentsMigration < Dynomite::Migration
7
- # def up
8
- # create_table :comments do |t|
9
- # t.partition_key "post_id:string" # required
10
- # t.sort_key "created_at:string" # optional
11
- # t.provisioned_throughput(5) # sets both read and write, defaults to 5 when not set
12
- # end
13
- # end
14
- # end
15
- context "create_table" do
16
- let(:dsl) do
17
- Dynomite::Migration::Dsl.db = double("db").as_null_object
18
- Dynomite::Migration::Dsl.new(:create_table, "posts")
19
- end
20
-
21
- it "build up the dsl in memory" do
22
- dsl.partition_key "id:string" # required
23
- dsl.sort_key "created_at:string" # optional
24
- dsl.provisioned_throughput(25)
25
-
26
- expect(dsl.key_schema).to eq([
27
- {:attribute_name=>"id", :key_type=>"HASH"},
28
- {:attribute_name=>"created_at", :key_type=>"RANGE"}])
29
- expect(dsl.attribute_definitions).to eq([
30
- {:attribute_name=>"id", :attribute_type=>"S"},
31
- {:attribute_name=>"created_at", :attribute_type=>"S"}])
32
- expect(dsl.provisioned_throughput).to eq(
33
- :read_capacity_units=>25,
34
- :write_capacity_units=>25
35
- )
36
- end
37
- end
38
-
39
- context "update_table" do
40
- let(:dsl) do
41
- Dynomite::Migration::Dsl.new(:update_table, "comments")
42
- end
43
-
44
- it "builds up the gsi index params" do
45
- dsl.provisioned_throughput(18)
46
- allow(dsl).to receive(:gsi_attribute_definitions).and_return([])
47
-
48
- dsl.gsi(:create) do |i|
49
- i.partition_key "post_id:string"
50
- i.sort_key "updated_at:string" # optional
51
- end
52
- dsl.gsi(:update, "another-index") do |i|
53
- i.provisioned_throughput(8)
54
- end
55
- dsl.gsi(:delete, "old-index")
56
-
57
- params = dsl.params
58
- # pp params # uncomment out to inspect params
59
- # attribute_definitions is a Double because we've mocked out:
60
- # Dynomite::Migration::Dsl.db = double("db").as_null_object
61
- expect(params.key?(:attribute_definitions)).to be true
62
- expect(params.key?(:global_secondary_index_updates)).to be true
63
- global_secondary_index_updates = params[:global_secondary_index_updates]
64
- index_actions = global_secondary_index_updates.map {|hash| hash.keys.first }
65
- expect(index_actions.sort).to eq([:create, :update, :delete].sort)
66
- end
67
- end
68
-
69
- # it "execute uses what the dsl methods built up in memory and translates it dynmaodb params that then get used to execute and run the command" do
70
- # dsl.partition_key "id:string" # required
71
- # dsl.sort_key "created_at:string" # optional
72
- # dsl.provisioned_throughput(25)
73
- # # dsl.execute # TODO: dsl.execute in here
74
- # end
75
- end
76
-
@@ -1,23 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Dynomite::Migration::Generator do
4
- before(:each) do
5
- FileUtils.rm_rf("#{Dynomite.app_root}dynamodb/migrate")
6
- end
7
-
8
- let(:generator) do
9
- Dynomite::Migration::Generator.new("comments",
10
- partition_key: "post_id:string",
11
- sort_key: "created_at:string",
12
- quiet: true
13
- )
14
- end
15
-
16
- it "generates migration file in dynamodb/migrate" do
17
- generator.generate
18
-
19
- migration_path = Dir.glob("#{Dynomite.app_root}dynamodb/migrate/*").first
20
- migration_exist = File.exist?(migration_path)
21
- expect(migration_exist).to be true
22
- end
23
- end
@@ -1,60 +0,0 @@
1
- require "spec_helper"
2
-
3
- class CreateCommentsMigration < Dynomite::Migration
4
- def up
5
- create_table :comments do |t|
6
- t.partition_key "post_id:string" # required
7
- t.sort_key "created_at:string" # optional
8
- t.provisioned_throughput(5) # sets both read and write, defaults to 5 when not set
9
- end
10
- end
11
- end
12
-
13
- class UpdateCommentsMigration < Dynomite::Migration
14
- def up
15
- update_table :comments do |t|
16
- # NOTE: You cannot update provisioned_throughput at the same time as creating
17
- # an GSI
18
- # t.provisioned_throughput(7) # sets both read and write, defaults to 5 when not set
19
- t.gsi(:create) do |i|
20
- i.partition_key "post_id:string"
21
- i.sort_key "updated_at:string" # optional
22
- i.provisioned_throughput(8)
23
- end
24
- # t.gsi(:update, "update-me-index") do |i|
25
- # i.provisioned_throughput(9)
26
- # end
27
- # t.gsi(:delete, "delete-me-index")
28
- end
29
- end
30
- end
31
-
32
- describe Dynomite::Migration do
33
- context "mocked db" do
34
- before(:each) { Dynomite::Migration::Dsl.db = db }
35
- let(:db) { double(:db) }
36
- let(:null) { double(:null).as_null_object }
37
-
38
- it "executes the migration" do
39
- allow(db).to receive(:create_table).and_return(null)
40
-
41
- CreateCommentsMigration.new.up
42
-
43
- expect(db).to have_received(:create_table)
44
- end
45
- end
46
-
47
- # To test dynamodb endpoint configured in config/dynamodb.yml uncomment the code
48
- # you want to test and run:
49
- #
50
- # LIVE=1 rspec spec/lib/dynomite/migration_spec.rb -e 'live db'
51
- #
52
- context "live db" do
53
- before(:each) { Dynomite::Item.db = nil } # setting to nil will clear out mock and force it to load AWS
54
- it "executes the migration" do
55
- CreateCommentsMigration.new.up # uncomment to test
56
- # UpdateCommentsMigration.new.up # uncomment to test
57
- end
58
- end if ENV['LIVE']
59
- end
60
-
@@ -1,110 +0,0 @@
1
- ENV['DYNOMITE_ENV'] = 'test'
2
- ENV['DYNOMITE_CONFIG'] = 'spec/fixtures/app_root/config/dynamodb.yml'
3
- ENV['JETS_ROOT'] = 'spec/fixtures'
4
-
5
- root = File.expand_path("../../", __FILE__)
6
- require "#{root}/lib/dynomite"
7
-
8
- require "pp"
9
- require "fileutils"
10
-
11
- # This file was generated by the `rspec --init` command. Conventionally, all
12
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
13
- # The generated `.rspec` file contains `--require spec_helper` which will cause
14
- # this file to always be loaded, without a need to explicitly require it in any
15
- # files.
16
- #
17
- # Given that it is always loaded, you are encouraged to keep this file as
18
- # light-weight as possible. Requiring heavyweight dependencies from this file
19
- # will add to the boot time of your test suite on EVERY test run, even for an
20
- # individual file that may not need all of that loaded. Instead, consider making
21
- # a separate helper file that requires the additional dependencies and performs
22
- # the additional setup, and require it from the spec files that actually need
23
- # it.
24
- #
25
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
26
- RSpec.configure do |config|
27
- # rspec-expectations config goes here. You can use an alternate
28
- # assertion/expectation library such as wrong or the stdlib/minitest
29
- # assertions if you prefer.
30
- config.expect_with :rspec do |expectations|
31
- # This option will default to `true` in RSpec 4. It makes the `description`
32
- # and `failure_message` of custom matchers include text for helper methods
33
- # defined using `chain`, e.g.:
34
- # be_bigger_than(2).and_smaller_than(4).description
35
- # # => "be bigger than 2 and smaller than 4"
36
- # ...rather than:
37
- # # => "be bigger than 2"
38
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
39
- end
40
-
41
- # rspec-mocks config goes here. You can use an alternate test double
42
- # library (such as bogus or mocha) by changing the `mock_with` option here.
43
- config.mock_with :rspec do |mocks|
44
- # Prevents you from mocking or stubbing a method that does not exist on
45
- # a real object. This is generally recommended, and will default to
46
- # `true` in RSpec 4.
47
- mocks.verify_partial_doubles = true
48
- end
49
-
50
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
51
- # have no way to turn it off -- the option exists only for backwards
52
- # compatibility in RSpec 3). It causes shared context metadata to be
53
- # inherited by the metadata hash of host groups and examples, rather than
54
- # triggering implicit auto-inclusion in groups with matching metadata.
55
- config.shared_context_metadata_behavior = :apply_to_host_groups
56
-
57
- # The settings below are suggested to provide a good initial experience
58
- # with RSpec, but feel free to customize to your heart's content.
59
- =begin
60
- # This allows you to limit a spec run to individual examples or groups
61
- # you care about by tagging them with `:focus` metadata. When nothing
62
- # is tagged with `:focus`, all examples get run. RSpec also provides
63
- # aliases for `it`, `describe`, and `context` that include `:focus`
64
- # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
65
- config.filter_run_when_matching :focus
66
-
67
- # Allows RSpec to persist some state between runs in order to support
68
- # the `--only-failures` and `--next-failure` CLI options. We recommend
69
- # you configure your source control system to ignore this file.
70
- config.example_status_persistence_file_path = "spec/examples.txt"
71
-
72
- # Limits the available syntax to the non-monkey patched syntax that is
73
- # recommended. For more details, see:
74
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
75
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
76
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
77
- config.disable_monkey_patching!
78
-
79
- # This setting enables warnings. It's recommended, but in some cases may
80
- # be too noisy due to issues in dependencies.
81
- config.warnings = true
82
-
83
- # Many RSpec users commonly either run the entire suite or an individual
84
- # file, and it's useful to allow more verbose output when running an
85
- # individual spec file.
86
- if config.files_to_run.one?
87
- # Use the documentation formatter for detailed output,
88
- # unless a formatter has already been configured
89
- # (e.g. via a command-line flag).
90
- config.default_formatter = "doc"
91
- end
92
-
93
- # Print the 10 slowest examples and example groups at the
94
- # end of the spec run, to help surface which specs are running
95
- # particularly slow.
96
- config.profile_examples = 10
97
-
98
- # Run specs in random order to surface order dependencies. If you find an
99
- # order dependency and want to debug it, you can fix the order by providing
100
- # the seed, which is printed after each run.
101
- # --seed 1234
102
- config.order = :random
103
-
104
- # Seed global randomization in this process using the `--seed` CLI option.
105
- # Setting this allows you to use `--seed` to deterministically reproduce
106
- # test failures related to randomization by passing the same `--seed` value
107
- # as the one that triggered the failure.
108
- Kernel.srand config.seed
109
- =end
110
- end