easy_start 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f71c23b5bde69222583a2143054ea0f03dcb2acf
4
- data.tar.gz: 4282b2622d3403d69b695973b11df56d8788ab32
3
+ metadata.gz: 117afa6c490363f1dd33d8f9e802e1dff39e8581
4
+ data.tar.gz: 3505ffe63dcd3c709ecc4672b0947b4a55505249
5
5
  SHA512:
6
- metadata.gz: bde55cdc8dad339dc5be85793a4a383e37edf89667a2d2c5eefcb9bd3bac320d2c810db90ecdfdb1faa5c1dab4d1f71c479faaf510c15201f8016cc93759d7ed
7
- data.tar.gz: 78c136a23e62a95e8a4a6852a01c0ab63fe9a5e669c8c6d75fff5c8ac69837cb0f5097df46b42f59df72b67f620308ff9b755e097d96deea5803740f8137dbd7
6
+ metadata.gz: fefac2bb246d910afeeccbe1a593a7ebd7c33f91abe53e1940d60997105343ff981e5da4dec4a7d02952bcfea9c6d1c8b24470a37245e40b226c2487202b26ae
7
+ data.tar.gz: cf89f28d5667988d4c9e791cb32c5aa3388c8db7d185db28517d02b2e1aa89c7939bbc29260152040a565813b3d4b64c46bdabfc29eda33529ba9e7c231a510b
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ easy_start (0.1.3)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (10.5.0)
11
+ rspec (3.7.0)
12
+ rspec-core (~> 3.7.0)
13
+ rspec-expectations (~> 3.7.0)
14
+ rspec-mocks (~> 3.7.0)
15
+ rspec-core (3.7.1)
16
+ rspec-support (~> 3.7.0)
17
+ rspec-expectations (3.7.0)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.7.0)
20
+ rspec-mocks (3.7.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.7.0)
23
+ rspec-support (3.7.1)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.16)
30
+ easy_start!
31
+ rake (~> 10.0)
32
+ rspec (~> 3.0)
33
+
34
+ BUNDLED WITH
35
+ 1.16.0
data/README.md CHANGED
@@ -1,9 +1,19 @@
1
1
  # EasyStart
2
2
 
3
- EasyStart will allow users to quickly start the local rails server in a single command. This gem is intended to be used only in development mode.
3
+ EasyStart will allow users to run certain rails commands (mainly used in local development environment) related to a application from anywhere in terminal.
4
+ User need not change directory to the application root for running commands like `rails s` , `rails c` etc.
5
+ Just adding the application path and application name to the meta data is required to use this gem.
6
+
7
+ After adding the meta data, you can launch the application from anywhere in the terminal by running the following command
4
8
 
5
9
  $ easy_start application_name
6
- the above command will start the rails server in your local machine and you are ready to go to your browser to test or develop your application.
10
+
11
+ This will start the rails server on port 3000.
12
+
13
+ EasyStart also supports switching branches, mentioning the port, opening rails console.
14
+
15
+ Add multiple projects and start their server or access their console with single command.
16
+
7
17
 
8
18
  ## Installation
9
19
 
@@ -19,11 +29,31 @@ Now you are ready to start your project from anywhere in terminal by
19
29
 
20
30
  $ easy_start application_name
21
31
 
32
+ or
33
+
34
+ $ easy_start -l application_name
35
+
22
36
  Switching branches are also supported by EasyStart
23
37
 
24
38
  $ easy_start application_name branch_name
25
39
 
26
- Note: mentioning branch name will switch the application directory to that branch and will automatically pull the latest version of the branch before starting the server.
40
+ or
41
+
42
+ $ easy_start -l application_name -b branch_name
43
+
44
+ Note: mentioning branch name will switch the application directory to that branch and will automatically pull the latest version of the branch before starting the server( the branch should be available locally for it to work as expected).
45
+
46
+ Mentioning the port to be used by the server
47
+
48
+ $ easy_start -l application_name -P 4000
49
+
50
+ By default application will run on port 3000.
51
+
52
+ Opening rails console
53
+
54
+ $ easy_start -c application_name
55
+
56
+
27
57
 
28
58
  ## Development
29
59
 
@@ -15,10 +15,36 @@ OptionParser.new do |opts|
15
15
  opts.on('-p', '--path path', 'path, should be mentioned after -a') do |path|
16
16
  options['project_path'] = path;
17
17
  end
18
+
19
+ opts.on('-l', '--launch launch', 'launch, mention application_name') do |name|
20
+ options['launch_project_name'] = name;
21
+ end
22
+
23
+ opts.on('-b', '--branch branch', 'branch, should be mentioned after application_name') do |branch|
24
+ options['project_branch'] = branch;
25
+ end
26
+
27
+ opts.on('-P', '--port port', 'port, should be mentioned after application_name') do |port|
28
+ options['project_port'] = port;
29
+ end
30
+
31
+ opts.on('-c', '--console console', 'console, mention application_name for launching console') do |console_name|
32
+ options['console_project_name'] = console_name;
33
+ end
34
+
18
35
  end.parse!
19
36
 
20
37
  if options.present?
21
- EasyStart.add(options)
38
+ case
39
+ when options['project_name'].present?
40
+ EasyStart.add(options)
41
+ when options['launch_project_name'].present?
42
+ EasyStart.launch(options)
43
+ when options['console_project_name'].present?
44
+ EasyStart.launch_console(options['console_project_name'])
45
+ else
46
+ puts 'Format provided incorrect!!'
47
+ end
22
48
  else
23
49
  EasyStart.launch(ARGV[0],ARGV[1])
24
50
  end
Binary file
@@ -32,10 +32,13 @@ module EasyStart
32
32
  end
33
33
  end
34
34
 
35
- def self.launch(name,branch='')
35
+ def self.launch(launch_data,branch='')
36
+ name = launch_data.respond_to?(:keys) ? launch_data['launch_project_name'] : launch_data
37
+ port = launch_data['project_port'] || '3000'
38
+ branch = launch_data['project_branch'] || branch
36
39
  begin
37
40
  file_path = File.join(File.dirname(__FILE__), "../scripts/#{name}.sh")
38
- a = system "#{file_path}",(branch || '')
41
+ a = system "#{file_path}", port ,(branch || '')
39
42
  rescue SystemExit, Interrupt
40
43
  exit 0
41
44
  rescue Exception => e
@@ -43,7 +46,27 @@ module EasyStart
43
46
  end
44
47
  end
45
48
 
49
+ def self.launch_console(name)
50
+ root_path = get_root_path(name)
51
+ system "cd #{root_path} && rails c"
52
+ end
53
+
46
54
  def self.meta_data
47
- ['cd "$ROOT_PATH"','if [ -n "$1" ]; then','git checkout $1','git pull','fi','rails s'].join("\n")
55
+ ['cd "$ROOT_PATH"','if [ -n "$2" ]; then','git checkout $2','git pull','fi','rails s -p $1'].join("\n")
48
56
  end
57
+
58
+ def self.get_root_path(name)
59
+ root_path = ""
60
+ file_path = File.join(File.dirname(__FILE__), "../scripts/#{name}.sh")
61
+ File.open(file_path).each do |line|
62
+ if line.include? 'ROOT_PATH='
63
+ line.slice!("ROOT_PATH=\"")
64
+ line.slice!("\"\n")
65
+ root_path = line
66
+ break
67
+ end
68
+ end
69
+ root_path
70
+ end
71
+
49
72
  end
@@ -1,3 +1,3 @@
1
1
  module EasyStart
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_start
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arun Eapachen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-19 00:00:00.000000000 Z
11
+ date: 2018-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -65,6 +65,7 @@ files:
65
65
  - ".rspec"
66
66
  - ".travis.yml"
67
67
  - Gemfile
68
+ - Gemfile.lock
68
69
  - LICENSE.txt
69
70
  - README.md
70
71
  - Rakefile
@@ -73,6 +74,7 @@ files:
73
74
  - bin/setup
74
75
  - easy_start-0.1.0.gem
75
76
  - easy_start-0.1.1.gem
77
+ - easy_start-0.1.2.gem
76
78
  - easy_start.gemspec
77
79
  - lib/easy_start.rb
78
80
  - lib/easy_start/version.rb