commandify 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,123 +5,130 @@ module Commandify
5
5
 
6
6
  module Command
7
7
 
8
- ALL = %w( r m v c a h j s i f conf e init db l la lt las laj v va vas vaj
9
- srvstop srvstart srvrestart )
10
-
11
8
  class << self
12
9
 
13
10
  include Commandify::Core
14
11
 
15
12
  def run command
16
- send command
13
+ send "run_#{command}"
14
+ end
15
+
16
+ def commands
17
+ methods.select { |v| v =~ /^run_/ }.collect do |command|
18
+ command.to_s.gsub 'run_', ''
19
+ end
17
20
  end
18
21
 
19
22
  # Navigation
20
23
 
21
- def r
24
+ def run_r
22
25
  goto Commandify::Directories::ROOT
23
26
  end
24
27
 
25
- def m
28
+ def run_p
29
+ goto Commandify::Directories::PUBLIC
30
+ end
31
+
32
+ def run_m
26
33
  goto Commandify::Directories::MODELS
27
34
  end
28
35
 
29
- def v
36
+ def run_v
30
37
  goto Commandify::Directories::VIEWS
31
38
  end
32
39
 
33
- def c
40
+ def run_c
34
41
  goto Commandify::Directories::CONTROLLERS
35
42
  end
36
43
 
37
- def a
44
+ def run_a
38
45
  goto Commandify::Directories::ASSETS
39
46
  end
40
47
 
41
- def h
48
+ def run_h
42
49
  goto Commandify::Directories::HELPERS
43
50
  end
44
51
 
45
- def j
52
+ def run_j
46
53
  goto Commandify::Directories::JAVASCRIPTS
47
54
  end
48
55
 
49
- def s
56
+ def run_s
50
57
  goto Commandify::Directories::STYLESHEETS
51
58
  end
52
59
 
53
- def i
60
+ def run_i
54
61
  goto Commandify::Directories::IMAGES
55
62
  end
56
63
 
57
- def f
64
+ def run_f
58
65
  goto Commandify::Directories::FONTS
59
66
  end
60
67
 
61
- def conf
68
+ def run_conf
62
69
  goto Commandify::Directories::CONFIG
63
70
  end
64
71
 
65
- def e
72
+ def run_e
66
73
  goto Commandify::Directories::CONFIG
67
74
  end
68
75
 
69
- def init
76
+ def run_init
70
77
  goto Commandify::Directories::INITIALIZERS
71
78
  end
72
79
 
73
- def db
80
+ def run_db
74
81
  goto Commandify::Directories::DB
75
82
  end
76
83
 
77
- def l
84
+ def run_l
78
85
  goto Commandify::Directories::LIB
79
86
  end
80
87
 
81
- def la
88
+ def run_la
82
89
  goto Commandify::Directories::LIB_ASSETS
83
90
  end
84
91
 
85
- def lt
92
+ def run_lt
86
93
  goto Commandify::Directories::LIB_TASKS
87
94
  end
88
95
 
89
- def las
96
+ def run_las
90
97
  goto Commandify::Directories::LIB_ASSETS_STYLESHEETS
91
98
  end
92
99
 
93
- def laj
100
+ def run_laj
94
101
  goto Commandify::Directories::LIB_ASSETS_JAVASCRIPTS
95
102
  end
96
103
 
97
- def v
104
+ def run_v
98
105
  goto Commandify::Directories::VENDOR
99
106
  end
100
107
 
101
- def va
108
+ def run_va
102
109
  goto Commandify::Directories::VENDOR_ASSETS
103
110
  end
104
111
 
105
- def vas
112
+ def run_vas
106
113
  goto Commandify::Directories::VENDOR_ASSETS_STYLESHEETS
107
114
  end
108
115
 
109
- def vaj
116
+ def run_vaj
110
117
  goto Commandify::Directories::VENDOR_ASSETS_JAVASCRIPTS
111
118
  end
112
119
 
113
120
  # Processes
114
121
 
115
- def srvstop port=3000
122
+ def run_srvstop port=3000
116
123
  system "sudo kill -9 #{server_pid(port)}"
117
124
  end
118
125
 
119
- def srvstart port=3000
126
+ def run_srvstart port=3000
120
127
  srvstop port
121
128
  system "rails server"
122
129
  end
123
130
 
124
- def srvrestart port=3000
131
+ def run_srvrestart port=3000
125
132
  srvstop port
126
133
  srvstart port
127
134
  end
@@ -4,6 +4,8 @@ module Commandify
4
4
 
5
5
  ROOT = nil
6
6
 
7
+ PUBLIC = 'public'
8
+
7
9
  MODELS = 'app/models'
8
10
 
9
11
  VIEWS = 'app/views'
@@ -1,5 +1,5 @@
1
1
  require 'commandify/command'
2
- require 'commandify/helpers'
2
+ require 'commandify/tty'
3
3
  require 'commandify/version'
4
4
 
5
5
  module Commandify
@@ -8,7 +8,7 @@ module Commandify
8
8
 
9
9
  class << self
10
10
 
11
- include Commandify::Helpers
11
+ include Commandify::Tty
12
12
 
13
13
  # write to .bashrc if havent already
14
14
  def run
@@ -25,7 +25,7 @@ module Commandify
25
25
 
26
26
  def run!
27
27
  mod_bashrc!
28
- notify install_message
28
+ notify "Be sure to run 'source ~/.bashrc' or open a new terminal for the changes to take effect."
29
29
  end
30
30
 
31
31
  # checks for current Commandify version in .bashrc
@@ -33,10 +33,6 @@ module Commandify
33
33
  File.read(bashrc).include? start_marker
34
34
  end
35
35
 
36
- def install_message
37
- "Be sure to run 'source ~/.bashrc' or open a new terminal for the changes to take effect."
38
- end
39
-
40
36
  # full path of .bashrc
41
37
  def bashrc
42
38
  File.expand_path('~/.bashrc')
@@ -61,7 +57,7 @@ module Commandify
61
57
  def new_command_aliases
62
58
  aliases = ""
63
59
  aliases << start_marker
64
- Commandify::Command::ALL.each do |command|
60
+ Commandify::Command.commands.each do |command|
65
61
  aliases << command_alias(command)
66
62
  end
67
63
  aliases << end_marker
@@ -1,6 +1,6 @@
1
1
  module Commandify
2
2
 
3
- module Helpers
3
+ module Tty
4
4
 
5
5
  def log msg
6
6
  STDOUT.puts " | " << msg
@@ -1,3 +1,3 @@
1
1
  module Commandify
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commandify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -30,8 +30,8 @@ files:
30
30
  - lib/commandify/command.rb
31
31
  - lib/commandify/core.rb
32
32
  - lib/commandify/directories.rb
33
- - lib/commandify/helpers.rb
34
33
  - lib/commandify/install.rb
34
+ - lib/commandify/tty.rb
35
35
  - lib/commandify/version.rb
36
36
  homepage: ''
37
37
  licenses: []