Skip to content
This repository has been archived by the owner on Nov 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #7 from vknabel/feature/upgrade-kylef-dependencies
Browse files Browse the repository at this point in the history
[chore] Upgraded dependencies
  • Loading branch information
vknabel authored Feb 24, 2017
2 parents b609a12 + 2595005 commit f352928
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Rock

## 0.3.1

### Non Breaking Changes

- **[Dependencies]** Upgraded `PathKit`, `Stencil` and `PromptLine` which fixes Linux issues

## 0.3.0

### Additions
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ let package = Package(
Target(name: "RockLib", dependencies: []),
],
dependencies: [
.Package(url: "https://github.com/kylef/PathKit.git", Version(0, 7, 1)),
.Package(url: "https://github.com/kylef/Stencil.git", Version(0, 7, 2)),
.Package(url: "https://github.com/kylef/PathKit.git", Version(0, 8, 0)),
.Package(url: "https://github.com/kylef/Stencil.git", Version(0, 8, 0)),
.Package(url: "https://github.com/Carthage/Commandant.git", majorVersion: 0, minor: 11),
.Package(url: "https://github.com/mtynior/ColorizeSwift.git", majorVersion: 1, minor: 1),
.Package(url: "https://github.com/behrang/YamlSwift.git", majorVersion: 3, minor: 3),
.Package(url: "https://github.com/antitypical/Result.git", majorVersion: 3),
.Package(url: "https://github.com/vknabel/Lens.git", majorVersion: 0, minor: 1),
.Package(url: "https://github.com/vknabel/PromptLine.git", Version(0, 5, 1)),
.Package(url: "https://github.com/vknabel/PromptLine.git", Version(0, 6, 1)),
]
)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ $ curl -sL https://raw.githubusercontent.com/vknabel/Rock/master/Scripts/Install

Rock can be updated by simply running installing itself with a version specified.
```bash
$ rock install rock@0.3.0
$ rock install rock@0.3.1
```

## Limitations
Expand Down
3 changes: 2 additions & 1 deletion Rockfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Rock
url: https://github.com/vknabel/Rock
version: 0.3.0
version: 0.3.1
# Dependencies may be installed locally by running `rock install`
# If you like you can even delcare Specs inline or override specific scripts.
dependencies:
Expand Down Expand Up @@ -44,6 +44,7 @@ scripts:
# Set git tag
- git tag -a {{version}} -m {{version}}
- git push --tags
postpublish:
# Copy latest Changelog
- sed -n /'^## {{version}}$'/,/'^## '/p CHANGELOG.md | sed -e '$ d' | pbcopy
# Create new release on Github
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Install.generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ typealias Process = Task
#endif

let rockPath = ProcessInfo.processInfo.environment["ROCK_PATH"] ?? "~/.rock"
let version = ProcessInfo.processInfo.environment["ROCK_VERSION"] ?? "0.3.0"
let version = ProcessInfo.processInfo.environment["ROCK_VERSION"] ?? "0.3.1"

func run(workingDir: String? = nil, _ args: String...) {
let process = Process()
Expand Down
3 changes: 2 additions & 1 deletion Sources/RockLib/Generated/Version.generated.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Generated using Sourcery 0.5.3 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT


public extension RockConfig {
public static let version = "0.3.0"
public static let version = "0.3.1"
}
19 changes: 9 additions & 10 deletions Sources/RockLib/YamlAndStencil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import PathKit
import Stencil
import Yaml

typealias ContextLiteral = [String: Any]

private extension String {
func render(_ context: Context? = nil) throws -> String {
func render(_ context: ContextLiteral? = nil) throws -> String {
let template = Template(templateString: self)
return try template.render(context)
}
Expand Down Expand Up @@ -55,19 +57,18 @@ private extension Yaml {

func render(
_ dictionary: [String: Any],
namespace: Namespace = Namespace(),
descriptor: Yaml.YamlSortDescriptor
) throws -> (Any, Yaml) {
let context = dictionary
switch self {
case let .string(value):
let context = Context(dictionary: dictionary, namespace: namespace)
let rendered = try value.render(context)
return (rendered, .string(rendered))
case let .array(values):
var contextList = [Any]()
var vs = [(Any, Yaml)]()
for v in values {
let result = try v.render(dictionary, namespace: namespace, descriptor: descriptor)
let result = try v.render(dictionary, descriptor: descriptor)
contextList.append(result.0)
vs.append(result)
}
Expand All @@ -78,8 +79,8 @@ private extension Yaml {
var localDictionary: [String: Any] = [:]

try value.sorted(by: descriptor).forEach { key, value in
let renderedKey = try key.render(dictionary, namespace: namespace, descriptor: descriptor)
let renderedValue = try value.render(dictionary, namespace: namespace, descriptor: descriptor)
let renderedKey = try key.render(dictionary, descriptor: descriptor)
let renderedValue = try value.render(dictionary, descriptor: descriptor)
dict[renderedKey.1] = renderedValue.1

if let renderedKey = renderedKey.0 as? String {
Expand All @@ -99,17 +100,15 @@ public extension Yaml {

public static func rendering(
_ text: String,
namespace: Namespace = Namespace(),
orderedBy order: [Yaml] = ["const", "constant", "constants", "version", "license", "name", "url"]
) throws -> Yaml {
return try rendering(text, namespace: namespace, sort: sortDescriptor(by: order))
return try rendering(text, sort: sortDescriptor(by: order))
}

public static func rendering(
_ text: String,
namespace: Namespace = Namespace(),
sort descriptor: YamlSortDescriptor
) throws -> Yaml {
return try Yaml.load(text).render([:], namespace: namespace, descriptor: descriptor).1
return try Yaml.load(text).render([:], descriptor: descriptor).1
}
}

0 comments on commit f352928

Please sign in to comment.