enzyme 0.1.2 → 0.1.3
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.
- data/VERSION +1 -1
- data/lib/commands/config.rb +1 -1
- data/lib/commands/create.rb +16 -23
- data/lib/commands/sync.rb +16 -33
- data/lib/enzyme.rb +7 -7
- data/lib/setup.rb +1 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/commands/config.rb
CHANGED
data/lib/commands/create.rb
CHANGED
@@ -16,25 +16,29 @@ module Create extend self
|
|
16
16
|
when :koi
|
17
17
|
koi(project_name)
|
18
18
|
else
|
19
|
-
|
19
|
+
raise "Unknown project type `#{project_type}`."
|
20
20
|
end
|
21
21
|
else
|
22
22
|
base(project_name)
|
23
23
|
end
|
24
|
+
puts "Complete."
|
24
25
|
else
|
25
|
-
|
26
|
+
raise "A project name must be given. For example: `enzyme create project_name`"
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
29
30
|
def base(project_name)
|
30
|
-
unless $settings.projects_directory
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
raise "The `projects_directory` setting is not set. Set it using `enzyme config projects_directory \"/Users/me/Projects\" --global`." unless $settings.projects_directory
|
32
|
+
raise "The `sync.shared_directory` setting is not set. Set it using `enzyme config sync.shared_directory \"shared\" --global`." unless $settings.sync.shared_directory
|
33
|
+
raise "The `user` setting is not set. Set it using `enzyme config user \"me\" --global`." unless $settings.user
|
34
|
+
|
35
|
+
puts "Creating the #{project_name} project at #{$settings.projects_directory}/#{project_name}..."
|
34
36
|
|
35
37
|
system "mkdir #{$settings.projects_directory}/#{project_name}"
|
38
|
+
# TODO: Move the resources directory and it's content to the sync command. Create shouldn't be responsible for it.
|
36
39
|
system "mkdir #{$settings.projects_directory}/#{project_name}/resources"
|
37
|
-
system "mkdir #{$settings.projects_directory}/#{project_name}/resources
|
40
|
+
system "mkdir #{$settings.projects_directory}/#{project_name}/resources/#{$settings.sync.shared_directory}"
|
41
|
+
system "mkdir #{$settings.projects_directory}/#{project_name}/resources/#{$settings.user}"
|
38
42
|
system "touch #{$settings.projects_directory}/#{project_name}/.enzyme.yml"
|
39
43
|
|
40
44
|
Dir.chdir("#{$settings.projects_directory}/#{project_name}")
|
@@ -44,24 +48,13 @@ module Create extend self
|
|
44
48
|
end
|
45
49
|
|
46
50
|
def koi(project_name)
|
47
|
-
|
51
|
+
raise "Koi projects are not avaliable in this version of Enzyme (#{$version})."
|
48
52
|
end
|
49
53
|
|
50
54
|
def pms(project_name)
|
51
|
-
unless $settings.projects_directory
|
52
|
-
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
unless $settings.github.user
|
57
|
-
Enzyme.error("The `sync.github.user` setting is not set. Set it using `enzyme config github.user \"me\"`.")
|
58
|
-
return
|
59
|
-
end
|
60
|
-
|
61
|
-
unless $settings.github.token
|
62
|
-
Enzyme.error("The `sync.github.token` setting is not set. Set it using `enzyme config github.token \"0123456789abcdef0123456789abcdef\"`.")
|
63
|
-
return
|
64
|
-
end
|
55
|
+
raise "The `sync.projects_directory` setting is not set. Set it using `enzyme config projects_directory \"/Users/me/Projects\" --global`." unless $settings.projects_directory
|
56
|
+
raise "The `sync.github.user` setting is not set. Set it using `enzyme config github.user \"me\" --global`." unless $settings.github.user
|
57
|
+
raise "The `sync.github.token` setting is not set. Set it using `enzyme config github.token \"0123456789abcdef0123456789abcdef\" --global`." unless $settings.github.token
|
65
58
|
|
66
59
|
base(project_name)
|
67
60
|
|
@@ -85,7 +78,7 @@ Enzyme.register(Create) do
|
|
85
78
|
puts ''
|
86
79
|
puts '### SYNOPSIS'
|
87
80
|
puts ''
|
88
|
-
puts ' enzyme create project_name [pms]'
|
81
|
+
puts ' enzyme create <project_name> [pms | koi]'
|
89
82
|
puts ''
|
90
83
|
puts '### EXAMPLES'
|
91
84
|
puts ''
|
data/lib/commands/sync.rb
CHANGED
@@ -6,55 +6,38 @@ module Sync extend self
|
|
6
6
|
ARGV.reject { |x| x.start_with?("-") }
|
7
7
|
project_name = ARGV.shift || $settings.project_name
|
8
8
|
|
9
|
-
unless project_name
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
unless $settings.
|
15
|
-
|
16
|
-
return
|
17
|
-
end
|
18
|
-
|
19
|
-
unless $settings.sync.host
|
20
|
-
Enzyme.error("The `sync.host` setting is not set. Set it using `enzyme config sync.host \"Host._afpovertcp._tcp.local\"`.")
|
21
|
-
return
|
22
|
-
end
|
23
|
-
|
24
|
-
unless $settings.sync.projects_directory
|
25
|
-
Enzyme.error("The `sync.projects_directory` setting is not set. Set it using `enzyme config sync.projects_directory \"My Projects Directory\"`.")
|
26
|
-
return
|
27
|
-
end
|
28
|
-
|
29
|
-
unless $settings.sync.protected_directory
|
30
|
-
Enzyme.error("The `sync.protected_directory` setting is not set. Set it using `enzyme config sync.protected_directory \"my_directory\"`.")
|
31
|
-
return
|
32
|
-
end
|
33
|
-
|
34
|
-
unless $settings.sync.shared_directory
|
35
|
-
Enzyme.error("The `sync.shared_directory` setting is not set. Set it using `enzyme config sync.shared_directory \"our_shared_directory\"`.")
|
36
|
-
return
|
37
|
-
end
|
9
|
+
raise "No project name specified. Ensure you're in the project's directory or set it specifically. Run `enzyme help sync` for help." unless project_name
|
10
|
+
raise "The #{project_name} project could not be found." unless File.exist?("#{$settings.projects_directory}/#{project_name}")
|
11
|
+
raise "The `sync.share_name` setting is not set. Set it using `enzyme config sync.share_name \"Share Name\" --global`." unless $settings.sync.share_name
|
12
|
+
raise "The `sync.host` setting is not set. Set it using `enzyme config sync.host \"Host._afpovertcp._tcp.local\" --global`." unless $settings.sync.host
|
13
|
+
raise "The `sync.projects_directory` setting is not set. Set it using `enzyme config sync.projects_directory \"My Projects Directory\" --global`." unless $settings.sync.projects_directory
|
14
|
+
raise "The `user` setting is not set. Set it using `enzyme config user \"my_directory\" --global`." unless $settings.user
|
15
|
+
raise "The `sync.shared_directory` setting is not set. Set it using `enzyme config sync.shared_directory \"our_shared_directory\" --global`." unless $settings.sync.shared_directory
|
38
16
|
|
39
17
|
# Mount the network volume. Only works on OS X.
|
40
18
|
system "mkdir \"/Volumes/#{$settings.sync.share_name}\""
|
41
19
|
system "mount -t afp \"afp://#{$settings.sync.host}/#{$settings.sync.share_name}\" \"/Volumes/#{$settings.sync.share_name}\""
|
42
20
|
system "mkdir \"/Volumes/#{$settings.sync.share_name}/#{$settings.sync.projects_directory}/#{project_name}\""
|
43
21
|
# Pull.
|
44
|
-
system "rsync -aH --stats -v -u --progress --exclude '#{$settings.
|
22
|
+
system "rsync -aH --stats -v -u --progress --exclude '#{$settings.user}/**' \"/Volumes/#{$settings.sync.share_name}/#{$settings.sync.projects_directory}/#{project_name}/\" '#{$settings.projects_directory}/#{project_name}/resources/'"
|
45
23
|
# Push.
|
46
|
-
system "rsync -aH --stats -v -u --progress --include '*/' --include '#{$settings.sync.shared_directory}/**' --include '#{$settings.
|
24
|
+
system "rsync -aH --stats -v -u --progress --include '*/' --include '#{$settings.sync.shared_directory}/**' --include '#{$settings.user}/**' --exclude '*' '#{$settings.projects_directory}/#{project_name}/resources/' \"/Volumes/#{$settings.sync.share_name}/#{$settings.sync.projects_directory}/#{project_name}/\""
|
47
25
|
end
|
48
26
|
|
49
27
|
end
|
50
28
|
|
51
29
|
Enzyme.register(Sync) do
|
52
30
|
puts 'SYNC COMMAND'
|
53
|
-
puts '
|
31
|
+
puts '------------'
|
54
32
|
puts ''
|
55
33
|
puts '### SYNOPSIS'
|
56
34
|
puts ''
|
57
|
-
puts ' enzyme sync [project_name]'
|
35
|
+
puts ' enzyme sync [<project_name>]'
|
36
|
+
puts ''
|
37
|
+
puts '### OPTIONS'
|
38
|
+
puts ''
|
39
|
+
puts '<project_name>'
|
40
|
+
puts ': The name of the project to sync. If the working directory is the root of a project this option does not need to be passed.'
|
58
41
|
puts ''
|
59
42
|
puts '### EXAMPLES'
|
60
43
|
puts ''
|
data/lib/enzyme.rb
CHANGED
@@ -51,16 +51,16 @@ module Enzyme extend self
|
|
51
51
|
puts ''
|
52
52
|
puts '### Commands'
|
53
53
|
puts ''
|
54
|
-
puts ' enzyme config [key [value [--global]]]'
|
55
|
-
puts ' enzyme create project_name [
|
56
|
-
# puts ' enzyme join project_name'
|
57
|
-
puts ' enzyme sync [project_name]'
|
54
|
+
puts ' enzyme config [<key> [<value> [--global]]]'
|
55
|
+
puts ' enzyme create <project_name> [pms | koi]'
|
56
|
+
# puts ' enzyme join <project_name>'
|
57
|
+
puts ' enzyme sync [<project_name>]'
|
58
58
|
puts ''
|
59
59
|
puts '### Help'
|
60
60
|
puts ''
|
61
|
-
puts ' enzyme help [command]'
|
62
|
-
puts ' enzyme [command] --help'
|
63
|
-
puts ' enzyme [command] -h'
|
61
|
+
puts ' enzyme help [<command>]'
|
62
|
+
puts ' enzyme [<command>] --help'
|
63
|
+
puts ' enzyme [<command>] -h'
|
64
64
|
puts ''
|
65
65
|
puts '### Debugging'
|
66
66
|
puts ''
|
data/lib/setup.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enzyme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Haydn Ewers
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-19 00:00:00 +10:30
|
19
19
|
default_executable: enzyme
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|