flow-cli 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48d5643f471acdc59e639f673bd7e55e935effbf
4
- data.tar.gz: e87fcaa448f2f16f3c0e2f30176f56711bc8b4da
3
+ metadata.gz: b35752ca7684642efbd22fe04e00382f78cb07f3
4
+ data.tar.gz: 9a45f23b55153f632142fde46736082336f26ef3
5
5
  SHA512:
6
- metadata.gz: 2ccfe63966f8268d136b5386ccfffd7e796d08ce2afe81be50057859be0b15384621814674bf967bae5e2c6f726a90e99f37b3f24f23dd434a9aed8e37c79214
7
- data.tar.gz: 767d2abaa5689eae0397594a200d707b34641d5ad155c51d54e4ea0f82638bfff8557e22fdf485b1c7510803b173ceaa1910a890522ea22f3fbada7bb52d18d4
6
+ metadata.gz: 99048d71b191c1fbd5206fccb71503fe2ea80c7120482e64279208236befa067c91193eda6349f447ea029dfd5293b483c8a52bfe9676377bb9c12c3ba265423
7
+ data.tar.gz: d76e56023a79784a189ef053bb26bdc53ad7b4060febcac676696888ad22fd96039bcc41606ef4c7f6f81d7c891a41bf4f0c007de8ca91da740717fbee6caf5e
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
- source 'https://rubygems.org'
1
+ #source 'https://rubygems.org'
2
+ source 'https://gems.ruby-china.org'
2
3
 
3
4
  # Specify your gem's dependencies in flow-cli.gemspec
4
5
  gemspec
data/README.md CHANGED
@@ -2,28 +2,124 @@
2
2
 
3
3
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/flow/cli`. To experiment with that code, run `bin/console` for an interactive prompt.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ ## simple Installation
6
6
 
7
- ## Installation
7
+ curl -L https://raw.githubusercontent.com/FIRHQ/flow-cli/master/simple-install.sh | bash -s
8
8
 
9
- Add this line to your application's Gemfile:
9
+ it would:
10
10
 
11
- ```ruby
12
- gem 'flow-cli'
13
- ```
11
+ install rvm (which manage ruby version)
12
+ install ruby 2.3.1
13
+ using gem mirror ruby-china.org
14
+ install gem flow-cli
14
15
 
15
- And then execute:
16
16
 
17
- $ bundle
17
+ ## Installation
18
18
 
19
- Or install it yourself as:
19
+ I guess you had install rvm ?
20
20
 
21
21
  $ gem install flow-cli
22
22
 
23
23
  ## Usage
24
24
 
25
25
  flow-cli --help # help
26
- flow-cli remote # flow ci operations.
26
+ flow-cli remote --help# flow ci operation help.
27
+
28
+ ## Example
29
+
30
+ ### Build flow yaml
31
+
32
+ ```
33
+ ➜ flowclibasic git:(master) ✗ flow-cli build_yaml_file
34
+
35
+ export_method? development
36
+ less log? Yes
37
+ [17:54:50]: $ xcodebuild -list -project ./flowclibasic.xcodeproj
38
+ [17:54:52]: $ xcodebuild -showBuildSettings -scheme flowclibasic -project ./flowclibasic.xcodeproj
39
+ ---
40
+ env:
41
+ - FLOW_YAML_FROM=flow-cli
42
+ flows:
43
+ - name: default_flow_by_cli
44
+ language: objc
45
+ version: Xcode8
46
+ env:
47
+ trigger:
48
+ push:
49
+ - develop
50
+ - master
51
+ steps:
52
+ - name: init
53
+ plugin:
54
+ name: objc_init
55
+ - name: git
56
+ plugin:
57
+ name: git
58
+ - name: install
59
+ plugin:
60
+ name: objc_init
61
+ - name: build
62
+ scripts:
63
+ - fastlane gym build --project ./flowclibasic.xcodeproj --scheme flowclibasic
64
+ --output_name flowclibasic --clean false --export_method development --silent
65
+
66
+ ```
67
+
68
+ ### show build script
69
+
70
+ ```
71
+ ➜ flowclibasic git:(master) ✗ flow-cli show_build_script
72
+ This is the build script in yaml
73
+
74
+ ******************************
75
+ fastlane gym build --project ./flowclibasic.xcodeproj --scheme flowclibasic --output_name flowclibasic --clean false --export_method development --silent
76
+ ******************************
77
+ ```
78
+
79
+
80
+ ### Flow-cli login
81
+
82
+ ```
83
+ ➜ flow-cli git:(master) ✗ flow-cli remote login
84
+ email? jc@fir.im
85
+ password? ••••••••
86
+ you info saved to ~/.flow_cli_config.yml
87
+ login success...
88
+ ```
89
+
90
+ ### Choose a project
91
+
92
+ ```
93
+ ➜ flow-cli git:(master) ✗ flow-cli remote project_init
94
+ Choose your project? FIRHQ/flow-cli
95
+ project_id = 591a8ff86c112a739a1abefe, flow_id = 591a9003ef2cb037c03c0c94. saved this info...
96
+ ```
97
+
98
+ ### Fetch latest jobs
99
+
100
+ ```
101
+ flow-cli git:(master) ✗ flow-cli remote fetch_latest_jobs
102
+ ┌──────┬──────────┬──────┬───────┬──────────────┬─────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────┐
103
+ │number│event_type│branch│status │commit_log │created_at_str │url │
104
+ ├──────┼──────────┼──────┼───────┼──────────────┼─────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────┤
105
+ │8 │push │master│success│update version│2017-05-16 17:38:36 +0800│https://dashboard.flow.ci/projects/xxxxxxxxx/jobs/591ac89c6c112a4dfa1abf3f│
106
+ │7 │push │master│success│fix │2017-05-16 17:37:36 +0800│https://dashboard.flow.ci/projects/xxxxxxxxx/jobs/591ac860ef2cb07df83c0df8│
107
+ │6 │push │master│success│add readme │2017-05-16 17:21:10 +0800│https://dashboard.flow.ci/projects/xxxxxxxxx/jobs/591ac4866c112a3f6c1abfd8│
108
+ │5 │push │master│success│fix table show│2017-05-16 17:14:31 +0800│https://dashboard.flow.ci/projects/xxxxxxxxx/jobs/591ac2f76c112a4dfa1abf10│
109
+ │4 │push │master│success│fix │2017-05-16 17:05:28 +0800│https://dashboard.flow.ci/projects/xxxxxxxxx/jobs/591ac0d8fbd08628bbd81e4f│
110
+ │3 │push │master│success│fix │2017-05-16 17:02:31 +0800│https://dashboard.flow.ci/projects/xxxxxxxxx/jobs/591ac0276c112a3f6c1abf6e│
111
+ │2 │push │master│failure│refactoring │2017-05-16 14:38:37 +0800│https://dashboard.flow.ci/projects/xxxxxxxxx/jobs/591a9e6d6c112a04a41abf3a│
112
+ │1 │manual │master│success│ │2017-05-16 13:37:52 +0800│https://dashboard.flow.ci/projects/xxxxxxxxx/jobs/591a90306c112a2b6f1abf5d│
113
+ └──────┴──────────┴──────┴───────┴──────────────┴─────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────┘
114
+ ```
115
+
116
+ ### run a manual job
117
+
118
+ ```
119
+ flow-cli git:(master) ✗ flow-cli remote run_manual_job --branch develop
120
+ job started. click ( cmd + click ) url to visit on browser
121
+ https://dashboard.flow.ci/projects/xxxxxxxxxx/jobs/591acbb2fbd0860841d81dd4
122
+ ```
27
123
 
28
124
  ## Development
29
125
 
data/flow-cli.gemspec CHANGED
@@ -41,11 +41,15 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency "rspec", "~> 3.0"
42
42
  spec.add_development_dependency "simplecov"
43
43
  spec.add_development_dependency "rubocop"
44
- spec.add_development_dependency "byebug"
44
+
45
+ spec.add_dependency "byebug"
46
+ spec.add_dependency "pastel"
47
+ spec.add_dependency "tty-table"
48
+ spec.add_dependency "tty-prompt"
49
+ spec.add_dependency "tty-command"
45
50
 
46
51
  spec.add_dependency "thor", "~> 0.18"
47
- spec.add_dependency "tty", "~> 0.7"
48
52
  spec.add_dependency "fastlane", "~> 2.28"
49
53
  spec.add_dependency "oj", "~> 2"
50
54
  spec.add_dependency "rest-client"
51
- end
55
+ end
@@ -1,5 +1,8 @@
1
1
  require 'yaml'
2
- require 'tty'
2
+ require "pastel"
3
+ require "tty-table"
4
+ require "tty-prompt"
5
+ require "tty-command"
3
6
  require 'thor'
4
7
  require_relative './commands/remote'
5
8
 
@@ -1,6 +1,9 @@
1
1
  require 'yaml'
2
2
  require 'byebug'
3
- require 'tty'
3
+ require "pastel"
4
+ require "tty-table"
5
+ require "tty-prompt"
6
+ require "tty-command"
4
7
  require 'thor'
5
8
 
6
9
  module Flow::Cli
@@ -1,5 +1,5 @@
1
1
  module Flow
2
2
  module Cli
3
- VERSION = "0.0.6".freeze
3
+ VERSION = "0.0.7".freeze
4
4
  end
5
5
  end
data/simple-install.sh ADDED
@@ -0,0 +1,205 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Copy from: ruby-bootstrap.sh
4
+ # Description: This script bootstraps rvm, Ruby
5
+
6
+ RVM_FRESH_INSTALL=0 # 0=false, 1=true
7
+ MIRROR_CHINA_INSTALL=1 # 0=false, 1=true
8
+
9
+
10
+ ###
11
+ ### Helper variables and functions
12
+ ###
13
+
14
+ # Make the operating system of this host available as $OS.
15
+ OS_UNKNOWN="os-unknown"
16
+ OS_MAC="mac"
17
+ OS_LINUX="linux"
18
+ case `uname` in
19
+ Linux*)
20
+ OS=$OS_LINUX
21
+ ;;
22
+ Darwin*)
23
+ OS=$OS_MAC
24
+ ;;
25
+ *)
26
+ OS=$OS_UNKNOWN
27
+ ;;
28
+ esac
29
+
30
+ # Colors for shell output
31
+ if [ "$OS" = "$OS_MAC" ]; then
32
+ red='\x1B[1;31m'
33
+ green='\x1B[1;32m'
34
+ yellow='\x1B[1;33m'
35
+ blue='\x1B[1;34m'
36
+ nocolor='\x1B[0m'
37
+ else
38
+ red='\e[1;31m'
39
+ green='\e[1;32m'
40
+ yellow='\e[1;33m'
41
+ blue='\e[1;34m'
42
+ nocolor='\e[0m'
43
+ fi
44
+
45
+ function puts() {
46
+ local opts=''
47
+ if [ "$1" = "-n" ]; then
48
+ opts='-n'
49
+ shift
50
+ fi
51
+ msg="$@"
52
+ echo -e $opts "${blue}${msg}${nocolor}"
53
+ }
54
+
55
+ function warn() {
56
+ local opts=''
57
+ if [ "$1" = "-n" ]; then
58
+ opts='-n'
59
+ shift
60
+ fi
61
+ msg="$@"
62
+ echo -e $opts "${yellow}${msg}${nocolor}"
63
+ }
64
+
65
+ function error() {
66
+ local opts=''
67
+ if [ "$1" = "-n" ]; then
68
+ opts='-n'
69
+ shift
70
+ fi
71
+ msg="$@"
72
+ echo -e $opts "${red}${msg}${nocolor}"
73
+ }
74
+
75
+ function success() {
76
+ local opts=''
77
+ if [ "$1" = "-n" ]; then
78
+ opts='-n'
79
+ shift
80
+ fi
81
+ msg="$@"
82
+ echo -e $opts "${green}${msg}${nocolor}"
83
+ }
84
+
85
+ function rvm_post_install_message() {
86
+ warn "Important: We performed a fresh install of rvm for you."
87
+ warn " This means you manually perform two tasks now."
88
+ warn
89
+ warn "Task 1 of 2:"
90
+ warn "------------"
91
+ warn "Please run the following command in all your open shell windows to"
92
+ warn "start using rvm. In rare cases you need to reopen all shell windows."
93
+ warn
94
+ warn " source ~/.rvm/scripts/rvm"
95
+ warn
96
+ warn
97
+ warn "Task 2 of 2:"
98
+ warn "------------"
99
+ warn "Permanently update your shell environment to source/add rvm."
100
+ warn "The example below shows how to do this for Bash."
101
+ warn
102
+ warn "Add the following two lines to your ~/.bashrc:"
103
+ warn
104
+ warn " PATH=\$PATH:\$HOME/.rvm/bin # Add RVM to PATH for scripting"
105
+ warn " [[ -s \"\$HOME/.rvm/scripts/rvm\" ]] && source \"\$HOME/.rvm/scripts/rvm\" # Load RVM into a shell session *as a function*"
106
+ warn
107
+ warn "That's it! Sorry for the extra work but this is the safest"
108
+ warn "way to update your environment without breaking anything."
109
+ }
110
+
111
+ function find_ruby_version_file() {
112
+ local filename=".ruby-version"
113
+ local curr_dir=$1
114
+ curr_dir=`cd "$curr_dir"; pwd`
115
+ local candidate_file="$curr_dir/$filename"
116
+ while [ ! -f "$candidate_file" ]; do
117
+ parent_dir=`cd ..; pwd`
118
+ if [ "$parent_dir" = "$curr_dir" ]; then
119
+ # We have reached /, we can't go up any further.
120
+ candidate_file=""
121
+ break
122
+ else
123
+ curr_dir="$parent_dir"
124
+ candidate_file="$curr_dir/$filename"
125
+ fi
126
+ done
127
+ echo $candidate_file
128
+ }
129
+
130
+ function detect_desired_ruby_version() {
131
+ local desired_ruby_version=""
132
+ ruby_version_file=`find_ruby_version_file $(pwd)`
133
+ if [ -n "$ruby_version_file" ]; then
134
+ desired_ruby_version=`head -n 1 $ruby_version_file`
135
+ fi
136
+ echo $desired_ruby_version
137
+ }
138
+
139
+ # We must detect the desired Ruby version before rvm "manipulates" the shell environment for its own purposes.
140
+ # I assume the cause of the problem is rvm's variant of the 'cd' command (~/.rvm/scripts/cd), which may alter the
141
+ # normal behavior of 'cd' in a way that breaks our usage of 'cd' in the function 'find_ruby_version_file' above.
142
+ puts -n "Detecting desired Ruby version: "
143
+ RUBY_VERSION=`detect_desired_ruby_version`
144
+ if [ -z "$RUBY_VERSION" ]; then
145
+ warn "FAILED (could not find .ruby-version) -- falling back to latest stable Ruby version"
146
+ RUBY_VERSION="ruby" # 'ruby' defaults to latest stable version
147
+ else
148
+ success "OK ($RUBY_VERSION)"
149
+ fi
150
+
151
+
152
+ ###
153
+ ### Bootstrap RVM
154
+ ###
155
+ puts -n "Checking for rvm: "
156
+ which rvm &>/dev/null
157
+ if [ $? -ne 0 ]; then
158
+ error "NOT FOUND (If you already ran ruby-bootstrap: have you performed the post-installation steps?)"
159
+ puts "Installing latest stable version of rvm..."
160
+ RVM_FRESH_INSTALL=1
161
+ curl -L https://get.rvm.io | bash -s stable --autolibs=enable --ignore-dotfiles || exit 1
162
+ else
163
+ success "OK"
164
+ fi
165
+
166
+ if [ -d ~/.rvm/bin ]; then
167
+ PATH=$PATH:~/.rvm/bin
168
+ fi
169
+ source ~/.rvm/scripts/rvm
170
+
171
+ if [ $MIRROR_CHINA_INSTALL -eq 1 ]; then
172
+ echo "ruby_url=https://cache.ruby-china.org/pub/ruby" > ~/.rvm/user/db
173
+ fi
174
+ ###
175
+ ### Install Ruby
176
+ ###
177
+ puts "Installing Ruby version ${RUBY_VERSION}..."
178
+ rvm install $RUBY_VERSION
179
+ if [ $? -ne 0 -a $RVM_FRESH_INSTALL -eq 1 ]; then
180
+ rvm_post_install_message
181
+ exit 2
182
+ fi
183
+ if [ $MIRROR_CHINA_INSTALL -eq 1 ]; then
184
+ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
185
+ fi
186
+
187
+ ###
188
+ ### Install Bundler
189
+ ###
190
+ puts "Installing bundler..."
191
+ gem install bundler
192
+ if [ $? -ne 0 -a $RVM_FRESH_INSTALL -eq 1 ]; then
193
+ rvm_post_install_message
194
+ exit 3
195
+ fi
196
+
197
+ puts "Installing flow-cli gem"
198
+ gem install flow-cli
199
+ if [ $? -ne 0 -a $RVM_FRESH_INSTALL -eq 1 ]; then
200
+ rvm_post_install_message
201
+ exit 4
202
+ fi
203
+
204
+
205
+ puts "run flow-cli -v to check"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flow-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - atpking
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-16 00:00:00.000000000 Z
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,7 +87,7 @@ dependencies:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
- type: :development
90
+ type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
@@ -95,33 +95,75 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: thor
98
+ name: pastel
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '0.18'
103
+ version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '0.18'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: tty
112
+ name: tty-table
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: tty-prompt
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: tty-command
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: thor
113
155
  requirement: !ruby/object:Gem::Requirement
114
156
  requirements:
115
157
  - - "~>"
116
158
  - !ruby/object:Gem::Version
117
- version: '0.7'
159
+ version: '0.18'
118
160
  type: :runtime
119
161
  prerelease: false
120
162
  version_requirements: !ruby/object:Gem::Requirement
121
163
  requirements:
122
164
  - - "~>"
123
165
  - !ruby/object:Gem::Version
124
- version: '0.7'
166
+ version: '0.18'
125
167
  - !ruby/object:Gem::Dependency
126
168
  name: fastlane
127
169
  requirement: !ruby/object:Gem::Requirement
@@ -204,6 +246,7 @@ files:
204
246
  - lib/flow/cli/yaml_builders/flow_yaml_builder.rb
205
247
  - lib/flow/cli/yaml_builders/ios_build_step_generator.rb
206
248
  - lib/flow/cli/yaml_builders/ios_yaml_builder.rb
249
+ - simple-install.sh
207
250
  homepage: https://flow.ci
208
251
  licenses:
209
252
  - MIT
@@ -229,7 +272,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
272
  version: '0'
230
273
  requirements: []
231
274
  rubyforge_project:
232
- rubygems_version: 2.6.10
275
+ rubygems_version: 2.6.12
233
276
  signing_key:
234
277
  specification_version: 4
235
278
  summary: Flow CI CLI