crafti 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -2
- data/bin/crafti +12 -19
- data/bin/rake +16 -0
- data/lib/crafti/version.rb +1 -1
- data/lib/crafti.rb +39 -8
- data/test/assets/app_template.rb +5 -1
- data/test/dsl_test.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ca10828ced14277fa89718834fde28d09195be7
|
4
|
+
data.tar.gz: 59c96bcb7d0d1e0c27cc5c709270aae94b7feb37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ac5b68a150393e746f37cb1688cd0db9d6ade00a283ab66a7d71094932ce7bceb8beafe203cce7d11a3e9679d76bffc952cf9e971b9a9f24e460ce417b9321b
|
7
|
+
data.tar.gz: 66270327702398f91efaa1734822f18b8981b5717d9eca571491470b167a32573cb0e3b0fe3764beafc3fb889958d1bb076fbba3d0cb0afc0842502ae8fbba95
|
data/README.md
CHANGED
@@ -18,6 +18,8 @@ I really wanted something that was bash like, but with Ruby block syntax. Someth
|
|
18
18
|
|
19
19
|
## Examples
|
20
20
|
|
21
|
+
There is a Crafti Repository that has some working templates here: [https://github.com/revans/crafti-templates](https://github.com/revans/crafti-templates)
|
22
|
+
|
21
23
|
### Sinatra Style Structure
|
22
24
|
|
23
25
|
````ruby
|
@@ -73,7 +75,18 @@ root "appname" do
|
|
73
75
|
{ app_classname: 'FannyPackApplication',
|
74
76
|
environment: 'ENV["RACK_ENV"]' }
|
75
77
|
|
76
|
-
|
78
|
+
# Yes, bower support - [http://www.bower.io](http://www.bower.io)
|
79
|
+
bower "angularjs", "bootstrap", "sugar"
|
80
|
+
|
81
|
+
# Bundler Support (:install only)
|
82
|
+
bundle :install, with: 'binstubs'
|
83
|
+
|
84
|
+
# Git Support
|
85
|
+
git do
|
86
|
+
init
|
87
|
+
add :all # can replace ':all' with '.', or 'Readme.mkd', 'Procfile', 'Guardfile'
|
88
|
+
commit 'Created the project'
|
89
|
+
end
|
77
90
|
end
|
78
91
|
|
79
92
|
````
|
@@ -82,4 +95,4 @@ end
|
|
82
95
|
|
83
96
|
* command to read templates from the internet (e.g. github)
|
84
97
|
* generate a starter template
|
85
|
-
* allow the main template file be an erb file where command options can be passed into (e.g. the name passed to the root method)
|
98
|
+
* allow the main template file be an erb file where command options can be passed into (e.g. the name passed to the root method)
|
data/bin/crafti
CHANGED
@@ -1,23 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'crafti' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
2
8
|
|
3
|
-
require '
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
options = Crafti::CLI.parse(ARGV)
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
else
|
12
|
-
puts "That command is not supported."
|
13
|
-
exit
|
14
|
-
end
|
15
|
-
|
16
|
-
# require 'pathname'
|
17
|
-
# path = Pathname.new(options.template_path).expand_path
|
18
|
-
# puts "Options:\n"
|
19
|
-
# puts options.inspect
|
20
|
-
# puts "Values:\n"
|
21
|
-
# puts "path: #{path.to_s}"
|
22
|
-
# puts "\nContent:\n#{path.read}"
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
23
15
|
|
16
|
+
load Gem.bin_path('crafti', 'crafti')
|
data/bin/rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rake', 'rake')
|
data/lib/crafti/version.rb
CHANGED
data/lib/crafti.rb
CHANGED
@@ -115,29 +115,60 @@ module Crafti
|
|
115
115
|
run "bower install #{package}"
|
116
116
|
end
|
117
117
|
end
|
118
|
+
|
119
|
+
def bundle(command, options = {})
|
120
|
+
opts = [options[:with]].flatten.map { |o| "--#{o}" }.join(' ')
|
121
|
+
opts ||= ''
|
122
|
+
|
123
|
+
run "bundle #{command.to_s} #{opts}"
|
124
|
+
end
|
125
|
+
|
126
|
+
#
|
127
|
+
# git do
|
128
|
+
# init
|
129
|
+
# add :all
|
130
|
+
# commit 'First Commit'
|
131
|
+
# end
|
132
|
+
#
|
133
|
+
def git(&block)
|
134
|
+
Git.new(app_path, &block)
|
135
|
+
end
|
118
136
|
end
|
119
137
|
|
120
|
-
|
121
|
-
|
138
|
+
class Git
|
139
|
+
attr_reader :app_path
|
122
140
|
|
123
|
-
def
|
124
|
-
|
141
|
+
def initialize(app_path, &block)
|
142
|
+
@app_path = app_path
|
143
|
+
instance_eval(&block) if block_given?
|
144
|
+
end
|
145
|
+
|
146
|
+
def init
|
147
|
+
git "init ."
|
125
148
|
end
|
126
149
|
|
127
|
-
|
150
|
+
def add(*args)
|
151
|
+
cmd = case args.first
|
152
|
+
when :all then "."
|
153
|
+
else
|
154
|
+
files = args.join(' ')
|
155
|
+
end
|
156
|
+
|
157
|
+
git "add #{cmd}"
|
128
158
|
end
|
129
159
|
|
130
|
-
|
160
|
+
def commit(message)
|
161
|
+
git "commit -am '#{message}'"
|
131
162
|
end
|
132
163
|
|
133
|
-
|
164
|
+
def git(command)
|
165
|
+
results = system "cd #{app_path} && git #{command}"
|
134
166
|
end
|
135
167
|
end
|
136
168
|
|
137
169
|
class Root
|
138
170
|
include FileUtilsExtension
|
139
171
|
include RunCommands
|
140
|
-
include Git
|
141
172
|
|
142
173
|
def self.root(appname, &block)
|
143
174
|
app = new(appname)
|
data/test/assets/app_template.rb
CHANGED
data/test/dsl_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crafti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,6 +57,7 @@ email:
|
|
57
57
|
- robert@codewranglers.org
|
58
58
|
executables:
|
59
59
|
- crafti
|
60
|
+
- rake
|
60
61
|
extensions: []
|
61
62
|
extra_rdoc_files: []
|
62
63
|
files:
|
@@ -67,6 +68,7 @@ files:
|
|
67
68
|
- README.md
|
68
69
|
- Rakefile
|
69
70
|
- bin/crafti
|
71
|
+
- bin/rake
|
70
72
|
- crafti.gemspec
|
71
73
|
- lib/crafti.rb
|
72
74
|
- lib/crafti/cli.rb
|