From f631534324d67bf86736e23dd2c55069f066618c Mon Sep 17 00:00:00 2001 From: emawby Date: Fri, 14 May 2021 10:55:12 -0700 Subject: [PATCH] moving templates to tmpl directory structure minor update to DEVELOPING.md --- DEVELOPING.md | 2 +- lib/osproject_ios.rb | 11 ++++++++--- {lib => tmpl/iOS}/Info.plist | 0 {lib => tmpl/iOS/objc}/NotificationService.h | 0 {lib => tmpl/iOS/objc}/NotificationService.m | 0 {lib => tmpl/iOS/swift}/NotificationService.swift | 0 6 files changed, 9 insertions(+), 4 deletions(-) rename {lib => tmpl/iOS}/Info.plist (100%) rename {lib => tmpl/iOS/objc}/NotificationService.h (100%) rename {lib => tmpl/iOS/objc}/NotificationService.m (100%) rename {lib => tmpl/iOS/swift}/NotificationService.swift (100%) diff --git a/DEVELOPING.md b/DEVELOPING.md index abaa3b7..f97a334 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -11,7 +11,7 @@ projectname. For example, `spec/samples/googleandroid/kotlin/bottomnav`. The primary tests are located in `spec/osproject_spec.rb`, which contains the autoloading platform test. Additional SDK sample tests are defined in this file. -Using RSpec, you can run test cases using `RSpec spec/osproject_spec.rb`. Note that the require paths are resolved according to the dir you're in when you're executing the code so running `RSpec spec/osproject_spec.rb` from inside the spec folder will not work. +Using RSpec, you can run test cases using `bin/rspec spec/osproject_spec.rb`. Note that the require paths are resolved according to the dir you're in when you're executing the code so running `bin/rspec spec/osproject_spec.rb` from inside the spec folder will not work. ## CLI CLI Behavior and business logic tests are located in `spec/oscli.rb`. diff --git a/lib/osproject_ios.rb b/lib/osproject_ios.rb index d318dc0..038720a 100644 --- a/lib/osproject_ios.rb +++ b/lib/osproject_ios.rb @@ -14,6 +14,11 @@ class OSProject::IOS < OSProject attr_accessor :target_name + SWIFT_NSE_PATH = 'tmpl/iOS/swift/NotificationService.swift' + OBJC_NSE_H_PATH = 'tmpl/iOS/objc/NotificationService.h' + OBJC_NSE_M_PATH = 'tmpl/iOS/objc/NotificationService.m' + NSE_INFO_PLIST_PATH = 'tmpl/iOS/Info.plist' + def initialize(dir, lang, os_app_id) @has_sdk = false super("ios", dir, lang, os_app_id) @@ -63,16 +68,16 @@ def _create_nse() end if lang == :swift - FileUtils.cp_r('lib/NotificationService.swift', nsePath) + FileUtils.cp_r(SWIFT_NSE_PATH, nsePath) assets = self.nse_group.new_reference("OneSignalNotificationServiceExtension/NotificationService.swift") else - FileUtils.cp_r %w(lib/NotificationService.h lib/NotificationService.m), nsePath + FileUtils.cp_r [OBJC_NSE_H_PATH, OBJC_NSE_M_PATH], nsePath self.nse_group.new_reference("OneSignalNotificationServiceExtension/NotificationService.h") assets = self.nse_group.new_reference("OneSignalNotificationServiceExtension/NotificationService.m") end # copy the Info.plist file into the NSE group - FileUtils.cp_r('lib/Info.plist', nsePath) + FileUtils.cp_r(NSE_INFO_PLIST_PATH, nsePath) plist_reference = self.nse_group.new_reference("OneSignalNotificationServiceExtension/Info.plist") # Create NSE target diff --git a/lib/Info.plist b/tmpl/iOS/Info.plist similarity index 100% rename from lib/Info.plist rename to tmpl/iOS/Info.plist diff --git a/lib/NotificationService.h b/tmpl/iOS/objc/NotificationService.h similarity index 100% rename from lib/NotificationService.h rename to tmpl/iOS/objc/NotificationService.h diff --git a/lib/NotificationService.m b/tmpl/iOS/objc/NotificationService.m similarity index 100% rename from lib/NotificationService.m rename to tmpl/iOS/objc/NotificationService.m diff --git a/lib/NotificationService.swift b/tmpl/iOS/swift/NotificationService.swift similarity index 100% rename from lib/NotificationService.swift rename to tmpl/iOS/swift/NotificationService.swift