diff --git a/CHANGELOG.md b/CHANGELOG.md index d9804f72..579dc2ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,9 @@ Due to the removal of legacy code, there are a few breaking changes in this new ### Bug Fixes -_None_ +* Fix `snakeToCamelCase` parameters information in README. + [Liquidsoul](https://github.com/Liquidsoul) + [#45](https://github.com/SwiftGen/StencilSwiftKit/pulls/45) ### Breaking Changes diff --git a/README.md b/README.md index 39d1b782..0b784c63 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ * [String filters](Documentation/filters-strings.md): * `escapeReservedKeywords`: Escape keywods reserved in the Swift language, by wrapping them inside backticks so that the can be used as regular escape keywords in Swift code. * `lowerFirstWord` - * `snakeToCamelCase`: Transforms text from snake_case to camelCase. By default it keeps leading underscores, unless a single optional argument is set to "true", "no" or "0". + * `snakeToCamelCase`: Transforms text from snake_case to camelCase. By default it keeps leading underscores, unless a single optional argument is set to "true", "yes" or "1". * `camelToSnakeCase`: Transforms text from camelCase to snake_case. By default it converts to lower case, unless a single optional argument is set to "false", "no" or "0". * `swiftIdentifier`: Transforms an arbitrary string into a valid Swift identifier (using only valid characters for a Swift identifier as defined in the Swift language reference) * `titlecase` diff --git a/Rakefile b/Rakefile index a62b43b0..c1a20e7a 100644 --- a/Rakefile +++ b/Rakefile @@ -7,5 +7,46 @@ SCHEME_NAME = 'Tests' CONFIGURATION = 'Debug' POD_NAME = 'StencilSwiftKit' +## [ Release a new version ] ################################################## + +namespace :release do + desc 'Create a new release on CocoaPods' + task :new => [:check_versions, 'xcode:test', :cocoapods] + + desc 'Check if all versions from the podspecs and CHANGELOG match' + task :check_versions do + results = [] + + # Check if bundler is installed first, as we'll need it for the cocoapods task (and we prefer to fail early) + `which bundler` + results << Utils.table_result($?.success?, 'Bundler installed', 'Please install bundler using `gem install bundler` and run `bundle install` first.') + + # Extract version from podspec + podspec_version = Utils.podspec_version(POD_NAME) + Utils.table_info("#{POD_NAME}.podspec", podspec_version) + + # Check if version in Podfile.lock matches + podfile_lock_version = Utils.podfile_lock_version(POD_NAME) + results << Utils.table_result(podfile_lock_version == podspec_version, "Podfile.lock", "Please run pod install") + + # Check if entry present in CHANGELOG + changelog_entry = system(%Q{grep -q '^## #{Regexp.quote(podspec_version)}$' CHANGELOG.md}) + results << Utils.table_result(changelog_entry, "CHANGELOG, Entry added", "Please add an entry for #{podspec_version} in CHANGELOG.md") + + changelog_master = system(%q{grep -qi '^## Master' CHANGELOG.md}) + results << Utils.table_result(!changelog_master, "CHANGELOG, No master", 'Please remove entry for master in CHANGELOG') + + exit 1 unless results.all? + + print "Release version #{podspec_version} [Y/n]? " + exit 2 unless (STDIN.gets.chomp == 'Y') + end + + desc "pod trunk push #{POD_NAME} to CocoaPods" + task :cocoapods do + Utils.print_header "Pushing pod to CocoaPods Trunk" + sh "bundle exec pod trunk push #{POD_NAME}.podspec" + end +end task :default => 'xcode:test'