fastlane-plugin-apprepo 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +2 -0
  3. data/.gitignore +0 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +4 -0
  6. data/Gemfile +7 -1
  7. data/README.md +9 -2
  8. data/assets/RepofileDefault +34 -0
  9. data/assets/apprepo.png +0 -0
  10. data/assets/circle.key +27 -0
  11. data/assets/fastlane.png +0 -0
  12. data/assets/manifest.png +0 -0
  13. data/circle.yml +11 -9
  14. data/coverage/.last_run.json +5 -0
  15. data/coverage/.resultset.json +1244 -0
  16. data/coverage/.resultset.json.lock +0 -0
  17. data/fastlane-plugin-apprepo.gemspec +6 -2
  18. data/fastlane/Appfile +1 -0
  19. data/fastlane/Fastfile +42 -0
  20. data/fastlane/Pluginfile +1 -0
  21. data/fastlane/Repofile +33 -0
  22. data/greeter.rb +6 -0
  23. data/lib/fastlane/plugin/apprepo.rb +26 -7
  24. data/lib/fastlane/plugin/apprepo/actions/apprepo_action.rb +106 -92
  25. data/lib/fastlane/plugin/apprepo/actions/download_manifest.rb +40 -0
  26. data/lib/fastlane/plugin/apprepo/actions/init.rb +46 -0
  27. data/lib/fastlane/plugin/apprepo/actions/rubocop.rb +29 -0
  28. data/lib/fastlane/plugin/apprepo/actions/run.rb +69 -0
  29. data/lib/fastlane/plugin/apprepo/actions/submit.rb +41 -0
  30. data/lib/fastlane/plugin/apprepo/analyser.rb +35 -0
  31. data/lib/fastlane/plugin/apprepo/command.rb +17 -0
  32. data/lib/fastlane/plugin/apprepo/commands_generator.rb +121 -0
  33. data/lib/fastlane/plugin/apprepo/detect_values.rb +29 -0
  34. data/lib/fastlane/plugin/apprepo/helper/analyser.rb +35 -0
  35. data/lib/fastlane/plugin/apprepo/helper/commands_generator.rb +121 -0
  36. data/lib/fastlane/plugin/apprepo/helper/detect_values.rb +29 -0
  37. data/lib/fastlane/plugin/apprepo/helper/loader.rb +15 -0
  38. data/lib/fastlane/plugin/apprepo/helper/manifest.rb +44 -0
  39. data/lib/fastlane/plugin/apprepo/helper/options.rb +120 -0
  40. data/lib/fastlane/plugin/apprepo/helper/runner.rb +68 -0
  41. data/lib/fastlane/plugin/apprepo/helper/setup.rb +49 -0
  42. data/lib/fastlane/plugin/apprepo/helper/uploader.rb +301 -0
  43. data/lib/fastlane/plugin/apprepo/loader.rb +15 -0
  44. data/lib/fastlane/plugin/apprepo/manifest.rb +44 -0
  45. data/lib/fastlane/plugin/apprepo/options.rb +120 -0
  46. data/lib/fastlane/plugin/apprepo/runner.rb +68 -0
  47. data/lib/fastlane/plugin/apprepo/setup.rb +49 -0
  48. data/lib/fastlane/plugin/apprepo/uploader.rb +301 -0
  49. data/lib/fastlane/plugin/apprepo/version.rb +4 -3
  50. data/manifest.json +10 -0
  51. data/sampleapp.ipa +1 -0
  52. data/test +0 -0
  53. metadata +46 -2
File without changes
@@ -14,9 +14,13 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = 'https://github.com/suculent/fastlane-plugin-apprepo'
15
15
  spec.license = 'MIT'
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec_files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+
21
+ spec.files = spec_files
18
22
  spec.require_paths = ['lib']
19
-
23
+
20
24
  spec.add_development_dependency 'json', '= 1.8.1'
21
25
  spec.add_development_dependency 'rspec', '~> 3.4', '>= 3.4.0'
22
26
  spec.add_development_dependency 'fastlane', '~> 1.89'
data/fastlane/Appfile ADDED
@@ -0,0 +1 @@
1
+ package_name "com.suculent.Apprepo-fastlane-plugin"
data/fastlane/Fastfile ADDED
@@ -0,0 +1,42 @@
1
+ fastlane_version "1.90.0"
2
+
3
+ default_platform :mac
4
+
5
+ platform :mac do
6
+ before_all do
7
+ ENV["SLACK_URL"] = "https://hooks.slack.com/services/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"
8
+ end
9
+
10
+ desc "Runs all the tests"
11
+ lane :test do
12
+ sh "rspec .."
13
+ end
14
+
15
+ desc "Build a RubyGem"
16
+ lane :build do
17
+ sh "gem build ../fastlane-plugin-apprepo.gemspec"
18
+ end
19
+
20
+ desc "Deploy a new version to the RubyGems.org"
21
+ lane :deploy do
22
+ sh "gem push ../fastlane-plugin-apprepo-0.1.0.gem"
23
+
24
+ slack(
25
+ message: "Successfully deployed new Fastlane Plugin Update."
26
+ )
27
+ end
28
+
29
+ after_all do |lane|
30
+ # This block is called, only if the executed lane was successful
31
+ #slack(
32
+ # message: "Successfully deployed new Fastlane Plugin Update."
33
+ #)
34
+ end
35
+
36
+ error do |lane, exception|
37
+ slack(
38
+ message: exception.message,
39
+ success: false
40
+ )
41
+ end
42
+ end
@@ -0,0 +1 @@
1
+ #gem "fastlane-plugin-apprepo"
data/fastlane/Repofile ADDED
@@ -0,0 +1,33 @@
1
+ ###################### More Options ######################
2
+ # If you want to have even more control, check out the documentation
3
+ # https://github.com/suculent/apprepo/blob/master/Repofile.md
4
+
5
+ ###################### Automatically generated ######################
6
+ # Feel free to remove the following line if you use fastlane (which you should)
7
+
8
+ app_identifier "com.apprepo.test" # your app's bundle identifier
9
+ ipa "./sampleapp.ipa" # can be overriden with --ipa
10
+ manifest_path "./manifest.json" # Path to the manifest.json you want to use.
11
+
12
+ #
13
+ # Authentication
14
+ #
15
+
16
+ # You can use your '~/.ssh/config' file to setup RSA keys to AppRepo, or use following options:
17
+
18
+
19
+ repo_url "107.22.101.216" # repo.teacloud.net
20
+ repo_user "circle"
21
+ repo_key "assets/circle.key"
22
+ # repo_key "/Users/sychram/.ssh/circle.key" # should have 'chmod 600'
23
+
24
+ notify true # Add this to automatically notify the AppRepo users after uploading metadata/binary.
25
+
26
+ # Optionals
27
+
28
+ app_version "0.1"
29
+ app_icon "./assets/apprepo.png"
30
+ appcode "APPREPO"
31
+ repo_title "TestApp"
32
+ repo_description "Some description is required for AppRepo users to know, that is this app."
33
+ repo_summary "Experimental Fastlane Extension"
data/greeter.rb ADDED
@@ -0,0 +1,6 @@
1
+ # Hello World for RSpec tests
2
+ class Greeter
3
+ def greet
4
+ 'Hello World!'
5
+ end
6
+ end
@@ -1,17 +1,36 @@
1
- #require_relative 'apprepo/version'
2
- require 'fastlane/plugin/apprepo/version'
1
+ #!/usr/bin/env ruby
2
+
3
+ # encoding: utf-8
4
+
5
+ require 'json'
6
+ require 'fastlane'
7
+ require 'fastlane_core'
8
+
9
+ require_relative 'apprepo/version'
3
10
 
4
11
  module Fastlane
12
+ # Root module of the plugin (seems like a class-loader)
5
13
  module Apprepo
6
14
  # Return all .rb files inside the "actions" and "helper" directory
7
15
  def self.all_classes
8
16
  Dir[File.expand_path('*/{actions,helper}/*.rb', File.dirname(__FILE__))]
9
17
  end
10
18
  end
11
- end
12
19
 
13
- # By default we want to import all available actions and helpers
14
- # A plugin can contain any number of actions and plugins
15
- Fastlane::Apprepo.all_classes.each do |current|
16
- require current
20
+ Encoding.default_external = Encoding::UTF_8
21
+ Encoding.default_internal = Encoding::UTF_8
22
+
23
+ # By default we want to import all available actions and helpers
24
+ # A plugin can contain any number of actions and plugins
25
+ Fastlane::Apprepo.all_classes.each do |current|
26
+ require current
27
+ end
28
+
29
+ # Test only, should be removed...
30
+ UI.message('Initializing new CommandsGenerator')
31
+ cgen = Apprepo::CommandsGenerator.new
32
+ UI.message('Downloading Manifest...')
33
+ cgen.download_manifest
34
+ UI.message('Running Deployment...')
35
+ cgen.run
17
36
  end
@@ -2,125 +2,139 @@ require 'fastlane'
2
2
 
3
3
  module Fastlane
4
4
  module Actions
5
+ #  Action subclass for the Fastlane plugin
6
+
7
+ # rubocop:disable Metrics/AbcSize
8
+ # rubocop:disable Metrics/AbcSize
9
+ # rubocop:disable Metrics/MethodLength
10
+ # rubocop:disable Metrics/CyclomaticComplexity
11
+ # rubocop:disable Metrics/PerceivedComplexity
5
12
  class ApprepoAction < Action
6
- def self.run(params)
7
- require 'apprepo'
13
+ def self.run(_params)
14
+ require 'Apprepo'
8
15
 
9
16
  if defined?(::Apprepo::Command::Make)
10
-
11
- # New `apprepo make` command
17
+ # New `Apprepo make` command
18
+ puts 'New `Apprepo make` command'
12
19
  ::Apprepo::Command::Make.run
13
20
 
14
21
  else
15
-
16
- # Legacy `apprepo` command
22
+ # Legacy `Apprepo` command
23
+ puts 'Legacy `Apprepo` command'
17
24
  ::Apprepo::Command.run
18
25
  end
19
26
  end
20
27
 
21
28
  def self.description
22
- "Runs `apprepo` for the project"
29
+ 'Runs `Apprepo` for the project'
23
30
  end
24
31
 
25
32
  def self.available_options
26
- [
27
- FastlaneCore::ConfigItem.new(key: :ipa,
28
- short_option: '-i',
29
- optional: true,
30
- env_name: 'APPREPO_IPA_PATH',
31
- description: 'Path to your ipa file',
32
- default_value: Dir['*.ipa'].first,
33
- verify_block: proc do |value|
33
+ [
34
+ FastlaneCore::ConfigItem.new(key: :ipa,
35
+ short_option: '-i',
36
+ optional: true,
37
+ env_name: 'Apprepo_IPA_PATH',
38
+ description: 'Path to your ipa file',
39
+ default_value: Dir['*.ipa'].first,
40
+ verify_block: proc do |value|
34
41
  UI.user_error!("Could not find ipa file at path '#{value}'") unless File.exist?(value)
35
42
  UI.user_error!("'#{value}' doesn't seem to be an ipa file") unless value.end_with?('.ipa')
36
- end,
37
- conflicting_options: [:pkg],
38
- conflict_block: proc do |value|
43
+ end,
44
+ conflicting_options: [:pkg],
45
+ conflict_block: proc do |value|
39
46
  UI.user_error!("You can't use 'ipa' and '#{value.key}' options in one run.")
40
- end),
41
- FastlaneCore::ConfigItem.new(key: :app_identifier,
42
- short_option: '-b',
43
- optional: false,
44
- env_name: 'APPREPO_APP_ID',
45
- description: 'Your bundle identifier',
46
- default_value: ""),
47
- FastlaneCore::ConfigItem.new(key: :app_code,
48
- short_option: '-c',
49
- optional: true,
50
- env_name: 'APPREPO_APPCODE',
51
- description: 'APPCODE value for apprepo'),
52
- FastlaneCore::ConfigItem.new(key: :repo_url,
53
- short_option: '-r',
54
- optional: false,
55
- env_name: 'APPREPO_URL',
56
- description: 'URL of your Apprepo server'),
57
- FastlaneCore::ConfigItem.new(key: :repo_user,
58
- short_option: '-u',
59
- optional: false,
60
- env_name: 'APPREPO_USER',
61
- description: 'USER of your Apprepo server'),
62
- FastlaneCore::ConfigItem.new(key: :repo_key,
63
- short_option: '-k',
64
- optional: false,
65
- env_name: 'APPREPO_KEY',
66
- description: 'RSA key for your Apprepo server'),
67
- FastlaneCore::ConfigItem.new(key: :repo_description,
68
- short_option: '-d',
69
- optional: true,
70
- env_name: 'APPREPO_DESCRIPTION',
71
- description: 'Long description for your Apprepo server'),
72
- FastlaneCore::ConfigItem.new(key: :metadata_path,
73
- short_option: '-m',
74
- description: 'Path to the folder containing the metadata files',
75
- optional: true),
76
- FastlaneCore::ConfigItem.new(key: :meta_title,
77
- short_option: '-a',
78
- description: 'Name of the app',
79
- optional: true),
80
- FastlaneCore::ConfigItem.new(key: :skip_binary_upload,
81
- description: 'Skip uploading an ipa or pkg to iTunes Connect',
82
- is_string: false,
83
- default_value: false),
84
- FastlaneCore::ConfigItem.new(key: :app_version,
85
- short_option: '-z',
86
- description: 'The version that should be edited or created',
87
- optional: true),
88
- FastlaneCore::ConfigItem.new(key: :skip_metadata,
89
- description: "Don't upload the metadata (e.g. title, description), this will still upload screenshots",
90
- is_string: false,
91
- default_value: false),
92
- FastlaneCore::ConfigItem.new(key: :notify,
93
- description: "Notify AppRepo users on update",
94
- is_string: false,
95
- default_value: false),
96
- FastlaneCore::ConfigItem.new(key: :build_number,
97
- short_option: '-n',
98
- description: 'If set the given build number (already uploaded to iTC) will be used instead of the current built one',
99
- optional: true,
100
- conflicting_options: [:ipa, :pkg],
101
- conflict_block: proc do |value|
47
+ end),
48
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
49
+ short_option: '-b',
50
+ optional: false,
51
+ env_name: 'Apprepo_APP_ID',
52
+ description: 'Your bundle identifier',
53
+ default_value: ''),
54
+ FastlaneCore::ConfigItem.new(key: :app_code,
55
+ short_option: '-c',
56
+ optional: true,
57
+ env_name: 'Apprepo_APPCODE',
58
+ description: 'APPCODE value for Apprepo'),
59
+ FastlaneCore::ConfigItem.new(key: :repo_url,
60
+ short_option: '-r',
61
+ optional: false,
62
+ env_name: 'Apprepo_URL',
63
+ description: 'URL of your Apprepo server'),
64
+ FastlaneCore::ConfigItem.new(key: :repo_user,
65
+ short_option: '-u',
66
+ optional: false,
67
+ env_name: 'Apprepo_USER',
68
+ description: 'USER of your Apprepo server'),
69
+ FastlaneCore::ConfigItem.new(key: :repo_key,
70
+ short_option: '-k',
71
+ optional: false,
72
+ env_name: 'Apprepo_KEY',
73
+ description: 'RSA key for your Apprepo server'),
74
+ FastlaneCore::ConfigItem.new(key: :repo_description,
75
+ short_option: '-d',
76
+ optional: true,
77
+ env_name: 'Apprepo_DESCRIPTION',
78
+ description: 'Long detailed description for your Apprepo server',
79
+ default_value: ''),
80
+ FastlaneCore::ConfigItem.new(key: :repo_summary,
81
+ short_option: '-s',
82
+ optional: true,
83
+ env_name: 'Apprepo_SUMMARY',
84
+ description: 'Short description for your Apprepo server',
85
+ default_value: ''),
86
+ FastlaneCore::ConfigItem.new(key: :manifest_path,
87
+ short_option: '-m',
88
+ description: 'Path to the folder containing the metadata files',
89
+ optional: true),
90
+ FastlaneCore::ConfigItem.new(key: :repo_title,
91
+ short_option: '-a',
92
+ description: 'Name of the app',
93
+ optional: false),
94
+ FastlaneCore::ConfigItem.new(key: :skip_binary_upload,
95
+ description: 'Skip uploading an ipa or pkg to Apprepo',
96
+ is_string: false,
97
+ default_value: false),
98
+ FastlaneCore::ConfigItem.new(key: :app_version,
99
+ short_option: '-z',
100
+ description: 'The version that should be edited or created',
101
+ optional: true),
102
+ FastlaneCore::ConfigItem.new(key: :skip_manifest,
103
+ description: "Don't upload the metadata (e.g. title, description), this will still upload screenshots",
104
+ is_string: false,
105
+ default_value: false),
106
+ FastlaneCore::ConfigItem.new(key: :notify,
107
+ description: 'Notify Apprepo users on update',
108
+ is_string: false,
109
+ default_value: false),
110
+ FastlaneCore::ConfigItem.new(key: :build_number,
111
+ short_option: '-n',
112
+ description: 'If set the given build number (already uploaded to iTC) will be used instead of the current built one',
113
+ optional: true,
114
+ conflicting_options: [:ipa, :pkg],
115
+ conflict_block: proc do |value|
102
116
  UI.user_error!("You can't use 'build_number' and '#{value.key}' options in one run.")
103
- end),
117
+ end),
104
118
 
105
- # App Metadata
106
- # Non Localised
107
- FastlaneCore::ConfigItem.new(key: :app_icon,
108
- description: 'Metadata: The path to the app icon',
109
- optional: true,
110
- short_option: '-l',
111
- verify_block: proc do |value|
119
+ # App Metadata
120
+ # Non Localised
121
+ FastlaneCore::ConfigItem.new(key: :app_icon,
122
+ description: 'Metadata: The path to the app icon',
123
+ optional: true,
124
+ short_option: '-l',
125
+ verify_block: proc do |value|
112
126
  UI.user_error!("Could not find png file at path '#{value}'") unless File.exist?(value)
113
127
  UI.user_error!("'#{value}' doesn't seem to be a png file") unless value.end_with?('.png')
114
- end)
115
- ]
128
+ end)
129
+ ]
116
130
  end
117
131
 
118
- def self.is_supported?(platform)
132
+ def self.supported?(platform)
119
133
  [:ios, :mac].include? platform
120
134
  end
121
135
 
122
136
  def self.authors
123
- ["suculent"]
137
+ ['suculent']
124
138
  end
125
139
  end
126
140
  end
@@ -0,0 +1,40 @@
1
+ module Fastlane
2
+ module Actions
3
+ class DownloadManifestAction < Action
4
+ def self.run(_params)
5
+ puts _params
6
+ command :download_manifest do |c|
7
+ c.syntax = 'apprepo download_manifest'
8
+ c.description = 'Download metadata only'
9
+ c.action do |_args, options|
10
+ config = FastlaneCore::Configuration
11
+ available_opts = Apprepo::Options.available_options
12
+ options = config.create(available_opts, options.__hash__)
13
+ options.load_configuration_file('Repofile')
14
+ Apprepo::Runner.new(options).download_manifest
15
+ end
16
+ end
17
+ end
18
+
19
+ #####################################################
20
+ # @!group Documentation
21
+ #####################################################
22
+
23
+ def self.description
24
+ 'Runs the Apprepo plugin'
25
+ end
26
+
27
+ def self.available_options
28
+ []
29
+ end
30
+
31
+ def self.authors
32
+ ['suculent@me.com']
33
+ end
34
+
35
+ def self.is_supported?(_platform)
36
+ true
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,46 @@
1
+ module Fastlane
2
+ module Actions
3
+ class InitAction < Action
4
+ def self.run(_params)
5
+ #sh 'bundle exec rubocop -D'
6
+ command :init do |c|
7
+ c.syntax = 'apprepo init'
8
+ c.description = 'Create the initial `apprepo` configuration'
9
+ c.action do |_args, options|
10
+ if File.exist?('Repofile') || File.exist?('fastlane/Repofile')
11
+ UI.important('You already got a running apprepo setup.')
12
+ return 0
13
+ end
14
+
15
+ require 'apprepo/setup'
16
+ config = FastlaneCore::Configuration
17
+ available_opts = Apprepo::Options.available_options
18
+ options = config.create(available_opts, options.__hash__)
19
+ Apprepo::Runner.new(options)
20
+ Apprepo::Setup.new.run(options)
21
+ end
22
+ end
23
+ end
24
+
25
+ #####################################################
26
+ # @!group Documentation
27
+ #####################################################
28
+
29
+ def self.description
30
+ 'Initializes Repofile'
31
+ end
32
+
33
+ def self.available_options
34
+ []
35
+ end
36
+
37
+ def self.authors
38
+ ['suculent@me.com']
39
+ end
40
+
41
+ def self.is_supported?(_platform)
42
+ true
43
+ end
44
+ end
45
+ end
46
+ end