faststrap 0.0.4 → 0.0.5

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: a9d7bbdb618838c9c6b0b7b1b4e9a4bae4ab9972
4
- data.tar.gz: 0b74142c070e7db5be8fe85a9f9726d3a1fc3131
3
+ metadata.gz: bcd613f4add72b44fe37ec4091549e52ed712182
4
+ data.tar.gz: e708f0c0a8293c253690ee9b9bc701283781ec60
5
5
  SHA512:
6
- metadata.gz: 506121084f8be76debe4a49ce3053fe26b083c6bf265ff3f7470340c3c0f587edcc84d339e8b620278b659bc0157a4de59bf09d92e0fa2196a3a51ecc61eac04
7
- data.tar.gz: 2245c12f98e1898a60e3a61f6a0613c01c023fc3de6d8ac836bd5878e810639722ca8f8ed4686d1f33fcad1ee1c634381489082244350b17de8393ae1c7a23b4
6
+ metadata.gz: f9ec7ae8f9cf3f2a2b57e18b27f8817630ad1a875e45c7e51f30d12918259c7a20318994f8e97ccd7620d0607097c3b46a8a8bd4da83eed45a964330b88883f6
7
+ data.tar.gz: c628509267f52227dc9f59725f2e829f6353de1a64544c065f5ba83c7457f0b2b5208da9d4b617bd2401dcc8b9a2d53991f75024407fb95f246b83f32794d5cb
data/bin/faststrap CHANGED
@@ -1,3 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'faststrap'
4
+
5
+ Faststrap::Bootstrap.start
data/lib/faststrap.rb CHANGED
@@ -1,32 +1,50 @@
1
+ require 'thor'
2
+ require 'thor/group'
3
+
1
4
  require 'faststrap/install_actions/install_actions_helper'
2
5
  require 'faststrap/install_action'
3
6
 
4
7
  module Faststrap
5
8
 
6
- def self.list_actions(mod)
7
- cs = mod.constants.select {|c| Class === mod.const_get(c)}
8
- cs.collect! { |c| eval("#{mod}::#{c.to_s}") }
9
- sort_actions(cs)
10
- end
11
9
 
12
- def self.sort_actions(actions)
13
- actions.sort {|x,y| x.index_pos <=> y.index_pos }
10
+ def self.possible_responses(actions_count)
11
+ (1..actions_count).to_a.collect! { |e| e.to_s } << "*"
14
12
  end
15
13
 
16
- def self.present_actions(mod)
17
- list_actions(mod).each do |a|
18
- puts "#{a.index_pos} - #{a.description}"
14
+ def self.handle_answer(answer,actions)
15
+ actions.each do |a|
16
+ if answer == "*"
17
+ a.run
18
+ else
19
+ a.run if answer == a.index
20
+ end
19
21
  end
20
22
  end
21
23
 
22
24
 
23
- Faststrap::InstallActions.load_default_actions
25
+ class Bootstrap < Thor
26
+ include Thor::Actions
27
+
28
+ desc 'ios', 'bootstrap your computer for ios env'
29
+ def ios
30
+ puts "We have the follow actions for ios :"
31
+
32
+ Faststrap::InstallActions.load_default_actions
33
+ install_actions = Faststrap::InstallActions.list
34
+ install_actions_count = install_actions.count
24
35
 
36
+ Faststrap::InstallActions.present
37
+ puts "* - Everything"
25
38
 
26
- puts "\nSelect what you want to install by typing the number of the action.\nYou can type more than one separeted by commas (Ex: 0,1,3,5)\nType all to install everything."
27
- present_actions(Faststrap::InstallActions)
28
- puts "all - Everything"
39
+ answer = ask("What do you want to install for ios environment ?",
40
+ :limited_to => Faststrap.possible_responses(install_actions_count))
29
41
 
42
+ answer = (answer.to_i) -1 unless answer == '*'
43
+
44
+ Faststrap.handle_answer(answer,install_actions)
45
+
46
+ end
47
+ end
30
48
 
31
49
 
32
50
 
@@ -3,7 +3,7 @@ require 'faststrap/install_actions/install_actions_helper'
3
3
  module Faststrap
4
4
  class InstallAction
5
5
 
6
- def self.index_pos
6
+ def self.index
7
7
  0
8
8
  end
9
9
 
@@ -11,12 +11,17 @@ module Faststrap
11
11
  "InstallAction description"
12
12
  end
13
13
 
14
- def self.install_cmd
14
+ def self.cmd
15
15
  "InstallAction cmd"
16
16
  end
17
17
 
18
- def self.install_action_name
18
+ def self.name
19
19
  "InstallAction"
20
20
  end
21
+
22
+ def self.run
23
+ puts "Installing #{name} .."
24
+ cmd
25
+ end
21
26
  end
22
27
  end
@@ -2,18 +2,22 @@ module Faststrap
2
2
  module InstallActions
3
3
  class BashCompletionInstallAction < InstallAction
4
4
 
5
- def self.index_pos
6
- 1
5
+ def self.index
6
+ 8
7
7
  end
8
8
 
9
9
  def self.description
10
- "BashCompletionInstallAction description"
10
+ "Install bash-completion cmd using homebrew"
11
11
  end
12
12
 
13
- def self.install_cmd
14
- puts "echo BashCompletionInstallAction"
13
+ def self.cmd
14
+ system "brew install bash-completion"
15
15
  end
16
-
16
+
17
+ def self.name
18
+ "bash-completion"
19
+ end
20
+
17
21
  end
18
22
  end
19
23
  end
@@ -0,0 +1,23 @@
1
+ module Faststrap
2
+ module InstallActions
3
+ class CalabashBundleInstallAction < InstallAction
4
+
5
+ def self.index
6
+ 10
7
+ end
8
+
9
+ def self.description
10
+ "Install Calabash Bundle[calabash-common,calabash-cucumber,cs-bdd,blabla]"
11
+ end
12
+ def self.cmd
13
+ ["calabash-common",'calabash-cucumber',
14
+ 'cs-bdd','blabla'].map { |d| system("sudo gem install #{d} --verbose") }
15
+ end
16
+
17
+ def self.name
18
+ "Calabash Bundle[calabash-common,calabash-cucumber,cs-bdd,blabla]"
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,22 @@
1
+ module Faststrap
2
+ module InstallActions
3
+ class CarthageInstallAction < InstallAction
4
+
5
+ def self.index
6
+ 9
7
+ end
8
+
9
+ def self.description
10
+ "Install Carthage"
11
+ end
12
+ def self.cmd
13
+ system 'brew install carthage'
14
+ end
15
+
16
+ def self.name
17
+ "Carthage"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ module Faststrap
2
+ module InstallActions
3
+ class CocoapodsInstallAction < InstallAction
4
+
5
+ def self.index
6
+ 3
7
+ end
8
+
9
+ def self.description
10
+ "Install Cocoapods"
11
+ end
12
+ def self.cmd
13
+ system 'sudo gem install cocoapods --verbose'
14
+ end
15
+
16
+ def self.name
17
+ "Cocoapods"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ module Faststrap
2
+ module InstallActions
3
+ class FastlaneInstallAction < InstallAction
4
+
5
+ def self.index
6
+ 5
7
+ end
8
+
9
+ def self.description
10
+ "Install Fastlane"
11
+ end
12
+ def self.cmd
13
+ system 'sudo gem install fastlane --verbose'
14
+ end
15
+
16
+ def self.name
17
+ "Fastlane"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ module Faststrap
2
+ module InstallActions
3
+ class GitInstallAction < InstallAction
4
+
5
+ def self.index
6
+ 2
7
+ end
8
+
9
+ def self.description
10
+ "Install Git"
11
+ end
12
+ def self.cmd
13
+ system 'brew install git'
14
+ end
15
+
16
+ def self.name
17
+ "Git"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -2,16 +2,21 @@ module Faststrap
2
2
  module InstallActions
3
3
  class HomebrewInstallAction < InstallAction
4
4
 
5
- def self.index_pos
5
+ def self.index
6
6
  0
7
7
  end
8
8
 
9
9
  def self.description
10
- "HomebrewInstallAction description"
10
+ "Install Homebrew"
11
11
  end
12
- def self.install_cmd
13
- puts "echo HomebrewInstallAction"
12
+ def self.cmd
13
+ system 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"'
14
14
  end
15
+
16
+ def self.name
17
+ "Homebrew"
18
+ end
19
+
15
20
  end
16
21
  end
17
22
  end
@@ -1,9 +1,29 @@
1
1
  module Faststrap
2
2
  module InstallActions
3
+
4
+ @@mod = Faststrap::InstallActions
5
+
3
6
  def self.load_default_actions
4
7
  Dir[File.expand_path '*install_action.rb', File.dirname(__FILE__)].each do |file|
5
8
  require file
6
9
  end
7
10
  end
11
+
12
+ def self.list
13
+ cs = @@mod.constants.select {|c| Class === @@mod.const_get(c)}
14
+ cs.collect! { |c| eval("#{@@mod}::#{c.to_s}") }
15
+ sort_actions(cs)
16
+ end
17
+
18
+ def self.sort_actions(actions)
19
+ actions.sort {|x,y| x.index <=> y.index }
20
+ end
21
+
22
+ def self.present
23
+ list.each do |a|
24
+ puts "#{a.index + 1} - #{a.name}"
25
+ end
26
+ end
27
+
8
28
  end
9
29
  end
@@ -0,0 +1,22 @@
1
+ module Faststrap
2
+ module InstallActions
3
+ class JenkinsInstallAction < InstallAction
4
+
5
+ def self.index
6
+ 6
7
+ end
8
+
9
+ def self.description
10
+ "Install Jenkins CI"
11
+ end
12
+ def self.cmd
13
+ system 'brew install jenkins'
14
+ end
15
+
16
+ def self.name
17
+ "Jenkins CI"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ module Faststrap
2
+ module InstallActions
3
+ class RestClientInstallAction < InstallAction
4
+
5
+ def self.index
6
+ 7
7
+ end
8
+
9
+ def self.description
10
+ "Install RestClient"
11
+ end
12
+ def self.cmd
13
+ system 'sudo gem install rest-client --verbose'
14
+ end
15
+
16
+ def self.name
17
+ "rest-client"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ module Faststrap
2
+ module InstallActions
3
+ class XcodeCmdToolsInstallAction < InstallAction
4
+
5
+ def self.index
6
+ 1
7
+ end
8
+
9
+ def self.description
10
+ "Install Xcode cmd line tools"
11
+ end
12
+ def self.cmd
13
+ system 'xcode-select --install'
14
+ end
15
+
16
+ def self.name
17
+ "Xcode Cmd Tools"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ module Faststrap
2
+ module InstallActions
3
+ class XctoolInstallAction < InstallAction
4
+
5
+ def self.index
6
+ 4
7
+ end
8
+
9
+ def self.description
10
+ "Install Xctool"
11
+ end
12
+ def self.cmd
13
+ system 'brew install xctool'
14
+ end
15
+
16
+ def self.name
17
+ "xctool"
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module Faststrap
2
+ VERSION = '0.0.5'
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faststrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Lioy
@@ -9,7 +9,77 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-04-29 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 0.19.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.19.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 3.1.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 3.1.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '0.29'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '0.29'
13
83
  description: setup and bootstrap your mac OS environment for development.
14
84
  email: lioyufrj@gmail.com
15
85
  executables:
@@ -23,8 +93,18 @@ files:
23
93
  - lib/faststrap.rb
24
94
  - lib/faststrap/install_action.rb
25
95
  - lib/faststrap/install_actions/bash_completion_install_action.rb
96
+ - lib/faststrap/install_actions/calabash_bundle_install_action.rb
97
+ - lib/faststrap/install_actions/carthage_install_action.rb
98
+ - lib/faststrap/install_actions/cocoapods_install_action.rb
99
+ - lib/faststrap/install_actions/fastlane_install_action.rb
100
+ - lib/faststrap/install_actions/git_install_action.rb
26
101
  - lib/faststrap/install_actions/homebrew_install_action.rb
27
102
  - lib/faststrap/install_actions/install_actions_helper.rb
103
+ - lib/faststrap/install_actions/jenkins_install_action.rb
104
+ - lib/faststrap/install_actions/rest_client_install_action.rb
105
+ - lib/faststrap/install_actions/xcode_cmd_tools_install_action.rb
106
+ - lib/faststrap/install_actions/xctool_install_action.rb
107
+ - lib/faststrap/version.rb
28
108
  homepage: https://github.com/thiagolioy/faststrap
29
109
  licenses:
30
110
  - MIT