Skip to content

Commit

Permalink
Drop rake dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopelosin committed May 30, 2013
1 parent 7872523 commit f37f918
Show file tree
Hide file tree
Showing 16 changed files with 21 additions and 100 deletions.
1 change: 0 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ PATH
activesupport (~> 3.2.13)
json (~> 1.8.0)
nap (~> 0.5.1)
rake (~> 10.0.0)

GEM
remote: http://rubygems.org/
Expand Down
1 change: 0 additions & 1 deletion cocoapods-core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Gem::Specification.new do |s|
s.require_paths = %w{ lib }

s.add_runtime_dependency 'activesupport', '~> 3.2.13'
s.add_runtime_dependency 'rake', '~> 10.0.0' # TEMPORARY SUPPORT
s.add_runtime_dependency 'nap', "~> 0.5.1"
s.add_runtime_dependency "json", "~> 1.8.0"

Expand Down
8 changes: 0 additions & 8 deletions lib/cocoapods-core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ class Informative < PlainInformative; end
#
Spec = Specification

# TODO: Temporary support for FileList
#
if RUBY_VERSION >= '1.9'
require 'rake/file_list'
else
require 'rake'
end
FileList = Rake::FileList
end


6 changes: 1 addition & 5 deletions lib/cocoapods-core/specification/consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,7 @@ def merge_values(attr, existing_value, new_value)
#
def prepare_value(attr, value)
if attr.container == Array
if value.class == Rake::FileList
value = [value]
else
value = [*value].compact
end
value = [*value].compact
end

hook_name = prepare_hook_name(attr)
Expand Down
4 changes: 0 additions & 4 deletions lib/cocoapods-core/specification/dsl/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,6 @@ def validate_for_writing(spec, value)
"#{to_s}. Allowed keys: `#{allowed_keys.inspect}`"
end
end

if defined?(Rake) && value.is_a?(Rake::FileList)
# UI.warn "Rake::FileList is deprecated, use `exclude_files` (#{attrb.name})."
end
end

# @return [Array] the flattened list of the allowed keys for the
Expand Down
8 changes: 2 additions & 6 deletions lib/cocoapods-core/specification/linter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,8 @@ def validate_file_patterns
patterns = patterns.values.flatten(1)
end
patterns.each do |pattern|
if pattern.is_a?(Rake::FileList)
warning "Rake::FileList is deprecated, use `exclude_files` (#{attrb.name})."
else
if pattern.start_with?('/')
error "File patterns must be relative and cannot start with a slash (#{attrb.name})."
end
if pattern.start_with?('/')
error "File patterns must be relative and cannot start with a slash (#{attrb.name})."
end
end
end
Expand Down
26 changes: 1 addition & 25 deletions lib/cocoapods-core/specification/yaml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,9 @@ def to_hash
# without loss of information.
#
def safe_to_hash?
!has_file_list(self) && pre_install_callback.nil? && post_install_callback.nil?
pre_install_callback.nil? && post_install_callback.nil?
end

# @return [Bool] If any of the specs uses the FileList class.
#
def has_file_list(spec)
result = false
all_specs = [ spec, *spec.recursive_subspecs ]
all_specs.each do |current_spec|
current_spec.available_platforms.each do |platform|
consumer = Specification::Consumer.new(current_spec, platform)
attributes = DSL.attributes.values.select(&:file_patterns?)
attributes.each do |attrb|
patterns = consumer.send(attrb.name)
if patterns.is_a?(Hash)
patterns = patterns.values.flatten(1)
end
patterns.each do |pattern|
if pattern.is_a?(Rake::FileList)
result = true
end
end
end
end
end
result
end
end

# Configures a new specification from the given hash.
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/spec-repos/master
Submodule master updated 3127 files
2 changes: 1 addition & 1 deletion spec/source/aggregate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module Pod
end

it "searches the sets specifying a dependency on a subspec" do
dep = Dependency.new('RestKit/JSON')
dep = Dependency.new('RestKit/Network')
set = @sut.search(dep)
set.name.should == 'RestKit'
set.sources.map(&:name).should == %w| master |
Expand Down
2 changes: 1 addition & 1 deletion spec/source_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module Pod
end

it "returns the available versions of a Pod" do
@sut.versions('Reachability').map(&:to_s).should == %w| 3.1.0 3.0.0 2.0.5 2.0.4 |
@sut.versions('Reachability').map(&:to_s).should == %w| 3.1.0 3.0.0 2.0.5 |
end

it "returns the specification for the given name and version" do
Expand Down
17 changes: 0 additions & 17 deletions spec/specification/consumer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -385,23 +385,6 @@ module Pod
@consumer.libraries.should == []
end

it "doesn't triggers the lazy evaluation of Rake::FileList [TEMPORARY]" do
@file_list = Rake::FileList.new('FileList-Resources')
def @file_list.resolve
raise "Error"
end
@subspec.source_files = @file_list
lambda { @subspec_consumer.source_files }.should.not.raise
end

it "doesn't triggers the lazy evaluation of Rake::FileList [TEMPORARY]" do
@file_list = Rake::FileList.new('FileList-Resources')
def @file_list.resolve
raise "Error"
end
@spec.ios.source_files = @file_list
lambda { @subspec_consumer.source_files }.should.not.raise
end
end

#--------------------------------------#
Expand Down
9 changes: 0 additions & 9 deletions spec/specification/linter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,6 @@ def message_should_include(*values)
message.should.include('source_files')
end

xit "announces deprecations for the Rake::FileList [TEMPORARY]" do
@spec.source_files = ::Rake::FileList.new('FileList-Classes')
@linter.lint
message = @linter.results.first.message
message.should.include('FileList')
message.should.include('deprecated')
message.should.include('source_files')
end

it "checks if a specification is empty" do
consumer = Specification::Consumer
consumer.any_instance.stubs(:source_files).returns([])
Expand Down
5 changes: 1 addition & 4 deletions spec/specification/set/presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@ module Pod
@presenter = Spec::Set::Presenter.new(set)
subspecs = @presenter.subspecs
subspecs.last.class.should == Specification
subspecs.map(&:name).should == [
"RestKit/JSON", "RestKit/XML", "RestKit/Network", "RestKit/UI",
"RestKit/ObjectMapping", "RestKit/ObjectMapping/JSON", "RestKit/ObjectMapping/XML",
"RestKit/ObjectMapping/CoreData", "RestKit/Testing"]
subspecs.map(&:name).should == ["RestKit/Core", "RestKit/ObjectMapping", "RestKit/Network", "RestKit/CoreData", "RestKit/Testing", "RestKit/Search", "RestKit/Support"]
end
end

Expand Down
10 changes: 5 additions & 5 deletions spec/specification/set/statistics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ module Pod

it "returns the GitHub watchers of a Pod" do
repo_data = { 'watchers' => 2771 }
GitHub.expects(:repo).with('git://github.com/johnezang/JSONKit.git').returns(repo_data)
GitHub.expects(:repo).with('https://github.com/johnezang/JSONKit.git').returns(repo_data)
@stats.github_watchers(@set).should == 2771
end

it "returns the GitHub forks of a Pod" do
repo_data = { 'forks' => 423 }
GitHub.expects(:repo).with('git://github.com/johnezang/JSONKit.git').returns(repo_data)
GitHub.expects(:repo).with('https://github.com/johnezang/JSONKit.git').returns(repo_data)
@stats.github_forks(@set).should == 423
end

it "returns the time of the last push from GitHub" do
repo_data = { 'pushed_at' => "2012-07-12T17:36:21Z" }
GitHub.expects(:repo).with('git://github.com/johnezang/JSONKit.git').returns(repo_data)
GitHub.expects(:repo).with('https://github.com/johnezang/JSONKit.git').returns(repo_data)
@stats.github_pushed_at(@set).should == Time.parse("2012-07-12T17:36:21Z")
end

Expand All @@ -66,7 +66,7 @@ module Pod

it "uses an in memory cache" do
repo_data = { 'watchers' => 2771 }
GitHub.expects(:repo).with('git://github.com/johnezang/JSONKit.git').returns(repo_data)
GitHub.expects(:repo).with('https://github.com/johnezang/JSONKit.git').returns(repo_data)
@stats.github_watchers(@set).should == 2771
GitHub.expects(:repo).never
@stats.github_watchers(@set).should == 2771
Expand Down Expand Up @@ -121,7 +121,7 @@ module Pod
before do
@repo_fixture = { 'watchers' => 2771, 'forks' => 423, 'pushed_at' => "2012-07-12T17:36:21Z" }
File.open(@cache_file, 'w') { |f| f.write(YAML.dump({ 'JSONKit' => {}})) }
GitHub.expects(:repo).with('git://github.com/johnezang/JSONKit.git').returns(@repo_fixture)
GitHub.expects(:repo).with('https://github.com/johnezang/JSONKit.git').returns(@repo_fixture)
end

it "saves the cache after retrieving GitHub information" do
Expand Down
15 changes: 8 additions & 7 deletions spec/specification/set_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ module Pod
end

it "returns the versions available for the pod ordered from highest to lowest" do
@set.versions.should == %w[1.6 1.3.3 1.3.2 1.3.1 1.3 1.2.3 1.2.2 1.2.1 1.2 1.1 1.0].map { |v| Version.new(v) }
@set.versions.should.all { |v| v.is_a?(Version) }
@set.versions.map(&:to_s).should == %w[1.6.2 1.6.1 1.6 1.3.3 1.3.2 1.3.1 1.3 1.2.3 1.2.2 1.2.1 1.2 1.1 1.0]
end

it "returns the highest version available for the pod" do
@set.highest_version.should == Version.new('1.6')
@set.highest_version.should == Version.new('1.6.2')
end

it "returns the path of the spec with the highest version" do
@set.highest_version_spec_path.should == @source.repo + 'CocoaLumberjack/1.6/CocoaLumberjack.podspec'
@set.highest_version_spec_path.should == @source.repo + 'CocoaLumberjack/1.6.2/CocoaLumberjack.podspec'
end

it "checks if the dependency of the specification is compatible with existing requirements" do
Expand All @@ -47,16 +48,16 @@ module Pod
end

it "returns a hash representation" do
spec_path = @source.repo + 'CocoaLumberjack/1.6/CocoaLumberjack.podspec'
spec_path = @source.repo + 'CocoaLumberjack/1.6.2/CocoaLumberjack.podspec'
@set.to_hash.should == {
"name" => "CocoaLumberjack",
"versions" => {
"master" => [
"1.6", "1.3.3", "1.3.2", "1.3.1", "1.3", "1.2.3", "1.2.2",
"1.2.1", "1.2.0", "1.1.0", "1.0.0"
"1.6.2", "1.6.1", "1.6", "1.3.3", "1.3.2", "1.3.1", "1.3", "1.2.3", "1.2.2",
"1.2.1", "1.2", "1.1", "1.0"
]
},
"highest_version" => "1.6",
"highest_version" => "1.6.2",
"highest_version_spec" => spec_path.to_s
}
end
Expand Down
5 changes: 0 additions & 5 deletions spec/specification/yaml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@ module Pod
@spec.pre_install do; end
@spec.safe_to_hash?.should.be.false
end

it "returns that it is not safe to convert a specification to a hash if it uses the FileList class" do
@spec.source_files = FileList['Classes']
@spec.safe_to_hash?.should.be.false
end
end

#-------------------------------------------------------------------------#
Expand Down

0 comments on commit f37f918

Please sign in to comment.