zapp_sdk_tasks 0.2.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5830246ee46e41bf4d2ce8f42264f054c46a26245403f1cd7fdea106a4ba4e0f
4
+ data.tar.gz: 75a87602ee32d99446bd78857358a50b9786a8f41ddc7713de3c7c9fa45d4343
5
+ SHA512:
6
+ metadata.gz: 24c1631efefe54cd50fc2da6ba80ad5455c990a22768e31b6cdfdbba07854be8c93fa3fe15f12b07afc5697ee92a3537c86d4e2a677099db6b9be162c0b7ccd9
7
+ data.tar.gz: e486c89c6c13539288618e6cd7ecc9674d337b386d07567d367ef02dc4de477f19b537784fb3830f623368d3bdd47cf8db2cd0f209ac7848b4db685f98883a2c
@@ -0,0 +1,47 @@
1
+ version: 2
2
+ jobs:
3
+ build:
4
+ docker:
5
+ # specify the version you desire here
6
+ - image: circleci/ruby:2.3.5-node-browsers
7
+
8
+ working_directory: ~/repo
9
+
10
+ steps:
11
+ - checkout
12
+
13
+ # Download and cache dependencies
14
+ - restore_cache:
15
+ keys:
16
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
17
+ # fallback to using the latest cache if no exact match is found
18
+ - v1-dependencies-
19
+
20
+ - run:
21
+ name: install dependencies
22
+ command: |
23
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
24
+
25
+ - save_cache:
26
+ paths:
27
+ - ./vendor/bundle
28
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
29
+
30
+ - run:
31
+ name: run tests
32
+ command: |
33
+ mkdir /tmp/test-results
34
+ TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
35
+
36
+ bundle exec rspec --format progress \
37
+ --format RspecJunitFormatter \
38
+ --out /tmp/test-results/rspec.xml \
39
+ --format progress \
40
+ $TEST_FILES
41
+
42
+ # collect reports
43
+ - store_test_results:
44
+ path: /tmp/test-results
45
+ - store_artifacts:
46
+ path: /tmp/test-results
47
+ destination: test-results
data/.gitignore ADDED
@@ -0,0 +1,51 @@
1
+ *.gem
2
+ *.rbc
3
+ .rspec_status
4
+ /.config
5
+ /coverage/
6
+ /InstalledFiles
7
+ /pkg/
8
+ /spec/reports/
9
+ /spec/examples.txt
10
+ /test/tmp/
11
+ /test/version_tmp/
12
+ /tmp/
13
+
14
+ # Used by dotenv library to load environment variables.
15
+ # .env
16
+
17
+ ## Specific to RubyMotion:
18
+ .dat*
19
+ .repl_history
20
+ build/
21
+ *.bridgesupport
22
+ build-iPhoneOS/
23
+ build-iPhoneSimulator/
24
+
25
+ ## Specific to RubyMotion (use of CocoaPods):
26
+ #
27
+ # We recommend against adding the Pods directory to your .gitignore. However
28
+ # you should judge for yourself, the pros and cons are mentioned at:
29
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
30
+ #
31
+ # vendor/Pods/
32
+
33
+ ## Documentation cache and generated files:
34
+ /.yardoc/
35
+ /_yardoc/
36
+ /doc/
37
+ /rdoc/
38
+
39
+ ## Environment normalization:
40
+ /.bundle/
41
+ /vendor/bundle
42
+ /lib/bundler/man/
43
+
44
+ # for a library or gem, you might want to ignore these files since the code is
45
+ # intended to run in multiple environments; otherwise, check them in:
46
+ # Gemfile.lock
47
+ # .ruby-version
48
+ # .ruby-gemset
49
+
50
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
51
+ .rvmrc
data/.rubocop.yml ADDED
@@ -0,0 +1,65 @@
1
+ AllCops:
2
+ Exclude:
3
+ - .bundle/**/*
4
+ - vendor/bundle/**/*
5
+ - bin/*
6
+ - Gemfile
7
+ - Rakefile
8
+
9
+ CollectionMethods:
10
+ Enabled: true
11
+ PreferredMethods:
12
+ detect:
13
+ find_all:
14
+ inject: reduce
15
+ collect: map
16
+
17
+ Documentation:
18
+ Enabled: false
19
+
20
+ LineLength:
21
+ Max: 100
22
+
23
+ PercentLiteralDelimiters:
24
+ PreferredDelimiters:
25
+ '%': '{}'
26
+
27
+ PredicateName:
28
+ NamePrefixBlacklist:
29
+ - is_
30
+
31
+ StringLiterals:
32
+ EnforcedStyle: double_quotes
33
+
34
+ DotPosition:
35
+ EnforcedStyle: leading
36
+
37
+ Metrics/AbcSize:
38
+ Max: 25
39
+
40
+ Metrics/MethodLength:
41
+ Max: 20
42
+
43
+ Metrics/BlockLength:
44
+ Exclude:
45
+ - 'Rakefile'
46
+ - 'spec/**/*.rb'
47
+
48
+ Layout/AlignParameters:
49
+ EnforcedStyle: with_fixed_indentation
50
+
51
+ Layout/MultilineOperationIndentation:
52
+ EnforcedStyle: indented
53
+
54
+ SpaceBeforeFirstArg:
55
+ Enabled: false
56
+
57
+ Layout/IndentHash:
58
+ EnforcedStyle: consistent
59
+
60
+ Style/BracesAroundHashParameters:
61
+ Enabled: false
62
+
63
+ Style/RedundantBegin:
64
+ Enabled: false
65
+
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at r.meirman@applicaster.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,94 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ zapp_sdk_tasks (0.1.0)
5
+ aws-sdk-s3 (~> 1)
6
+ faraday (~> 0.15.3)
7
+ rake (~> 11.0)
8
+ versionomy (~> 0.5.0)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ ast (2.4.0)
14
+ aws-eventstream (1.0.1)
15
+ aws-partitions (1.117.0)
16
+ aws-sdk-core (3.40.0)
17
+ aws-eventstream (~> 1.0)
18
+ aws-partitions (~> 1.0)
19
+ aws-sigv4 (~> 1.0)
20
+ jmespath (~> 1.0)
21
+ aws-sdk-kms (1.13.0)
22
+ aws-sdk-core (~> 3, >= 3.39.0)
23
+ aws-sigv4 (~> 1.0)
24
+ aws-sdk-s3 (1.27.0)
25
+ aws-sdk-core (~> 3, >= 3.39.0)
26
+ aws-sdk-kms (~> 1)
27
+ aws-sigv4 (~> 1.0)
28
+ aws-sigv4 (1.0.3)
29
+ blockenspiel (0.5.0)
30
+ coderay (1.1.2)
31
+ diff-lcs (1.3)
32
+ dotenv (2.5.0)
33
+ fantaskspec (1.0.0)
34
+ rake (>= 11.0)
35
+ rspec (~> 3.0)
36
+ faraday (0.15.4)
37
+ multipart-post (>= 1.2, < 3)
38
+ jaro_winkler (1.5.1)
39
+ jmespath (1.4.0)
40
+ method_source (0.9.2)
41
+ multipart-post (2.0.0)
42
+ parallel (1.12.1)
43
+ parser (2.5.3.0)
44
+ ast (~> 2.4.0)
45
+ powerpack (0.1.2)
46
+ pry (0.12.2)
47
+ coderay (~> 1.1.0)
48
+ method_source (~> 0.9.0)
49
+ rainbow (3.0.0)
50
+ rake (11.3.0)
51
+ rspec (3.8.0)
52
+ rspec-core (~> 3.8.0)
53
+ rspec-expectations (~> 3.8.0)
54
+ rspec-mocks (~> 3.8.0)
55
+ rspec-core (3.8.0)
56
+ rspec-support (~> 3.8.0)
57
+ rspec-expectations (3.8.2)
58
+ diff-lcs (>= 1.2.0, < 2.0)
59
+ rspec-support (~> 3.8.0)
60
+ rspec-mocks (3.8.0)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.8.0)
63
+ rspec-support (3.8.0)
64
+ rspec_junit_formatter (0.4.1)
65
+ rspec-core (>= 2, < 4, != 2.12.0)
66
+ rubocop (0.60.0)
67
+ jaro_winkler (~> 1.5.1)
68
+ parallel (~> 1.10)
69
+ parser (>= 2.5, != 2.5.1.1)
70
+ powerpack (~> 0.1)
71
+ rainbow (>= 2.2.2, < 4.0)
72
+ ruby-progressbar (~> 1.7)
73
+ unicode-display_width (~> 1.4.0)
74
+ ruby-progressbar (1.10.0)
75
+ unicode-display_width (1.4.0)
76
+ versionomy (0.5.0)
77
+ blockenspiel (~> 0.5)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ bundler (~> 1.16)
84
+ dotenv (~> 2.5.0)
85
+ fantaskspec (~> 1.0.0)
86
+ pry (~> 0.12.1)
87
+ rake (~> 11.0)
88
+ rspec (~> 3.0)
89
+ rspec_junit_formatter (~> 0.4.1)
90
+ rubocop (~> 0.60.0)
91
+ zapp_sdk_tasks!
92
+
93
+ BUNDLED WITH
94
+ 1.16.2
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Applicaster LTD.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # Zapp Sdk Tasks
2
+
3
+ This repo provides various rake tasks to be used on any new Zapp sdk repo you
4
+ create.
5
+
6
+ ## Installation
7
+ **Prerequisites**
8
+
9
+ ```
10
+ ruby >= 2.3.5
11
+ ```
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'zapp_sdk_tasks'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install zapp_sdk_tasks
26
+
27
+ ## Usage
28
+
29
+ This repo contains two tasks:
30
+
31
+ #### Create Zapp SDK
32
+
33
+ This task creates a stable or Canary (preview) sdk on Zapp, using a tag or
34
+ branch name.
35
+
36
+ Run:
37
+
38
+ `bundle exec rake zapp_sdks:create[<platform as defined in zapp>,<version e.g. 1.0.0>,<sdk repo name>,<zapp token>]`
39
+
40
+ Make sure the params are comma-separated without whitespaces
41
+
42
+ **Params**
43
+
44
+ param | description
45
+ ----------------|-------------|
46
+ platform | The platform supported by the current published sdk (Currently supporting `android/ios/roku/tvos/samsung_tv`) |
47
+ version | The requireed version for the published sdk. *Note: only semver stable/final and preview versions will publish the sdk in zapp* |
48
+ repository name | The sdk repo name |
49
+ zapp token | Zapp API access token |
50
+
51
+ #### Publish Changelog
52
+
53
+ This task creates and publish changelog to Amazon s3.
54
+ **Make sure you setup `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION` environment variable in order to use this task.
55
+
56
+ Run:
57
+
58
+ `bundle exec rake zapp_sdks:publish_changelog[<platform as defined in zapp>,<version e.g. 1.0.0>]`
59
+
60
+ Make sure the params are comma-separated without whitespaces
61
+
62
+ **Params**
63
+
64
+ param | description
65
+ ----------------|-------------|
66
+ platform | The platform supported by the current published sdk (Currently supporting `android/ios/roku/tvos/samsung_tv`) |
67
+ version | The requireed version for the published sdk |
68
+
69
+
70
+ ## Development
71
+
72
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
73
+
74
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
75
+
76
+ ## Contributing
77
+
78
+ Bug reports and pull requests are welcome on GitHub at https://github.com/applicaster/zapp_sdk_tasks. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
79
+
80
+ ## Code of Conduct
81
+
82
+ Everyone interacting in the ZappSdkTasks project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/applicaster/zapp_sdk_tasks/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rubocop/rake_task'
5
+ require 'rspec/core/rake_task'
6
+ require 'pry'
7
+
8
+ path = File.expand_path(__dir__)
9
+ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), "lib"))
10
+ Dir.glob("#{path}/lib/**/*.rake").each { |f| load f }
11
+
12
+ RSpec::Core::RakeTask.new(:spec)
13
+ RuboCop::RakeTask.new
14
+
15
+ task(:default).clear
16
+ task default: %i[rubocop spec]
data/bin/console ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'zapp_sdk_tasks'
6
+
7
+ require 'pry'
8
+ Pry.start
9
+
10
+ require 'irb'
11
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ChangelogHelper
4
+ def self.generate_changelog(platform, version)
5
+ install_changelog_maker
6
+ init_changelog(platform, version)
7
+ system "./node_modules/.bin/changelog-maker --all >> CHANGELOG.md"
8
+ end
9
+
10
+ def self.install_changelog_maker
11
+ system "npm i changelog-maker"
12
+ end
13
+
14
+ def self.init_changelog(platform, version)
15
+ File.open("CHANGELOG.md", "w+") do |f|
16
+ f.write("##{platform} SDK Version: #{version}\n\n")
17
+ end
18
+ end
19
+
20
+ def self.print_success(platform, version)
21
+ <<~HEREDOC
22
+ Changelog uploaded!
23
+ https://assets-production.applicaster.com/zapp/sdk_versions/#{platform}/#{version}/CHANGELOG.md"
24
+ HEREDOC
25
+ end
26
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class GitHelper
4
+ def self.last_commit_message
5
+ `git log -1 --oneline`
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class S3Helper
4
+ def self.resource_from_env_vars
5
+ Aws::S3::Resource.new(
6
+ access_key_id: ENV["AWS_ACCESS_KEY_ID"],
7
+ secret_access_key: ENV["AWS_SECRET_ACCESS_KEY"],
8
+ region: ENV["AWS_REGION"]
9
+ )
10
+ end
11
+
12
+ def self.write_options
13
+ { acl: "public-read", cache_control: "max-age=60" }
14
+ end
15
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "versionomy"
4
+
5
+ class SdkHelper
6
+ def self.zapp_host
7
+ "https://zapp.applicaster.com"
8
+ end
9
+
10
+ def self.zapp_api_path
11
+ "api/v1/sdk_creation_workers"
12
+ end
13
+
14
+ def self.zapp_request_params(request_options)
15
+ {
16
+ sdk_version: {
17
+ version: request_options[:version],
18
+ platform: request_options[:platform],
19
+ screen_sizes: ["universal"],
20
+ status: "stable",
21
+ official: true,
22
+ channel: preview?(request_options[:version]) ? "canary_channel" : "stable_channel",
23
+ ci_provider: "circle_ci",
24
+ ci_project_id: request_options[:project_repo_name],
25
+ base_sdk_version_id: base_sdk_id(request_options[:version]),
26
+ scm_tag: request_options[:version],
27
+ build_branch: preview?(request_options[:version]) ? request_options[:version] : "release"
28
+ },
29
+ use_latest_dev: base_sdk_id(request_options[:version]).to_s.empty?,
30
+ access_token: ENV["ZAPP_TOKEN"] || request_options[:zapp_token]
31
+ }
32
+ end
33
+
34
+ def self.base_sdk_id(version)
35
+ return if preview?(version)
36
+
37
+ match_data = GitHelper.last_commit_message.match(/\[\s*(?:from\s*[-_])(.+)\s*\]/)
38
+ return unless match_data
39
+
40
+ match_data[1]
41
+ end
42
+
43
+ def self.preview?(version)
44
+ release_type(version).to_sym == :preview
45
+ end
46
+
47
+ def self.release_type(version)
48
+ version = Versionomy.parse(version)
49
+ version.release_type
50
+ end
51
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "versionomy"
5
+ require "logger"
6
+ require "zapp_sdk_tasks/git_helper"
7
+ require "zapp_sdk_tasks/sdk_helper"
8
+
9
+ desc "Create SDK version on Zapp"
10
+ namespace :zapp_sdks do
11
+ task :create, :platform, :version, :project_repo_name, :zapp_token do |_task, args|
12
+ begin
13
+ connection = Faraday.new(url: SdkHelper.zapp_host) do |faraday|
14
+ faraday.request :url_encoded
15
+ faraday.response :logger, ::Logger.new(STDOUT), bodies: true do |logger|
16
+ logger.filter(/(access_token=)(\w+)/, "\1[REMOVED]")
17
+ end
18
+
19
+ faraday.adapter Faraday.default_adapter
20
+ end
21
+
22
+ unless %i[release preview final].include?(SdkHelper.release_type(args[:version]))
23
+ puts "skipping sdk creation, version #{args[:version]} should not be published"
24
+ next
25
+ end
26
+
27
+ response = connection.post(SdkHelper.zapp_api_path, SdkHelper.zapp_request_params(args))
28
+
29
+ raise "Failed to create SDK on Zapp with error #{response.status}" unless response.success?
30
+
31
+ puts "SDK #{args[:version]} was created!"
32
+ rescue Versionomy::Errors::VersionomyError
33
+ puts "skipping sdk creation, version #{args[:version]} should not be published"
34
+ next
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "aws-sdk-s3"
4
+ require "versionomy"
5
+ require "zapp_sdk_tasks/s3_helper"
6
+ require "zapp_sdk_tasks/changelog_helper"
7
+
8
+ desc "Generate Changelog.md and publish to s3"
9
+ namespace :zapp_sdks do
10
+ task :publish_changelog, :platform, :version do |_task, args|
11
+ begin
12
+ version = Versionomy.parse(args[:version])
13
+ release_type = version.release_type
14
+
15
+ unless %i[release preview final].include?(release_type)
16
+ puts "skipping changelog publish, version #{args[:version]} should not be published"
17
+ next
18
+ end
19
+
20
+ ChangelogHelper.generate_changelog(args[:platform], args[:version])
21
+ s3 = S3Helper.resource_from_env_vars
22
+
23
+ obj = s3.bucket(ENV["S3_BUCKET_NAME"])
24
+ .object("zapp/sdk_versions/#{args[:platform]}/#{args[:version]}/CHANGELOG.md")
25
+
26
+ File.open("CHANGELOG.md", "rb") do |file|
27
+ obj.put({ body: file }.merge(S3Helper.write_options))
28
+ end
29
+
30
+ ChangelogHelper.print_success(args[:platform], args[:version])
31
+ rescue Versionomy::Errors::VersionomyError
32
+ puts "skipping changelog publish, version #{args[:version]} should not be published"
33
+ next
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ZappSdkTasks
4
+ VERSION = "0.2.0"
5
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "zapp_sdk_tasks/version"
4
+
5
+ module ZappSdkTasks
6
+ class ZappRakeTasks
7
+ include Rake::DSL if defined? Rake::DSL
8
+
9
+ def install_tasks
10
+ path = File.expand_path(__dir__)
11
+ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), "lib"))
12
+ Dir.glob("#{path}/lib/**/*.rake").each { |f| load f }
13
+ end
14
+ end
15
+ end
16
+
17
+ ZappSdkTasks::ZappRakeTasks.new.install_tasks
18
+
19
+ if defined?(Rails)
20
+ module ZappSdkTasks
21
+ class Railtie < ::Rails::Railtie
22
+ railtie_name :zapp_sdk_tasks
23
+
24
+ rake_tasks do
25
+ path = File.expand_path(__dir__)
26
+ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), "lib"))
27
+ Dir.glob("#{path}/lib/**/*.rake").each { |f| load f }
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "zapp_sdk_tasks/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "zapp_sdk_tasks"
9
+ spec.version = ZappSdkTasks::VERSION
10
+ spec.authors = ["Ran Meirman"]
11
+ spec.email = ["r.meirman@applicaster.com"]
12
+
13
+ spec.summary = "Zapp sdks related common tasks"
14
+ spec.homepage = "https://github.com/applicaster/zapp-sdk-tasks"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_dependency "aws-sdk-s3", "~> 1"
26
+ spec.add_dependency "faraday", "~> 0.15.3"
27
+ spec.add_dependency "rake", "~> 11.0"
28
+ spec.add_dependency "versionomy", "~> 0.5.0"
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.16"
31
+ spec.add_development_dependency "dotenv", "~> 2.5.0"
32
+ spec.add_development_dependency "fantaskspec", "~> 1.0.0"
33
+ spec.add_development_dependency "pry", "~> 0.12.1"
34
+ spec.add_development_dependency "rake", "~> 11.0"
35
+ spec.add_development_dependency "rspec", "~> 3.0"
36
+ spec.add_development_dependency "rspec_junit_formatter", "~> 0.4.1"
37
+ spec.add_development_dependency "rubocop", "~> 0.60.0"
38
+ end
metadata ADDED
@@ -0,0 +1,231 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zapp_sdk_tasks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Ran Meirman
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-11-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk-s3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.15.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.15.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '11.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '11.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: versionomy
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.5.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.16'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.16'
83
+ - !ruby/object:Gem::Dependency
84
+ name: dotenv
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.5.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.5.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: fantaskspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.0.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.0.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.12.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.12.1
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '11.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '11.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rspec
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '3.0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '3.0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rspec_junit_formatter
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 0.4.1
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 0.4.1
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.60.0
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.60.0
181
+ description:
182
+ email:
183
+ - r.meirman@applicaster.com
184
+ executables: []
185
+ extensions: []
186
+ extra_rdoc_files: []
187
+ files:
188
+ - ".circleci/config.yml"
189
+ - ".gitignore"
190
+ - ".rubocop.yml"
191
+ - CODE_OF_CONDUCT.md
192
+ - Gemfile
193
+ - Gemfile.lock
194
+ - LICENSE
195
+ - README.md
196
+ - Rakefile
197
+ - bin/console
198
+ - bin/setup
199
+ - lib/zapp_sdk_tasks.rb
200
+ - lib/zapp_sdk_tasks/changelog_helper.rb
201
+ - lib/zapp_sdk_tasks/git_helper.rb
202
+ - lib/zapp_sdk_tasks/s3_helper.rb
203
+ - lib/zapp_sdk_tasks/sdk_helper.rb
204
+ - lib/zapp_sdk_tasks/tasks/create_sdk.rake
205
+ - lib/zapp_sdk_tasks/tasks/publish_changelog.rake
206
+ - lib/zapp_sdk_tasks/version.rb
207
+ - zapp_sdk_tasks.gemspec
208
+ homepage: https://github.com/applicaster/zapp-sdk-tasks
209
+ licenses: []
210
+ metadata: {}
211
+ post_install_message:
212
+ rdoc_options: []
213
+ require_paths:
214
+ - lib
215
+ required_ruby_version: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - ">="
218
+ - !ruby/object:Gem::Version
219
+ version: '0'
220
+ required_rubygems_version: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - ">="
223
+ - !ruby/object:Gem::Version
224
+ version: '0'
225
+ requirements: []
226
+ rubyforge_project:
227
+ rubygems_version: 2.7.6
228
+ signing_key:
229
+ specification_version: 4
230
+ summary: Zapp sdks related common tasks
231
+ test_files: []