Skip to content

Commit

Permalink
supported cocoapods
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryo Aoyama authored and Ryo Aoyama committed Jun 1, 2014
1 parent 93a9b60 commit db376cd
Show file tree
Hide file tree
Showing 45 changed files with 191 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
2A3D05991939A145004220E0 /* 7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 2A3D05851939A145004220E0 /* 7.jpg */; };
2A3D059A1939A145004220E0 /* 8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 2A3D05861939A145004220E0 /* 8.jpg */; };
2A3D059B1939A145004220E0 /* 9.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 2A3D05871939A145004220E0 /* 9.jpg */; };
2A6EBA65193B204A00450C43 /* RACollectionViewReorderableTripletLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A6EBA62193B204A00450C43 /* RACollectionViewReorderableTripletLayout.m */; };
2A6EBA66193B204A00450C43 /* RACollectionViewTripletLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A6EBA64193B204A00450C43 /* RACollectionViewTripletLayout.m */; };
2AC2131F19396ED700521FB9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AC2131E19396ED700521FB9 /* Foundation.framework */; };
2AC2132119396ED700521FB9 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AC2132019396ED700521FB9 /* CoreGraphics.framework */; };
2AC2132319396ED700521FB9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2AC2132219396ED700521FB9 /* UIKit.framework */; };
Expand All @@ -42,8 +44,6 @@
2AC2135B19396EFD00521FB9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2AC2135519396EFD00521FB9 /* Main.storyboard */; };
2AC2135C19396EFD00521FB9 /* RAViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AC2135719396EFD00521FB9 /* RAViewController.m */; };
2AC2135D19396EFD00521FB9 /* RACollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AC2135919396EFD00521FB9 /* RACollectionViewCell.m */; };
2AC2136319396F5E00521FB9 /* RACollectionViewReorderableTripletLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AC2136019396F5E00521FB9 /* RACollectionViewReorderableTripletLayout.m */; };
2AC2136419396F5E00521FB9 /* RACollectionViewTripletLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 2AC2136219396F5E00521FB9 /* RACollectionViewTripletLayout.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -77,6 +77,10 @@
2A3D05851939A145004220E0 /* 7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 7.jpg; sourceTree = "<group>"; };
2A3D05861939A145004220E0 /* 8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 8.jpg; sourceTree = "<group>"; };
2A3D05871939A145004220E0 /* 9.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 9.jpg; sourceTree = "<group>"; };
2A6EBA61193B204A00450C43 /* RACollectionViewReorderableTripletLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACollectionViewReorderableTripletLayout.h; sourceTree = "<group>"; };
2A6EBA62193B204A00450C43 /* RACollectionViewReorderableTripletLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACollectionViewReorderableTripletLayout.m; sourceTree = "<group>"; };
2A6EBA63193B204A00450C43 /* RACollectionViewTripletLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACollectionViewTripletLayout.h; sourceTree = "<group>"; };
2A6EBA64193B204A00450C43 /* RACollectionViewTripletLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACollectionViewTripletLayout.m; sourceTree = "<group>"; };
2AC2131B19396ED700521FB9 /* RACollectionViewReorderableTripletLayout-Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "RACollectionViewReorderableTripletLayout-Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; };
2AC2131E19396ED700521FB9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
2AC2132019396ED700521FB9 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
Expand All @@ -98,10 +102,6 @@
2AC2135719396EFD00521FB9 /* RAViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RAViewController.m; sourceTree = "<group>"; };
2AC2135819396EFD00521FB9 /* RACollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACollectionViewCell.h; sourceTree = "<group>"; };
2AC2135919396EFD00521FB9 /* RACollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACollectionViewCell.m; sourceTree = "<group>"; };
2AC2135F19396F5E00521FB9 /* RACollectionViewReorderableTripletLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACollectionViewReorderableTripletLayout.h; sourceTree = "<group>"; };
2AC2136019396F5E00521FB9 /* RACollectionViewReorderableTripletLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACollectionViewReorderableTripletLayout.m; sourceTree = "<group>"; };
2AC2136119396F5E00521FB9 /* RACollectionViewTripletLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RACollectionViewTripletLayout.h; sourceTree = "<group>"; };
2AC2136219396F5E00521FB9 /* RACollectionViewTripletLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RACollectionViewTripletLayout.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -155,10 +155,22 @@
path = photos;
sourceTree = "<group>";
};
2A6EBA60193B204A00450C43 /* RACollectionViewReorderableTripletLayout */ = {
isa = PBXGroup;
children = (
2A6EBA61193B204A00450C43 /* RACollectionViewReorderableTripletLayout.h */,
2A6EBA62193B204A00450C43 /* RACollectionViewReorderableTripletLayout.m */,
2A6EBA63193B204A00450C43 /* RACollectionViewTripletLayout.h */,
2A6EBA64193B204A00450C43 /* RACollectionViewTripletLayout.m */,
);
name = RACollectionViewReorderableTripletLayout;
path = ../RACollectionViewReorderableTripletLayout;
sourceTree = "<group>";
};
2AC2131219396ED700521FB9 = {
isa = PBXGroup;
children = (
2AC2135E19396F5E00521FB9 /* RACollectionReorderableViewTripletLayout */,
2A6EBA60193B204A00450C43 /* RACollectionViewReorderableTripletLayout */,
2AC2132419396ED700521FB9 /* RACollectionViewReorderableTripletLayout-Demo */,
2AC2134319396ED700521FB9 /* RACollectionViewReorderableTripletLayout-DemoTests */,
2AC2131D19396ED700521FB9 /* Frameworks */,
Expand Down Expand Up @@ -232,17 +244,6 @@
name = "Supporting Files";
sourceTree = "<group>";
};
2AC2135E19396F5E00521FB9 /* RACollectionReorderableViewTripletLayout */ = {
isa = PBXGroup;
children = (
2AC2135F19396F5E00521FB9 /* RACollectionViewReorderableTripletLayout.h */,
2AC2136019396F5E00521FB9 /* RACollectionViewReorderableTripletLayout.m */,
2AC2136119396F5E00521FB9 /* RACollectionViewTripletLayout.h */,
2AC2136219396F5E00521FB9 /* RACollectionViewTripletLayout.m */,
);
path = RACollectionReorderableViewTripletLayout;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -363,10 +364,10 @@
files = (
2AC2132B19396ED700521FB9 /* main.m in Sources */,
2AC2135A19396EFD00521FB9 /* RAAppDelegate.m in Sources */,
2AC2136419396F5E00521FB9 /* RACollectionViewTripletLayout.m in Sources */,
2AC2136319396F5E00521FB9 /* RACollectionViewReorderableTripletLayout.m in Sources */,
2AC2135C19396EFD00521FB9 /* RAViewController.m in Sources */,
2AC2135D19396EFD00521FB9 /* RACollectionViewCell.m in Sources */,
2A6EBA66193B204A00450C43 /* RACollectionViewTripletLayout.m in Sources */,
2A6EBA65193B204A00450C43 /* RACollectionViewReorderableTripletLayout.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
File renamed without changes.

This file was deleted.

Binary file not shown.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ RACollectionViewReorderableTripletLayout
![animated gif](https://github.com/ra1028/RACollectionViewReorderableTripletLayout/raw/master/Assets/animation.gif)


## Installation

RACollectionViewReorderableTribletLayout is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

pod "RACollectionViewReorderableTribletLayout"


## Usage
Add RACollectionViewReorderableTripletLayout to your collection view, then set delegate and datasource.
```Objective-C
Expand Down Expand Up @@ -55,4 +63,5 @@ Add RACollectionViewReorderableTripletLayout to your collection view, then set d


## License
RACollectionViewReorderableTripletLayout is released under the MIT License, see LICENSE.txt.
RACollectionViewReorderableTribletLayout is available under the MIT license. See the LICENSE file for more info.

160 changes: 160 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
desc "Runs the specs [EMPTY]"
task :spec do
# Provide your own implementation
end

task :version do
git_remotes = `git remote`.strip.split("\n")

if git_remotes.count > 0
puts "-- fetching version number from github"
sh 'git fetch'

remote_version = remote_spec_version
end

if remote_version.nil?
puts "There is no current released version. You're about to release a new Pod."
version = "0.0.1"
else
puts "The current released version of your pod is " +
remote_spec_version.to_s()
version = suggested_version_number
end

puts "Enter the version you want to release (" + version + ") "
new_version_number = $stdin.gets.strip
if new_version_number == ""
new_version_number = version
end

replace_version_number(new_version_number)
end

desc "Release a new version of the Pod (append repo=name to push to a private spec repo)"
task :release do
# Allow override of spec repo name using `repo=private` after task name
repo = ENV["repo"] || "master"

puts "* Running version"
sh "rake version"

unless ENV['SKIP_CHECKS']
if `git symbolic-ref HEAD 2>/dev/null`.strip.split('/').last != 'master'
$stderr.puts "[!] You need to be on the `master' branch in order to be able to do a release."
exit 1
end

if `git tag`.strip.split("\n").include?(spec_version)
$stderr.puts "[!] A tag for version `#{spec_version}' already exists. Change the version in the podspec"
exit 1
end

puts "You are about to release `#{spec_version}`, is that correct? [y/n]"
exit if $stdin.gets.strip.downcase != 'y'
end

puts "* Running specs"
sh "rake spec"

puts "* Linting the podspec"
sh "pod lib lint"

# Then release
sh "git commit #{podspec_path} CHANGELOG.md -m 'Release #{spec_version}' --allow-empty"
sh "git tag -a #{spec_version} -m 'Release #{spec_version}'"
sh "git push origin master"
sh "git push origin --tags"
if repo == "master"
sh "pod trunk push #{podspec_path}"
else
sh "pod repo push #{repo} #{podspec_path}"
end
end

# @return [Pod::Version] The version as reported by the Podspec.
#
def spec_version
require 'cocoapods'
spec = Pod::Specification.from_file(podspec_path)
spec.version
end

# @return [Pod::Version] The version as reported by the Podspec from remote.
#
def remote_spec_version
require 'cocoapods-core'

if spec_file_exist_on_remote?
remote_spec = eval(`git show origin/master:#{podspec_path}`)
remote_spec.version
else
nil
end
end

# @return [Bool] If the remote repository has a copy of the podpesc file or not.
#
def spec_file_exist_on_remote?
test_condition = `if git rev-parse --verify --quiet origin/master:#{podspec_path} >/dev/null;
then
echo 'true'
else
echo 'false'
fi`

'true' == test_condition.strip
end

# @return [String] The relative path of the Podspec.
#
def podspec_path
podspecs = Dir.glob('*.podspec')
if podspecs.count == 1
podspecs.first
else
raise "Could not select a podspec"
end
end

# @return [String] The suggested version number based on the local and remote
# version numbers.
#
def suggested_version_number
if spec_version != remote_spec_version
spec_version.to_s()
else
next_version(spec_version).to_s()
end
end

# @param [Pod::Version] version
# the version for which you need the next version
#
# @note It is computed by bumping the last component of
# the version string by 1.
#
# @return [Pod::Version] The version that comes next after
# the version supplied.
#
def next_version(version)
version_components = version.to_s().split(".");
last = (version_components.last.to_i() + 1).to_s
version_components[-1] = last
Pod::Version.new(version_components.join("."))
end

# @param [String] new_version_number
# the new version number
#
# @note This methods replaces the version number in the podspec file
# with a new version number.
#
# @return void
#
def replace_version_number(new_version_number)
text = File.read(podspec_path)
text.gsub!(/(s.version( )*= ")#{spec_version}(")/,
"\\1#{new_version_number}\\3")
File.open(podspec_path, "w") { |file| file.puts text }
end

0 comments on commit db376cd

Please sign in to comment.