klipp 0.2.2.4 → 0.2.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ba63b780cdd76dfb3697cc312f59e0dbfc925a5
4
- data.tar.gz: 346dab90c394a08965a510681a584159b1b0a525
3
+ metadata.gz: ae3eafef7a7bbb434e6cd73d7f6fcca43823f4c2
4
+ data.tar.gz: d0ebae062629adecd570b294cc8f7e73d334438d
5
5
  SHA512:
6
- metadata.gz: 9e7e421fc095fea7d3af5ee20b93d47071810d60f4f4c3be4f4faad3a1cba2155b765f6d3d29a1a929c1d0a44650529c0c66cc6efadcae361f82ac99b8bfb6b9
7
- data.tar.gz: d6b0222b565eb32e101f6b7b29578d5fce70defe3702ac009d7e6881e4acff286decf5eff1174a46322fdf803bbd1df36b2643386764183e9368d9902eea3632
6
+ metadata.gz: 7c7a927987f1ab4836396b9dc80ffe702d6a0a0df0686a81f553a0a02dcb2c52cbc2f7b72989e1192f3b4fd47d35cea4baad6e80c8f5942ed2d0334a07b17dd7
7
+ data.tar.gz: 2af864cf90e910e66869f84c74573297e24612e77b5ca088aaedb28452826db61313d0cd43aa2af2e18b96857b7bca3acc42560c15b83216da160ca1a887c10d
data/README.md CHANGED
@@ -1,35 +1,56 @@
1
1
  # Klipp [![Build Status](https://travis-ci.org/epologee/klipp.png)](https://travis-ci.org/epologee/klipp) [![Coverage Status](https://coveralls.io/repos/epologee/klipp/badge.png)](https://coveralls.io/r/epologee/klipp)
2
2
  ## Code templates for the rest of us.
3
3
 
4
- Klipp is a ruby gem with a command line interface for creating new programming projects from existing templates. It was originally designed to create Xcode projects. However, there are no Apple or Xcode specific features in Klipp, so you can use it for pretty much any textfile-and-directory-based template.
5
4
 
6
- When compared to Xcode's plist-based templating system, Klipp takes an existing Xcode project and creates a new project by copying and modifying an existing template project by your own specifications.
5
+ Klipp is a Ruby gem that you can use to replicate folder structures, while doing extensive search-and-replace operations on filenames, directory names and file contents.
6
+
7
+ I developed Klipp as an alternative to the templating system of Apple's Xcode, to use while developing iOS projects. However, there are no Apple or Xcode specific features in Klipp, so you can use it for pretty much any textfile-and-directory-based template.
7
8
 
8
9
  ## Installation
9
10
 
10
11
  Install Klipp with RubyGems:
11
12
 
12
13
  $ gem install klipp
13
-
14
- Execute and read the usage instructions:
14
+
15
+ Then run Klipp from the command line and read the instructions:
15
16
 
16
17
  $ klipp
18
+
19
+ ## Templates a.k.a. Specs
20
+
21
+ When you execute `klipp` the first time, it will create a `.klipp` folder in your home directory, where it will search for template directories. Each template has one `.klippspec` file. Upon first use however, you will not have any specs. For starters you might try my personal specs by executing:
22
+
23
+ $ git clone https://github.com/epologee/klipp-specs.git ~/.klipp/epologee
24
+
25
+ After that, you can call `klipp template list` to see the specs it includes.
26
+
27
+ ## Inspiration
28
+
29
+ I've borrowed some of the terminology of Klipp from the RubyGem and CocoaPods community, which is why you see things like this:
30
+
31
+ + `.klippspec` files defining the structure of a template (compare to `.gemspec` and `.podspec`)
32
+ + `Klippfile` files used to setup a new project from an existing template (compare to `Gemfile` and `Podfile`)
33
+ + The `~/.klipp` folder containing your templates (compare to `~/.cocoapods`)
34
+
35
+ ## Usage
36
+
37
+ You use klipp from the terminal, as a command line tool. For example, if you have a template setup in the `~/.klipp/` folder called `iPhoneProject`, you can call commands like:
38
+
39
+ + `klipp template list` to list your templates
40
+ + `klipp create iPhoneProject` interactively prompts you to enter the values required for the template. This works well with very small templates, like creating a new class.
41
+ + `klipp prepare iPhoneProject` to create a new `Klippfile` for the `iPhoneProject` template. You edit the Klippfiles by hand to supply it with strings, numbers and booleans. This is easier for templates with more required values.
42
+ + `klipp create` to create a new project from a `Klippfile`, relative to your current directory.
43
+ + `klipp create -f` to re-create the project, overwriting the existing one.
17
44
 
18
- ## CLI under construction ...
45
+ You can always just start by running `klipp` and have the terminal tell you what commands to add to get your desired result.
19
46
 
20
- Klipp is still in the early development stage. When 0.1 ships, the CLI will feature:
47
+ ## Contribute
21
48
 
22
- * `klipp repo add <repo-name> [<repo-url>]` - git init [or clone] template repositories in the `~/.klipp` directory
23
- * `klipp template spec <template-name>` - creates a new template specificiation called `<template-name>.klippspec`, for you to configure your template's properties.
24
- * `klipp template push <repo-name>` - push a new template to one of your template repositories.
25
- * `klipp template list [<repo-name>]` - list all available templates on your machine [per repository]
26
- * `klipp prepare <template-name>` - prepare the creation of files from a new template, by authoring a `Klippfile`
27
- * `klipp create [<template-name>]` - create files based on the prepared `Klippfile` [or interactively from the terminal].
49
+ The gem in its current state is very usable. It's got decent rspec coverage (96%+) and I personally use the publicly available gem build for all my templating needs. There are however areas in which I would love the project to evolve more:
28
50
 
29
- ## Contributing
51
+ + Better terminal output during the creation process.
52
+ + The ability to update an existing `Klippfile` when the corresponding `project.klippspec` is updated underneath.
53
+ + Better feedback when something is missing, like token values or terminal commands.
54
+ + A setup to share your templates, like the specs from CocoaPods and RubyGems projects.
30
55
 
31
- 1. Fork it
32
- 2. Create your feature branch (`git checkout -b my-new-feature`)
33
- 3. Commit your changes (`git commit -am 'Add some feature'`)
34
- 4. Push to the branch (`git push origin my-new-feature`)
35
- 5. Create new Pull Request
56
+ So if you're willing to help, feel free to fork and send those pull requests!
data/lib/klipp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Klipp
2
- VERSION = "0.2.2.4"
2
+ VERSION = "0.2.2.5"
3
3
  end
@@ -9,13 +9,12 @@ class String
9
9
  end
10
10
 
11
11
  module Template
12
-
13
12
  class Token
14
13
  attr_accessor :hidden, :value, :default_value, :type, :bool_strings
15
14
  attr_accessor :comment, :validation, :validation_hint
16
15
 
17
16
  def initialize(value = nil, hidden = false)
18
- self.value = value if value
17
+ self.value = value unless value.nil?
19
18
  @hidden = hidden
20
19
  end
21
20
 
@@ -30,6 +29,7 @@ module Template
30
29
  end
31
30
 
32
31
  def value
32
+ return false if @value === false
33
33
  @value || self.default_value
34
34
  end
35
35
 
@@ -59,31 +59,29 @@ module Template
59
59
 
60
60
  def validation_hint
61
61
  case
62
- when self.type == :string then
63
- @validation_hint || (validation ? "Match /#{validation.to_s}/ (no custom validation_hint given)." : "Text required")
64
- when self.type == :bool then
65
- "Boolean value, either 'true' or 'false' (but without the apostrophes)"
62
+ when self.type == :string then
63
+ @validation_hint || (validation ? "Match /#{validation.to_s}/ (no custom validation_hint given)." : "Text required")
64
+ when self.type == :bool then
65
+ "Boolean value, either 'true' or 'false' (but without the apostrophes)"
66
66
  end
67
67
  end
68
68
 
69
69
  def validate?(value)
70
70
  case
71
- when self.type == :string then
72
- value.is_a?(String) && (validation.nil? || validation.match(value))
73
- when self.type == :bool then
74
- value.is_a?(TrueClass) or value.is_a?(FalseClass)
71
+ when self.type == :string then
72
+ value.is_a?(String) && (validation.nil? || validation.match(value))
73
+ when self.type == :bool then
74
+ value.is_a?(TrueClass) or value.is_a?(FalseClass)
75
75
  end
76
76
  end
77
77
 
78
78
  def to_s
79
79
  case
80
- when self.type == :bool then
81
- bool_strings[value ? 1 : 0]
82
- else
83
- value
80
+ when self.type == :bool then
81
+ bool_strings[value ? 1 : 0]
82
+ else
83
+ value
84
84
  end
85
85
  end
86
-
87
86
  end
88
-
89
87
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Template::Token do
4
-
5
4
  before do
6
5
  @token = Template::Token.new
7
6
  end
@@ -15,7 +14,6 @@ describe Template::Token do
15
14
  end
16
15
 
17
16
  context 'with type string' do
18
-
19
17
  it 'has a hidden property' do
20
18
  @token.hidden = true
21
19
  @token.hidden.should eq true
@@ -48,13 +46,12 @@ describe Template::Token do
48
46
  it 'invalidates booleans assigned' do
49
47
  expect { @token.value = true }.to raise_error RuntimeError
50
48
  end
51
-
52
49
  end
53
50
 
54
51
  context 'with type bool' do
55
-
56
52
  before do
57
53
  @token.type = :bool
54
+ @token.default_value = true
58
55
  end
59
56
 
60
57
  it 'accepts boolean values' do
@@ -94,7 +91,5 @@ describe Template::Token do
94
91
  it 'invalidates other strings' do
95
92
  expect { @token.value = 'ja' }.to raise_error RuntimeError
96
93
  end
97
-
98
94
  end
99
-
100
- end
95
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: klipp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2.4
4
+ version: 0.2.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric-Paul Lecluse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-14 00:00:00.000000000 Z
11
+ date: 2014-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  version: '0'
212
212
  requirements: []
213
213
  rubyforge_project:
214
- rubygems_version: 2.2.0
214
+ rubygems_version: 2.2.2
215
215
  signing_key:
216
216
  specification_version: 4
217
217
  summary: Klipp is a command line gem for creating new (Xcode) projects from existing
@@ -262,4 +262,3 @@ test_files:
262
262
  - spec/template/spec_spec.rb
263
263
  - spec/template/token_spec.rb
264
264
  - spec/template_spec.rb
265
- has_rdoc: