simplate 0.0.9 → 0.0.10

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: 56d52594813cfee3c7d248e917de21a9be88e12e
4
- data.tar.gz: 8d5a4ce54ff52ba15df3d1983b9e79182b90b0c1
3
+ metadata.gz: bd1d845e0ce6e34df5f0f736027e7b8bf90cd784
4
+ data.tar.gz: 6b8c852a0bbf07ccd6b654d7ef30865f95706696
5
5
  SHA512:
6
- metadata.gz: 109f90cf2187a52224035dc9362add003e58429d62d1519913f03364e2253cdc8c9278785f61f75e7e5200a4f42f9466dfca2203b6d39f07ee589d6eaba4f03e
7
- data.tar.gz: e7f32cd1a7340f09e939a484b4a0a9a2a75a9883a390d309b8db3386ce3b32d5536776c40246a71a51767b8b6f21fe04aac09bbf46b9de3255272352737760e0
6
+ metadata.gz: 949ab6c3ef89ce6bf2a800630a168dd195c980e25c983c17226a1e3cefa78f85c48bd9d0e76575ece37f80f250a0bcf4908ea361d337f5f0e67e599771884bb9
7
+ data.tar.gz: 5f51b882b885197fc52abf41b8bd4c0ab1749b6e429503302317e918a3882dd9aaf1577f81c9d9a3dbb95510bafc6b3adea2abe383e792a5478c2fe8a8412245
data/bin/simplate ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require 'simplate'
3
+
4
+ if ARGV[0]
5
+ Simplate::Command.prepare(ARGV[0])
6
+ else
7
+ puts "Usage:"
8
+ puts " $ simplate [app_name]"
9
+ end
@@ -0,0 +1 @@
1
+ source 'https://rubygems.org'
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+
3
+ pathname_modules = Pathname.new(Dir.pwd).parent.join("lib/modules")
4
+ pathname_models = Pathname.new(Dir.pwd).parent.join("lib/models")
5
+
6
+ Dir["#{pathname_modules}/*.rb"].each {|file| require file}
7
+ Dir["#{pathname_models}/*.rb"].each {|file| require file}
8
+
9
+ RSpec.configure do |config|
10
+ end
@@ -0,0 +1,57 @@
1
+ module Simplate
2
+ module Command
3
+ @@app_name = ''
4
+ @@root_path = ''
5
+
6
+ def Command.root_path
7
+ Pathname.new(File.dirname(__FILE__)).parent.parent.parent
8
+ end
9
+
10
+ def Command.app_name
11
+ @@app_name
12
+ end
13
+
14
+ def Command.app_name=(value)
15
+ @@app_name = value
16
+ end
17
+
18
+ def Command.prepare(app_name)
19
+ @@app_name = app_name
20
+
21
+ Command.executables(app_name).each do |c|
22
+ `#{c}`
23
+ end
24
+ end
25
+
26
+ def Command.executables(app_name)
27
+ Command.app_name = app_name
28
+
29
+ executables = []
30
+
31
+ executables << "mkdir #{app_name}"
32
+ executables << "mkdir #{app_name}/lib"
33
+ executables << "mkdir #{app_name}/lib/models"
34
+ executables << "mkdir #{app_name}/lib/modules"
35
+ executables << "mkdir #{app_name}/spec"
36
+ executables << "mkdir #{app_name}/spec/models"
37
+ executables << "mkdir #{app_name}/spec/modules"
38
+ executables << Command.copy_file('Gemfile')
39
+ executables << Command.copy_file('spec_helper.rb')
40
+
41
+ executables
42
+ end
43
+
44
+ def Command.copy_file(filename)
45
+ case filename
46
+ when "Gemfile"
47
+ from = Command.root_path.join('lib/simplate/copies/Gemfile')
48
+ to = Command.app_name + '/Gemfile'
49
+ "cp #{from} #{to}"
50
+ when "spec_helper.rb"
51
+ from = Command.root_path.join('lib/simplate/copies/spec_helper.rb')
52
+ to = Command.app_name + '/spec/spec_helper.rb'
53
+ "cp #{from} #{to}"
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,3 +1,3 @@
1
1
  module Simplate
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
data/simplate/Gemfile ADDED
@@ -0,0 +1 @@
1
+ source 'https://rubygems.org'
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+
3
+ pathname_modules = Pathname.new(Dir.pwd).parent.join("lib/modules")
4
+ pathname_models = Pathname.new(Dir.pwd).parent.join("lib/models")
5
+
6
+ Dir["#{pathname_modules}/*.rb"].each {|file| require file}
7
+ Dir["#{pathname_models}/*.rb"].each {|file| require file}
8
+
9
+ RSpec.configure do |config|
10
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe Simplate::Command do
4
+
5
+ it '.prepare' do
6
+ Simplate::Command.app_name = 'simplate'
7
+ Simplate::Command.app_name.should eql('simplate')
8
+ end
9
+
10
+ it '.executables' do
11
+ executables = Simplate::Command.executables('simplate2')
12
+
13
+ Simplate::Command.app_name.should eql('simplate2')
14
+ executables.class.should eql(Array)
15
+ end
16
+
17
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Simplate do
4
+
5
+ it '.root_path' do
6
+ Simplate.root_path.to_s.should == '/Users/jkim/projects/ruby/gems/simplate'
7
+ end
8
+
9
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+
3
+ pathname_modules = Pathname.new(File.dirname(__FILE__)).parent.join("lib/simplate/modules")
4
+ Dir["#{pathname_modules}/*.rb"].each {|file| require file}
5
+
6
+ pathname_root_module = Pathname.new(File.dirname(__FILE__)).parent.join('lib')
7
+ Dir["#{pathname_root_module}/*.rb"].each {|file| require file}
8
+
9
+ RSpec.configure do |config|
10
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Kim
@@ -42,7 +42,8 @@ description: Simplate generates a perfect directory structure for a well organiz
42
42
  Ruby app
43
43
  email:
44
44
  - iamjsonkim@gmail.com
45
- executables: []
45
+ executables:
46
+ - simplate
46
47
  extensions: []
47
48
  extra_rdoc_files: []
48
49
  files:
@@ -51,9 +52,18 @@ files:
51
52
  - LICENSE.txt
52
53
  - README.md
53
54
  - Rakefile
55
+ - bin/simplate
54
56
  - lib/simplate.rb
57
+ - lib/simplate/copies/Gemfile
58
+ - lib/simplate/copies/spec_helper.rb
59
+ - lib/simplate/modules/command.rb
55
60
  - lib/simplate/version.rb
56
61
  - simplate.gemspec
62
+ - simplate/Gemfile
63
+ - simplate/spec/spec_helper.rb
64
+ - spec/modules/command_spec.rb
65
+ - spec/modules/simplate_spec.rb
66
+ - spec/spec_helper.rb
57
67
  homepage: ''
58
68
  licenses:
59
69
  - MIT
@@ -78,4 +88,7 @@ rubygems_version: 2.2.0
78
88
  signing_key:
79
89
  specification_version: 4
80
90
  summary: Boilerplate for creating an opinionated Ruby app
81
- test_files: []
91
+ test_files:
92
+ - spec/modules/command_spec.rb
93
+ - spec/modules/simplate_spec.rb
94
+ - spec/spec_helper.rb