aspen 0.1.6 → 0.1.7
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 +8 -8
- data/lib/aspen.rb +22 -27
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGI0YjcxZjM1ZDBjOTc4YTBiODkyYjVlZTg0MzQ0NWY5MmJjODg3ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDAzNGM1MTI1MmZhMWU3NzZhYjQ2YTkyMTk3ZDdjM2NiY2JmMzlmMg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDMxMTg1NzQ3MjdkZTZlYmM2YzRlYjZiN2ViZjI1Nzg5YTIxYjA0Y2M3Y2Zk
|
10
|
+
Yzc1YzM3Y2FjMjVlODk3ZDRjMmFmNGRlMGJlZjE1OWFmOWUyZDIyNGVmNjk4
|
11
|
+
NzU4OGNkN2Q4MDg1MzMzOGNkZDY2ZDM1ZmE5NzRkYWEyOTQ4OWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTk2OTBkNWNjY2Y3ZmI0YzU0NDM0YjIwYmVmZjlmYjlmMDgxY2Q2YzI3YWRm
|
14
|
+
MzRmMjg1OGU3YTBmZmQ5MGE1MDY2ODJjOTQyYWU4YzJmNTU4ODM1NDE5ZWMz
|
15
|
+
NGQyYjYwNTVlZTdjNjg4YjI5ZTU3NjFjMjU0YjMwNWI0N2Q1MDQ=
|
data/lib/aspen.rb
CHANGED
@@ -3,6 +3,8 @@ require 'rspec'
|
|
3
3
|
|
4
4
|
class Aspen
|
5
5
|
|
6
|
+
DIRECTORIES = ["","/bin", "/config","/lib/models","/lib/concerns"]
|
7
|
+
|
6
8
|
def self.method_missing(method, *args, &block)
|
7
9
|
puts "Invalid command - try again."
|
8
10
|
end
|
@@ -18,19 +20,22 @@ class Aspen
|
|
18
20
|
return help
|
19
21
|
end
|
20
22
|
return method_missing(:run, args) if args == nil
|
21
|
-
@@root_name = sterilize_project_name(args
|
23
|
+
@@root_name = sterilize_project_name(args)
|
22
24
|
return if @@root_name == nil
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
FileUtils.mkdir_p("#{@@root_name}/config", :verbose => true)
|
25
|
+
project_init
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.project_init
|
29
|
+
directory_init
|
29
30
|
rspec_init
|
30
31
|
make_files
|
31
32
|
successful_creation
|
32
33
|
end
|
33
34
|
|
35
|
+
def self.directory_init
|
36
|
+
DIRECTORIES.each {|dir| FileUtils.mkdir_p("#{@@root_name}#{dir}", :verbose => true)}
|
37
|
+
end
|
38
|
+
|
34
39
|
def self.rspec_init
|
35
40
|
current = FileUtils.pwd()
|
36
41
|
FileUtils.cd("#{@@root_name}")
|
@@ -38,31 +43,21 @@ class Aspen
|
|
38
43
|
FileUtils.cd(current)
|
39
44
|
end
|
40
45
|
|
41
|
-
def self.
|
42
|
-
|
43
|
-
|
44
|
-
# response = $stdin.gets.strip.downcase
|
45
|
-
# if response == "y"
|
46
|
-
# system ruby -e "Dir.chdir(#{@@root_name}); system 'bash'"
|
47
|
-
# end
|
46
|
+
def self.make_files
|
47
|
+
FileUtils.touch("#{@@root_name}/README.md")
|
48
|
+
FileUtils.touch("#{@@root_name}/config/environment.rb")
|
48
49
|
end
|
49
50
|
|
50
|
-
def self.
|
51
|
-
|
52
|
-
FileUtils.touch("#{@@root_name}/config/environment.rb") #environment
|
53
|
-
File.open("#{@@root_name}/config/environment.rb", "w+") do |f|
|
54
|
-
f << "Dir.foreach('lib') do |file|
|
55
|
-
next if file.start_with?('.')
|
56
|
-
require_relative '../lib/\"#{file}\"' if file.end_with?('.rb')
|
57
|
-
end"
|
58
|
-
end
|
51
|
+
def self.successful_creation
|
52
|
+
puts "\nProject successfully created at:\n\t#{Dir.pwd}/#{@@root_name}\n"
|
59
53
|
end
|
60
54
|
|
61
|
-
def self.sterilize_project_name(
|
62
|
-
|
63
|
-
|
55
|
+
def self.sterilize_project_name(args)
|
56
|
+
name = (args.size == 1 ? args.first : args.join(" "))
|
57
|
+
if name.match(/^[a-z]/i)
|
58
|
+
name.strip.downcase.gsub(/[\s\_]/,"-")
|
64
59
|
else
|
65
|
-
|
60
|
+
puts "Invalid project name: #{name}"
|
66
61
|
end
|
67
62
|
end
|
68
63
|
end
|