mtm 2.0.2 → 2.0.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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTlkZWZlYzZmN2U1YzVhZjk1ZmVhMmYyNGQwZThlMmZhODYzNzBlNQ==
4
+ Mzg1Y2ZlMDRlY2Y1OGQ0YTcyM2EzMGM4MmMzNWEwMzU2NjYxZWZiMw==
5
5
  data.tar.gz: !binary |-
6
- YjQ4N2I3OTg1MjNkNzA5YzAwNjY3MThlZmM2NzhiM2NjZWZjZGNmMA==
6
+ OGVlMWQ5MGM2NGQyN2YyMWQ0YTUwYzJhOTE5YjFmMGFiMWY5OWQwMw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NDgzZThkYzk4MjkyZDhkYzBiZTBmYmFhMWVhZGI0YzFkNjVmNWNjZWUyOTgw
10
- YmJmMDNhYWNkZDdjMzMzODkyZGQxNDIxMDdiZjgwYzEyYmNlMDBhNWNlMmY3
11
- M2E2YWVlMDA2YjEzYTE3MDE1YzBjMzNiNmJiYzMzODIzMmQ2MDU=
9
+ YjgzZDEzOTdjZTBjOTVlYTcxMTBkZWVjMDdiNWZkOTJmNjhhOTU3NWU0OGZk
10
+ ZTRkYzU4ODQ4NTFmYTRmMjA4ODZmNzNjYTBhZjExNDdhMDk3YWRlYzI0YjZm
11
+ MmJmYzFmMzcwMTA1YzBkZjkyNzY3NjRiM2YyMmVkMTk1NjNhMTU=
12
12
  data.tar.gz: !binary |-
13
- ZDkyZmRiZjcyYTdlYTY0NmFjM2EzN2ZlNDlmYmVmNDg0MmIyOTFkMmU3NDNh
14
- YTk1YzdhZjliZjdhOGFkMDNjMWE4ZGM3Zjc1MTEwNjUxMjllMjk2NzcyZjgy
15
- YzU1YjFlMTVlNjc2NDdlOTZlZGRmZjY3NzliYzIyYmI2ZWQxM2E=
13
+ OTViNjNmYTAyMjgwMjI4NzZiNmI2ZmEzMDk2MWJlNTAxYzM0NzZhZjE2ODFm
14
+ MGExYjNjY2FkZjYxZjRmMzYxZDA4YzRmMDUzM2M2NWEyYjg1MjRjODAzYzcx
15
+ NWEwNmQwZDg3NThlZDM3Zjc1ZDYzZDM2MzE5N2E1ZjIxNzEwZjM=
data/README.md CHANGED
@@ -1,38 +1,42 @@
1
- # Mtm
1
+ ## Mtm
2
2
 
3
- Timecard solution for a day's work information
3
+ Timecard solution for a day's work information
4
4
 
5
- ## Installation
5
+ ## Installation
6
6
 
7
- the default environment is tuby 1.9.3
8
- Opens your teminal and input:
9
-
10
- $gem install mtm
7
+ the default environment is ruby 1.9.3
8
+ Opens your teminal and input:
9
+ `gem install mtm`
11
10
 
12
- ## Usage
11
+ ## Usage
12
+ * Opens your teminal and input:
13
+ `tm -p 'Project name' -c 'Change name' -h 8 -d 'Tested some pages' -u bruce.yue:password`
14
+ * The default hours is 8 and default description is "Tested some pages and fixed some bugs."
15
+ * If step 2 have been done, '-u' is not required in the step 3.
16
+ For example:
17
+ * Project "CM Peak Development Requests", Its change is "Automate Upload of Build Records"
18
+ `tm -p 'Peak Development' -c 'Build Records' -h 6 -d 'Added exception process logic.'`
13
19
 
14
- Opens your teminal and input: tm -p 'Project name' -c 'Change name' -h 8 -d 'Tested some pages' -u bruce.yue:password
15
- The default hours is 8 and default description is "Tested some pages and fixed some bugs."
16
- If step 2 have been done, '-u' is not required in the step 3.
17
- For example:
18
- Project "CM Peak Development Requests", Its change is "Automate Upload of Build Records"
19
- $: tm -p 'Peak Development' -c 'Build Records' -h 6 -d 'Added exception process logic.'
20
-
21
- If there is no change. just paste
20
+ * If there is no change. just paste
22
21
 
23
- $: tm -p 'Peak Development' -h 6 -d 'Added exception process logic.'
24
-
25
- Fill your time card at some time.
26
- $: at 9pm today tm -p 'Peak Development' -h 6 -d 'Added exception process logic.'
27
-
28
-
29
- ## Config
30
-
31
- 1. run
32
- $ which ruby
33
- The result will be '/Users/Jack/.rvm/gems/ruby-1.9.3-p327/bin/mtm'
34
- 2. go to
35
- '/Users/Jack/.rvm/gems/ruby-1.9.3-p327/gems/mtm-1.0.4/lib/mtm'
36
- 3. config
37
- config.rb
38
- 4. mtm -h for details
22
+ `tm -p 'Peak Development' -h 6 -d 'Added exception process logic.'`
23
+
24
+ * Fill your time card at some time.
25
+ `at 9pm today tm -p 'Peak Development' -h 6 -d 'Added exception process logic.'`
26
+
27
+
28
+ ## Config
29
+
30
+ 1. run
31
+ `gem environment`
32
+ Find the GEM PATHS
33
+ 2. go to
34
+ 'GEM PATHS'/gems/mtm-2.0.3/lib/mtm'
35
+ 3. config
36
+ open config.rb
37
+ config field
38
+ SF_USERNAME = '' # Salesforce user name
39
+ SF_PASSWORD = '' # Salesforce password
40
+ SF_SECURITY_TOKEN = '' # Salesforce password security token(option)
41
+ MOBILE_NUMBER = '' # 18988888888 you need to send the mobile to me and verify it.
42
+ 4. `mtm -h` for details
data/lib/mtm/config.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  ####################################################################################
4
4
  # please fill these fields: ###
5
5
  SF_USERNAME = '' # Salesforce user name ###
6
- SF_PASSWORD = '' # Salesforce password ###
6
+ SF_PASSWORD = '' # Salesforce password ###
7
7
  SF_SECURITY_TOKEN = '' # Salesforce password security token(option) ###
8
8
  MOBILE_NUMBER = '' # 18988888888 you need to send the mobile to me and verify it.
9
9
 
data/lib/mtm/mtm.rb CHANGED
@@ -36,8 +36,9 @@ auth_token = 'a502db99e86340c4967cb89f0714c4ce'
36
36
  op = OptionParser.new do |opts|
37
37
  opts.banner = <<-BANNER
38
38
  Timecard Solution
39
- Usage: Open the gem, find the config file '../mtm/lib/mtm/config.rb'
40
- and input your Salesforce user name and password(token).
39
+ Usage: run 'gem environment' in your console and find the 'GEM PATHS'
40
+ go to 'GEM PATHS/gems/mtm-2.0.3/lib/mtm'
41
+ open config.rb and input your Salesforce user name and password(token).
41
42
  mtm -p project -c change -h 6 -d 'Added exception process logic.'
42
43
  BANNER
43
44
  opts.separator ''
@@ -65,7 +66,7 @@ op = OptionParser.new do |opts|
65
66
  options[:tm_project] = project
66
67
  end
67
68
 
68
- opts.on("-N ProjectNumber", "The project number.") do |number_p|
69
+ opts.on("-N ProjectNumber", "The project number: 07865(Prj-07865).") do |number_p|
69
70
  options[:tm_p_number] = number_p
70
71
  end
71
72
 
@@ -180,9 +181,11 @@ if projects.size == 1
180
181
  options[:tm_date], options[:tm_hour], team_member.first.Id,
181
182
  options[:tm_description], projects.first.Name, client)
182
183
  elsif projects.first.Changes__r == nil
184
+ is_success = false
183
185
  puts
184
186
  puts 'No change found.'
185
187
  else
188
+ is_success = false
186
189
  puts
187
190
  puts 'Please select a change to continue:'
188
191
  projects.first.Changes__r.each { |c| puts c.Name }
@@ -200,8 +203,9 @@ else
200
203
  puts 'Please select a project to continue:'
201
204
  projects.each { |p| puts p.Name }
202
205
  end
206
+ puts is_success
203
207
  if is_success
204
- Mtm.send_sms(projects.first.Name, options[:tm_hour], options[:tm_description], MOBILE_NUMBER, account_sid, auth_token)
208
+ Mtm.send_sms(account_sid, auth_token, MOBILE_NUMBER, projects.first.Name, options[:tm_hour], options[:tm_description])
205
209
  end
206
210
 
207
211
  @pb.finish
data/lib/mtm/utils.rb CHANGED
@@ -24,14 +24,14 @@ module Mtm
24
24
  puts "Timecrad created successfully. Hour: '#{args[3]}', Project: '#{args[6]}'"
25
25
  end
26
26
 
27
- def send_sms(*args, mobile, account_sid, auth_token)
27
+ def send_sms(account_sid, auth_token, mobile, *args)
28
28
  if !mobile.empty?
29
29
  begin
30
30
  # set up a client to talk to the Twilio REST API
31
31
  @t_client = Twilio::REST::Client.new account_sid, auth_token
32
32
  @t_client.account.sms.messages.create(
33
33
  :from => '+19788000322',
34
- :to => '+86'+mobile,
34
+ :to => '+86' + mobile,
35
35
  :body => "Project: #{args[0]}, Hours: #{args[1]}, Description: #{args[2]}"
36
36
  )
37
37
  rescue Exception => e
data/lib/mtm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mtm
2
- VERSION = "2.0.2"
2
+ VERSION = "2.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruce Yue
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir:
10
10
  - bin
11
11
  cert_chain: []
12
- date: 2013-03-30 00:00:00.000000000 Z
12
+ date: 2013-04-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: restforce