enoki 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +41 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +27 -0
- data/Rakefile +2 -0
- data/bin/enoki +4 -0
- data/enoki.gemspec +27 -0
- data/lib/enoki/cli/common.rb +43 -0
- data/lib/enoki/cli/generate.rb +37 -0
- data/lib/enoki/cli/init.rb +26 -0
- data/lib/enoki/cli/list.rb +8 -0
- data/lib/enoki/cli/shell.rb +13 -0
- data/lib/enoki/cli/show.rb +10 -0
- data/lib/enoki/cli.rb +8 -0
- data/lib/enoki/templates/.enoki.yml.tt +3 -0
- data/lib/enoki/version.rb +3 -0
- data/lib/enoki.rb +6 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 421193dfba17a3a10ac4ed8e56bd17db8b62028f
|
4
|
+
data.tar.gz: 1d6939b29abfade2c748f85568ff0d9458331cc0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bbeed8a9a88aa43f0008ee05502a2fb7b1c3daa6dedc11aad69c8a83bcd1f6d4a39e0a70bc521996b95b25c38ff817a74245366d8fa6454e70b1e42137f8d2ae
|
7
|
+
data.tar.gz: 51e0140f87338c6cf541682af93a5167c48531e0e304a058d2b54c2ee13202891690cb2daf561b76cb1bf85ebc20311d1c6561ad34b5cb2a55b840cc18daa329
|
data/.gitignore
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
|
11
|
+
/.idea
|
12
|
+
|
13
|
+
### https://raw.github.com/github/gitignore/065e152d02eedc392f360305c084a4342e9e2caf/Global/macOS.gitignore
|
14
|
+
|
15
|
+
# General
|
16
|
+
*.DS_Store
|
17
|
+
.AppleDouble
|
18
|
+
.LSOverride
|
19
|
+
|
20
|
+
# Icon must end with two \r
|
21
|
+
Icon
|
22
|
+
|
23
|
+
# Thumbnails
|
24
|
+
._*
|
25
|
+
|
26
|
+
# Files that might appear in the root of a volume
|
27
|
+
.DocumentRevisions-V100
|
28
|
+
.fseventsd
|
29
|
+
.Spotlight-V100
|
30
|
+
.TemporaryItems
|
31
|
+
.Trashes
|
32
|
+
.VolumeIcon.icns
|
33
|
+
.com.apple.timemachine.donotpresent
|
34
|
+
|
35
|
+
# Directories potentially created on remote AFP share
|
36
|
+
.AppleDB
|
37
|
+
.AppleDesktop
|
38
|
+
Network Trash Folder
|
39
|
+
Temporary Items
|
40
|
+
.apdisk
|
41
|
+
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Tomohiro Moro
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# Enoki
|
2
|
+
|
3
|
+
Code generator for Xcode project.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```
|
8
|
+
$ gem install enoki
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
TODO: Write usage instructions here
|
14
|
+
|
15
|
+
## Development
|
16
|
+
|
17
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
18
|
+
|
19
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
20
|
+
|
21
|
+
## Contributing
|
22
|
+
|
23
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/slightair/enoki.
|
24
|
+
|
25
|
+
## License
|
26
|
+
|
27
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/enoki
ADDED
data/enoki.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'enoki/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "enoki"
|
8
|
+
spec.version = Enoki::VERSION
|
9
|
+
spec.authors = ["slightair"]
|
10
|
+
spec.email = ["arksutite@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Code generator for Xcode project.}
|
13
|
+
spec.description = %q{Code generator for Xcode project.}
|
14
|
+
spec.homepage = "https://github.com/slightair/enoki"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features|examples)/})
|
19
|
+
end
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
|
26
|
+
spec.add_dependency 'thor'
|
27
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Enoki
|
4
|
+
class CLI < Thor
|
5
|
+
no_commands do
|
6
|
+
def settings_file
|
7
|
+
"./.enoki.yml"
|
8
|
+
end
|
9
|
+
|
10
|
+
def settings
|
11
|
+
@settings ||= begin
|
12
|
+
unless File.exist?(settings_file)
|
13
|
+
say_error("Settings file not found. Please create '.enoki.yml' or run 'enoki init'")
|
14
|
+
exit 1
|
15
|
+
end
|
16
|
+
|
17
|
+
YAML.load_file(settings_file)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def template_dir
|
22
|
+
@template_dir ||= File.absolute_path(settings["template_dir"] || "./templates")
|
23
|
+
end
|
24
|
+
|
25
|
+
def project_root_dir
|
26
|
+
@project_root_dir ||= File.absolute_path(settings["project_root_dir"] || "./")
|
27
|
+
end
|
28
|
+
|
29
|
+
def project_file_path
|
30
|
+
@project_file_path ||= begin
|
31
|
+
if settings["project_file_path"].nil?
|
32
|
+
raise "Error: Required settings not found in .enoki.yml! (project_file_path)"
|
33
|
+
end
|
34
|
+
File.absolute_path(settings["project_file_path"])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def templates
|
39
|
+
Dir.glob(File.join(template_dir, "*/")).map { |f| File.basename(f) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module Enoki
|
4
|
+
class CLI < Thor
|
5
|
+
NAME_PLACEHOLDER = '__name__'
|
6
|
+
EXT_TEMPLATE = '.tt'
|
7
|
+
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
desc "generate TEMPLATE FUNCTION_NAME", "generate code files from template"
|
11
|
+
def generate(template_name, name)
|
12
|
+
unless templates.include? template_name
|
13
|
+
say_error "Template not found"
|
14
|
+
exit 1
|
15
|
+
end
|
16
|
+
|
17
|
+
selected_template_root = Pathname.new(File.expand_path(template_name, template_dir))
|
18
|
+
project_root = Pathname.new(project_root_dir)
|
19
|
+
file_list = Dir.glob(selected_template_root.join("**/*#{EXT_TEMPLATE}")).map do |file|
|
20
|
+
Pathname.new(file).relative_path_from(selected_template_root)
|
21
|
+
end
|
22
|
+
|
23
|
+
file_list.each do |path|
|
24
|
+
source_path = path.expand_path(selected_template_root).to_path
|
25
|
+
dest_path = path.expand_path(project_root).to_path.gsub(NAME_PLACEHOLDER, name.capitalize).chomp(EXT_TEMPLATE)
|
26
|
+
|
27
|
+
template(source_path, dest_path, context: context_for_template(name))
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
no_commands do
|
32
|
+
def context_for_template(name)
|
33
|
+
binding
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Enoki
|
2
|
+
class CLI < Thor
|
3
|
+
include Thor::Actions
|
4
|
+
|
5
|
+
def self.source_root
|
6
|
+
File.expand_path("../", File.dirname(__FILE__))
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "init", "create settings file"
|
10
|
+
def init
|
11
|
+
if File.exist?(settings_file)
|
12
|
+
exit 0 unless yes?("Settings file already exist. Re-create settings file? (y/N)", :yellow)
|
13
|
+
end
|
14
|
+
|
15
|
+
default_template_dir = "./templates"
|
16
|
+
default_project_root_dir = "./"
|
17
|
+
default_project_file_path = "./YourProject.xcodeproj"
|
18
|
+
|
19
|
+
template_dir = ask("Your template directory?", default: default_template_dir, path: true)
|
20
|
+
project_root_dir = ask("Your project root directory?", default: default_project_root_dir, path: true)
|
21
|
+
project_file_path = ask("Your project file path?", default: default_project_file_path, path: true)
|
22
|
+
|
23
|
+
template("templates/.enoki.yml.tt", settings_file, context: binding)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/enoki/cli.rb
ADDED
data/lib/enoki.rb
ADDED
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: enoki
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- slightair
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Code generator for Xcode project.
|
56
|
+
email:
|
57
|
+
- arksutite@gmail.com
|
58
|
+
executables:
|
59
|
+
- enoki
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- bin/enoki
|
69
|
+
- enoki.gemspec
|
70
|
+
- lib/enoki.rb
|
71
|
+
- lib/enoki/cli.rb
|
72
|
+
- lib/enoki/cli/common.rb
|
73
|
+
- lib/enoki/cli/generate.rb
|
74
|
+
- lib/enoki/cli/init.rb
|
75
|
+
- lib/enoki/cli/list.rb
|
76
|
+
- lib/enoki/cli/shell.rb
|
77
|
+
- lib/enoki/cli/show.rb
|
78
|
+
- lib/enoki/templates/.enoki.yml.tt
|
79
|
+
- lib/enoki/version.rb
|
80
|
+
homepage: https://github.com/slightair/enoki
|
81
|
+
licenses:
|
82
|
+
- MIT
|
83
|
+
metadata: {}
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options: []
|
86
|
+
require_paths:
|
87
|
+
- lib
|
88
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
requirements: []
|
99
|
+
rubyforge_project:
|
100
|
+
rubygems_version: 2.5.1
|
101
|
+
signing_key:
|
102
|
+
specification_version: 4
|
103
|
+
summary: Code generator for Xcode project.
|
104
|
+
test_files: []
|