Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize the repo and fix CI + PR flow #189

Merged
merged 35 commits into from
Dec 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
865110d
update README.md
igor-makarov Dec 20, 2018
c4d0160
fix gemspec to include xcodeproj 1.3.0
igor-makarov Dec 22, 2018
e5d97c4
Add Gemfile*.lock to .gitignore
igor-makarov Dec 22, 2018
27f57bb
change rubies
igor-makarov Dec 22, 2018
6eaa759
do we need bundler version?
igor-makarov Dec 22, 2018
ee44b93
remove defunct ruby version
igor-makarov Dec 22, 2018
decb461
clean rubies
igor-makarov Dec 22, 2018
374c093
remove two tests that aren't actually testing Xcake
igor-makarov Dec 22, 2018
bb23ff5
fix rubocop running
igor-makarov Dec 22, 2018
e5ec7f6
rubocop all files
igor-makarov Dec 22, 2018
319cfe2
fix rubocop rules
igor-makarov Dec 22, 2018
6cb1f1e
rubocop autocorrect
igor-makarov Dec 22, 2018
8d3a27b
rubocop excludes
igor-makarov Dec 22, 2018
847404a
fix test
igor-makarov Dec 22, 2018
41e21f0
add simplecov
igor-makarov Dec 22, 2018
92bd8e1
[temp] disable rubocop
igor-makarov Dec 22, 2018
7ade8a3
fix huge stacktraces when running rake
igor-makarov Dec 22, 2018
c235abf
add tests for default accessors
igor-makarov Dec 22, 2018
43db0b8
fix test
igor-makarov Dec 22, 2018
7b68035
fix rubocop semantic issues
igor-makarov Dec 22, 2018
d0edb95
add gemspec lint
igor-makarov Dec 22, 2018
bc473a6
fix rubocop indent fails
igor-makarov Dec 22, 2018
9ad4dee
require pry in non-CI test run
igor-makarov Dec 22, 2018
300d3ec
update hound ci
igor-makarov Dec 22, 2018
c5f0e3c
reduce number of CI jobs
igor-makarov Dec 22, 2018
940fe52
add more debug deps
igor-makarov Dec 22, 2018
2e3d0c9
updated README
igor-makarov Dec 22, 2018
0ff3199
cleanup unnecessary bin files
igor-makarov Dec 22, 2018
04a8e04
modify Travis config so that linter runs in a separate job + change t…
igor-makarov Dec 22, 2018
0b29387
fix Travis CI config
igor-makarov Dec 22, 2018
d1f002c
Rubocop config fixes
igor-makarov Dec 22, 2018
74660d7
fix tests
igor-makarov Dec 22, 2018
c62eb9c
cleanup Rubocop rule list
igor-makarov Dec 22, 2018
b85c1d8
Rubocop string literals
igor-makarov Dec 22, 2018
83fdea3
Rubocop: enforce guard clauses
igor-makarov Dec 22, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Gemfile*.lock
*.gem
*.rbc
/.config
Expand Down
2 changes: 1 addition & 1 deletion hound.yml → .hound.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ruby:
rubocop:
config_file: .rubocop.yml
60 changes: 60 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
AllCops:
Include:
- '**/*.rb'
- '**/*.gemspec'

Gemspec/RequiredRubyVersion:
Enabled: false

Lint/UnusedMethodArgument:
AutoCorrect: false

Style/EmptyMethod:
EnforcedStyle: expanded

Metrics/BlockLength:
Exclude:
- 'spec/**/*'

Metrics/ModuleLength:
Exclude:
- 'spec/**/*'

Metrics/AbcSize:
Max: 30
Exclude:
- 'lib/xcake/ui.rb'

Metrics/LineLength:
Max: 130

Metrics/ParameterLists:
Max: 6

# Offense count: 19
Style/Documentation:
Enabled: false

Style/SymbolArray:
EnforcedStyle: brackets

Style/PercentLiteralDelimiters:
PreferredDelimiters:
default: ()
'%w': ()

Style/ClassCheck:
EnforcedStyle: kind_of?

Style/RaiseArgs:
EnforcedStyle: exploded

Naming/FileName:
Exclude:
- '**/PBX*.rb'

Metrics/MethodLength:
Max: 25
Exclude:
- 'lib/xcake/ui.rb'

23 changes: 13 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
os:
- osx
language: ruby

matrix:
include:
- rvm: 2.5.0
env: XCAKE_CI_TASKS=LINT
git:
submodules: false

env: XCAKE_CI_TASKS=TEST

gemfile:
- gemfiles/Gemfile.xcodeproj-1.3.x
- gemfiles/Gemfile.xcodeproj-1.4.x
- Gemfile
- gemfiles/Gemfile.xcodeproj-edge
rvm:
# The latest ruby version
# - 2.4.0 # Doesn't build :()
- 2.3.1
# OS X 10.9.5-10.10.0 (2.0.0-p481)
- 2.0.0-p481
# OS X 10.9.3-10.9.4
- 2.0.0-p451
before_install: gem install bundler -v 1.10.6
- 2.5.0
- ruby-2.0.0-p648
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in xcake.gemspec
gemspec
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
# Xcake
[![Gem](https://img.shields.io/gem/v/xcake.svg)](https://rubygems.org/gems/xcake)
[![Twitter: @jcampbell_05](https://img.shields.io/badge/contact-@jcampbell_05-blue.svg?style=flat)](https://twitter.com/jcampbell_05)
[![Twitter: @igormaka](https://img.shields.io/badge/contact-@igormaka-blue.svg?style=flat)](https://twitter.com/igormaka)
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/fastlane/fastlane/blob/master/LICENSE)
[![Build Status](https://img.shields.io/travis/jcampbell05/xcake/master.svg?style=flat)](https://travis-ci.org/jcampbell05/xcake)
[![Test Coverage](https://img.shields.io/coveralls/jcampbell05/xcake/master.svg)](https://coveralls.io/github/jcampbell05/xcake)
[![Build Status](https://img.shields.io/travis/igor-makarov/xcake/master.svg?style=flat)](https://travis-ci.org/igor-makarov/xcake)
[![Test Coverage](https://img.shields.io/coveralls/igor-makarov/xcake/master.svg)](https://coveralls.io/github/igor-makarov/xcake)
[![Gem](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-xcake)

### === No Longer Maintained === ###
### Back under new management!

It's been 4 years since Xcake was first released and the iOS development scene has changed.
We now have Fastlane, Swift and almost everyone uses Cocoapods. On top of that I have less time to
dedicate to this tool than before.
The original author of Xcake, [James Campbell](https://github.com/jcampbell05) has decided to move on to other endeavors.
[Igor Makarov](https://github.com/igor-makarov) has volunteered to step in as the main maintainer, both because of his reliance on the gem for work, and because of general aversion to `.pbxproj` files.

Luckily whilst Xcake once stood alone, there are noe finally some very strong alternatives.
### Cakefile — A Podfile for your main project!

For those who were interested in using or are using xcake then I reccomend taking a look at https://github.com/yonaskolb/XcodeGen
Describe your project in a simple text file: your `Cakefile`.
Xcake generates your project based on this file including importing all of your files and creating groups and targets to match the file hierarchy.

### Describe Xcode project in a human readable format and (re)generate one on demand.
This is perfect for working in teams or with CocoaPods as it reduces merge conflicts, makes it easy to modify settings and allows you to create a clean project anytime you need to.

You describe your project in a simple text file: your `Cakefile`.
Xcake creates your project based on this including importing all of your files and creating groups
to match the file hiearchy.
Isn't this just like Generamba or Crafter?
No, these tools are for scafolding an initial project structure to get you started (creating folder structure, git repo etc.).
Xcake will not create a folder structure, but will generate a project from it, and will continue to generate it each time you want it. Added some files? Generate! Renamed a folder? Generate!
Sick of seeing `.pbxproj` diffs in git? Add your project to `.gitignore` and generate it on checkout.

This is perfect for working in teams or with cocoapods as it reduces conflicts,
makes it easy to modify settings and allows you to create a clean project anytime you need to.

Isn't this just like liftoff, generamba or crafter? No these tools are for scafolding a whole project structure to get you started (Creating folder structure, git repo etc.). However xcake is not for this, xcake is just for generating a xcodeproject.
Get in contact with the developer on Twitter: [@igormaka](https://twitter.com/igormaka).

Get in contact with the developer on Twitter: [@jcampbell_05](https://twitter.com/jcampbell_05)
PBX delendare est.

-------
<p align="center">
Expand Down
45 changes: 43 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,47 @@
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

RSpec::Core::RakeTask.new(:spec)
ALL_TASKS = 'TEST LINT'.freeze
tasks = ENV.fetch('XCAKE_CI_TASKS') { ALL_TASKS }.upcase.split(/\s+/)

task default: :spec
task :spec do
begin
igor-makarov marked this conversation as resolved.
Show resolved Hide resolved
sh "bundle exec rspec #{specs('**')}"
rescue RuntimeError
STDERR.puts "Tests failed!"
exit 1
end
end

RuboCop::RakeTask.new

task :all do
if tasks.include?('TEST')
title 'Running tests'
Rake::Task['spec'].invoke
end

if tasks.include?('LINT')
title 'Checking code style'
Rake::Task['rubocop'].invoke
end
end

task default: :all

# Helpers
#-----------------------------------------------------------------------------#

def specs(dir)
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
end

def title(title)
cyan_title = "\033[0;36m#{title}\033[0m"
puts
puts '-' * 80
puts cyan_title
puts '-' * 80
puts
end
10 changes: 0 additions & 10 deletions bin/console

This file was deleted.

7 changes: 0 additions & 7 deletions bin/setup

This file was deleted.

5 changes: 2 additions & 3 deletions fastlane-plugin-xcake/fastlane-plugin-xcake.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fastlane/plugin/xcake/version'

Expand All @@ -19,7 +18,7 @@ Gem::Specification.new do |spec|

spec.add_dependency 'xcake'

spec.add_development_dependency 'rspec', '~> 3.4.0'
spec.add_development_dependency 'fastlane', '~> 1.89'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'rspec', '~> 3.4.0'
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ def self.description
end

def self.available_options
[
]
[]
end

def self.is_supported?(platform)
def self.is_supported?(platform) # rubocop:disable Naming/PredicateName
[:ios, :mac].include? platform
end

Expand Down
2 changes: 1 addition & 1 deletion fastlane-plugin-xcake/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
igor-makarov marked this conversation as resolved.
Show resolved Hide resolved

# This module is only used to check the environment is currently a testing env
module SpecHelper
Expand Down
5 changes: 0 additions & 5 deletions gemfiles/Gemfile.xcodeproj-1.3.x

This file was deleted.

5 changes: 0 additions & 5 deletions gemfiles/Gemfile.xcodeproj-1.4.x

This file was deleted.

3 changes: 1 addition & 2 deletions gemfiles/Gemfile.xcodeproj-edge
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in xcake.gemspec
gemspec :path => '..'
gem "xcodeproj", :git => 'https://github.com/CocoaPods/Xcodeproj'
gem 'xcodeproj', :git => 'https://github.com/CocoaPods/Xcodeproj'
4 changes: 1 addition & 3 deletions lib/xcake/command/make.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ class Make < Command
def run
file_path = "#{Dir.pwd}/Cakefile"

unless File.exist?(file_path)
raise Xcake::Informative, "Couldn't find Cakefile"
end
raise Xcake::Informative, "Couldn't find Cakefile" unless File.exist?(file_path)

EventHooks.run_hook :before_cakefile_read
file_contents = File.read(file_path)
Expand Down
20 changes: 10 additions & 10 deletions lib/xcake/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ module Constants
]
}.freeze,
[:ios, :ui_test_bundle] => {
"LD_RUNPATH_SEARCH_PATHS" => [
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks"
'LD_RUNPATH_SEARCH_PATHS' => [
'$(inherited)',
'@executable_path/Frameworks',
'@loader_path/Frameworks'
]
}.freeze,
[:osx, :unit_test_bundle] => {
Expand All @@ -25,10 +25,10 @@ module Constants
]
}.freeze,
[:osx, :ui_test_bundle] => {
"LD_RUNPATH_SEARCH_PATHS" => [
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks"
'LD_RUNPATH_SEARCH_PATHS' => [
'$(inherited)',
'@executable_path/../Frameworks',
'@loader_path/../Frameworks'
]
}.freeze
).freeze
Expand Down Expand Up @@ -60,8 +60,8 @@ module Constants
#
# @return [Hash] The common build settings
#
def self.common_build_settings(type, platform = nil, deployment_target = nil, target_product_type = nil, language = :objc)
target_product_type = (PRODUCT_TYPE_UTI.find { |_, v| v == target_product_type } || [target_product_type || :application])[0]
def self.common_build_settings(type, platform = nil, deployment_target = nil, target_product_type = nil, language = :objc) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/LineLength
target_product_type = (PRODUCT_TYPE_UTI.find { |_, v| v == target_product_type } || [target_product_type || :application])[0] # rubocop:disable Metrics/LineLength
common_settings = COMMON_BUILD_SETTINGS

# Use intersecting settings for all key sets as base
Expand Down
2 changes: 0 additions & 2 deletions lib/xcake/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ module Context
# The internal hash of native objects reference by their
# related DSL object
#
attr_accessor :object_hash

def object_hash
@object_hash ||= {}
end
Expand Down
13 changes: 5 additions & 8 deletions lib/xcake/context/xcodeproj_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class XcodeprojContext

attr_accessor :project

def create_object_for(dsl_object)
def create_object_for(dsl_object) # rubocop:disable Metrics/CyclomaticComplexity
case dsl_object
when BuildPhase
create_object_for_build_phase(dsl_object)
Expand All @@ -28,17 +28,14 @@ def create_object_for_build_phase(build_phase)
@project.new(build_phase.build_phase_type)
end

def create_object_for_build_rule(build_rule)
def create_object_for_build_rule(_build_rule)
@project.new(Xcodeproj::Project::Object::PBXBuildRule)
end

def create_object_for_project(project)

project_path = "./#{project.name}.xcodeproj"

if File.exist?(project_path)
FileUtils.remove_dir(project_path)
end

FileUtils.remove_dir(project_path) if File.exist?(project_path)

@project = Xcode::Project.new(project_path, true)
@project.setup_for_xcake
Expand All @@ -53,7 +50,7 @@ def create_object_for_configuration(configuration)
@project.new_configuration(configuration)
end

def create_object_for_scheme(scheme)
def create_object_for_scheme(_scheme)
Xcode::Scheme.new
end

Expand Down
4 changes: 1 addition & 3 deletions lib/xcake/dsl/build_phase/copy_files_build_phase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def configure_native_build_phase(native_build_phase, context)
@files.each do |file|
file_reference = context.file_reference_for_path(file)
build_file = native_build_phase.add_file_reference(file_reference)
if code_sign
build_file.settings = { 'ATTRIBUTES' => ['CodeSignOnCopy'] }
end
build_file.settings = { 'ATTRIBUTES' => ['CodeSignOnCopy'] } if code_sign
end
end

Expand Down
Loading