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

v0.12.0.31 - Spurius Lartius #84

Merged
merged 10 commits into from
Jul 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -18,3 +18,4 @@ cabal.sandbox.config
.stack-work/
cabal.project.local
codex.tags
_Dangerfile.tmp
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sudo: false
# Choose a lightweight base image; we provide our own build tools.
language: c


# GHC depends on GMP. You can add other dependencies here as well.
addons:
apt:
Expand All @@ -17,15 +18,25 @@ env:
- ARGS="--resolver=lts-7"

before_install:
# Update ruby
- rvm use 2.1 --install --binary --fuzzy

# Download and unpack the stack executable
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'

# Download and instal hlint
- rake

install:
- bundle install

# This line does all of the work: installs GHC if necessary, build the library,
# executables, and test suites, and runs the test suites. --no-terminal works
# around some quirks in Travis's terminal implementation.
script:
- bundle exec danger
- stack $ARGS setup
- stack $ARGS test --no-terminal --haddock --no-haddock-deps
- stack $ARGS build
Expand Down
20 changes: 20 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Sometimes it's a README fix, or something like that - which isn't relevant for
# including in a project's CHANGELOG for example
declared_trivial = github.pr_title.include? "#trivial"

# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"

# Warn when there is a big PR
warn("Big PR") if git.lines_of_code > 500


affected_files = git.added_files + git.modified_files

haskell_files = affected_files.select { |file| file.end_with?('.hs') }

hlint.lint(haskell_files, true)

# Don't let testing shortcuts get into master by accident
fail("fdescribe left in tests") if `grep -r fdescribe specs/ `.length > 1
fail("fit left in tests") if `grep -r fit specs/ `.length > 1
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true
source "https://rubygems.org"

gem "danger"
gem "danger-hlint"
gem "pry"
64 changes: 64 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
claide (1.0.2)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
coderay (1.1.1)
colored2 (3.1.2)
cork (0.3.0)
colored2 (~> 3.1)
danger (5.3.3)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
cork (~> 0.1)
faraday (~> 0.9)
faraday-http-cache (~> 1.0)
git (~> 1)
kramdown (~> 1.5)
octokit (~> 4.7)
terminal-table (~> 1)
danger-hlint (0.0.3)
danger-plugin-api (~> 1.0)
danger-plugin-api (1.0.0)
danger (> 2.0)
faraday (0.12.1)
multipart-post (>= 1.2, < 3)
faraday-http-cache (1.3.1)
faraday (~> 0.8)
git (1.3.0)
kramdown (1.14.0)
method_source (0.8.2)
multipart-post (2.0.0)
nap (1.1.0)
octokit (4.7.0)
sawyer (~> 0.8.0, >= 0.5.3)
open4 (1.3.4)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
public_suffix (2.0.5)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
slop (3.6.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.3.0)

PLATFORMS
ruby

DEPENDENCIES
danger
danger-hlint
pry

BUNDLED WITH
1.14.6
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ as a shared cache for frameworks built with [Carthage](https://github.com/Cartha
- [Uploading](#uploading)
- [Downloading](#downloading)
- [Listing](#listing)
- [Troubleshooting](#troubleshooting)
- [Troubleshooting & FAQ](#troubleshooting--faq)
- [Getting "Image not found" when running an application using binaries](#getting-image-not-found-when-running-an-application-using-binaries)
- [Supporting multiple Swift Versions](#supporting-multiple-swift-versions)
- [Presentations and Tutorials](#presentations-and-tutorials)
- [Who uses Rome?](#who-uses-rome)
- [License](#license)
Expand Down Expand Up @@ -416,7 +417,7 @@ Note: `list` __completely ignores dSYMs and Carthage version files__. If a dSYM
or a [Carthage version file](https://github.com/Carthage/Carthage/blob/master/Documentation/VersionFile.md)
is missing, __the corresponding framework is still reported as present__.

## Troubleshooting
## Troubleshooting & FAQ

### Getting "Image not found" when running an application using binaries

Expand All @@ -432,6 +433,22 @@ To fix that, add an explicit import statement to one of your files:
import CoreLocation
import MapKit
```

### Supporting multiple Swift Versions

Storing artifacts or a the same famework at different Swift versions can be
achieved by specifying a cache prefix when using any Rome command like so:

```
$ rome upload --platform iOS --cache-prefix Swift3 Alamofire
$ rome download --platform iOS --cache-prefix Swift3 Alamofire
$ rome list --platform iOS --cache-prefix Swift3
```

The specified prefix is prepended to the git repository name in the caches.
Using a local cache path like `~/Library/Caches/Rome` will store Alamofire from
the example above at `~/Library/Caches/Rome/Swift3/Alamofire`

## Presentations and Tutorials

Video tutorial on Rome given at [CocoaHeads Berlin](http://cocoaheads-berlin.org/) and [slides](https://speakerdeck.com/blender/caching-a-simple-solution-to-speeding-up-build-times)
Expand Down
27 changes: 27 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

namespace :hlint do

desc "Download and install hlint"
task :install do
REPO = "https://github.com/ndmitchell/hlint"
VERSION = "2.0.9"#DangerHlint::HLINT_VERSION
ASSET = "hlint-#{VERSION}-x86_64-linux.tar.gz"
URL = "#{REPO}/releases/download/v#{VERSION}/#{ASSET}"
DESTINATION_BASE = File.expand_path(File.join(File.dirname(__FILE__), 'bin'))
DESTINATION_TMP = File.join("#{DESTINATION_BASE}", 'tmp')

puts "Downloading hlint@v#{VERSION}"
sh [
"mkdir -p #{DESTINATION_TMP}",
"curl -s -L #{URL} -o #{ASSET}",
"tar -xf #{ASSET} -C #{DESTINATION_TMP}",
"cp #{DESTINATION_TMP}/hlint-#{VERSION}/hlint #{File.expand_path("~/.local/bin")}",
"cp -R #{DESTINATION_TMP}/hlint-#{VERSION}/data #{File.expand_path("~/.local/bin")}",
"rm -r #{DESTINATION_BASE}/",
"rm #{ASSET}"
].join(" && ")
end

end

task default: 'hlint:install'
5 changes: 3 additions & 2 deletions Rome.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Rome
version: 0.11.0.27
version: 0.12.0.31
synopsis: An S3 cache for Carthage
description: Please see README.md
homepage: https://github.com/blender/Rome
Expand Down Expand Up @@ -42,6 +42,8 @@ library
, containers >= 0.5
, unordered-containers >= 0.2.7
, conduit >= 1.2
, http-conduit >= 2.1.0
, http-types >= 0.9
, conduit-extra >= 1.1
, ini >= 0.3.5
, split >= 0.2.1.3
Expand All @@ -54,7 +56,6 @@ library
, resourcet >= 1.1
, optparse-applicative >= 0.12
, aeson >= 0.11
, lens >= 4.13

ghc-options: -Wall -fno-warn-unused-do-bind

Expand Down
8 changes: 4 additions & 4 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import System.Exit



romeVersion :: String
romeVersion = "0.11.0.27"
romeVersion :: RomeVersion
romeVersion = (0, 12, 0, 31)



Expand All @@ -19,9 +19,9 @@ main = do
let opts = info (Opts.helper <*> Opts.flag' Nothing (Opts.long "version" <> Opts.help "Prints the version information" <> Opts.hidden ) <|> Just <$> parseRomeOptions) (header "S3 cache tool for Carthage" )
cmd <- execParser opts
case cmd of
Nothing -> putStrLn $ romeVersion ++ " - Romam uno die non fuisse conditam."
Nothing -> putStrLn $ romeVersionToString romeVersion ++ " - Romam uno die non fuisse conditam."
Just romeOptions -> do
p <- runExceptT $ runRomeWithOptions romeOptions
p <- runExceptT $ runRomeWithOptions romeOptions romeVersion
case p of
Right _ -> return ()
Left e -> die e
8 changes: 5 additions & 3 deletions src/CommandParsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import Types.Commands
-- verifyParser :: Parser VerifyFlag
-- verifyParser = VerifyFlag <$> Opts.switch ( Opts.long "verify" <> Opts.help "Verify that the framework has the same hash as specified in the Cartfile.resolved.")

cachePrefixParser :: Parser String
cachePrefixParser = Opts.strOption (Opts.value "" <> Opts.metavar "PREFIX" <> Opts.long "cache-prefix" <> Opts.help "A prefix appended to the top level directories inside the caches. Usefull to separate artifacts between Swift versions.")

skipLocalCacheParser :: Parser SkipLocalCacheFlag
skipLocalCacheParser = SkipLocalCacheFlag <$> Opts.switch ( Opts.long "skip-local-cache" <> Opts.help "Ignore the local cache when performing the operation.")
skipLocalCacheParser = SkipLocalCacheFlag <$> Opts.switch (Opts.long "skip-local-cache" <> Opts.help "Ignore the local cache when performing the operation.")

reposParser :: Opts.Parser [GitRepoName]
reposParser = Opts.many (Opts.argument (GitRepoName <$> str) (Opts.metavar "FRAMEWORKS..." <> Opts.help "Zero or more framework names. If zero, all frameworks and dSYMs are uploaded."))
Expand All @@ -35,7 +37,7 @@ platformsParser = (nub . concat <$> Opts.some (Opts.option (eitherReader platfor
platformListOrError s = mapM platformOrError $ splitPlatforms s

udcPayloadParser :: Opts.Parser RomeUDCPayload
udcPayloadParser = RomeUDCPayload <$> reposParser <*> platformsParser {- <*> verifyParser-} <*> skipLocalCacheParser
udcPayloadParser = RomeUDCPayload <$> reposParser <*> platformsParser <*> cachePrefixParser <*> skipLocalCacheParser

uploadParser :: Opts.Parser RomeCommand
uploadParser = pure Upload <*> udcPayloadParser
Expand All @@ -51,7 +53,7 @@ listModeParser = (
<|> Opts.flag All All (Opts.help "Reports missing or present status of frameworks in the cache. Ignores dSYMs.")

listPayloadParser :: Opts.Parser RomeListPayload
listPayloadParser = RomeListPayload <$> listModeParser <*> platformsParser
listPayloadParser = RomeListPayload <$> listModeParser <*> platformsParser <*> cachePrefixParser

listParser :: Opts.Parser RomeCommand
listParser = List <$> listPayloadParser
Expand Down
6 changes: 3 additions & 3 deletions src/Data/Romefile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module Data.Romefile
)
where

import Control.Monad.Except
import Control.Lens
import Control.Monad.Except
import Data.HashMap.Strict as M
import Data.Ini as INI
import Data.Ini.Utils as INI
Expand Down Expand Up @@ -62,8 +62,6 @@ ignoreMapEntries = lens _ignoreMapEntries (\parseResult n -> parseResult { _igno





data RomeCacheInfo = RomeCacheInfo { _bucket :: Maybe Text
, _localCacheDir :: Maybe FilePath
}
Expand Down Expand Up @@ -143,6 +141,8 @@ getRomefileEntries sectionDelimiter ini = do
(splitOn "," frameworkCommonNames)))
(M.toList m)



-- | Take a path and makes it absolute resolving ../ and ~
-- See https://www.schoolofhaskell.com/user/dshevchenko/cookbook/transform-relative-path-to-an-absolute-path
absolutize :: FilePath -> IO FilePath
Expand Down
Loading