mmine 0.5.2 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2800c10a54597154aa688b4b33c10777331fef21d30c2241a1ec30eb44649242
4
- data.tar.gz: eece39c70436d2b8c790a8e6aadc68733959542a162403f48dc63bfd63f68797
3
+ metadata.gz: 33b499c4904a55c44b7a6d70387ff4ab3a0c51c52a9b08e5ba807159e58244f4
4
+ data.tar.gz: fa81305dbc1311da2ccbb5ac86624793c7772d3e7dc45df7a8f780e3bdc9c6d9
5
5
  SHA512:
6
- metadata.gz: 10cebf9df3bcc9e60c453f349afb2d9293eef2fdf860b927aa19202b9799cf46331f5336d0b396648e34bc248a6d2dca1e84daa16a3274bd11f5b216d58b7419
7
- data.tar.gz: 41b64be07b953ee6741133263a9db4cf74230dad4e19baf71777d3a30a0b8e8a6880aacea11c1028a6350e6e8dd24820624fa1f1bab81a3af91be437b8438708
6
+ metadata.gz: 1d60185f5677cc973d0954ec5d6d1147b8dc09cc43ef2e0b8ace283c2ddc8d83b920c7ef4e654f63011a1d0fe96f8bb20e04b204c28cf8e94a33859b47729abd
7
+ data.tar.gz: 5096dc3c0b0d4b7cbdeff836e36674797144764c431a1b6683edeec243cdaa5e6682f80647f90a45fd0598a1fc61af960d8dde8c6c11e8209553d61975275e85
data/bin/mmine CHANGED
@@ -8,6 +8,9 @@ first_arg, *the_rest = ARGV
8
8
  options = {}
9
9
  integrate_parse = OptionParser.new do |opts|
10
10
  opts.banner = "Usage: mmine [command] [parameters]"
11
+ opts.on("-a", "--application-code APP_CODE", "Your Push Application Code from Infobip Portal") do |app_code|
12
+ options[:"application-code"] = app_code
13
+ end
11
14
  opts.on("-p", "--project XCODE_PROJECT", "Path for your Xcode project file (.xcodeproj)") do |project|
12
15
  options[:project] = project
13
16
  end
@@ -36,12 +39,12 @@ case first_arg
36
39
  when "integrate"
37
40
  begin
38
41
  integrate_parse.parse!
39
- mandatory = [:"project", :"app-group", :"target"]
42
+ mandatory = [:"application-code",:"project", :"app-group", :"target"]
40
43
  missing = mandatory.select{ |param| options[param].nil? }
41
44
  unless missing.empty?
42
45
  raise OptionParser::MissingArgument.new(missing.join(', '))
43
46
  end
44
- integrator = NotificationExtensionIntegrator.new(options[:project], options[:"app-group"], options[:target], options[:cordova] || false, options[:"swift-version"] || "4.2")
47
+ integrator = NotificationExtensionIntegrator.new(options[:"application-code"], options[:project], options[:"app-group"], options[:target], options[:cordova] || false, options[:"swift-version"] || "4.2")
45
48
  integrator.logger = Logger.new(STDOUT)
46
49
  integrator.logger.formatter = proc do |severity, datetime, progname, msg|
47
50
  "#{severity}: #{msg}\n"
@@ -12,13 +12,14 @@ module Mmine
12
12
  end
13
13
 
14
14
  class NotificationExtensionIntegrator
15
- def initialize(project_file_path, app_group, main_target_name, cordova = false, swift_ver)
15
+ def initialize(application_code, project_file_path, app_group, main_target_name, cordova = false, swift_ver)
16
16
  @project_file_path = project_file_path
17
17
  @app_group = app_group
18
18
  @main_target_name = main_target_name
19
19
  @logger = nil
20
20
  @cordova = cordova
21
21
  @swift_version = swift_ver
22
+ @application_code = application_code
22
23
 
23
24
  @project_dir = Pathname.new(@project_file_path).parent.to_s
24
25
  @project = Xcodeproj::Project.open(@project_file_path)
@@ -113,11 +114,22 @@ class NotificationExtensionIntegrator
113
114
  FileUtils.cp(@extension_source_name_filepath, @extension_code_destination_filepath)
114
115
  filereference = getNotificationExtensionGroupReference().new_reference(@extension_code_destination_filepath)
115
116
  @ne_target.add_file_references([filereference])
117
+
118
+ putApplicationCodeInSourceCode()
116
119
  else
117
120
  @logger.info("Notification extension source code already exists on path: #{@extension_code_destination_filepath}")
118
121
  end
119
122
  end
120
123
 
124
+ def putApplicationCodeInSourceCode
125
+ @application_code
126
+ source_code = File.read(@extension_code_destination_filepath)
127
+ modified_source_code = source_code.gsub(/<# put your Application Code here #>/, "\"#{@application_code}\"")
128
+
129
+ @logger.info("\tWriting application code to source code...")
130
+ File.open(@extension_code_destination_filepath, "w") {|file| file.puts modified_source_code }
131
+ end
132
+
121
133
  def setupDevelopmentTeam
122
134
  setNotificationExtensionBuildSettings('DEVELOPMENT_TEAM', @main_target_build_settings_debug['DEVELOPMENT_TEAM'], @main_target_build_settings_release['DEVELOPMENT_TEAM'])
123
135
  end
data/lib/mmine/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mmine
2
- VERSION = "0.5.2"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Kadochnikov