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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8766c9dd2a82d0af8cd5dddab5993b5e25146c33
4
- data.tar.gz: 93303fa34da492afd27bcd70f221167744d57da4
3
+ metadata.gz: 8ca10828ced14277fa89718834fde28d09195be7
4
+ data.tar.gz: 59c96bcb7d0d1e0c27cc5c709270aae94b7feb37
5
5
  SHA512:
6
- metadata.gz: f4bd2a65671feafccc65c8504ef172367a4c2dc4e53e8663b4bf3d49afbad3f5e6caeb8deaa9dbf7cb4b6de4d668e4be0e1ee8770b791128ef206c40a45a0129
7
- data.tar.gz: 3f61cef9c39cfe9b86b0586314a0400e78638c295229021f73b45542b73b355bd8811f30b04480958c3a11a76dc6d8e5c878da487c5b159353c00c179fe5cdec
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
- run "bundle install --binstubs" # runs a terminal command
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 'rubygems'
4
- require 'crafti'
5
- # require_relative '../lib/crafti'
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
- if options.event == "generate"
10
- Crafti::FileReader.generate(options.template_path)
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')
@@ -1,7 +1,7 @@
1
1
  module Crafti
2
2
  MAJOR = 0
3
3
  MINOR = 0
4
- PATCH = 19
4
+ PATCH = 20
5
5
 
6
6
  def self.version
7
7
  [
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
- module Git
121
- include RunCommands
138
+ class Git
139
+ attr_reader :app_path
122
140
 
123
- def git(command)
124
- run "git #{command}"
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
- class Init
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
- class Add
160
+ def commit(message)
161
+ git "commit -am '#{message}'"
131
162
  end
132
163
 
133
- class Commit
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)
@@ -6,5 +6,9 @@ root "appname" do
6
6
  touch "Guardfile"
7
7
  touch "test/test_helper.rb"
8
8
 
9
- git "init ."
9
+ git do
10
+ init
11
+ add :all
12
+ commit 'Created the project'
13
+ end
10
14
  end
data/test/dsl_test.rb CHANGED
@@ -11,6 +11,7 @@ class DSLTest < Minitest::Test
11
11
  file.evaluate
12
12
 
13
13
  assert File.exists?("appname/.git")
14
+ assert (system 'cd appname && git status')
14
15
 
15
16
  assert File.exists?("appname")
16
17
  cleanup("appname")
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.19
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-18 00:00:00.000000000 Z
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