Permalink
Browse files

Merge pull request #512 from CocoaPods/b0.15.0

0.15.0
  • Loading branch information...
2 parents 0cc4fd5 + efba29b commit 3ec34b5a12700b4d6ae6ccadceeee3e2afb39b34 @fabiopelosin fabiopelosin committed Sep 21, 2012
Showing with 779 additions and 512 deletions.
  1. +16 −0 CHANGELOG.md
  2. +1 −1 lib/cocoapods.rb
  3. +4 −19 lib/cocoapods/command.rb
  4. +16 −11 lib/cocoapods/command/list.rb
  5. +0 −61 lib/cocoapods/command/presenter.rb
  6. +0 −118 lib/cocoapods/command/presenter/cocoa_pod.rb
  7. +7 −8 lib/cocoapods/command/push.rb
  8. +21 −19 lib/cocoapods/command/repo.rb
  9. +6 −4 lib/cocoapods/command/search.rb
  10. +15 −14 lib/cocoapods/command/setup.rb
  11. +8 −8 lib/cocoapods/command/spec.rb
  12. +14 −12 lib/cocoapods/dependency.rb
  13. +31 −25 lib/cocoapods/downloader/git.rb
  14. +4 −3 lib/cocoapods/downloader/http.rb
  15. +6 −4 lib/cocoapods/downloader/mercurial.rb
  16. +6 −2 lib/cocoapods/downloader/subversion.rb
  17. +6 −6 lib/cocoapods/executable.rb
  18. +68 −56 lib/cocoapods/installer.rb
  19. +15 −11 lib/cocoapods/installer/target_installer.rb
  20. +25 −16 lib/cocoapods/installer/user_project_integrator.rb
  21. +2 −1 lib/cocoapods/local_pod.rb
  22. +15 −0 lib/cocoapods/podfile.rb
  23. +26 −38 lib/cocoapods/resolver.rb
  24. +48 −32 lib/cocoapods/specification.rb
  25. +215 −0 lib/cocoapods/user_interface.rb
  26. +116 −0 lib/cocoapods/user_interface/ui_pod.rb
  27. +2 −2 spec/functional/command/list_spec.rb
  28. +2 −2 spec/functional/command/push_spec.rb
  29. +2 −2 spec/functional/command/repo_spec.rb
  30. +4 −5 spec/functional/command/setup_spec.rb
  31. +3 −3 spec/functional/command/spec_spec.rb
  32. +10 −10 spec/functional/{command/presenter_spec.rb → user_interface_spec.rb}
  33. +16 −0 spec/integration_spec.rb
  34. +1 −0 spec/spec_helper.rb
  35. +15 −9 spec/spec_helper/command.rb
  36. +13 −0 spec/spec_helper/user_interface.rb
  37. +10 −0 spec/unit/podfile_spec.rb
  38. +10 −10 spec/unit/specification_spec.rb
View
@@ -1,3 +1,19 @@
+## 0.15.0 (unreleased)
+
+[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/master...b0.15.0)
+
+###### Enhancements
+
+- Added a pre install hook to the Podfile and to root specifications.
+ [#486](https://github.com/CocoaPods/CocoaPods/issues/486)
+- Support for `header_mappings_dir` attribute in subspecs.
+- Refactored UI.
+
+###### Bug fixes
+
+- Improvements to the git cache that should be more robust.
+ [#517](https://github.com/CocoaPods/CocoaPods/issues/517)
+
## Master
[CocoaPods](https://github.com/CocoaPods/CocoaPods/compare/0.14.0...master)
View
@@ -7,7 +7,6 @@
#
# E.g. https://github.com/CocoaPods/CocoaPods/issues/398
unless Gem::Version::Requirement.new('>= 1.4.0').satisfied_by?(Gem::Version.new(Gem::VERSION))
- require 'colored'
STDERR.puts "Your RubyGems version (#{Gem::VERSION}) is too old, please update with: `gem update --system`".red
exit 1
end
@@ -41,6 +40,7 @@ def message
autoload :Source, 'cocoapods/source'
autoload :Spec, 'cocoapods/specification'
autoload :Specification, 'cocoapods/specification'
+ autoload :UI, 'cocoapods/user_interface'
autoload :Version, 'cocoapods/version'
autoload :Pathname, 'pathname'
View
@@ -7,7 +7,6 @@ class Command
autoload :List, 'cocoapods/command/list'
autoload :Linter, 'cocoapods/command/linter'
autoload :Outdated, 'cocoapods/command/outdated'
- autoload :Presenter, 'cocoapods/command/presenter'
autoload :Push, 'cocoapods/command/push'
autoload :Repo, 'cocoapods/command/repo'
autoload :Search, 'cocoapods/command/search'
@@ -74,6 +73,7 @@ def self.run(*argv)
Setup.new(ARGV.new).run_if_needed
end
sub_command.run
+ UI.puts
rescue Interrupt
puts "[!] Cancelled".red
@@ -145,24 +145,9 @@ def verify_lockfile_exists!
def update_spec_repos_if_necessary!
if @update_repo
- print_title 'Updating Spec Repositories', true
- Repo.new(ARGV.new(["update"])).run
- end
- end
-
- def print_title(title, only_verbose = true)
- if config.verbose?
- puts "\n" + title.yellow
- elsif !config.silent? && !only_verbose
- puts title
- end
- end
-
- def print_subtitle(title, only_verbose = false)
- if config.verbose?
- puts "\n" + title.green
- elsif !config.silent? && !only_verbose
- puts title
+ UI.section 'Updating Spec Repositories' do
+ Repo.new(ARGV.new(["update"])).run
+ end
end
end
end
@@ -14,23 +14,26 @@ def self.banner
end
def self.options
- [["--update", "Run `pod repo update` before listing"]].concat(Presenter.options).concat(super)
+ [[
+ "--update", "Run `pod repo update` before listing",
+ "--stats", "Show additional stats (like GitHub watchers and forks)"
+ ]].concat(super)
end
extend Executable
executable :git
def initialize(argv)
- @update = argv.option('--update')
- @new = argv.option('new')
- @presenter = Presenter.new(argv)
+ @update = argv.option('--update')
+ @stats = argv.option('--stats')
+ @new = argv.option('new')
super unless argv.empty?
end
def list_all
sets = Source.all_sets
- sets.each {|s| puts @presenter.describe(s)}
- puts "\n#{sets.count} pods were found"
+ sets.each { |set| UI.pod(set, :name) }
+ UI.puts "\n#{sets.count} pods were found"
end
def list_new
@@ -53,16 +56,18 @@ def list_new
days.reverse.each do |d|
sets = groups[d]
next unless sets
- puts "\nPods added in the last #{d == 1 ? 'day' : "#{d} days"}".yellow
- sets.sort_by {|s| creation_dates[s.name]}.each {|s| puts @presenter.describe(s)}
+ UI.section("\nPods added in the last #{"day".pluralize(d)}".yellow) do
+ sorted = sets.sort_by {|s| creation_dates[s.name]}
+ sorted.each { |set| UI.pod(set, (@stats ? :stats : :name)) }
+ end
end
end
def run
- puts "\nUpdating Spec Repositories\n".yellow if @update && config.verbose?
- Repo.new(ARGV.new(["update"])).run if @update
+ UI.section("\nUpdating Spec Repositories\n".yellow) do
+ Repo.new(ARGV.new(["update"])).run
+ end if @update && config.verbose?
@new ? list_new : list_all
- puts
end
end
end
@@ -1,61 +0,0 @@
-module Pod
- class Command
- class Presenter
- def self.options
- [["--stats", "Show additional stats (like GitHub watchers and forks)"]]
- end
-
- autoload :CocoaPod, 'cocoapods/command/presenter/cocoa_pod'
-
- def initialize(argv)
- @stats = argv.option('--stats')
- end
-
- def render(array)
- result = "\n"
- seats.each {|s| puts describe(s)}
- result
- end
-
- def describe(set)
- pod = CocoaPod.new(set)
- result = "\n--> #{pod.name} (#{pod.versions})\n".green
- result << wrap_string(pod.summary)
- result << detail('Homepage', pod.homepage)
- result << detail('Source', pod.source_url)
- if @stats
- result << detail('Pushed', pod.github_last_activity)
- result << detail('Authors', pod.authors) if pod.authors =~ /,/
- result << detail('Author', pod.authors) if pod.authors !~ /,/
- result << detail('License', pod.license)
- result << detail('Platform', pod.platform)
- result << detail('Watchers', pod.github_watchers)
- result << detail('Forks', pod.github_forks)
- end
- result << detail('Sub specs', pod.subspecs)
- result
- end
-
- private
-
- # adapted from http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
- def wrap_string(txt, col = 80, indentation = 4)
- indent = ' ' * indentation
- txt.strip.gsub(/(.{1,#{col}})( +|$)\n?|(.{#{col}})/, indent + "\\1\\3\n")
- end
-
- def detail(title, value)
- return '' if !value
- ''.tap do |t|
- t << " - #{title}:".ljust(16)
- if value.class == Array
- separator = "\n - "
- t << separator << value.join(separator)
- else
- t << value.to_s << "\n"
- end
- end
- end
- end
- end
-end
@@ -1,118 +0,0 @@
-require 'active_support/core_ext/array/conversions'
-
-module Pod
- class Command
- class Presenter
- class CocoaPod
- attr_accessor :set
-
- def initialize(set)
- @set = set
- end
-
- # set information
- def name
- @set.name
- end
-
- def version
- @set.versions.last
- end
-
- def versions
- @set.versions.reverse.join(", ")
- end
-
- # specification information
- def spec
- @set.specification
- end
-
- def authors
- spec.authors.keys.to_sentence
- end
-
- def homepage
- spec.homepage
- end
-
- def description
- spec.description
- end
-
- def summary
- spec.summary
- end
-
- def source_url
- spec.source.reject {|k,_| k == :commit || k == :tag }.values.first
- end
-
- def platform
- spec.available_platforms.sort { |a,b| a.to_s.downcase <=> b.to_s.downcase }.join(' - ')
- end
-
- def license
- spec.license[:type] if spec.license
- end
-
- # will return array of all subspecs (recursevly) or nil
- def subspecs
- (spec.recursive_subspecs.any? && spec.recursive_subspecs) || nil
- end
-
- # Statistics information
- def creation_date
- Pod::Specification::Statistics.instance.creation_date(@set)
- end
-
- def github_watchers
- Pod::Specification::Statistics.instance.github_watchers(@set)
- end
-
- def github_forks
- Pod::Specification::Statistics.instance.github_forks(@set)
- end
-
- def github_last_activity
- distance_from_now_in_words(Pod::Specification::Statistics.instance.github_pushed_at(@set))
- end
-
- def ==(other)
- self.class === other && @set == other.set
- end
-
- def eql?(other)
- self.class === other && name.eql?(other.name)
- end
-
- def hash
- name.hash
- end
-
- private
-
- def distance_from_now_in_words(from_time)
- return nil unless from_time
- from_time = Time.parse(from_time)
- to_time = Time.now
- distance_in_days = (((to_time - from_time).abs)/60/60/24).round
-
- case distance_in_days
- when 0..7
- "less than a week ago"
- when 8..29
- "#{distance_in_days} days ago"
- when 30..45
- "1 month ago"
- when 46..365
- "#{(distance_in_days.to_f / 30).round} months ago"
- else
- "more than a year ago"
- end
- end
- end
- end
- end
-end
-
@@ -36,21 +36,20 @@ def run
update_repo
add_specs_to_repo
push_repo unless @local_only
- puts
end
private
def update_repo
- puts "Updating the `#{@repo}' repo\n".yellow unless config.silent
+ UI.puts "Updating the `#{@repo}' repo\n".yellow unless config.silent
# show the output of git even if not verbose
# TODO: use the `git!' and find a way to show the output in realtime.
- Dir.chdir(repo_dir) { puts `git pull 2>&1` }
+ Dir.chdir(repo_dir) { UI.puts `git pull 2>&1` }
end
def push_repo
- puts "\nPushing the `#{@repo}' repo\n".yellow unless config.silent
- Dir.chdir(repo_dir) { puts `git push 2>&1` }
+ UI.puts "\nPushing the `#{@repo}' repo\n".yellow unless config.silent
+ Dir.chdir(repo_dir) { UI.puts `git push 2>&1` }
end
def repo_dir
@@ -72,7 +71,7 @@ def podspec_files
end
def validate_podspec_files
- puts "\nValidating specs".yellow unless config.silent
+ UI.puts "\nValidating specs".yellow unless config.silent
lint_argv = ["lint"]
lint_argv << "--only-errors" if @allow_warnings
lint_argv << "--silent" if config.silent
@@ -83,7 +82,7 @@ def validate_podspec_files
end
def add_specs_to_repo
- puts "\nAdding the specs to the #{@repo} repo\n".yellow unless config.silent
+ UI.puts "\nAdding the specs to the #{@repo} repo\n".yellow unless config.silent
podspec_files.each do |spec_file|
spec = Pod::Specification.from_file(spec_file)
output_path = File.join(repo_dir, spec.name, spec.version.to_s)
@@ -94,7 +93,7 @@ def add_specs_to_repo
else
message = "[Add] #{spec}"
end
- puts " - #{message}" unless config.silent
+ UI.puts " - #{message}" unless config.silent
FileUtils.mkdir_p(output_path)
FileUtils.cp(Pathname.new(spec.name+'.podspec'), output_path)
Oops, something went wrong.

0 comments on commit 3ec34b5

Please sign in to comment.